History log of /u-boot/lib/Kconfig
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 953d335d 16-Apr-2024 Michal Simek <michal.simek@amd.com>

Kconfig: Add missing quotes around source file

All errors are generated by ./tools/qconfig.py -b -j8 -i whatever.
Error look like this:
drivers/crypto/Kconfig:9: warning: style: quotes recommended around
'drivers/crypto/nuvoton/Kconfig' in 'source drivers/crypto/nuvoton/Kconfig'

Signed-off-by: Michal Simek <michal.simek@amd.com>

# 6d9a851e 11-Apr-2024 Vincent Stehlé <vincent.stehle@arm.com>

Fix references to trace doc

The README.trace has been moved and converted to rst in commit dce26c7d56ed
("doc: move README.trace to HTML documentation"); fix all the remaining
references to this file.

Signed-off-by: Vincent Stehlé <vincent.stehle@arm.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>

# 1373ffde 18-Dec-2023 Tom Rini <trini@konsulko.com>

Merge tag 'v2024.01-rc5' into next

Prepare v2024.01-rc5


# 253f939a 20-Nov-2023 Tom Rini <trini@konsulko.com>

lib/Kconfig: Correct typo about SYSINFO_SMBIOS in help message

The correct symbol to enable to have SMBIOS populate fields based on the
device tree is SYSINFO_SMBIOS and not SMBIOS_SYSINFO.

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 47cfdb21 27-Oct-2023 Sean Anderson <sean.anderson@seco.com>

arm: semihosting: Support semihosting fallback on 32-bit ARM

Add support for a semihosting fallback on 32-bit ARM. The assembly is
lightly adapted from the irq return code, except there is no offset
since lr already points to the correct instruction. The C side is mostly
like ARM64, except we have fewer cases to deal with.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>

# a4dc3d56 26-Oct-2023 AKASHI Takahiro <akashi.tkhro@gmail.com>

lib: uuid: move CONFIG_RANDOM_UUID

This option is independent from any commands and should be managed
under lib. For instance, drivers/block/rkmtd.c is a user.

It would be better to remove this configuration.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# d5d9770f 27-Oct-2023 Tom Rini <trini@konsulko.com>

Merge tag 'tpm-next-27102023' of https://source.denx.de/u-boot/custodians/u-boot-tpm

bootX measurements and measurement API moved to u-boot core:

Up to now, U-Boot could perform measurements and EventLog creation as
described by the TCG spec when booting via EFI.

The EFI code was residing in lib/efi_loader/efi_tcg2.c and contained
both EFI specific code + the API needed to access the TPM, extend PCRs
and create an EventLog. The non-EFI part proved modular enough and
moving it around to the TPM subsystem was straightforward.

With that in place we can have a common API for measuring binaries
regardless of the boot command, EFI or boot(m|i|z), and contructing an
EventLog.

I've tested all of the EFI cases -- booting with an empty EventLog and
booting with a previous stage loader providing one and found no
regressions. Eddie tested the bootX part.

Eddie also fixed the sandbox TPM which couldn't be used for the EFI code
and it now supports all the required capabilities. This had a slight
sideeffect in our testing since the EFI subsystem initializes the TPM
early and 'tpm2 init' failed during some python tests. That code only
opens the device though, so we can replace it with 'tpm2 autostart'
which doesn't error out and still allows you to perfom the rest of the
tests but doesn't report an error if the device is already opened.

There's a few minor issues with this PR as well but since testing and
verifying the changes takes a considerable amount of time, I prefer
merging it now.

Heinrich has already sent a PR for -master containing "efi_loader: fix
EFI_ENTRY point on get_active_pcr_banks" and I am not sure if that will
cause any conflicts, but in any case they should be trivial to resolve.

Both the EFI and non-EFI code have a Kconfig for measuring the loaded
Device Tree. The reason this is optional is that we can't reason
when/if devices add random info like kaslr-seed, mac addresses etc in
the DT. In that case measurements are random, board specific and
eventually useless. The reason it was difficult to fix it prior to this
patchset is because the EFI subsystem and thus measurements was brought
up late and DT fixups might have already been applied. With this
patchset we can measure the DT really early in the future.

Heinrich also pointed out that the two Kconfigs for the DTB measurements
can be squashed in a single one and that the documentation only explains
the non-EFI case. I agree on both but as I said this is a sane working
version, so let's pull this first it's aleady big enough and painful to
test.


# 97707f12 24-Oct-2023 Eddie James <eajames@linux.ibm.com>

tpm: Support boot measurements

Add TPM2 functions to support boot measurement. This includes
starting up the TPM, initializing/appending the event log, and
measuring the U-Boot version. Much of the code was used in the
EFI subsystem, so remove it there and use the common functions.

Signed-off-by: Eddie James <eajames@linux.ibm.com>
For the API moving around from EFI -> u-boot core
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
For EFI testing
Tested-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

# 44071cd5 14-Oct-2023 Sean Anderson <seanga2@gmail.com>

fs: ext4: Fix building ext4 in SPL if write is enabled

If EXT4_WRITE is enabled, write capabilities will be compiled into SPL, but
not CRC16. Add an option to enable CRC16 to avoid linker errors.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 53fab13a 20-Sep-2023 Simon Glass <sjg@chromium.org>

efi: Use the installed SMBIOS tables

U-Boot should set up the SMBIOS tables during startup, as it does on x86.
Ensure that it does this correctly on non-x86 machines too, by creating
an event spy for last-stage init.

Tidy up the installation-condition code while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 8c11d19e 19-Sep-2023 Simon Glass <sjg@chromium.org>

x86: smbios: Add a Kconfig indicating SMBIOS-table presence

When booted from coreboot, U-Boot does not build the SMBIOS tables, but
it should still pass them on to the OS. Add a new option which indicates
whether SMBIOS tables are present, however they were built.

Flip the ordering so that the dependency is listed first, which is less
confusing.

Adjust GENERATE_SMBIOS_TABLE to depend on this new symbol.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 0c45c76c 19-Sep-2023 Simon Glass <sjg@chromium.org>

x86: Allow APCI in SPL

This is needed so we can find the DBG2 table provided by coreboot. Add a
Kconfig so it can be enabled.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 040a6048 14-Sep-2023 Simon Glass <sjg@chromium.org>

boot: Join FDT_FIXUP_PARTITIONS with related options

Move this to be with the other devicetree-fixup options.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 4cc40f61 14-Sep-2023 Simon Glass <sjg@chromium.org>

FWU: Avoid showing an unselectable menu option

Use a menuconfig to avoid showing a menu which cannot be selected in many
cases.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

# a90b5946 14-Sep-2023 Simon Glass <sjg@chromium.org>

lib: rational: Move the Kconfigs into the correct place

These should not be part of the 'system tables' menu. Move them outside
on their own.

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: 7d0f3fbb93c ("lib: rational: copy the rational fraction lib...")
Reviewed-by: Tom Rini <trini@konsulko.com>

# a077ac13 02-Aug-2023 Tom Rini <trini@konsulko.com>

Kconfigs: Correct default of "0" on hex type entries

It is not a parse error to have a default value of "0" for a "hex" type
entry, instead of "0x0". However, "0" and "0x0" are not treated the
same even by the tools themselves. Correct this by changing the default
value from "0" to "0x0" for all hex type questions that had the
incorrect default. Fix one instance (in two configs) of a default of "0"
being used on a hex question to be "0x0". Remove the cases where a
defconfig had set a value of "0x0" to be used as the default had been
"0".

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# af62d83c 03-Aug-2023 Oleksandr Suvorov <oleksandr.suvorov@foundries.io>

spl: move SPL_CRC32 option to lib/Kconfig

All SPL hash algorithm options are collected in lib/Kconfig. Move
SPL_CRC32 there as well.

Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
Reviewed-by: Simon Glass <sjg@chromium.org>

# dfe00b34 13-Jul-2023 Manorit Chawdhry <m-chawdhry@ti.com>

lib: Kconfig: k3: Enable SHA512 for fit signature

We are using our custMpk for signing that is a 4096 bit key, 4096 bit
rsa key requires a SHA512 hashing algorithm to be enabled as per the
source. Even though it is not mandated but this is how it works and is
tested.

Enables SHA512 if fit signature is enabled on K3 platforms.

Signed-off-by: Manorit Chawdhry <m-chawdhry@ti.com>

# 0992a90d 04-May-2023 Simon Glass <sjg@chromium.org>

acpi: Create a new Kconfig for ACPI

We have several Kconfig options for ACPI, but all relate to specific
functions, such as generating tables and AML code.

Add a new option which controls including basic ACPI library code,
including the lib/acpi directory. This will allow us to add functions
which are available even if table generation is not supported.

Adjust the command to avoid a build error when ACPIGEN is not enabled.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 94c8da21 22-Mar-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: Fix LMB_MEMORY_REGIONS flag usage

Remove test on CONFIG_LMB_MEMORY_REGIONS introduced by commit
7c1860fce4e3 ("lmb: Fix lmb property's defination under struct lmb").

This code in lmb_init() is strange, because if CONFIG_LMB_USE_MAX_REGIONS
and CONFIG_LMB_MEMORY_REGIONS are not defined, the implicit #else is empty
and the required initialization is not done:
lmb->memory.max = ?
lmb->reserved.max = ?

But this setting is not possible:
- CONFIG_LMB_USE_MAX_REGIONS not defined
- CONFIG_LMB_MEMORY_REGIONS not defined
because CONFIG_LMB_MEMORY_REGIONS and CONFIG_LMB_RESERVED_REGIONS are
defined as soon as the CONFIG_LMB_USE_MAX_REGIONS is not defined.

This patch removes this impossible case #elif and I add some
explanation in lmb.h to explain why in the struct lmb {} the lmb
property is defined if CONFIG_LMB_MEMORY_REGIONS is NOT defined.

This patch also removes CONFIG_LMB_XXX dependency on CONFIG_LMB as these
defines are used in API file lmb.h and not only in library file.

Fixes: 5e2548c1d6e03 ("lmb: Fix LMB_MEMORY_REGIONS flag usage")
Reported-by: Mark Millard <marklmi@yahoo.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Acked-by: Michal Simek <michal.simek@amd.com>

# c61df340 18-Mar-2023 Marek Vasut <marek.vasut+renesas@mailbox.org>

lib: Fix SYS_TIMER_COUNTS_DOWN description in Kconfig

The SYS_TIMER_COUNTS_DOWN description contains a typo,
s@rathe@&r@ , fix it.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>

# 3b510807 22-Feb-2023 Simon Glass <sjg@chromium.org>

lib: Add an SPL config for LIB_UUID

This is selected by PARTITION_UUIDS which has a separate option for SPL.
Add an SPL option for LIB_UUID also, so that we can keep them consistent.

Also add one for PARTITION_TYPE_GUID to avoid a build error in part_efi.c
which wants to call a uuid function in SPL.

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

# 5a6bc166 22-Feb-2023 Simon Glass <sjg@chromium.org>

lib: Add VPL options for SHA1 and SHA256

Add these options so these algorithms can be used in VPL.

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

# ae625d92 22-Feb-2023 Simon Glass <sjg@chromium.org>

lib: Add a Kconfig for SPL_BZIP2

This is implicitly used in the source and seems useful, so add it.

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

# c33425c6 15-Jan-2023 Simon Glass <sjg@chromium.org>

trace: Reduce the default for TRACE_EARLY_CALL_DEPTH_LIMIT

This is a silly value at present, since U-Boot's call depth never reaches
200. Fix it.

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

# 2dc16a2c 19-Jan-2023 Sjoerd Simons <sjoerd@collabora.com>

Bump LMB_MAX_REGIONS default to 16

Since commit 06d514d77c37 ("lmb: consider EFI memory map") the EFI regions
are also pushed into the lmb if EFI_LOADER is enabled (which is by
default on most system). Which can cause the number of entries to go
over the maximum as it's default is only 8.

Specifically i ran into this case on an TI am62 which has an fdt with
4 reserved regions (in practice 3 lmb entries due to adjecent ranges).

As this is likely to impact more devices bump the default max
regions to 16 so there is a bit more slack.

Fixes: 06d514d77c ("lmb: consider EFI memory map")
Link: https://bugzilla.opensuse.org/show_bug.cgi?id=1207562
Reviewed-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Signed-off-by: Sjoerd Simons <sjoerd@collabora.com>
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
[trini: collect tags from the other equivalent patch]

# 948d3999 08-Feb-2023 Tom Rini <trini@konsulko.com>

Revert "lmb: Default to not-LMB_USE_MAX_REGIONS"

As explained by Philippe Schenker, I was misinterpreting what happened
in the case where we do not set LMB_USE_MAX_REGIONS and so had
re-introduced the problem I was attempting to more widely resolve.

This reverts commit 007ae5d108a37564905ea1588cb279f3a522cc3d.

Reported-by: Philippe Schenker <philippe.schenker@toradex.com>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 007ae5d1 25-Jan-2023 Tom Rini <trini@konsulko.com>

lmb: Default to not-LMB_USE_MAX_REGIONS

The LMB code allows for picking a hard limit on the number of regions it
can know of, or to dynamically allocate these regions. The reason for
this choice is to allow for the compiler to perform a size optimization
in the common case. This optimization however, is very small, ranging
from 196 bytes to 15 bytes saved, or in some cases, being larger. Now
that we also have more regions covered by LMB (in order to protect
various parts of our self at run time), the default of 8 is also much
easier to hit and leads to non-obvious error messages (which imply that
an area is protected, not that we're out of areas to add to the list).

Switch to the dynamic use as the default.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 53c47c59 19-Jan-2023 Tom Rini <trini@konsulko.com>

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


# 4b9b25d9 12-Jan-2023 Brandon Maier <brandon.maier@collins.com>

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

[1] https://github.com/torvalds/linux/commit/e0c1b49f5b674cca7b10549c53b3791d0bbc90a8
[2] https://github.com/facebook/zstd/blob/f302ad8811643c428c4e3498e28f53a0578020d3/lib/libzstd.mk#L31

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>

# ebc1d50a 21-Dec-2022 Simon Glass <sjg@chromium.org>

Revert "fdtdec: drop needlessly convoluted CONFIG_PHANDLE_CHECK_SEQ"

The fdt_path_offset() function is slow since it must scan the tree.
This substantial overhead now applies to all boards.

The original code may not be ideal but it is fit for purpose and is only
needed on a few boards.

Reverting this reduces time to set up driver model by about 30ms.

Before revert:

Accumulated time:
47,170 dm_r
53,237 dm_spl
572,986 dm_f

Accumulated time:
44,598 dm_r
50,347 dm_spl
549,133 dm_f

This reverts commit 26f981f295d00351b6f0c69b5317b254b2361cc0.

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

# 12619d4e 21-Dec-2022 Simon Glass <sjg@chromium.org>

trace: Don't require TIMER_EARLY

Some platforms cannot honour this and don't need trace before relocation.
Use 'imply' instead, so boards can disable this.

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

# 0c16fca9 07-Jan-2023 Simon Glass <sjg@chromium.org>

tpm: Add a proper Kconfig option for crc8 in SPL

The current approach is a bit of a hack and only works for the tpm
subsystem. Add a Kconfig so that crc8 can be enabled in SPL for other
purposes.

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

# 14f43797 19-Dec-2022 Tom Rini <trini@konsulko.com>

Merge tag 'v2023.01-rc4' into next

Prepare v2023.01-rc4

Signed-off-by: Tom Rini <trini@konsulko.com>


# ae3527f0 07-Dec-2022 Kautuk Consul <kconsul@ventanamicro.com>

arch/riscv: add semihosting support for RISC-V

We add RISC-V semihosting based serial console for JTAG based early
debugging.

The RISC-V semihosting specification is available at:
https://github.com/riscv/riscv-semihosting-spec/blob/main/riscv-semihosting-spec.adoc

Signed-off-by: Anup Patel <apatel@ventanamicro.com>
Signed-off-by: Kautuk Consul <kconsul@ventanamicro.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>

# 1c03ab9f 07-Dec-2022 Kautuk Consul <kconsul@ventanamicro.com>

lib: Add common semihosting library

We factor out the arch-independent parts of the ARM semihosting
implementation as a common library so that it can be shared
with RISC-V.

Signed-off-by: Kautuk Consul <kconsul@ventanamicro.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>

# 3b8dfc42 16-Nov-2022 Tom Rini <trini@konsulko.com>

Convert CONFIG_SYS_TIMER_COUNTS_DOWN to Kconfig

This converts the following to Kconfig:
CONFIG_SYS_TIMER_COUNTS_DOWN

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 86794052 21-Oct-2022 Sughosh Ganu <sughosh.ganu@linaro.org>

FWU: Add support for the FWU Multi Bank Update feature

The FWU Multi Bank Update feature supports updating firmware images
to one of multiple sets(also called banks) of images. The firmware
images are clubbed together in banks, with the system booting images
from the active bank. Information on the images such as which bank
they belong to is stored as part of the metadata structure, which is
stored on the same storage media as the firmware images on a dedicated
partition.

At the time of update, the metadata is read to identify the bank to
which the images need to be flashed(update bank). On a successful
update, the metadata is modified to set the updated bank as active
bank to subsequently boot from.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

# 40ed7be4 02-Aug-2022 Tom Rini <trini@konsulko.com>

Convert CONFIG_SYS_FDT_PAD to Kconfig

This converts the following to Kconfig:
CONFIG_SYS_FDT_PAD

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e67ffb5a 22-Jul-2022 Sughosh Ganu <sughosh.ganu@linaro.org>

tpm: rng: Add driver model interface for TPM RNG device

The TPM device has a builtin random number generator(RNG)
functionality. Expose the RNG functions of the TPM device to the
driver model so that they can be used by the EFI_RNG_PROTOCOL if the
protocol is installed.

Also change the function arguments and return type of the random
number functions to comply with the driver model api.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

# b340199f 10-Jun-2022 Tom Rini <trini@konsulko.com>

spl: Ensure all SPL symbols in Kconfig have some SPL dependency

Tighten up symbol dependencies in a number of places. Ensure that a SPL
specific option has at least a direct dependency on SPL. In places
where it's clear that we depend on something more specific, use that
dependency instead. This means in a very small number of places we can
drop redundant dependencies.

Reported-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 13ce351b 08-Jun-2022 Tom Rini <trini@konsulko.com>

vpl: Ensure all VPL symbols in Kconfig have some VPL dependency

Tighten up symbol dependencies in a number of places. Ensure that a VPL
specific option has at least a direct dependency on VPL. In places
where it's clear that we depend on something more specific, use that
dependency instead.

Reported-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 8bea4bf7 08-Jun-2022 Tom Rini <trini@konsulko.com>

tpl: Ensure all TPL symbols in Kconfig have some TPL dependency

Tighten up symbol dependencies in a number of places. Ensure that a TPL
specific option has at least a direct dependency on TPL. In places
where it's clear that we depend on something more specific, use that
dependency instead.

Reported-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 26f981f2 19-May-2022 Rasmus Villemoes <rasmus.villemoes@prevas.dk>

fdtdec: drop needlessly convoluted CONFIG_PHANDLE_CHECK_SEQ

Asking if the alias we found actually points at the device tree node
we passed in (in the guise of its offset from blob) can be done simply
by asking if the fdt_path_offset() of the alias' path is identical to
offset.

In fact, the current method suffers from the possibility of false
negatives: dtc does not necessarily emit a phandle property for a node
just because it is referenced in /aliases; it only emits a phandle
property for a node if it is referenced in <angle brackets>
somewhere. So if both the node we passed in and the alias node we're
considering don't have phandles, fdt_get_phandle() returns 0 for both.

Since the proper check is so simple, there's no reason to hide that
behind a config option (and if one really wanted that, it should be
called something else because there's no need to involve phandle in
the check).

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Acked-by: Aswath Govindraju <a-govindraju@ti.com>

# d30924f1 01-May-2022 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: fix selection of CONFIG_CHARSET

lib/charset.c is not optional for
EFI_APP || EFI_LOADER || UFS || UT_UNICODE.
These must select CONFIG_CHARSET.

Fixes: 726cd9836db0 ("efi: Make unicode printf available to the app")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>

# 747093dd 30-Apr-2022 Simon Glass <sjg@chromium.org>

vpl: Add Kconfig options for VPL

Add VPL versions of commonly used Kconfig options.

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

# 11232139 06-Apr-2022 Tom Rini <trini@konsulko.com>

nds32: Remove the architecture

As removal of nds32 has been ack'd for the Linux kernel, remove support
here as well.

Cc: Rick Chen <rick@andestech.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Rick Chen <rick@andestech.com>

# fd210fee 28-Mar-2022 Philippe Reynes <philippe.reynes@softathome.com>

lib: allow to build asn1 decoder and oid registry in SPL

This commit adds the options:
- SPL_ASN1_DECODER
- SPL_OID_REGISTRY

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>

# 7d44a985 28-Mar-2022 Philippe Reynes <philippe.reynes@softathome.com>

lib: Kconfig: enhance the help of OID_REGISTRY

Enhance the help for the config OID_REGISTRY.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>

# a0e71d96 28-Mar-2022 Philippe Reynes <philippe.reynes@softathome.com>

lib: Kconfig: enhance help for ASN1

Enhance the help for configs ASN1_COMPILER
and ASN1_decoder.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>

# 761a1786 27-Jan-2022 Tom Rini <trini@konsulko.com>

Merge tag 'dm-pull-26jan22' of https://source.denx.de/u-boot/custodians/u-boot-dm

acpi refactoring to allow non-x86 use
binman support for bintools (binary tools)
minor tools improvements in preparation for FDT signing
various minor fixes and improvements


# 334a9b9d 25-Nov-2021 Loic Poulain <loic.poulain@linaro.org>

lib/circbuf: Make circbuf selectable symbol

It is currenly only used from usbtty driver but make it properly
selectable via Kconfig symbol, for future usage.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>

# e1722fcb 01-Dec-2021 Simon Glass <sjg@chromium.org>

x86: Allow any arch to generate ACPI tables

These have sadly found their way to ARM now. Allow any arch to support
generating ACPI tables.

Disable this for the tools build.

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

# 7c3fd5c2 26-Dec-2021 Qu Wenruo <wqu@suse.com>

lib: add BLAKE2 hash support

The code is cross-ported from BLAKE2 reference implementation
(https://github.com/BLAKE2/BLAKE2).

With minimal change to remove unused macros/features.

Currently there is only one user inside U-boot (btrfs), and since it
only utilize BLAKE2B, all other favors are all removed.

Signed-off-by: Qu Wenruo <wqu@suse.com>
[trini: Rename ROUND to R to avoid clash with <linux/bitops.h>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 97f2a749 04-Jan-2022 Eugen Hristev <eugen.hristev@collabora.com>

lib: Kconfig: fix PHANDLE_CHECK_SEQ position outside of menu

CONFIG_PHANDLE_CHECK_SEQ is outside of the menu 'Library routines'
thus it's invisible in menuconfig and cannot be selected.
Fix this by moving the 'endmenu' after the PHANDLE_CHECK_SEQ definition

Fixes: c589132a1d ("fdt: Use phandle to distinguish DT nodes with same name")
Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
Reviewed-by: Aswath Govindraju <a-govindraju@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 726cd983 29-Dec-2021 Simon Glass <sjg@chromium.org>

efi: Make unicode printf available to the app

This is needed to show unicode strings. Enable this code in the app.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>

# 6405ab7a 24-Nov-2021 Simon Glass <sjg@chromium.org>

Convert CONFIG_PHYSMEM to Kconfig

This converts the following to Kconfig:
CONFIG_PHYSMEM

Signed-off-by: Simon Glass <sjg@chromium.org>
Suggested-by: Sean Anderson <seanga2@gmail.com>

# ac7606af 14-Nov-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

lmb: fix typo 'commun'

%s/commun/common/

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

# e7d285b2 25-Sep-2021 Simon Glass <sjg@chromium.org>

image: Use the correct checks for CRC32

Add a host Kconfig for CRC32. With this we can use CONFIG_IS_ENABLED(CRC32)
directly in the host build, so drop the unnecessary indirection.

Add a few more conditions to SPL_CRC32 to avoid build failures as well as
TPL_CRC32. Also update hash.c to make crc32 optional and to actually take
notice of SPL_CRC32.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# 2c21256b 25-Sep-2021 Simon Glass <sjg@chromium.org>

hash: Use Kconfig to enable hashing in host tools and SPL

At present when building host tools, we force CONFIG_SHAxxx to be enabled
regardless of the board Kconfig setting. This is done in the image.h
header file.

For SPL we currently just assume the algorithm is desired if U-Boot proper
enables it.

Clean this up by adding new Kconfig options to enable hashing on the host,
relying on CONFIG_IS_ENABLED() to deal with the different builds.

Add new SPL Kconfigs for hardware-accelerated hashing, to maintain the
current settings.

This allows us to drop the image.h code and the I_WANT_MD5 hack.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# 603d15a5 25-Sep-2021 Simon Glass <sjg@chromium.org>

spl: cypto: Bring back SPL_ versions of SHA

Unfortunately these were removed by mistake. This means that adding hash
support to SPL brings in all software algorithms, with a substantial
increase in code size.

The origin of the problem was renaming them to SPL_FIT_xxx and then these
were removed altogether in a later commit.

Add them back. This aligns with CONFIG_MD5, for example, which has an SPL
variant.

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: f5bc9c25f31 ("image: Rename SPL_SHAxxx_SUPPORT to SPL_FIT_SHAxxx")
Fixes: eb5171ddec9 ("common: Remove unused CONFIG_FIT_SHAxxx selectors")
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# 6674edaa 16-Sep-2021 Tom Rini <trini@konsulko.com>

Merge tag 'v2021.10-rc4' into next

Prepare v2021.10-rc4

Signed-off-by: Tom Rini <trini@konsulko.com>

# gpg: Signature made Tue 14 Sep 2021 06:58:32 PM EDT
# gpg: using RSA key 1A3C7F70E08FAB1707809BBF147C39FF9634B72C
# gpg: Good signature from "Thomas Rini <trini@konsulko.com>" [ultimate]

# Conflicts:
# board/Arcturus/ucp1020/spl.c
# cmd/mvebu/Kconfig
# common/Kconfig.boot
# common/image-fit.c
# configs/UCP1020_defconfig
# configs/sifive_unmatched_defconfig
# drivers/pci/Kconfig
# include/configs/UCP1020.h
# include/configs/sifive-unmatched.h
# lib/Makefile
# scripts/config_whitelist.txt


# 5145bc73 01-Sep-2021 Oleksandr Suvorov <oleksandr.suvorov@foundries.io>

lib: fix typos in Kconfig

There are trivial typos in the Kconfig file. Fixed them.
Also, fixed grammar in the descriptions with typos.

Fixes: d56b4b1974 ("configs: Migrate RBTREE, LZO, CMD_MTDPARTS, CMD_UBI and CMD_UBIFS")
Fixes: 7264f2928b ("spl: fit: Eanble GZIP support for image decompression")
Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# e60e4499 02-Sep-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

lib: Drop SHA512_ALGO in lieu of SHA512

SHA512_ALGO was used as a "either SHA512 or SHA384", although the
implementations of these two algorithms share a majority of code.

From a Kconfig interface perspective, it makes sense to present two
distinct options. This requires #ifdefing out the SHA512
implementation from sha512.c. The latter doesn't make any sense.

It's reasonable to say in Kconfig that SHA384 depends on SHA512, and
seems to be the more polite way to handle the selection.

Thus, automatically select SHA512 when SHA384 is enabled.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# b4c2c151 27-Aug-2021 Michal Simek <michal.simek@amd.com>

Kconfig: Remove all default n/no options

default n/no doesn't need to be specified. It is default option anyway.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
[trini: Rework FSP_USE_UPD portion]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 928a8be7 29-Jul-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

lib: ecdsa: Implement UCLASS_ECDSA verification on target

Implement the crypto_algo .verify() function for ecdsa256. Because
it backends on UCLASS_ECDSA, this change is focused on parsing the
keys from devicetree and passing this information to the specific
UCLASS driver.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# fa3f1f1d 24-Jul-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: disable CONFIG_SPL_HEXDUMP by default

CONFIG_HEXDUMP is needed to display UEFI variables using 'printenv -e'.

Enabling CONFIG_SPL_HEXDUMP only makes sense for debugging purposes.
Hence CONFIG_SPL_HEXDUMP should not be enabled by default.

The following boards currently have CONFIG_SPL_HEXDUMP=y. This includes
boards that don't use SPL at all.

axm_defconfig
imx8mm-cl-iot-gate_defconfig
imx8mm_venice_defconfig
imxrt1020-evk_defconfig
imxrt1050-evk_defconfig
kontron_sl28_defconfig
kp_imx53_defconfig
lx2160ardb_tfa_stmm_defconfig
mt7622_rfb_defconfig
octeon_ebb7304_defconfig
octeon_nic23_defconfig
qemu_arm64_defconfig
qemu_arm_defconfig
qemu-riscv32_defconfig
qemu-riscv32_smode_defconfig
qemu-riscv64_defconfig
qemu-riscv64_smode_defconfig
qemu-x86_64_defconfig
qemu-x86_defconfig
sandbox64_defconfig
sandbox_defconfig
stm32mp15_basic_defconfig
stm32mp15_trusted_defconfig
synquacer_developerbox_defconfig
taurus_defconfig
xilinx_versal_virt_defconfig

The patch only keeps it enabled on

sandbox_spl_defconfig

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 1a46cb6c 02-Jul-2021 Simon Glass <sjg@chromium.org>

lib: Create a new Kconfig option for charset conversion

Rather than looking at two KConfig options in the Makefile, create a new
Kconfig option for compiling lib/charset.c

Enable it for UFS also, which needs this support.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 26dd9936 08-Jul-2021 Steffen Jaeckel <jaeckel-floss@eyet-services.de>

lib: add crypt subsystem

Add the basic functionality required to support the standard crypt
format.
The files crypt-sha256.c and crypt-sha512.c originate from libxcrypt and
their formatting is therefor retained.
The integration is done via a crypt_compare() function in crypt.c.

```
libxcrypt $ git describe --long --always --all
tags/v4.4.17-0-g6b110bc
```

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 7d0f3fbb 11-Jun-2021 Tero Kristo <t-kristo@ti.com>

lib: rational: copy the rational fraction lib routines from Linux

Copy the best rational approximation calculation routines from Linux.
Typical usecase for these routines is to calculate the M/N divider
values for PLLs to reach a specific clock rate.

This is based on linux kernel commit:
"lib/math/rational.c: fix possible incorrect result from rational
fractions helper"
(sha1: 323dd2c3ed0641f49e89b4e420f9eef5d3d5a881)

Signed-off-by: Tero Kristo <t-kristo@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Tero Kristo <kristo@kernel.org>

# ec0512b1 24-May-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

Revert "lib: introduce HASH_CALCULATE option"

When we think of Kconfig, we usually think of features that we like
to enable or not. Ideally, we wouldn't use Kconfig to fix a build
issue, although sometimes it might make sense. With Kconfig it's hard
to guarantee that the fix is universal. We can only say that it works
for the set of tested configurations. In the majority of cases, it's
preferable to let the linker figure things out for us.

The reverted commit attempted to fix a build issue by adding an
invisible Kconfig option. This is wrong in several ways:

It invents a new Kconfig variable when CONFIG_HASH already
exists for the same purpose.
Second, hash-checksum.c makes use of the hash_progressive_lookup_algo()
symbol, which is only provided with CONFIG_HASH, but this dependency
was not expressed in the reverted patch.

It feels like Kconfig is turning into a listing of all available
source files, and a buffet to 'select' which ones to compile. The
purpose of this revert is to enable the next change to make use of
CONFIG_HASH instead of adding to Kconfig.

This reverts commit 87316da05f2fd49d3709275e64ef0c5980366ade.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Acked-by: Masahisa Kojima <masahisa.kojima@linaro.org>

# 1621d3c4 10-May-2021 Bin Meng <bmeng.cn@gmail.com>

lib: kconfig: Limit BINMAN_FDT for OF_SEPARATE or OF_EMBED

Generally speaking BINMAN_FDT makes sense for OF_SEPARATE or OF_EMBED.
For the other OF_CONTROL methods, it's quite possible binman node is
not available as binman is invoked during the build phase instead of
runtime. Let's only turn it on for OF_SEPARATE or OF_EMBED by default.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 87316da0 13-May-2021 Masahisa Kojima <kojima.masahisa@socionext.com>

lib: introduce HASH_CALCULATE option

Build error occurs when CONFIG_EFI_SECURE_BOOT or
CONFIG_EFI_CAPSULE_AUTHENTICATE is enabled,
because hash-checksum.c is not compiled.

Since hash_calculate() implemented in hash-checksum.c can be
commonly used aside from FIT image signature verification,
this commit itroduces HASH_CALCULATE option to decide
if hash-checksum.c shall be compiled.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# e2ae483c 13-May-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

hash: Kconfig option for SHA512 hardware acceleration

Commit a479f103dc1c ("hash: Allow for SHA512 hardware implementations")
defined function definitions for hardware accelerated SHA384 and SHA512.
If CONFIG_SHA_HW_ACCEL=y, these functions are used.

We already have boards using CONFIG_SHA_HW_ACCEL=y but none implements the
new functions hw_sha384() and hw_sha512().

For implementing the EFI TCG2 protocol we need SHA384 and SHA512. The
missing hardware acceleration functions lead to build errors on boards like
peach-pi_defconfig.

Introduce a new Kconfig symbol CONFIG_SHA512_HW_ACCEL to control if the
functions hw_sha384() and hw_sha512() shall be used to implement the SHA384
and SHA512 algorithms.

Fixes: a479f103dc1c ("hash: Allow for SHA512 hardware implementations")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

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

# 6d66502b 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: Add 2 config to define the max number of regions

Add 2 configs CONFIG_LMB_MEMORY_REGIONS and CONFIG_LMB_RESERVED_REGIONS
to change independently the max number of the regions in lmb
library.

When CONFIG_LMB_USE_MAX_REGIONS=y, move the lmb property arrays to
struct lmb and manage the array size with the element 'max' of struct
lmb_region; their are still allocated in stack.

When CONFIG_LMB_USE_MAX_REGIONS=n, keep the current location in
struct lmb_region to allow compiler optimization.

Increase CONFIG_LMB_RESERVED_REGIONS is useful to avoid lmb errors in
bootm when the number of reserved regions (not adjacent) is reached:
+ 1 region for relocated U-Boot
+ 1 region for initrd
+ 1 region for relocated linux device tree
+ reserved memory regions present in Linux device tree.

The current limit of 8 regions is reached with only 5 reserved regions
in DT.

see Linux kernel commit bf23c51f1f49 ("memblock: Move memblock arrays
to static storage in memblock.c and make their size a variable")

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# 4fa0150d 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: move MAX_LMB_REGIONS value in Kconfig

Move MAX_LMB_REGIONS value in Kconfig, the max number of the regions
in lmb library.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# 77b8cfef 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: move CONFIG_LMB in Kconfig

Migrate CONFIG_LMB in Kconfig.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# a479f103 16-Feb-2021 Joel Stanley <joel@jms.id.au>

hash: Allow for SHA512 hardware implementations

Similar to support for SHA1 and SHA256, allow the use of hardware hashing
engine by enabling the algorithm and setting CONFIG_SHA_HW_ACCEL /
CONFIG_SHA_PROG_HW_ACCEL.

Signed-off-by: Joel Stanley <joel@jms.id.au>

# f2c1442e 14-Mar-2021 Simon Glass <sjg@chromium.org>

bloblist: Make BLOBLIST_TABLES depend on BLOBLIST

Add an extra condition here since we cannot put x86 tables in a bloblist
when bloblists are not supported.

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

# e0103158 25-Feb-2021 Bin Meng <bmeng.cn@gmail.com>

lib: kconfig: Mention CONFIG_ADDR_MAP limitation in the help

Mention that CONFIG_ADDR_MAP only works in the post-relocation phase.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>

# 56e7257c 03-Feb-2021 Bin Meng <bmeng.cn@gmail.com>

lib: Fix BINMAN_FDT dependency

lib/binman.c references the following 3 ofnode APIs:
ofnode_first_subnode(), ofnode_path() and ofnode_read_bool().

These APIs get built only when DM is on. Fix the dependency then.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 59e4e391 18-Jan-2021 Tom Rini <trini@konsulko.com>

Merge https://gitlab.denx.de/u-boot/custodians/u-boot-riscv

- Update qemu-riscv.rst build instructions.
- Add support for SPI on Kendryte K210.
- Add Microchip PolarFire SoC Icicle Kit support.
- Add support for an early timer.
- Select TIMER_EARLY to avoid infinite recursion for Trace.


# a80f8513 17-Jan-2021 Pragnesh Patel <pragnesh.patel@sifive.com>

trace: select TIMER_EARLY to avoid infinite recursion

When tracing functions is enabled this adds calls to
__cyg_profile_func_enter() and __cyg_profile_func_exit() to the traced
functions.

__cyg_profile_func_enter() and __cyg_profile_func_exit() invoke
timer_get_us() to record the entry and exit time.

initr_dm() will make gd->dm_root = NULL and gd->timer = NULL, so
timer_get_us() -> get_ticks() -> dm_timer_init() will lead to an
indefinite recursion.

So select TIMER_EARLY when tracing got enabled.

Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Rick Chen <rick@andestech.com>

# 6205bbb1 04-Jan-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lib: cosmetic update of CONFIG_LIB_ELF description

Change 2 typo error in CONFIG_LIB_ELF description:
- Supoort => Support
- fir => for

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c589132a 02-Dec-2020 Aswath Govindraju <a-govindraju@ti.com>

fdt: Use phandle to distinguish DT nodes with same name

While assigning the sequence number to subsystem instances by reading the
aliases property, only DT nodes names are compared and not the complete
path. This causes a problem when there are two DT nodes with same name but
have different paths.

In arch/arm/dts/k3-am65-main.dtsi there are two USB controllers with the
same device tree node name but different path. When aliases are defined for
these USB controllers then fdtdec_get_alias_seq() fails to pick the correct
instance for a given index.

fdt_path_offset() function is slow and this would effect the U-Boot
startup. To avert the time penalty on all boards, apply this extra check
only when required by using a config option.

Fix it by comparing the phandles of DT nodes after the node names match,
under a config option.

Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Fix whitespace error in Kconfig:
Signed-off-by: Simon Glass <sjg@chromium.org>

# 28cef9ca 19-Nov-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

fs: fat: create correct short names

The current function set_name() used to create short names has the
following deficiencies resolved by this patch:

* Long names (e.g. FOO.TXT) are stored even if a short name is enough.
* Short names with spaces are created, e.g. "A ~1.TXT".
* Short names with illegal characters are created, e.g. "FOO++BAR".
* Debug output does not not consider that the short file name has no
concluding '\0'.

The solution for the following bug is split of into a separate patch:

* Short file names must be unique.

This patch only provides the loop over possible short file names.

Fixes: c30a15e590c ("FAT: Add FAT write feature")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# e4f8e543 05-Nov-2020 Simon Glass <sjg@chromium.org>

smbios: Drop the unused Kconfig options

Now that we can use devicetree to specify this information, drop the old
CONFIG options.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 44c74bdd 05-Nov-2020 Simon Glass <sjg@chromium.org>

sysinfo: Provide a default driver to set SMBIOS values

Some boards want to specify the manufacturer or product name but do not
need to have their own sysinfo driver.

Add a default driver which provides a way to specify this SMBIOS
information in the devicetree, without needing any board-specific
functionality.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d2cb7a22 04-Nov-2020 Simon Glass <sjg@chromium.org>

x86: Allow putting some tables in the bloblist

At present all tables are placed starting at address f0000 in memory, and
can be up to 64KB in size. If the tables are very large, this may not
provide enough space.

Also if the tables point to other tables (such as console log or a ramoops
area) then we must allocate other memory anyway.

The bloblist is a nice place to put these tables since it is contiguous,
which makes it easy to reserve this memory for linux using the 820 tables.

Add an option to put some of the tables in the bloblist. For SMBIOS and
ACPI, create suitable pointers from the f0000 region to the new location
of the tables.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
[bmeng: squashed in http://patchwork.ozlabs.org/project/uboot/patch/
20201105062407.1.I8091ad931cbbb5e3b6f6ababdf3f8d5db0d17bb9@changeid/]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# 415eab06 03-Nov-2020 Christian Gmeiner <christian.gmeiner@gmail.com>

smbios: add parsing API

Add a very simple API to be able to access SMBIOS strings
like vendor, model and bios version.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 72eda507 27-Oct-2020 Sean Anderson <seanga2@gmail.com>

lib: Add getopt

Some commands can get very unweildy if they have too many positional
arguments. Adding options makes them easier to read, remember, and
understand.

This implementation of getopt has been taken from barebox, which has had
option support for quite a while. I have made a few modifications to their
version, such as the removal of opterr in favor of a separate getopt_silent
function. In addition, I have moved all global variables into struct
getopt_context.

The getopt from barebox also re-orders the arguments passed to it so that
non-options are placed last. This allows users to specify options anywhere.
For example, `ls -l foo/ -R` would be re-ordered to `ls -l -R foo/` as
getopt parsed the options. However, this feature conflicts with the const
argv in cmd_tbl->cmd. This was originally added in 54841ab50c ("Make sure
that argv[] argument pointers are not modified."). The reason stated in
that commit is that hush requires argv to stay unmodified. Has this
situation changed? Barebox also uses hush, and does not have this problem.
Perhaps we could use their fix?

I have assigned maintenance of getopt to Simon Glass, as it is currently
only used by the log command. I would also be fine maintaining it.

Signed-off-by: Sean Anderson <seanga2@gmail.com>

# 26637e2e 12-Sep-2020 Simon Glass <sjg@chromium.org>

lib: Allow hexdump to be used in SPL

It is sometimes useful to output hex dumps in SPL. Add a config option to
allow this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# e87dfb05 05-Aug-2020 Andrii Anisov <andrii_anisov@epam.com>

lib: sscanf: add sscanf implementation

Port sscanf implementation from mini-os and introduce new
Kconfig option to enable it: CONFIG_SSCANF. Disable by default.

Signed-off-by: Andrii Anisov <andrii_anisov@epam.com>
Signed-off-by: Anastasiia Lukianenko <anastasiia_lukianenko@epam.com>
Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>

# 81014f73 30-Jul-2020 Joao Marcos Costa <joaomarcos.costa@bootlin.com>

include/u-boot, lib/zlib: add sources for zlib decompression

Add zlib (v1.2.11) uncompr() function to U-Boot. SquashFS depends on
this function to decompress data from a raw disk image. The actual
support for zlib into SquashFS sources will be added in a follow-up
commit.

Signed-off-by: Joao Marcos Costa <joaomarcos.costa@bootlin.com>

# 69be8fd1 03-Jun-2020 Marek Szyprowski <m.szyprowski@samsung.com>

powerpc: move ADDR_MAP to Kconfig

Move ADDR_MAP related config options from include/configs/*.h to the
proper place in lib/Kconfig. This has been done using
./tools/moveconfig.py and manual inspection of the generated changes.
This is a preparation to use ADDR_MAP helper on ARM 32bit Raspberry Pi4
board for mapping the PCIe XHCI MMIO, which is above the 4GiB identity
mapping limit.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# d16b38f4 15-Apr-2020 Reuben Dowle <reubendowle0@gmail.com>

Add support for SHA384 and SHA512

The current recommendation for best security practice from the US government
is to use SHA384 for TOP SECRET [1].

This patch adds support for SHA384 and SHA512 in the hash command, and also
allows FIT images to be hashed with these algorithms, and signed with
sha384,rsaXXXX and sha512,rsaXXXX

The SHA implementation is adapted from the linux kernel implementation.

[1] Commercial National Security Algorithm Suite
http://www.iad.gov/iad/programs/iad-initiatives/cnsa-suite.cfm

Signed-off-by: Reuben Dowle <reuben.dowle@4rf.com>

# 43e442a5 26-May-2020 Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

kconfig: fix some typos

Signed-off-by: Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

# eff5a547 22-May-2020 Michael Walle <michael@walle.cc>

cmd: zip: automatically pull in gzip()

Move the CONFIG_GZIP_COMPRESSED from a config.h macro to a Kconfig menu
item. It is not selectable by a user because there is no reason to do
so. Instead it will be automatically selected by the stuff which uses
gzip(), like the zip command.

Remove it from the config_whitelist.txt. Also remove
CONFIG_GZIP_COMPRESS_DEF_SZ as this was never used on any board. The
default seems to be sane, otherwise it should be added as a Kconfig
option.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8239be61 06-May-2020 Simon Glass <sjg@chromium.org>

lib: Allow MD5 to be enabled in SPL

At present the MD5 option cannot be enabled by board configs since it has
no Kconfig name. It is generally enabled, so long as FIT support is
present. But not all boards use FIT, particularly in SPL

Fix this and add an option for SPL as well. This allows board code to call
md5() even if FIT support is not enabled.

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

# 04cb3994 21-Apr-2020 Weijie Gao <weijie.gao@mediatek.com>

lib: enable lzma decompression support for SPL build

This patch enables LZMA decompression support for SPL build

Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>

# 2a2119e1 05-Mar-2020 Atish Patra <atishp@atishpatra.org>

lib: kconfig: Add option to set BZIP2 compression method

There is no way to select BZIP2 compression method.
Add it under library/compression config where all other
compression related configs are present.

Signed-off-by: Atish Patra <atish.patra@wdc.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 805b3cac 12-Feb-2020 Keerthy <j-keerthy@ti.com>

lib: elf: Move the generic elf loading/validating functions to lib

Move the generic elf loading/validating functions to lib/
so that they can be re-used and accessed by code existing
outside cmd.

While at it remove the duplicate static version of load_elf_image_phdr
under arch/arm/mach-imx/imx_bootaux.c.

Signed-off-by: Keerthy <j-keerthy@ti.com>
Suggested-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>

# 1611235b 19-Jan-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: Kconfig dependencies for pseudo-random library

drivers/rng/sandbox_rng.c requires rand() to be defined but configuration
option CONFIG_CONFIG_LIB_RAND selected in drivers/rng/Kconfig does not
exist.

test/lib/test_aes.c requires rand() to be defined.

Fix the selection criteria for choice "Pseudo-random library support type".

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 3c10dc95 06-Dec-2019 Simon Glass <sjg@chromium.org>

binman: Add a library to access binman entries

SPL and TPL can access information about binman entries using link-time
symbols but this is not available in U-Boot proper. Of course it could be
made available, but the intention is to just read the device tree.

Add support for this, so that U-Boot can locate entries.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# b4adf627 12-Nov-2019 AKASHI Takahiro <akashi.tkhro@gmail.com>

lib: crypto: add x509 parser

Imported from linux kernel v5.3:
x509.asn1 without changes
x509_akid.asn1 without changes
x509_parser.h without changes
x509_cert_parser.c with changes marked as __UBOOT__
x509_public_key.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# a9b45e6e 12-Nov-2019 AKASHI Takahiro <akashi.tkhro@gmail.com>

lib: add oid registry utility

Imported from linux kernel v5.3:
build_OID_registry without changes
oid_registry.h without changes
oid_registry.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# ab8a0e06 12-Nov-2019 AKASHI Takahiro <akashi.tkhro@gmail.com>

lib: add asn1 decoder

Imported from linux kernel v5.3:
lib/asn1_decoder.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 2b12196d 12-Nov-2019 AKASHI Takahiro <akashi.tkhro@gmail.com>

cmd: add asn1_compiler

Imported from linux kernel v5.3:
asn1.h without changes
asn1_ber_bytecode.h without changes
asn1_decoder.h without changes
asn1_compiler.c without changes

This host command will be used to create a ASN1 parser, for example,
for pkcs7 messages or x509 certificates. More specifically, it will
generate *byte code* which will be interpreted by asn1 decoder library.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 05429b6c 12-Nov-2019 AKASHI Takahiro <akashi.tkhro@gmail.com>

rtc: move date.c from drivers/rtc/ to lib/

In the next commit, rtc_mktime(), for compatibility with linux, will be
implemented using rtc_mktime(), which is no longer drivers/rtc specific.
So move this file under lib/.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 37ef1774 10-Nov-2019 Thomas Hebb <tommyhebb@gmail.com>

Kconfig: disambiguate config names for tiny printf

27084c03d36a ("spl: Allow tiny printf() to be controlled in SPL and
TPL") split this option in two for TPL and SPL, but didn't change the
Kconfig names, making them hard to set quickly.

Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>

# 0d76afc0 27-Oct-2019 Simon Glass <sjg@chromium.org>

fdt: Add Kconfig options to control code size

For better or worse libfdt recent grew a lot of code that checks the
validity of the device tree in great detail. When using unsigned or
unverified data this makes things safer, but it does add to code size.

Add some controls to select the trade-off between safety and code size.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 27084c03 25-Sep-2019 Simon Glass <sjg@chromium.org>

spl: Allow tiny printf() to be controlled in SPL and TPL

At present there is only one control for this and it is used for both SPL
and TPL. But SPL might have a lot more space than TPL so the extra cost of
a full printf() might be acceptable.

Split the option into two, providing separate SPL and TPL controls. The
TPL setting defaults to the same as SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2a51e16b 07-Jun-2019 Tom Rini <trini@konsulko.com>

configs: Make USE_TINY_PRINTF depend on SPL||TPL and be default

The USE_TINY_PRINTF symbol only changes things within SPL and TPL
builds, so make it depend on that support. Next, make it default as
within these cases we should rarely have need of more advanced print
formats outside of the debug context.

To do this, in a few cases we need to correct our Kconfig dependencies
as we had cases of non-SPL targets select'ing this symbol. Finally, in
the case of a few boards we really do need the full printf
functionality.

Signed-off-by: Tom Rini <trini@konsulko.com>

# da0fb5fd 02-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: make call depth limit customizable

Up to now we had hard coded values for the call depth up to which trace
records are created: 200 for early tracing, 15 thereafter. UEFI
applications reach a call depth of 80 or above.

Provide customizing settings for the call trace depth limit and the early
call trace depth limit. Use the old values as defaults.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8509f22a 29-Apr-2019 Marek Behún <kabel@kernel.org>

lib: add Zstandard decompression support

Add the zstd library from Linux kernel (only decompression support).
There are minimal changes to build with U-Boot, otherwise the files are
identical to Linux commit dc35da16 from March 2018, the files had not
been touched since in kernel. Also SPDX lincese tags were added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 83a486b6 29-Apr-2019 Marek Behún <kabel@kernel.org>

lib: Add xxhash support

This adds the xxhash support from Linux. Files are almost identical to
those added to Linux in commit 5d240522 ("lib: Add xxhash module") (they
haven't been touched since in Linux). The only difference is to add some
includes to be compatible with U-Boot. Also SPDX lincese tags were
added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 5132361a 29-Apr-2019 Heiko Schocher <hs@denx.de>

lib: Kconfig: fix help text for GZIP

commit 95f4bbd581cf ("lib: fdt: Allow LZO and GZIP DT compression in U-Boot")

introduced Kconfig option for gzip in U-Boot, but help text
says gzip for SPL, which is wrong. Fix this.

Signed-off-by: Heiko Schocher <hs@denx.de>
Acked-by: Marek Vasut <marex@denx.de>

# 1c6eb075 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE_BUFFER_SIZE et al to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE_BUFFER_SIZE
CONFIG_TRACE_EARLY_SIZE
CONFIG_TRACE_EARLY
CONFIG_TRACE_EARLY_ADDR

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

# a24a78d7 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE

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

# 54969b40 21-Mar-2019 Thierry Reding <treding@nvidia.com>

fdtdec: Add Kconfig symbol for tests

Runtime tests are provided as a test_fdtdec command implementation. Add
a Kconfig symbol that allows this command to be built so that the tests
can be used.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 95f4bbd5 08-Mar-2019 Marek Vasut <marex@denx.de>

lib: fdt: Allow LZO and GZIP DT compression in U-Boot

Add required Kconfig symbols, Makefile bits and macro fixes in a
few places to support LZO and DT compression in U-Boot. This can
save a lot of space with multi-DTB fitImages.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>

# 6e705114 13-Jan-2019 Chris Packham <judge.packham@gmail.com>

lib: Kconfig: spelling fixes

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 048c6e89 06-Nov-2018 Simon Glass <sjg@chromium.org>

spl: lz4: Allow use of lz4 compression in SPL

In some cases U-Boot is compressed and it is useful to be able to
decompress it in SPL. Add a Kconfig and Makefile change to allow this.
Note that this does not actually implement decompression.

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

# 2895c4b7 15-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

kconfig: Introduce HAVE_ARCH_IOMAP

Introduce a new Kconfig option for architecture codes to control
whether it provides io{read,write}{8,16,32} I/O accessor functions.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5592a633 01-Oct-2018 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt in TPL

In some cases (e.g. sandbox with verified boot) it is useful to support
libfdt in TPL. Update the Kconfig to handle this.

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

# 6307896c 01-Oct-2018 Simon Glass <sjg@chromium.org>

tpm: Add support for SPL and TPL

At present the tpm can only be used in U-Boot proper. Updated it to work
in SPL and TPL also.

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

# ab948cd2 19-Jul-2018 Masahiro Yamada <masahiroy@kernel.org>

fdt_support: make FDT_FIXUP_PARTITIONS depend on CMD_MTDPARTS

fdt_fixup_mtdparts() calls mtdparts_init() and device_find(),
which are defined in cmd/mtdparts.c

The combination of FDT_FIXUP_PARTITIONS=y and CMD_MTDPARTS=n
emits the following link error:

common/fdt_support.c:903: undefined reference to `mtdparts_init'
common/fdt_support.c:914: undefined reference to `device_find'

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 3330584d 03-Jun-2018 Igor Opaniuk <igor.opaniuk@gmail.com>

avb2.0: integrate avb 2.0 into the build system

Integrate libavb into the build system. Introduce CONFIG_LIBAVB
build option.

Signed-off-by: Igor Opaniuk <igor.opaniuk@linaro.org>

# f8c987f8 05-Jun-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

lib: Add hexdump

Often during debugging session it's very interesting to see
what data we were dealing with. For example what we write or read
to/from memory or peripherals.

This change introduces functions that allow to dump binary
data with one simple function invocation like:
------------------->8----------------
print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, buf, len);
------------------->8----------------

which gives us the following:
------------------->8----------------
00000000: f2 b7 c9 88 62 61 75 64 72 61 74 65 3d 31 31 35 ....baudrate=115
00000010: 32 30 30 00 62 6f 6f 74 61 72 67 73 3d 63 6f 6e 200.bootargs=con
00000020: 73 6f 6c 65 3d 74 74 79 53 33 2c 31 31 35 32 30 sole=ttyS3,11520
00000030: 30 6e 38 00 62 6f 6f 74 64 65 6c 61 79 3d 33 00 0n8.bootdelay=3.
00000040: 62 6f 6f 74 66 69 6c 65 3d 75 49 6d 61 67 65 00 bootfile=uImage.
00000050: 66 64 74 63 6f 6e 74 72 6f 6c 61 64 64 72 3d 39 fdtcontroladdr=9
00000060: 66 66 62 31 62 61 30 00 6c 6f 61 64 61 64 64 72 ffb1ba0.loadaddr
00000070: 3d 30 78 38 32 30 30 30 30 30 30 00 73 74 64 65 =0x82000000.stde
00000080: 72 72 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 rr=serial0@e0022
00000090: 30 30 30 00 73 74 64 69 6e 3d 73 65 72 69 61 6c 000.stdin=serial
000000a0: 30 40 65 30 30 32 32 30 30 30 00 73 74 64 6f 75 0@e0022000.stdou
000000b0: 74 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 30 t=serial0@e00220
000000c0: 30 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00..............
...
------------------->8----------------

Source of hexdump.c was copied from Linux kernel v4.7-rc2.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Mario Six <mario.six@gdsys.cc>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Stefan Roese <sr@denx.de>

# c232d14d 29-May-2018 Alex Kiernan <alex.kiernan@gmail.com>

mmc: Separate "mmc swrite" from fastboot

Introduce CONFIG_IMAGE_SPARSE and CONFIG_CMD_MMC_SWRITE so the "mmc
swrite" command is separated from the fastboot code.

Move image-sparse from common to lib so it's clear it's library code.

Rename CONFIG_FASTBOOT_FLASH_FILLBUF_SIZE to CONFIG_IMAGE_SPARSE_FILLBUF_SIZE
and migrate it to Kconfig.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Acked-by: Jassi Brar <jaswinder.singh@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6417572e 08-May-2018 Tom Rini <trini@konsulko.com>

lib/Kconfig: Mark OF_LIBFDT_OVERLAY as depending on OF_LIBFDT

The overlay code is only useful when OF_LIBFDT is set, so mark it as
depending on that first.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 58a46f88 25-Apr-2018 Praneeth Bajjuri <praneeth@ti.com>

configs: TI: Enable FIT Library overlay support

Enable the FDT library overlay support for all TI SOC family.

Without this option, when Loading fdt from FIT image, the
following warning is seen.

"config with overlays but CONFIG_OF_LIBFDT_OVERLAY not set".

Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
Suggested-by: Andrew F.Davis <afd@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>

# 14ad44ab 18-Apr-2018 Alex Kiernan <alex.kiernan@gmail.com>

spl: Split sprintf, strto* from SPL serial in Kconfig

When SPL serial is disabled, callers who need sprintf or strtoul fail
because their inclusion is guarded by CONFIG_SPL_SERIAL_SUPPORT/
CONFIG_TPL_SERIAL_SUPPORT.

Split printf, sprintf and strto into their own entries and then select
all of them if SERIAL_SUPPORT is enabled to match the current behaviour.

Include panic.o unconditionally as it can be called from anywhere which
uses BUG_ON().

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>

# e294ba06 04-Apr-2018 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-sunxi

Signed-off-by: Tom Rini <trini@konsulko.com>


# d14db11d 03-Apr-2018 Andre Przywara <andre.przywara@arm.com>

sunxi: revert disabling of features

In January some commits were introduced to mitigate the U-Boot image
size issues we encountered on sunxi builds.
Now with the MMC environment removed we can bring them back, as we
practically don't have a size limit anymore.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 32ce6179 13-Mar-2018 Bryan O'Donoghue <bryan.odonoghue@linaro.org>

optee: Add lib entries for sharing OPTEE code across ports

This patch adds code to lib to enable sharing of useful OPTEE code between
board-ports and architectures. The code on lib/optee/optee.c comes from the
TI omap2 port. Eventually the OMAP2 code will be patched to include the
shared code. The intention here is to add more useful OPTEE specific code
as more functionality gets added.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Cc: Harinarayan Bhatta <harinarayan@ti.com>
Cc: Andrew F. Davis <afd@ti.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Kever Yang <kever.yang@rock-chips.com>
Cc: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Cc: Peng Fan <peng.fan@nxp.com>
Tested-by: Peng Fan <peng.fan@nxp.com>

# 36c1877c 06-Feb-2018 Faiz Abbas <faiz_abbas@ti.com>

lib: Kconfig: Move DYNAMIC_CRC_TABLE to Kconfig

Add CONFIG prefix to DYNAMIC_CRC_TABLE and implement it in
Kconfig.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>

# a451bc27 05-Feb-2018 Adam Ford <aford173@gmail.com>

Convert LIB_UUID to Kconfig

config_fallback.h has some logic that checks a variety of options
and selects LIB_UUID if it hasn't already been selected. This
will all LIB_UUID in Kconfig and select this option for the list
of options to allow us to remove the logic from fallbacks

Signed-off-by: Adam Ford <aford173@gmail.com>

# a5a37567 06-Feb-2018 Adam Ford <aford173@gmail.com>

Convert CONFIG LIB_HW_RAND to Kconfig

config_fallbacks.h had some logic to automatically select
LIB_RAND if RANDOM_UUID or CMD_UUID were set if LIB_HW_RAND wasn't
already selected. By migrating LIB_HW_RAND to Kconfig, we can
remove this check from config_fallbacks.h and put it into Kconfig

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
[trini: Turn into a choice, add NET_RANDOM_ETHADDR]
Signed-off-by: Tom Rini <trini@konsulko.com>

# acd4d334 16-Jan-2018 Maxime Ripard <maxime.ripard@free-electrons.com>

net: regex: Disable by default on sunXi

The sunXi arm64 build has overflown, leading to the main U-boot binary
overwriting the environment when flashing the new image, or even worse,
overwriting itself when we're calling saveenv.

Disable this option that is not critical until we can adress the issue
properly.

Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 7e3caa81 03-Dec-2017 Masahiro Yamada <masahiroy@kernel.org>

Move CONFIG_PANIC_HANG to Kconfig

Freescale (NXP) boards have lots of defconfig files per board.
I used "imply PANIC_HANG" for them.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# da5337a6 08-Nov-2017 Nandor Han <nandor.han@ge.com>

rtc: add support for s35392a

Add support for S35392A RTC. The driver supports both U-Boot driver
models.

Signed-off-by: Nandor Han <nandor.han@ge.com>
Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
Cc: Heiko Schocher <hs@denx.de>

# f52bdf4b 14-Sep-2017 Jean-Jacques Hiblot <jjhiblot@ti.com>

lib: allow building lzo for the SPL

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 85d8bf57 03-Sep-2017 Marek Behún <kabel@kernel.org>

lib: Add CRC32-C

This is needed for BTRFS.

Signed-off-by: Marek Behun <marek.behun@nic.cz>

create mode 100644 lib/crc32c.c

# 7264f292 15-Aug-2017 York Sun <york.sun@nxp.com>

spl: fit: Eanble GZIP support for image decompression

Add Kconfig option SPL_GZIP and SPL_ZLIB to enable gunzip support for
SPL boot, eg. falcon boot compressed kernel image.

Signed-off-by: York Sun <york.sun@nxp.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6ef2f901 11-Aug-2017 Adam Ford <aford173@gmail.com>

Convert CONFIG_BCH to Kconfig

This converts the following to Kconfig:
CONFIG_BCH

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1a7ba1d 18-Aug-2017 Anatolij Gustschin <agust@denx.de>

Fix 'notes' typos

s/notes/nodes

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 96b9082c 03-Aug-2017 Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

rockchip: rk3188: rock: adjust for SPL/TPL split

With the changes to split SPL/TPL for the RK3368, I apparently missed
some needed adjustments to the RK3188 Kconfig and rock_defconfig.

This fixes build-issues for the rock board after applying the RK3368
enablement (and SPL/TPL) set that resulted from TPL_SERIAL_SUPPORT,
TPL_ROCKCHIP_BACK_TO_BROM and TPL_TINY_MEMSET being separate symbols
now.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d56b4b19 22-Jul-2017 Tom Rini <trini@konsulko.com>

configs: Migrate RBTREE, LZO, CMD_MTDPARTS, CMD_UBI and CMD_UBIFS

The above CONFIG options are in Kconfig, and now have correct depends and
inter-dependencies. Migrate these to configs/ from include/configs/. In the
case of CMD_UBIFS also change it to be a default y if CMD_UBI.

Signed-off-by: Tom Rini <trini@konsulko.com>

# aed998aa 17-May-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_LZMA to Kconfig

This converts the following to Kconfig:
CONFIG_LZMA

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

# b1a873df 26-Apr-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_CMD_AES et al to Kconfig

This converts the following to Kconfig:
CONFIG_CMD_AES
CONFIG_AES

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Add select AES to CMD_AES]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 173aafbf 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

cmd: Expose a Kconfig option to enable UBIFS commands

Create a new Kconfig entry to allow CMD_UBIFS selection from Kconfig and
add an hidden LZO option that can be selected by CMD_UBIFS.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>

# aa049152 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

mtd: ubi: Select RBTREE option from MTD_UBI Kconfig entry

Expose the RBTREE feature through Kconfig and select this option from the
MTD_UBI option.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>
[Rebased on master]
Signed-off-by: Jagan Teki <jagan@openedev.com>

# ab4458bd 02-Apr-2017 Simon Glass <sjg@chromium.org>

string: Provide a slimmed-down memset()

Most of the time the optimised memset() is what we want. For extreme
situations such as TPL it may be too large. For example on the 'rock'
board, using a simple loop saves a useful 48 bytes. With gcc 4.9 and
the rodata bug, this patch is enough to reduce the TPL image below the
limit.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>

# bea79d7d 14-Mar-2017 Andre Przywara <andre.przywara@arm.com>

Kconfig: introduce md5sum command selection

So far CONFIG_MD5SUM would need to be set by a board's include file.
Since the command is really generic, move it over to Kconfig to allow
it to be defined by either a board's defconfig, menuconfig or some
config snippet merged via mergeconfig.sh.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e663b350 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

smbios: Expose in efi_loader as table

We can pass SMBIOS easily as EFI configuration table to an EFI payload. This
patch adds enablement for that case.

While at it, we also enable SMBIOS generation for ARM systems, since they support
EFI_LOADER.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4b6dddc2 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

x86: Move smbios generation into arch independent directory

We will need the SMBIOS generation function on ARM as well going forward,
so let's move it into a non arch specific location.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# ebf7fff2 05-Oct-2016 Heiko Schocher <hs@denx.de>

spl: move FDT_FIXUP_PARTITIONS to Kconfig

Move FDT_FIXUP_PARTITIONS to Kconfig and cleanup existing
uses.

Signed-off-by: Heiko Schocher <hs@denx.de>

# ddf67f71 05-Jul-2016 Maxime Ripard <maxime.ripard@free-electrons.com>

libfdt: Add overlay application function

The device tree overlays are a good way to deal with user-modifyable
boards or boards with some kind of an expansion mechanism where we can
easily plug new board in (like the BBB, the Raspberry Pi or the CHIP).

Add a new function to merge overlays with a base device tree.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>

# 91b86e21 26-May-2016 Marek Vasut <marex@denx.de>

lib: Enable private libgcc by default

This patch decouples U-Boot binary from the toolchain on systems where
private libgcc is available. Instead of pulling in functions provided
by the libgcc from the toolchain, U-Boot will use it's own set of libgcc
functions. These functions are usually imported from Linux kernel, which
also uses it's own libgcc functions instead of the ones provided by the
toolchain.

This patch solves a rather common problem. The toolchain can usually
generate code for many variants of target architecture and often even
different endianness. The libgcc on the other hand is usually compiled
for one particular configuration and the functions provided by it may
or may not be suited for use in U-Boot. This can manifest in two ways,
either the U-Boot fails to compile altogether and linker will complain
or, in the much worse case, the resulting U-Boot will build, but will
misbehave in very subtle and hard to debug ways.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 67976306 30-Mar-2016 Masahiro Yamada <masahiroy@kernel.org>

cosmetic: Fix typos "privide"

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# ed980b8c 03-Mar-2016 Alexander Graf <agraf@csgraf.de>

efi_loader: hook up in build environment

Now that we have all the bits and pieces ready for EFI payload loading
support, hook them up in Makefiles and KConfigs so that we can build.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
[trini: Enable only when we of OF_LIBFDT, disable on kwb and colibri_pxa270]
Signed-off-by: Tom Rini <trini@konsulko.com>

# aa34fbc0 22-Feb-2016 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt to be used in SPL

Add an option to enable libfdt in SPL. This can be useful when decoding
FIT files in SPL.

We need to make sure this option is not enabled in SPL by this change.
Also this option needs to be enabled in host builds. Si add a new
IMAGE_USE_LIBFDT #define which can be used in files that are built on the
host but must also build for U-Boot and SPL.

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

# 69e173eb 22-Feb-2016 Simon Glass <sjg@chromium.org>

Move CONFIG_OF_LIBFDT to Kconfig

Move this option to Kconfig and tidy up existing boards.

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

# a187559e 05-Feb-2016 Bin Meng <bmeng.cn@gmail.com>

Use correct spelling of "U-Boot"

Correct spelling of "U-Boot" shall be used in all written text
(documentation, comments in source files etc.).

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Minkyu Kang <mk7.kang@samsung.com>

# 947c626d 14-Jan-2016 Tom Rini <trini@konsulko.com>

vsprintf.c: Always enable CONFIG_SYS_VSNPRINTF

Enabling this function always removes some class of string saftey issues.
The size change here in general is about 400 bytes and this seems a reasonable
trade-off.

Cc: Peng Fan <peng.fan@nxp.com>
Cc: Peter Robinson <pbrobinson@gmail.com>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Adrian Alonso <aalonso@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 7d9cde10 22-Nov-2015 Stefan Roese <sr@denx.de>

lib/tiny-printf.c: Add tiny printf function for space limited environments

This patch adds a small printf() version that supports all basic formats.
Its intented to be used in U-Boot SPL versions on platforms with very
limited internal RAM sizes.

To enable it, just define CONFIG_USE_TINY_PRINTF in your defconfig. This
will result in the SPL using this tiny function and the main U-Boot
still using the full-blown printf() function.

This code was copied from:
http://www.sparetimelabs.com/printfrevisited
With mostly only coding style related changes so that its checkpatch
clean.

The size reduction is about 2.5KiB. Here a comparison for the db-mv784mp-gp
(Marvell AXP) SPL:

Without this patch:
58963 18536 1928 79427 13643 ./spl/u-boot-spl

With this patch:
56542 18536 1956 77034 12cea ./spl/u-boot-spl

Note:
To make it possible to compile tiny-printf.c instead of vsprintf.c when
CONFIG_USE_TINY_PRINTF is defined, the functions printf() and vprintf() are
moved from common/console.c into vsprintf.c in this patch.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>

# 2419cd16 03-Oct-2015 Simon Glass <sjg@chromium.org>

dm: tpm: Drop CONFIG_DM_TPM

Now that all TPM drivers use driver model, we can drop the special driver
model CONFIG option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>

# 027b728d 06-Oct-2015 Julius Werner <jwerner@chromium.org>

Add support for LZ4 decompression algorithm

This patch adds support for LZ4-compressed FIT image contents. This
algorithm has a slightly worse compression ration than LZO while being
nearly twice as fast to decompress. When loading images from a fast
storage medium this usually results in a boot time win.

Sandbox-tested only since I don't have a U-Boot development system set
up right now. The code was imported unchanged from coreboot where it's
proven to work, though. I'm mostly interested in getting this recognized
by mkImage for use in a downstream project.

Signed-off-by: Julius Werner <jwerner@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# a7d660bc 22-Aug-2015 Simon Glass <sjg@chromium.org>

tpm: Add Kconfig options for TPMs

Add new Kconfig options for TPMs in preparation for moving boards to use
Kconfig for TPM configuration.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 867a6ac8 31-Jul-2015 Simon Glass <sjg@chromium.org>

efi: Add start-up library code

When running as an EFI application, U-Boot must request memory from EFI,
and provide access to the boot services U-Boot needs.

Add library code to perform these tasks. This includes efi_main() which is
the entry point from EFI. U-Boot is built as a shared library.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d1389403 23-Jun-2015 Simon Glass <sjg@chromium.org>

Add a dhrystone benchmark command

Drystone provides a convenient sanity check that the CPU is running at full
speed. Add this as a command which can be enabled as needed.

Note: I investigated using Coremark for this but there was a license
agreement and I could not work out if it was GPL-compatible.

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

# f7848d90 22-Jun-2015 Joe Hershberger <joe.hershberger@ni.com>

Allow CONFIG_REGEX to be disabled when CONFIG_NET

Instead of selecting REGEX when NET is enabled, make it the default, but
allow boards that are tiny to disable it and lose functionality on all
but the first Ethernet adapter.

cm-bf548, bf538f-ezkit, and bf533-stamp need this. None appear to have
more than one Ethernet interface.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# 3850dbe8 11-Jun-2015 Masahiro Yamada <masahiroy@kernel.org>

blackfin: fix undefined reference to srand and rand

Commit 9ba9e85f3f1c (net: Fix NET_RANDOM_ETHADDR dependencies)
accidentally dropped CONFIG_LIB_RAND defines for 14 Blackfin boards.

Prior to that commit, those boards defined CONFIG_LIB_RAND, but not
CONFIG_NET_RANDOM_ETHADDR. So, commit 9ba9e85f3f1c should not have
touched them, but in fact it ripped CONFIG_LIB_RAND off from all the
header files, which caused undefined reference to srand and rand.
CONFIG_LIB_RAND=y must be revived for such boards.

BTW, this commit indeed makes it better, but even with this fix,
three boards (bf533-stamp, bf538f-ezkit, cm-bf548) still can not
build due to region 'ram' overflowed error. This was cause by
commit 6eed3786c68c (net: Move the CMD_NET config to defconfigs)
because CMD_NET selects NET, and NET selects REGEX. Eventually,
some boards were newly enabled with CONFIG_REGEX, increasing the
memory footprint. A patch is expected to fix the build error.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 9ba9e85f 25-May-2015 Michal Simek <michal.simek@amd.com>

net: Fix NET_RANDOM_ETHADDR dependencies

NET_RANDOM_ETHADDR depends on lib/rand.c. This patch adds dependency to
Kconfig to ensure that library is also compiled.

Remove the definitions from Blackfin boards' include/configs.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 6501ff62 20-Apr-2015 Przemyslaw Marczak <p.marczak@samsung.com>

lib: Kconfig: add entry for errno_str() function

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1a60650c 21-Apr-2015 Joe Hershberger <joe.hershberger@ni.com>

kconfig: Move REGEX to Kconfig

Having this as a Kconfig allows it to be a dependent feature.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8156345d 06-Mar-2015 Simon Glass <sjg@chromium.org>

sandbox: Move CONFIG_SYS_VSNPRINTF to Kconfig

Move this over to Kconfig and tidy up.

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

# 94e3c8c4 19-Feb-2015 gaurav rana <gaurav.rana@freescale.com>

crypto/fsl - Add progressive hashing support using hardware acceleration.

Currently only normal hashing is supported using hardware acceleration.
Added support for progressive hashing using hardware.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
Signed-off-by: Gaurav Rana <gaurav.rana@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>

# d9f23c7f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

lib/rsa: Add Kconfig for devices supporting RSA Modular Exponentiation

Kconfig option added for devices which support RSA Verification.
1. RSA_SOFTWARE_EXP
Enables driver for supporting RSA Modular Exponentiation in Software
2. RSA_FREESCALE_EXP
Enables driver for supporting RSA Modular Exponentiation using Freescale specific
driver

The above drivers use RSA uclass

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
(Removed duplicate line in Kconfig comment)

Change-Id: I7663c4d5350e2bfc3dfa2696f70ef777d6ccc6f6

# c4beb22f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

FIT: Modify option FIT_SIGNATURE in Kconfig

For FIT signature based approach to work, RSA library needs to be selected.
The FIT_SIGNATURE option in Kconfig is modified to automatically select RSA.
Selecting RSA compiles the RSA library required for image verification.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 45ccec8f 23-Oct-2014 Masahiro Yamada <masahiroy@kernel.org>

kconfig: move CONFIG_USE_PRIVATE_LIBGCC to Kconfig

The private libgcc is supported only on ARM, MIPS, PowerPC, SH, x86.
Those architectures should "select" HAVE_PRIVATE_LIBGCC and
CONFIG_USE_PRIVATE_LIBGCC should depend on it.

Currently, this option is enabled on Tegra boards and x86 architecture.
Move the definition from header files to Kconfig.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Tested-by: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: Tom Warren <twarren@nvidia.com>

# 8c688bc4 23-Oct-2014 Masahiro Yamada <masahiroy@kernel.org>

kconfig: move CONFIG_SYS_HZ to lib/Kconfig

CONFIG_SYS_HZ is always defined as 1000 in config_fallbacks.h
(but some boards still have redundant definitions).

This commit moves the definition and the document in README to
Kconfig. Since lib/Kconfig can assure that CONFIG_SYS_HZ is 1000,
the sanity check in lib/time.c should be removed.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Reviewed-by: Marek Vasut <marex@denx.de>

# b0928da6 16-Sep-2014 Masahiro Yamada <masahiroy@kernel.org>

kconfig: move CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED to Kconfig

If this option is enabled, the objects under lib/ directory
are compiled with speed optimization, not size optimization.
(Currently, only used by some Blackfin boards.)

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# ed36323f 16-Sep-2014 Masahiro Yamada <masahiroy@kernel.org>

kconfig: add blank Kconfig files

This would be useful to start moving various config options.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# 6d9a851e 11-Apr-2024 Vincent Stehlé <vincent.stehle@arm.com>

Fix references to trace doc

The README.trace has been moved and converted to rst in commit dce26c7d56ed
("doc: move README.trace to HTML documentation"); fix all the remaining
references to this file.

Signed-off-by: Vincent Stehlé <vincent.stehle@arm.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>

# 1373ffde 18-Dec-2023 Tom Rini <trini@konsulko.com>

Merge tag 'v2024.01-rc5' into next

Prepare v2024.01-rc5


# 253f939a 20-Nov-2023 Tom Rini <trini@konsulko.com>

lib/Kconfig: Correct typo about SYSINFO_SMBIOS in help message

The correct symbol to enable to have SMBIOS populate fields based on the
device tree is SYSINFO_SMBIOS and not SMBIOS_SYSINFO.

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 47cfdb21 27-Oct-2023 Sean Anderson <sean.anderson@seco.com>

arm: semihosting: Support semihosting fallback on 32-bit ARM

Add support for a semihosting fallback on 32-bit ARM. The assembly is
lightly adapted from the irq return code, except there is no offset
since lr already points to the correct instruction. The C side is mostly
like ARM64, except we have fewer cases to deal with.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>

# a4dc3d56 26-Oct-2023 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: uuid: move CONFIG_RANDOM_UUID

This option is independent from any commands and should be managed
under lib. For instance, drivers/block/rkmtd.c is a user.

It would be better to remove this configuration.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# d5d9770f 27-Oct-2023 Tom Rini <trini@konsulko.com>

Merge tag 'tpm-next-27102023' of https://source.denx.de/u-boot/custodians/u-boot-tpm

bootX measurements and measurement API moved to u-boot core:

Up to now, U-Boot could perform measurements and EventLog creation as
described by the TCG spec when booting via EFI.

The EFI code was residing in lib/efi_loader/efi_tcg2.c and contained
both EFI specific code + the API needed to access the TPM, extend PCRs
and create an EventLog. The non-EFI part proved modular enough and
moving it around to the TPM subsystem was straightforward.

With that in place we can have a common API for measuring binaries
regardless of the boot command, EFI or boot(m|i|z), and contructing an
EventLog.

I've tested all of the EFI cases -- booting with an empty EventLog and
booting with a previous stage loader providing one and found no
regressions. Eddie tested the bootX part.

Eddie also fixed the sandbox TPM which couldn't be used for the EFI code
and it now supports all the required capabilities. This had a slight
sideeffect in our testing since the EFI subsystem initializes the TPM
early and 'tpm2 init' failed during some python tests. That code only
opens the device though, so we can replace it with 'tpm2 autostart'
which doesn't error out and still allows you to perfom the rest of the
tests but doesn't report an error if the device is already opened.

There's a few minor issues with this PR as well but since testing and
verifying the changes takes a considerable amount of time, I prefer
merging it now.

Heinrich has already sent a PR for -master containing "efi_loader: fix
EFI_ENTRY point on get_active_pcr_banks" and I am not sure if that will
cause any conflicts, but in any case they should be trivial to resolve.

Both the EFI and non-EFI code have a Kconfig for measuring the loaded
Device Tree. The reason this is optional is that we can't reason
when/if devices add random info like kaslr-seed, mac addresses etc in
the DT. In that case measurements are random, board specific and
eventually useless. The reason it was difficult to fix it prior to this
patchset is because the EFI subsystem and thus measurements was brought
up late and DT fixups might have already been applied. With this
patchset we can measure the DT really early in the future.

Heinrich also pointed out that the two Kconfigs for the DTB measurements
can be squashed in a single one and that the documentation only explains
the non-EFI case. I agree on both but as I said this is a sane working
version, so let's pull this first it's aleady big enough and painful to
test.


# 97707f12 24-Oct-2023 Eddie James <eajames@linux.ibm.com>

tpm: Support boot measurements

Add TPM2 functions to support boot measurement. This includes
starting up the TPM, initializing/appending the event log, and
measuring the U-Boot version. Much of the code was used in the
EFI subsystem, so remove it there and use the common functions.

Signed-off-by: Eddie James <eajames@linux.ibm.com>
For the API moving around from EFI -> u-boot core
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
For EFI testing
Tested-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

# 44071cd5 14-Oct-2023 Sean Anderson <seanga2@gmail.com>

fs: ext4: Fix building ext4 in SPL if write is enabled

If EXT4_WRITE is enabled, write capabilities will be compiled into SPL, but
not CRC16. Add an option to enable CRC16 to avoid linker errors.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 53fab13a 20-Sep-2023 Simon Glass <sjg@chromium.org>

efi: Use the installed SMBIOS tables

U-Boot should set up the SMBIOS tables during startup, as it does on x86.
Ensure that it does this correctly on non-x86 machines too, by creating
an event spy for last-stage init.

Tidy up the installation-condition code while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 8c11d19e 19-Sep-2023 Simon Glass <sjg@chromium.org>

x86: smbios: Add a Kconfig indicating SMBIOS-table presence

When booted from coreboot, U-Boot does not build the SMBIOS tables, but
it should still pass them on to the OS. Add a new option which indicates
whether SMBIOS tables are present, however they were built.

Flip the ordering so that the dependency is listed first, which is less
confusing.

Adjust GENERATE_SMBIOS_TABLE to depend on this new symbol.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 0c45c76c 19-Sep-2023 Simon Glass <sjg@chromium.org>

x86: Allow APCI in SPL

This is needed so we can find the DBG2 table provided by coreboot. Add a
Kconfig so it can be enabled.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 040a6048 14-Sep-2023 Simon Glass <sjg@chromium.org>

boot: Join FDT_FIXUP_PARTITIONS with related options

Move this to be with the other devicetree-fixup options.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 4cc40f61 14-Sep-2023 Simon Glass <sjg@chromium.org>

FWU: Avoid showing an unselectable menu option

Use a menuconfig to avoid showing a menu which cannot be selected in many
cases.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

# a90b5946 14-Sep-2023 Simon Glass <sjg@chromium.org>

lib: rational: Move the Kconfigs into the correct place

These should not be part of the 'system tables' menu. Move them outside
on their own.

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: 7d0f3fbb93c ("lib: rational: copy the rational fraction lib...")
Reviewed-by: Tom Rini <trini@konsulko.com>

# a077ac13 02-Aug-2023 Tom Rini <trini@konsulko.com>

Kconfigs: Correct default of "0" on hex type entries

It is not a parse error to have a default value of "0" for a "hex" type
entry, instead of "0x0". However, "0" and "0x0" are not treated the
same even by the tools themselves. Correct this by changing the default
value from "0" to "0x0" for all hex type questions that had the
incorrect default. Fix one instance (in two configs) of a default of "0"
being used on a hex question to be "0x0". Remove the cases where a
defconfig had set a value of "0x0" to be used as the default had been
"0".

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# af62d83c 03-Aug-2023 Oleksandr Suvorov <oleksandr.suvorov@foundries.io>

spl: move SPL_CRC32 option to lib/Kconfig

All SPL hash algorithm options are collected in lib/Kconfig. Move
SPL_CRC32 there as well.

Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
Reviewed-by: Simon Glass <sjg@chromium.org>

# dfe00b34 13-Jul-2023 Manorit Chawdhry <m-chawdhry@ti.com>

lib: Kconfig: k3: Enable SHA512 for fit signature

We are using our custMpk for signing that is a 4096 bit key, 4096 bit
rsa key requires a SHA512 hashing algorithm to be enabled as per the
source. Even though it is not mandated but this is how it works and is
tested.

Enables SHA512 if fit signature is enabled on K3 platforms.

Signed-off-by: Manorit Chawdhry <m-chawdhry@ti.com>

# 0992a90d 04-May-2023 Simon Glass <sjg@chromium.org>

acpi: Create a new Kconfig for ACPI

We have several Kconfig options for ACPI, but all relate to specific
functions, such as generating tables and AML code.

Add a new option which controls including basic ACPI library code,
including the lib/acpi directory. This will allow us to add functions
which are available even if table generation is not supported.

Adjust the command to avoid a build error when ACPIGEN is not enabled.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 94c8da21 22-Mar-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: Fix LMB_MEMORY_REGIONS flag usage

Remove test on CONFIG_LMB_MEMORY_REGIONS introduced by commit
7c1860fce4e3 ("lmb: Fix lmb property's defination under struct lmb").

This code in lmb_init() is strange, because if CONFIG_LMB_USE_MAX_REGIONS
and CONFIG_LMB_MEMORY_REGIONS are not defined, the implicit #else is empty
and the required initialization is not done:
lmb->memory.max = ?
lmb->reserved.max = ?

But this setting is not possible:
- CONFIG_LMB_USE_MAX_REGIONS not defined
- CONFIG_LMB_MEMORY_REGIONS not defined
because CONFIG_LMB_MEMORY_REGIONS and CONFIG_LMB_RESERVED_REGIONS are
defined as soon as the CONFIG_LMB_USE_MAX_REGIONS is not defined.

This patch removes this impossible case #elif and I add some
explanation in lmb.h to explain why in the struct lmb {} the lmb
property is defined if CONFIG_LMB_MEMORY_REGIONS is NOT defined.

This patch also removes CONFIG_LMB_XXX dependency on CONFIG_LMB as these
defines are used in API file lmb.h and not only in library file.

Fixes: 5e2548c1d6e03 ("lmb: Fix LMB_MEMORY_REGIONS flag usage")
Reported-by: Mark Millard <marklmi@yahoo.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Acked-by: Michal Simek <michal.simek@amd.com>

# c61df340 18-Mar-2023 Marek Vasut <marek.vasut+renesas@mailbox.org>

lib: Fix SYS_TIMER_COUNTS_DOWN description in Kconfig

The SYS_TIMER_COUNTS_DOWN description contains a typo,
s@rathe@&r@ , fix it.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>

# 3b510807 22-Feb-2023 Simon Glass <sjg@chromium.org>

lib: Add an SPL config for LIB_UUID

This is selected by PARTITION_UUIDS which has a separate option for SPL.
Add an SPL option for LIB_UUID also, so that we can keep them consistent.

Also add one for PARTITION_TYPE_GUID to avoid a build error in part_efi.c
which wants to call a uuid function in SPL.

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

# 5a6bc166 22-Feb-2023 Simon Glass <sjg@chromium.org>

lib: Add VPL options for SHA1 and SHA256

Add these options so these algorithms can be used in VPL.

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

# ae625d92 22-Feb-2023 Simon Glass <sjg@chromium.org>

lib: Add a Kconfig for SPL_BZIP2

This is implicitly used in the source and seems useful, so add it.

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

# c33425c6 15-Jan-2023 Simon Glass <sjg@chromium.org>

trace: Reduce the default for TRACE_EARLY_CALL_DEPTH_LIMIT

This is a silly value at present, since U-Boot's call depth never reaches
200. Fix it.

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

# 2dc16a2c 19-Jan-2023 Sjoerd Simons <sjoerd@collabora.com>

Bump LMB_MAX_REGIONS default to 16

Since commit 06d514d77c37 ("lmb: consider EFI memory map") the EFI regions
are also pushed into the lmb if EFI_LOADER is enabled (which is by
default on most system). Which can cause the number of entries to go
over the maximum as it's default is only 8.

Specifically i ran into this case on an TI am62 which has an fdt with
4 reserved regions (in practice 3 lmb entries due to adjecent ranges).

As this is likely to impact more devices bump the default max
regions to 16 so there is a bit more slack.

Fixes: 06d514d77c ("lmb: consider EFI memory map")
Link: https://bugzilla.opensuse.org/show_bug.cgi?id=1207562
Reviewed-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Signed-off-by: Sjoerd Simons <sjoerd@collabora.com>
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
[trini: collect tags from the other equivalent patch]

# 948d3999 08-Feb-2023 Tom Rini <trini@konsulko.com>

Revert "lmb: Default to not-LMB_USE_MAX_REGIONS"

As explained by Philippe Schenker, I was misinterpreting what happened
in the case where we do not set LMB_USE_MAX_REGIONS and so had
re-introduced the problem I was attempting to more widely resolve.

This reverts commit 007ae5d108a37564905ea1588cb279f3a522cc3d.

Reported-by: Philippe Schenker <philippe.schenker@toradex.com>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 007ae5d1 25-Jan-2023 Tom Rini <trini@konsulko.com>

lmb: Default to not-LMB_USE_MAX_REGIONS

The LMB code allows for picking a hard limit on the number of regions it
can know of, or to dynamically allocate these regions. The reason for
this choice is to allow for the compiler to perform a size optimization
in the common case. This optimization however, is very small, ranging
from 196 bytes to 15 bytes saved, or in some cases, being larger. Now
that we also have more regions covered by LMB (in order to protect
various parts of our self at run time), the default of 8 is also much
easier to hit and leads to non-obvious error messages (which imply that
an area is protected, not that we're out of areas to add to the list).

Switch to the dynamic use as the default.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 53c47c59 19-Jan-2023 Tom Rini <trini@konsulko.com>

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


# 4b9b25d9 12-Jan-2023 Brandon Maier <brandon.maier@collins.com>

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

[1] https://github.com/torvalds/linux/commit/e0c1b49f5b674cca7b10549c53b3791d0bbc90a8
[2] https://github.com/facebook/zstd/blob/f302ad8811643c428c4e3498e28f53a0578020d3/lib/libzstd.mk#L31

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>

# ebc1d50a 21-Dec-2022 Simon Glass <sjg@chromium.org>

Revert "fdtdec: drop needlessly convoluted CONFIG_PHANDLE_CHECK_SEQ"

The fdt_path_offset() function is slow since it must scan the tree.
This substantial overhead now applies to all boards.

The original code may not be ideal but it is fit for purpose and is only
needed on a few boards.

Reverting this reduces time to set up driver model by about 30ms.

Before revert:

Accumulated time:
47,170 dm_r
53,237 dm_spl
572,986 dm_f

Accumulated time:
44,598 dm_r
50,347 dm_spl
549,133 dm_f

This reverts commit 26f981f295d00351b6f0c69b5317b254b2361cc0.

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

# 12619d4e 21-Dec-2022 Simon Glass <sjg@chromium.org>

trace: Don't require TIMER_EARLY

Some platforms cannot honour this and don't need trace before relocation.
Use 'imply' instead, so boards can disable this.

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

# 0c16fca9 07-Jan-2023 Simon Glass <sjg@chromium.org>

tpm: Add a proper Kconfig option for crc8 in SPL

The current approach is a bit of a hack and only works for the tpm
subsystem. Add a Kconfig so that crc8 can be enabled in SPL for other
purposes.

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

# 14f43797 19-Dec-2022 Tom Rini <trini@konsulko.com>

Merge tag 'v2023.01-rc4' into next

Prepare v2023.01-rc4

Signed-off-by: Tom Rini <trini@konsulko.com>


# ae3527f0 07-Dec-2022 Kautuk Consul <kconsul@ventanamicro.com>

arch/riscv: add semihosting support for RISC-V

We add RISC-V semihosting based serial console for JTAG based early
debugging.

The RISC-V semihosting specification is available at:
https://github.com/riscv/riscv-semihosting-spec/blob/main/riscv-semihosting-spec.adoc

Signed-off-by: Anup Patel <apatel@ventanamicro.com>
Signed-off-by: Kautuk Consul <kconsul@ventanamicro.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>

# 1c03ab9f 07-Dec-2022 Kautuk Consul <kconsul@ventanamicro.com>

lib: Add common semihosting library

We factor out the arch-independent parts of the ARM semihosting
implementation as a common library so that it can be shared
with RISC-V.

Signed-off-by: Kautuk Consul <kconsul@ventanamicro.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>

# 3b8dfc42 16-Nov-2022 Tom Rini <trini@konsulko.com>

Convert CONFIG_SYS_TIMER_COUNTS_DOWN to Kconfig

This converts the following to Kconfig:
CONFIG_SYS_TIMER_COUNTS_DOWN

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 86794052 21-Oct-2022 Sughosh Ganu <sughosh.ganu@linaro.org>

FWU: Add support for the FWU Multi Bank Update feature

The FWU Multi Bank Update feature supports updating firmware images
to one of multiple sets(also called banks) of images. The firmware
images are clubbed together in banks, with the system booting images
from the active bank. Information on the images such as which bank
they belong to is stored as part of the metadata structure, which is
stored on the same storage media as the firmware images on a dedicated
partition.

At the time of update, the metadata is read to identify the bank to
which the images need to be flashed(update bank). On a successful
update, the metadata is modified to set the updated bank as active
bank to subsequently boot from.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

# 40ed7be4 02-Aug-2022 Tom Rini <trini@konsulko.com>

Convert CONFIG_SYS_FDT_PAD to Kconfig

This converts the following to Kconfig:
CONFIG_SYS_FDT_PAD

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e67ffb5a 22-Jul-2022 Sughosh Ganu <sughosh.ganu@linaro.org>

tpm: rng: Add driver model interface for TPM RNG device

The TPM device has a builtin random number generator(RNG)
functionality. Expose the RNG functions of the TPM device to the
driver model so that they can be used by the EFI_RNG_PROTOCOL if the
protocol is installed.

Also change the function arguments and return type of the random
number functions to comply with the driver model api.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

# b340199f 10-Jun-2022 Tom Rini <trini@konsulko.com>

spl: Ensure all SPL symbols in Kconfig have some SPL dependency

Tighten up symbol dependencies in a number of places. Ensure that a SPL
specific option has at least a direct dependency on SPL. In places
where it's clear that we depend on something more specific, use that
dependency instead. This means in a very small number of places we can
drop redundant dependencies.

Reported-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 13ce351b 08-Jun-2022 Tom Rini <trini@konsulko.com>

vpl: Ensure all VPL symbols in Kconfig have some VPL dependency

Tighten up symbol dependencies in a number of places. Ensure that a VPL
specific option has at least a direct dependency on VPL. In places
where it's clear that we depend on something more specific, use that
dependency instead.

Reported-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 8bea4bf7 08-Jun-2022 Tom Rini <trini@konsulko.com>

tpl: Ensure all TPL symbols in Kconfig have some TPL dependency

Tighten up symbol dependencies in a number of places. Ensure that a TPL
specific option has at least a direct dependency on TPL. In places
where it's clear that we depend on something more specific, use that
dependency instead.

Reported-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 26f981f2 19-May-2022 Rasmus Villemoes <rasmus.villemoes@prevas.dk>

fdtdec: drop needlessly convoluted CONFIG_PHANDLE_CHECK_SEQ

Asking if the alias we found actually points at the device tree node
we passed in (in the guise of its offset from blob) can be done simply
by asking if the fdt_path_offset() of the alias' path is identical to
offset.

In fact, the current method suffers from the possibility of false
negatives: dtc does not necessarily emit a phandle property for a node
just because it is referenced in /aliases; it only emits a phandle
property for a node if it is referenced in <angle brackets>
somewhere. So if both the node we passed in and the alias node we're
considering don't have phandles, fdt_get_phandle() returns 0 for both.

Since the proper check is so simple, there's no reason to hide that
behind a config option (and if one really wanted that, it should be
called something else because there's no need to involve phandle in
the check).

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Acked-by: Aswath Govindraju <a-govindraju@ti.com>

# d30924f1 01-May-2022 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: fix selection of CONFIG_CHARSET

lib/charset.c is not optional for
EFI_APP || EFI_LOADER || UFS || UT_UNICODE.
These must select CONFIG_CHARSET.

Fixes: 726cd9836db0 ("efi: Make unicode printf available to the app")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>

# 747093dd 30-Apr-2022 Simon Glass <sjg@chromium.org>

vpl: Add Kconfig options for VPL

Add VPL versions of commonly used Kconfig options.

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

# 11232139 06-Apr-2022 Tom Rini <trini@konsulko.com>

nds32: Remove the architecture

As removal of nds32 has been ack'd for the Linux kernel, remove support
here as well.

Cc: Rick Chen <rick@andestech.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Rick Chen <rick@andestech.com>

# fd210fee 28-Mar-2022 Philippe Reynes <philippe.reynes@softathome.com>

lib: allow to build asn1 decoder and oid registry in SPL

This commit adds the options:
- SPL_ASN1_DECODER
- SPL_OID_REGISTRY

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>

# 7d44a985 28-Mar-2022 Philippe Reynes <philippe.reynes@softathome.com>

lib: Kconfig: enhance the help of OID_REGISTRY

Enhance the help for the config OID_REGISTRY.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>

# a0e71d96 28-Mar-2022 Philippe Reynes <philippe.reynes@softathome.com>

lib: Kconfig: enhance help for ASN1

Enhance the help for configs ASN1_COMPILER
and ASN1_decoder.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>

# 761a1786 27-Jan-2022 Tom Rini <trini@konsulko.com>

Merge tag 'dm-pull-26jan22' of https://source.denx.de/u-boot/custodians/u-boot-dm

acpi refactoring to allow non-x86 use
binman support for bintools (binary tools)
minor tools improvements in preparation for FDT signing
various minor fixes and improvements


# 334a9b9d 25-Nov-2021 Loic Poulain <loic.poulain@linaro.org>

lib/circbuf: Make circbuf selectable symbol

It is currenly only used from usbtty driver but make it properly
selectable via Kconfig symbol, for future usage.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>

# e1722fcb 01-Dec-2021 Simon Glass <sjg@chromium.org>

x86: Allow any arch to generate ACPI tables

These have sadly found their way to ARM now. Allow any arch to support
generating ACPI tables.

Disable this for the tools build.

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

# 7c3fd5c2 26-Dec-2021 Qu Wenruo <wqu@suse.com>

lib: add BLAKE2 hash support

The code is cross-ported from BLAKE2 reference implementation
(https://github.com/BLAKE2/BLAKE2).

With minimal change to remove unused macros/features.

Currently there is only one user inside U-boot (btrfs), and since it
only utilize BLAKE2B, all other favors are all removed.

Signed-off-by: Qu Wenruo <wqu@suse.com>
[trini: Rename ROUND to R to avoid clash with <linux/bitops.h>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 97f2a749 04-Jan-2022 Eugen Hristev <eugen.hristev@collabora.com>

lib: Kconfig: fix PHANDLE_CHECK_SEQ position outside of menu

CONFIG_PHANDLE_CHECK_SEQ is outside of the menu 'Library routines'
thus it's invisible in menuconfig and cannot be selected.
Fix this by moving the 'endmenu' after the PHANDLE_CHECK_SEQ definition

Fixes: c589132a1d ("fdt: Use phandle to distinguish DT nodes with same name")
Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
Reviewed-by: Aswath Govindraju <a-govindraju@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 726cd983 29-Dec-2021 Simon Glass <sjg@chromium.org>

efi: Make unicode printf available to the app

This is needed to show unicode strings. Enable this code in the app.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>

# 6405ab7a 24-Nov-2021 Simon Glass <sjg@chromium.org>

Convert CONFIG_PHYSMEM to Kconfig

This converts the following to Kconfig:
CONFIG_PHYSMEM

Signed-off-by: Simon Glass <sjg@chromium.org>
Suggested-by: Sean Anderson <seanga2@gmail.com>

# ac7606af 14-Nov-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

lmb: fix typo 'commun'

%s/commun/common/

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

# e7d285b2 25-Sep-2021 Simon Glass <sjg@chromium.org>

image: Use the correct checks for CRC32

Add a host Kconfig for CRC32. With this we can use CONFIG_IS_ENABLED(CRC32)
directly in the host build, so drop the unnecessary indirection.

Add a few more conditions to SPL_CRC32 to avoid build failures as well as
TPL_CRC32. Also update hash.c to make crc32 optional and to actually take
notice of SPL_CRC32.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# 2c21256b 25-Sep-2021 Simon Glass <sjg@chromium.org>

hash: Use Kconfig to enable hashing in host tools and SPL

At present when building host tools, we force CONFIG_SHAxxx to be enabled
regardless of the board Kconfig setting. This is done in the image.h
header file.

For SPL we currently just assume the algorithm is desired if U-Boot proper
enables it.

Clean this up by adding new Kconfig options to enable hashing on the host,
relying on CONFIG_IS_ENABLED() to deal with the different builds.

Add new SPL Kconfigs for hardware-accelerated hashing, to maintain the
current settings.

This allows us to drop the image.h code and the I_WANT_MD5 hack.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# 603d15a5 25-Sep-2021 Simon Glass <sjg@chromium.org>

spl: cypto: Bring back SPL_ versions of SHA

Unfortunately these were removed by mistake. This means that adding hash
support to SPL brings in all software algorithms, with a substantial
increase in code size.

The origin of the problem was renaming them to SPL_FIT_xxx and then these
were removed altogether in a later commit.

Add them back. This aligns with CONFIG_MD5, for example, which has an SPL
variant.

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: f5bc9c25f31 ("image: Rename SPL_SHAxxx_SUPPORT to SPL_FIT_SHAxxx")
Fixes: eb5171ddec9 ("common: Remove unused CONFIG_FIT_SHAxxx selectors")
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# 6674edaa 16-Sep-2021 Tom Rini <trini@konsulko.com>

Merge tag 'v2021.10-rc4' into next

Prepare v2021.10-rc4

Signed-off-by: Tom Rini <trini@konsulko.com>

# gpg: Signature made Tue 14 Sep 2021 06:58:32 PM EDT
# gpg: using RSA key 1A3C7F70E08FAB1707809BBF147C39FF9634B72C
# gpg: Good signature from "Thomas Rini <trini@konsulko.com>" [ultimate]

# Conflicts:
# board/Arcturus/ucp1020/spl.c
# cmd/mvebu/Kconfig
# common/Kconfig.boot
# common/image-fit.c
# configs/UCP1020_defconfig
# configs/sifive_unmatched_defconfig
# drivers/pci/Kconfig
# include/configs/UCP1020.h
# include/configs/sifive-unmatched.h
# lib/Makefile
# scripts/config_whitelist.txt


# 5145bc73 01-Sep-2021 Oleksandr Suvorov <oleksandr.suvorov@foundries.io>

lib: fix typos in Kconfig

There are trivial typos in the Kconfig file. Fixed them.
Also, fixed grammar in the descriptions with typos.

Fixes: d56b4b1974 ("configs: Migrate RBTREE, LZO, CMD_MTDPARTS, CMD_UBI and CMD_UBIFS")
Fixes: 7264f2928b ("spl: fit: Eanble GZIP support for image decompression")
Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# e60e4499 02-Sep-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

lib: Drop SHA512_ALGO in lieu of SHA512

SHA512_ALGO was used as a "either SHA512 or SHA384", although the
implementations of these two algorithms share a majority of code.

From a Kconfig interface perspective, it makes sense to present two
distinct options. This requires #ifdefing out the SHA512
implementation from sha512.c. The latter doesn't make any sense.

It's reasonable to say in Kconfig that SHA384 depends on SHA512, and
seems to be the more polite way to handle the selection.

Thus, automatically select SHA512 when SHA384 is enabled.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# b4c2c151 27-Aug-2021 Michal Simek <michal.simek@amd.com>

Kconfig: Remove all default n/no options

default n/no doesn't need to be specified. It is default option anyway.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
[trini: Rework FSP_USE_UPD portion]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 928a8be7 29-Jul-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

lib: ecdsa: Implement UCLASS_ECDSA verification on target

Implement the crypto_algo .verify() function for ecdsa256. Because
it backends on UCLASS_ECDSA, this change is focused on parsing the
keys from devicetree and passing this information to the specific
UCLASS driver.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# fa3f1f1d 24-Jul-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: disable CONFIG_SPL_HEXDUMP by default

CONFIG_HEXDUMP is needed to display UEFI variables using 'printenv -e'.

Enabling CONFIG_SPL_HEXDUMP only makes sense for debugging purposes.
Hence CONFIG_SPL_HEXDUMP should not be enabled by default.

The following boards currently have CONFIG_SPL_HEXDUMP=y. This includes
boards that don't use SPL at all.

axm_defconfig
imx8mm-cl-iot-gate_defconfig
imx8mm_venice_defconfig
imxrt1020-evk_defconfig
imxrt1050-evk_defconfig
kontron_sl28_defconfig
kp_imx53_defconfig
lx2160ardb_tfa_stmm_defconfig
mt7622_rfb_defconfig
octeon_ebb7304_defconfig
octeon_nic23_defconfig
qemu_arm64_defconfig
qemu_arm_defconfig
qemu-riscv32_defconfig
qemu-riscv32_smode_defconfig
qemu-riscv64_defconfig
qemu-riscv64_smode_defconfig
qemu-x86_64_defconfig
qemu-x86_defconfig
sandbox64_defconfig
sandbox_defconfig
stm32mp15_basic_defconfig
stm32mp15_trusted_defconfig
synquacer_developerbox_defconfig
taurus_defconfig
xilinx_versal_virt_defconfig

The patch only keeps it enabled on

sandbox_spl_defconfig

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 1a46cb6c 02-Jul-2021 Simon Glass <sjg@chromium.org>

lib: Create a new Kconfig option for charset conversion

Rather than looking at two KConfig options in the Makefile, create a new
Kconfig option for compiling lib/charset.c

Enable it for UFS also, which needs this support.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 26dd9936 08-Jul-2021 Steffen Jaeckel <jaeckel-floss@eyet-services.de>

lib: add crypt subsystem

Add the basic functionality required to support the standard crypt
format.
The files crypt-sha256.c and crypt-sha512.c originate from libxcrypt and
their formatting is therefor retained.
The integration is done via a crypt_compare() function in crypt.c.

```
libxcrypt $ git describe --long --always --all
tags/v4.4.17-0-g6b110bc
```

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 7d0f3fbb 11-Jun-2021 Tero Kristo <t-kristo@ti.com>

lib: rational: copy the rational fraction lib routines from Linux

Copy the best rational approximation calculation routines from Linux.
Typical usecase for these routines is to calculate the M/N divider
values for PLLs to reach a specific clock rate.

This is based on linux kernel commit:
"lib/math/rational.c: fix possible incorrect result from rational
fractions helper"
(sha1: 323dd2c3ed0641f49e89b4e420f9eef5d3d5a881)

Signed-off-by: Tero Kristo <t-kristo@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Tero Kristo <kristo@kernel.org>

# ec0512b1 24-May-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

Revert "lib: introduce HASH_CALCULATE option"

When we think of Kconfig, we usually think of features that we like
to enable or not. Ideally, we wouldn't use Kconfig to fix a build
issue, although sometimes it might make sense. With Kconfig it's hard
to guarantee that the fix is universal. We can only say that it works
for the set of tested configurations. In the majority of cases, it's
preferable to let the linker figure things out for us.

The reverted commit attempted to fix a build issue by adding an
invisible Kconfig option. This is wrong in several ways:

It invents a new Kconfig variable when CONFIG_HASH already
exists for the same purpose.
Second, hash-checksum.c makes use of the hash_progressive_lookup_algo()
symbol, which is only provided with CONFIG_HASH, but this dependency
was not expressed in the reverted patch.

It feels like Kconfig is turning into a listing of all available
source files, and a buffet to 'select' which ones to compile. The
purpose of this revert is to enable the next change to make use of
CONFIG_HASH instead of adding to Kconfig.

This reverts commit 87316da05f2fd49d3709275e64ef0c5980366ade.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Acked-by: Masahisa Kojima <masahisa.kojima@linaro.org>

# 1621d3c4 10-May-2021 Bin Meng <bmeng.cn@gmail.com>

lib: kconfig: Limit BINMAN_FDT for OF_SEPARATE or OF_EMBED

Generally speaking BINMAN_FDT makes sense for OF_SEPARATE or OF_EMBED.
For the other OF_CONTROL methods, it's quite possible binman node is
not available as binman is invoked during the build phase instead of
runtime. Let's only turn it on for OF_SEPARATE or OF_EMBED by default.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 87316da0 13-May-2021 Masahisa Kojima <kojima.masahisa@socionext.com>

lib: introduce HASH_CALCULATE option

Build error occurs when CONFIG_EFI_SECURE_BOOT or
CONFIG_EFI_CAPSULE_AUTHENTICATE is enabled,
because hash-checksum.c is not compiled.

Since hash_calculate() implemented in hash-checksum.c can be
commonly used aside from FIT image signature verification,
this commit itroduces HASH_CALCULATE option to decide
if hash-checksum.c shall be compiled.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# e2ae483c 13-May-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

hash: Kconfig option for SHA512 hardware acceleration

Commit a479f103dc1c ("hash: Allow for SHA512 hardware implementations")
defined function definitions for hardware accelerated SHA384 and SHA512.
If CONFIG_SHA_HW_ACCEL=y, these functions are used.

We already have boards using CONFIG_SHA_HW_ACCEL=y but none implements the
new functions hw_sha384() and hw_sha512().

For implementing the EFI TCG2 protocol we need SHA384 and SHA512. The
missing hardware acceleration functions lead to build errors on boards like
peach-pi_defconfig.

Introduce a new Kconfig symbol CONFIG_SHA512_HW_ACCEL to control if the
functions hw_sha384() and hw_sha512() shall be used to implement the SHA384
and SHA512 algorithms.

Fixes: a479f103dc1c ("hash: Allow for SHA512 hardware implementations")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

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

# 6d66502b 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: Add 2 config to define the max number of regions

Add 2 configs CONFIG_LMB_MEMORY_REGIONS and CONFIG_LMB_RESERVED_REGIONS
to change independently the max number of the regions in lmb
library.

When CONFIG_LMB_USE_MAX_REGIONS=y, move the lmb property arrays to
struct lmb and manage the array size with the element 'max' of struct
lmb_region; their are still allocated in stack.

When CONFIG_LMB_USE_MAX_REGIONS=n, keep the current location in
struct lmb_region to allow compiler optimization.

Increase CONFIG_LMB_RESERVED_REGIONS is useful to avoid lmb errors in
bootm when the number of reserved regions (not adjacent) is reached:
+ 1 region for relocated U-Boot
+ 1 region for initrd
+ 1 region for relocated linux device tree
+ reserved memory regions present in Linux device tree.

The current limit of 8 regions is reached with only 5 reserved regions
in DT.

see Linux kernel commit bf23c51f1f49 ("memblock: Move memblock arrays
to static storage in memblock.c and make their size a variable")

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# 4fa0150d 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: move MAX_LMB_REGIONS value in Kconfig

Move MAX_LMB_REGIONS value in Kconfig, the max number of the regions
in lmb library.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# 77b8cfef 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: move CONFIG_LMB in Kconfig

Migrate CONFIG_LMB in Kconfig.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# a479f103 16-Feb-2021 Joel Stanley <joel@jms.id.au>

hash: Allow for SHA512 hardware implementations

Similar to support for SHA1 and SHA256, allow the use of hardware hashing
engine by enabling the algorithm and setting CONFIG_SHA_HW_ACCEL /
CONFIG_SHA_PROG_HW_ACCEL.

Signed-off-by: Joel Stanley <joel@jms.id.au>

# f2c1442e 14-Mar-2021 Simon Glass <sjg@chromium.org>

bloblist: Make BLOBLIST_TABLES depend on BLOBLIST

Add an extra condition here since we cannot put x86 tables in a bloblist
when bloblists are not supported.

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

# e0103158 25-Feb-2021 Bin Meng <bmeng.cn@gmail.com>

lib: kconfig: Mention CONFIG_ADDR_MAP limitation in the help

Mention that CONFIG_ADDR_MAP only works in the post-relocation phase.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>

# 56e7257c 03-Feb-2021 Bin Meng <bmeng.cn@gmail.com>

lib: Fix BINMAN_FDT dependency

lib/binman.c references the following 3 ofnode APIs:
ofnode_first_subnode(), ofnode_path() and ofnode_read_bool().

These APIs get built only when DM is on. Fix the dependency then.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 59e4e391 18-Jan-2021 Tom Rini <trini@konsulko.com>

Merge https://gitlab.denx.de/u-boot/custodians/u-boot-riscv

- Update qemu-riscv.rst build instructions.
- Add support for SPI on Kendryte K210.
- Add Microchip PolarFire SoC Icicle Kit support.
- Add support for an early timer.
- Select TIMER_EARLY to avoid infinite recursion for Trace.


# a80f8513 17-Jan-2021 Pragnesh Patel <pragnesh.patel@sifive.com>

trace: select TIMER_EARLY to avoid infinite recursion

When tracing functions is enabled this adds calls to
__cyg_profile_func_enter() and __cyg_profile_func_exit() to the traced
functions.

__cyg_profile_func_enter() and __cyg_profile_func_exit() invoke
timer_get_us() to record the entry and exit time.

initr_dm() will make gd->dm_root = NULL and gd->timer = NULL, so
timer_get_us() -> get_ticks() -> dm_timer_init() will lead to an
indefinite recursion.

So select TIMER_EARLY when tracing got enabled.

Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Rick Chen <rick@andestech.com>

# 6205bbb1 04-Jan-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lib: cosmetic update of CONFIG_LIB_ELF description

Change 2 typo error in CONFIG_LIB_ELF description:
- Supoort => Support
- fir => for

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c589132a 02-Dec-2020 Aswath Govindraju <a-govindraju@ti.com>

fdt: Use phandle to distinguish DT nodes with same name

While assigning the sequence number to subsystem instances by reading the
aliases property, only DT nodes names are compared and not the complete
path. This causes a problem when there are two DT nodes with same name but
have different paths.

In arch/arm/dts/k3-am65-main.dtsi there are two USB controllers with the
same device tree node name but different path. When aliases are defined for
these USB controllers then fdtdec_get_alias_seq() fails to pick the correct
instance for a given index.

fdt_path_offset() function is slow and this would effect the U-Boot
startup. To avert the time penalty on all boards, apply this extra check
only when required by using a config option.

Fix it by comparing the phandles of DT nodes after the node names match,
under a config option.

Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Fix whitespace error in Kconfig:
Signed-off-by: Simon Glass <sjg@chromium.org>

# 28cef9ca 19-Nov-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

fs: fat: create correct short names

The current function set_name() used to create short names has the
following deficiencies resolved by this patch:

* Long names (e.g. FOO.TXT) are stored even if a short name is enough.
* Short names with spaces are created, e.g. "A ~1.TXT".
* Short names with illegal characters are created, e.g. "FOO++BAR".
* Debug output does not not consider that the short file name has no
concluding '\0'.

The solution for the following bug is split of into a separate patch:

* Short file names must be unique.

This patch only provides the loop over possible short file names.

Fixes: c30a15e590c ("FAT: Add FAT write feature")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# e4f8e543 05-Nov-2020 Simon Glass <sjg@chromium.org>

smbios: Drop the unused Kconfig options

Now that we can use devicetree to specify this information, drop the old
CONFIG options.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 44c74bdd 05-Nov-2020 Simon Glass <sjg@chromium.org>

sysinfo: Provide a default driver to set SMBIOS values

Some boards want to specify the manufacturer or product name but do not
need to have their own sysinfo driver.

Add a default driver which provides a way to specify this SMBIOS
information in the devicetree, without needing any board-specific
functionality.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d2cb7a22 04-Nov-2020 Simon Glass <sjg@chromium.org>

x86: Allow putting some tables in the bloblist

At present all tables are placed starting at address f0000 in memory, and
can be up to 64KB in size. If the tables are very large, this may not
provide enough space.

Also if the tables point to other tables (such as console log or a ramoops
area) then we must allocate other memory anyway.

The bloblist is a nice place to put these tables since it is contiguous,
which makes it easy to reserve this memory for linux using the 820 tables.

Add an option to put some of the tables in the bloblist. For SMBIOS and
ACPI, create suitable pointers from the f0000 region to the new location
of the tables.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
[bmeng: squashed in http://patchwork.ozlabs.org/project/uboot/patch/
20201105062407.1.I8091ad931cbbb5e3b6f6ababdf3f8d5db0d17bb9@changeid/]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# 415eab06 03-Nov-2020 Christian Gmeiner <christian.gmeiner@gmail.com>

smbios: add parsing API

Add a very simple API to be able to access SMBIOS strings
like vendor, model and bios version.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 72eda507 27-Oct-2020 Sean Anderson <seanga2@gmail.com>

lib: Add getopt

Some commands can get very unweildy if they have too many positional
arguments. Adding options makes them easier to read, remember, and
understand.

This implementation of getopt has been taken from barebox, which has had
option support for quite a while. I have made a few modifications to their
version, such as the removal of opterr in favor of a separate getopt_silent
function. In addition, I have moved all global variables into struct
getopt_context.

The getopt from barebox also re-orders the arguments passed to it so that
non-options are placed last. This allows users to specify options anywhere.
For example, `ls -l foo/ -R` would be re-ordered to `ls -l -R foo/` as
getopt parsed the options. However, this feature conflicts with the const
argv in cmd_tbl->cmd. This was originally added in 54841ab50c ("Make sure
that argv[] argument pointers are not modified."). The reason stated in
that commit is that hush requires argv to stay unmodified. Has this
situation changed? Barebox also uses hush, and does not have this problem.
Perhaps we could use their fix?

I have assigned maintenance of getopt to Simon Glass, as it is currently
only used by the log command. I would also be fine maintaining it.

Signed-off-by: Sean Anderson <seanga2@gmail.com>

# 26637e2e 12-Sep-2020 Simon Glass <sjg@chromium.org>

lib: Allow hexdump to be used in SPL

It is sometimes useful to output hex dumps in SPL. Add a config option to
allow this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# e87dfb05 05-Aug-2020 Andrii Anisov <andrii_anisov@epam.com>

lib: sscanf: add sscanf implementation

Port sscanf implementation from mini-os and introduce new
Kconfig option to enable it: CONFIG_SSCANF. Disable by default.

Signed-off-by: Andrii Anisov <andrii_anisov@epam.com>
Signed-off-by: Anastasiia Lukianenko <anastasiia_lukianenko@epam.com>
Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>

# 81014f73 30-Jul-2020 Joao Marcos Costa <joaomarcos.costa@bootlin.com>

include/u-boot, lib/zlib: add sources for zlib decompression

Add zlib (v1.2.11) uncompr() function to U-Boot. SquashFS depends on
this function to decompress data from a raw disk image. The actual
support for zlib into SquashFS sources will be added in a follow-up
commit.

Signed-off-by: Joao Marcos Costa <joaomarcos.costa@bootlin.com>

# 69be8fd1 03-Jun-2020 Marek Szyprowski <m.szyprowski@samsung.com>

powerpc: move ADDR_MAP to Kconfig

Move ADDR_MAP related config options from include/configs/*.h to the
proper place in lib/Kconfig. This has been done using
./tools/moveconfig.py and manual inspection of the generated changes.
This is a preparation to use ADDR_MAP helper on ARM 32bit Raspberry Pi4
board for mapping the PCIe XHCI MMIO, which is above the 4GiB identity
mapping limit.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# d16b38f4 15-Apr-2020 Reuben Dowle <reubendowle0@gmail.com>

Add support for SHA384 and SHA512

The current recommendation for best security practice from the US government
is to use SHA384 for TOP SECRET [1].

This patch adds support for SHA384 and SHA512 in the hash command, and also
allows FIT images to be hashed with these algorithms, and signed with
sha384,rsaXXXX and sha512,rsaXXXX

The SHA implementation is adapted from the linux kernel implementation.

[1] Commercial National Security Algorithm Suite
http://www.iad.gov/iad/programs/iad-initiatives/cnsa-suite.cfm

Signed-off-by: Reuben Dowle <reuben.dowle@4rf.com>

# 43e442a5 26-May-2020 Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

kconfig: fix some typos

Signed-off-by: Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

# eff5a547 22-May-2020 Michael Walle <michael@walle.cc>

cmd: zip: automatically pull in gzip()

Move the CONFIG_GZIP_COMPRESSED from a config.h macro to a Kconfig menu
item. It is not selectable by a user because there is no reason to do
so. Instead it will be automatically selected by the stuff which uses
gzip(), like the zip command.

Remove it from the config_whitelist.txt. Also remove
CONFIG_GZIP_COMPRESS_DEF_SZ as this was never used on any board. The
default seems to be sane, otherwise it should be added as a Kconfig
option.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8239be61 06-May-2020 Simon Glass <sjg@chromium.org>

lib: Allow MD5 to be enabled in SPL

At present the MD5 option cannot be enabled by board configs since it has
no Kconfig name. It is generally enabled, so long as FIT support is
present. But not all boards use FIT, particularly in SPL

Fix this and add an option for SPL as well. This allows board code to call
md5() even if FIT support is not enabled.

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

# 04cb3994 21-Apr-2020 Weijie Gao <weijie.gao@mediatek.com>

lib: enable lzma decompression support for SPL build

This patch enables LZMA decompression support for SPL build

Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>

# 2a2119e1 05-Mar-2020 Atish Patra <atishp@atishpatra.org>

lib: kconfig: Add option to set BZIP2 compression method

There is no way to select BZIP2 compression method.
Add it under library/compression config where all other
compression related configs are present.

Signed-off-by: Atish Patra <atish.patra@wdc.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 805b3cac 12-Feb-2020 Keerthy <j-keerthy@ti.com>

lib: elf: Move the generic elf loading/validating functions to lib

Move the generic elf loading/validating functions to lib/
so that they can be re-used and accessed by code existing
outside cmd.

While at it remove the duplicate static version of load_elf_image_phdr
under arch/arm/mach-imx/imx_bootaux.c.

Signed-off-by: Keerthy <j-keerthy@ti.com>
Suggested-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>

# 1611235b 19-Jan-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: Kconfig dependencies for pseudo-random library

drivers/rng/sandbox_rng.c requires rand() to be defined but configuration
option CONFIG_CONFIG_LIB_RAND selected in drivers/rng/Kconfig does not
exist.

test/lib/test_aes.c requires rand() to be defined.

Fix the selection criteria for choice "Pseudo-random library support type".

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 3c10dc95 06-Dec-2019 Simon Glass <sjg@chromium.org>

binman: Add a library to access binman entries

SPL and TPL can access information about binman entries using link-time
symbols but this is not available in U-Boot proper. Of course it could be
made available, but the intention is to just read the device tree.

Add support for this, so that U-Boot can locate entries.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# b4adf627 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: crypto: add x509 parser

Imported from linux kernel v5.3:
x509.asn1 without changes
x509_akid.asn1 without changes
x509_parser.h without changes
x509_cert_parser.c with changes marked as __UBOOT__
x509_public_key.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# a9b45e6e 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add oid registry utility

Imported from linux kernel v5.3:
build_OID_registry without changes
oid_registry.h without changes
oid_registry.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# ab8a0e06 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add asn1 decoder

Imported from linux kernel v5.3:
lib/asn1_decoder.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 2b12196d 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

cmd: add asn1_compiler

Imported from linux kernel v5.3:
asn1.h without changes
asn1_ber_bytecode.h without changes
asn1_decoder.h without changes
asn1_compiler.c without changes

This host command will be used to create a ASN1 parser, for example,
for pkcs7 messages or x509 certificates. More specifically, it will
generate *byte code* which will be interpreted by asn1 decoder library.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 05429b6c 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

rtc: move date.c from drivers/rtc/ to lib/

In the next commit, rtc_mktime(), for compatibility with linux, will be
implemented using rtc_mktime(), which is no longer drivers/rtc specific.
So move this file under lib/.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 37ef1774 10-Nov-2019 Thomas Hebb <tommyhebb@gmail.com>

Kconfig: disambiguate config names for tiny printf

27084c03d36a ("spl: Allow tiny printf() to be controlled in SPL and
TPL") split this option in two for TPL and SPL, but didn't change the
Kconfig names, making them hard to set quickly.

Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>

# 0d76afc0 27-Oct-2019 Simon Glass <sjg@chromium.org>

fdt: Add Kconfig options to control code size

For better or worse libfdt recent grew a lot of code that checks the
validity of the device tree in great detail. When using unsigned or
unverified data this makes things safer, but it does add to code size.

Add some controls to select the trade-off between safety and code size.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 27084c03 25-Sep-2019 Simon Glass <sjg@chromium.org>

spl: Allow tiny printf() to be controlled in SPL and TPL

At present there is only one control for this and it is used for both SPL
and TPL. But SPL might have a lot more space than TPL so the extra cost of
a full printf() might be acceptable.

Split the option into two, providing separate SPL and TPL controls. The
TPL setting defaults to the same as SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2a51e16b 07-Jun-2019 Tom Rini <trini@konsulko.com>

configs: Make USE_TINY_PRINTF depend on SPL||TPL and be default

The USE_TINY_PRINTF symbol only changes things within SPL and TPL
builds, so make it depend on that support. Next, make it default as
within these cases we should rarely have need of more advanced print
formats outside of the debug context.

To do this, in a few cases we need to correct our Kconfig dependencies
as we had cases of non-SPL targets select'ing this symbol. Finally, in
the case of a few boards we really do need the full printf
functionality.

Signed-off-by: Tom Rini <trini@konsulko.com>

# da0fb5fd 02-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: make call depth limit customizable

Up to now we had hard coded values for the call depth up to which trace
records are created: 200 for early tracing, 15 thereafter. UEFI
applications reach a call depth of 80 or above.

Provide customizing settings for the call trace depth limit and the early
call trace depth limit. Use the old values as defaults.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8509f22a 29-Apr-2019 Marek Behún <kabel@kernel.org>

lib: add Zstandard decompression support

Add the zstd library from Linux kernel (only decompression support).
There are minimal changes to build with U-Boot, otherwise the files are
identical to Linux commit dc35da16 from March 2018, the files had not
been touched since in kernel. Also SPDX lincese tags were added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 83a486b6 29-Apr-2019 Marek Behún <kabel@kernel.org>

lib: Add xxhash support

This adds the xxhash support from Linux. Files are almost identical to
those added to Linux in commit 5d240522 ("lib: Add xxhash module") (they
haven't been touched since in Linux). The only difference is to add some
includes to be compatible with U-Boot. Also SPDX lincese tags were
added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 5132361a 29-Apr-2019 Heiko Schocher <hs@denx.de>

lib: Kconfig: fix help text for GZIP

commit 95f4bbd581cf ("lib: fdt: Allow LZO and GZIP DT compression in U-Boot")

introduced Kconfig option for gzip in U-Boot, but help text
says gzip for SPL, which is wrong. Fix this.

Signed-off-by: Heiko Schocher <hs@denx.de>
Acked-by: Marek Vasut <marex@denx.de>

# 1c6eb075 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE_BUFFER_SIZE et al to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE_BUFFER_SIZE
CONFIG_TRACE_EARLY_SIZE
CONFIG_TRACE_EARLY
CONFIG_TRACE_EARLY_ADDR

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

# a24a78d7 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE

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

# 54969b40 21-Mar-2019 Thierry Reding <treding@nvidia.com>

fdtdec: Add Kconfig symbol for tests

Runtime tests are provided as a test_fdtdec command implementation. Add
a Kconfig symbol that allows this command to be built so that the tests
can be used.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 95f4bbd5 08-Mar-2019 Marek Vasut <marex@denx.de>

lib: fdt: Allow LZO and GZIP DT compression in U-Boot

Add required Kconfig symbols, Makefile bits and macro fixes in a
few places to support LZO and DT compression in U-Boot. This can
save a lot of space with multi-DTB fitImages.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>

# 6e705114 13-Jan-2019 Chris Packham <judge.packham@gmail.com>

lib: Kconfig: spelling fixes

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 048c6e89 06-Nov-2018 Simon Glass <sjg@chromium.org>

spl: lz4: Allow use of lz4 compression in SPL

In some cases U-Boot is compressed and it is useful to be able to
decompress it in SPL. Add a Kconfig and Makefile change to allow this.
Note that this does not actually implement decompression.

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

# 2895c4b7 15-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

kconfig: Introduce HAVE_ARCH_IOMAP

Introduce a new Kconfig option for architecture codes to control
whether it provides io{read,write}{8,16,32} I/O accessor functions.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5592a633 01-Oct-2018 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt in TPL

In some cases (e.g. sandbox with verified boot) it is useful to support
libfdt in TPL. Update the Kconfig to handle this.

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

# 6307896c 01-Oct-2018 Simon Glass <sjg@chromium.org>

tpm: Add support for SPL and TPL

At present the tpm can only be used in U-Boot proper. Updated it to work
in SPL and TPL also.

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

# ab948cd2 19-Jul-2018 Masahiro Yamada <masahiroy@kernel.org>

fdt_support: make FDT_FIXUP_PARTITIONS depend on CMD_MTDPARTS

fdt_fixup_mtdparts() calls mtdparts_init() and device_find(),
which are defined in cmd/mtdparts.c

The combination of FDT_FIXUP_PARTITIONS=y and CMD_MTDPARTS=n
emits the following link error:

common/fdt_support.c:903: undefined reference to `mtdparts_init'
common/fdt_support.c:914: undefined reference to `device_find'

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 3330584d 03-Jun-2018 Igor Opaniuk <igor.opaniuk@gmail.com>

avb2.0: integrate avb 2.0 into the build system

Integrate libavb into the build system. Introduce CONFIG_LIBAVB
build option.

Signed-off-by: Igor Opaniuk <igor.opaniuk@linaro.org>

# f8c987f8 05-Jun-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

lib: Add hexdump

Often during debugging session it's very interesting to see
what data we were dealing with. For example what we write or read
to/from memory or peripherals.

This change introduces functions that allow to dump binary
data with one simple function invocation like:
------------------->8----------------
print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, buf, len);
------------------->8----------------

which gives us the following:
------------------->8----------------
00000000: f2 b7 c9 88 62 61 75 64 72 61 74 65 3d 31 31 35 ....baudrate=115
00000010: 32 30 30 00 62 6f 6f 74 61 72 67 73 3d 63 6f 6e 200.bootargs=con
00000020: 73 6f 6c 65 3d 74 74 79 53 33 2c 31 31 35 32 30 sole=ttyS3,11520
00000030: 30 6e 38 00 62 6f 6f 74 64 65 6c 61 79 3d 33 00 0n8.bootdelay=3.
00000040: 62 6f 6f 74 66 69 6c 65 3d 75 49 6d 61 67 65 00 bootfile=uImage.
00000050: 66 64 74 63 6f 6e 74 72 6f 6c 61 64 64 72 3d 39 fdtcontroladdr=9
00000060: 66 66 62 31 62 61 30 00 6c 6f 61 64 61 64 64 72 ffb1ba0.loadaddr
00000070: 3d 30 78 38 32 30 30 30 30 30 30 00 73 74 64 65 =0x82000000.stde
00000080: 72 72 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 rr=serial0@e0022
00000090: 30 30 30 00 73 74 64 69 6e 3d 73 65 72 69 61 6c 000.stdin=serial
000000a0: 30 40 65 30 30 32 32 30 30 30 00 73 74 64 6f 75 0@e0022000.stdou
000000b0: 74 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 30 t=serial0@e00220
000000c0: 30 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00..............
...
------------------->8----------------

Source of hexdump.c was copied from Linux kernel v4.7-rc2.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Mario Six <mario.six@gdsys.cc>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Stefan Roese <sr@denx.de>

# c232d14d 29-May-2018 Alex Kiernan <alex.kiernan@gmail.com>

mmc: Separate "mmc swrite" from fastboot

Introduce CONFIG_IMAGE_SPARSE and CONFIG_CMD_MMC_SWRITE so the "mmc
swrite" command is separated from the fastboot code.

Move image-sparse from common to lib so it's clear it's library code.

Rename CONFIG_FASTBOOT_FLASH_FILLBUF_SIZE to CONFIG_IMAGE_SPARSE_FILLBUF_SIZE
and migrate it to Kconfig.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Acked-by: Jassi Brar <jaswinder.singh@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6417572e 08-May-2018 Tom Rini <trini@konsulko.com>

lib/Kconfig: Mark OF_LIBFDT_OVERLAY as depending on OF_LIBFDT

The overlay code is only useful when OF_LIBFDT is set, so mark it as
depending on that first.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 58a46f88 25-Apr-2018 Praneeth Bajjuri <praneeth@ti.com>

configs: TI: Enable FIT Library overlay support

Enable the FDT library overlay support for all TI SOC family.

Without this option, when Loading fdt from FIT image, the
following warning is seen.

"config with overlays but CONFIG_OF_LIBFDT_OVERLAY not set".

Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
Suggested-by: Andrew F.Davis <afd@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>

# 14ad44ab 18-Apr-2018 Alex Kiernan <alex.kiernan@gmail.com>

spl: Split sprintf, strto* from SPL serial in Kconfig

When SPL serial is disabled, callers who need sprintf or strtoul fail
because their inclusion is guarded by CONFIG_SPL_SERIAL_SUPPORT/
CONFIG_TPL_SERIAL_SUPPORT.

Split printf, sprintf and strto into their own entries and then select
all of them if SERIAL_SUPPORT is enabled to match the current behaviour.

Include panic.o unconditionally as it can be called from anywhere which
uses BUG_ON().

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>

# e294ba06 04-Apr-2018 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-sunxi

Signed-off-by: Tom Rini <trini@konsulko.com>


# d14db11d 03-Apr-2018 Andre Przywara <andre.przywara@arm.com>

sunxi: revert disabling of features

In January some commits were introduced to mitigate the U-Boot image
size issues we encountered on sunxi builds.
Now with the MMC environment removed we can bring them back, as we
practically don't have a size limit anymore.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 32ce6179 13-Mar-2018 Bryan O'Donoghue <bryan.odonoghue@linaro.org>

optee: Add lib entries for sharing OPTEE code across ports

This patch adds code to lib to enable sharing of useful OPTEE code between
board-ports and architectures. The code on lib/optee/optee.c comes from the
TI omap2 port. Eventually the OMAP2 code will be patched to include the
shared code. The intention here is to add more useful OPTEE specific code
as more functionality gets added.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Cc: Harinarayan Bhatta <harinarayan@ti.com>
Cc: Andrew F. Davis <afd@ti.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Kever Yang <kever.yang@rock-chips.com>
Cc: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Cc: Peng Fan <peng.fan@nxp.com>
Tested-by: Peng Fan <peng.fan@nxp.com>

# 36c1877c 06-Feb-2018 Faiz Abbas <faiz_abbas@ti.com>

lib: Kconfig: Move DYNAMIC_CRC_TABLE to Kconfig

Add CONFIG prefix to DYNAMIC_CRC_TABLE and implement it in
Kconfig.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>

# a451bc27 05-Feb-2018 Adam Ford <aford173@gmail.com>

Convert LIB_UUID to Kconfig

config_fallback.h has some logic that checks a variety of options
and selects LIB_UUID if it hasn't already been selected. This
will all LIB_UUID in Kconfig and select this option for the list
of options to allow us to remove the logic from fallbacks

Signed-off-by: Adam Ford <aford173@gmail.com>

# a5a37567 06-Feb-2018 Adam Ford <aford173@gmail.com>

Convert CONFIG LIB_HW_RAND to Kconfig

config_fallbacks.h had some logic to automatically select
LIB_RAND if RANDOM_UUID or CMD_UUID were set if LIB_HW_RAND wasn't
already selected. By migrating LIB_HW_RAND to Kconfig, we can
remove this check from config_fallbacks.h and put it into Kconfig

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
[trini: Turn into a choice, add NET_RANDOM_ETHADDR]
Signed-off-by: Tom Rini <trini@konsulko.com>

# acd4d334 16-Jan-2018 Maxime Ripard <maxime.ripard@free-electrons.com>

net: regex: Disable by default on sunXi

The sunXi arm64 build has overflown, leading to the main U-boot binary
overwriting the environment when flashing the new image, or even worse,
overwriting itself when we're calling saveenv.

Disable this option that is not critical until we can adress the issue
properly.

Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 7e3caa81 03-Dec-2017 Masahiro Yamada <masahiroy@kernel.org>

Move CONFIG_PANIC_HANG to Kconfig

Freescale (NXP) boards have lots of defconfig files per board.
I used "imply PANIC_HANG" for them.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# da5337a6 08-Nov-2017 Nandor Han <nandor.han@ge.com>

rtc: add support for s35392a

Add support for S35392A RTC. The driver supports both U-Boot driver
models.

Signed-off-by: Nandor Han <nandor.han@ge.com>
Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
Cc: Heiko Schocher <hs@denx.de>

# f52bdf4b 14-Sep-2017 Jean-Jacques Hiblot <jjhiblot@ti.com>

lib: allow building lzo for the SPL

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 85d8bf57 03-Sep-2017 Marek Behún <kabel@kernel.org>

lib: Add CRC32-C

This is needed for BTRFS.

Signed-off-by: Marek Behun <marek.behun@nic.cz>

create mode 100644 lib/crc32c.c

# 7264f292 15-Aug-2017 York Sun <york.sun@nxp.com>

spl: fit: Eanble GZIP support for image decompression

Add Kconfig option SPL_GZIP and SPL_ZLIB to enable gunzip support for
SPL boot, eg. falcon boot compressed kernel image.

Signed-off-by: York Sun <york.sun@nxp.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6ef2f901 11-Aug-2017 Adam Ford <aford173@gmail.com>

Convert CONFIG_BCH to Kconfig

This converts the following to Kconfig:
CONFIG_BCH

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1a7ba1d 18-Aug-2017 Anatolij Gustschin <agust@denx.de>

Fix 'notes' typos

s/notes/nodes

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 96b9082c 03-Aug-2017 Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

rockchip: rk3188: rock: adjust for SPL/TPL split

With the changes to split SPL/TPL for the RK3368, I apparently missed
some needed adjustments to the RK3188 Kconfig and rock_defconfig.

This fixes build-issues for the rock board after applying the RK3368
enablement (and SPL/TPL) set that resulted from TPL_SERIAL_SUPPORT,
TPL_ROCKCHIP_BACK_TO_BROM and TPL_TINY_MEMSET being separate symbols
now.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d56b4b19 22-Jul-2017 Tom Rini <trini@konsulko.com>

configs: Migrate RBTREE, LZO, CMD_MTDPARTS, CMD_UBI and CMD_UBIFS

The above CONFIG options are in Kconfig, and now have correct depends and
inter-dependencies. Migrate these to configs/ from include/configs/. In the
case of CMD_UBIFS also change it to be a default y if CMD_UBI.

Signed-off-by: Tom Rini <trini@konsulko.com>

# aed998aa 17-May-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_LZMA to Kconfig

This converts the following to Kconfig:
CONFIG_LZMA

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

# b1a873df 26-Apr-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_CMD_AES et al to Kconfig

This converts the following to Kconfig:
CONFIG_CMD_AES
CONFIG_AES

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Add select AES to CMD_AES]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 173aafbf 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

cmd: Expose a Kconfig option to enable UBIFS commands

Create a new Kconfig entry to allow CMD_UBIFS selection from Kconfig and
add an hidden LZO option that can be selected by CMD_UBIFS.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>

# aa049152 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

mtd: ubi: Select RBTREE option from MTD_UBI Kconfig entry

Expose the RBTREE feature through Kconfig and select this option from the
MTD_UBI option.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>
[Rebased on master]
Signed-off-by: Jagan Teki <jagan@openedev.com>

# ab4458bd 02-Apr-2017 Simon Glass <sjg@chromium.org>

string: Provide a slimmed-down memset()

Most of the time the optimised memset() is what we want. For extreme
situations such as TPL it may be too large. For example on the 'rock'
board, using a simple loop saves a useful 48 bytes. With gcc 4.9 and
the rodata bug, this patch is enough to reduce the TPL image below the
limit.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>

# bea79d7d 14-Mar-2017 Andre Przywara <andre.przywara@arm.com>

Kconfig: introduce md5sum command selection

So far CONFIG_MD5SUM would need to be set by a board's include file.
Since the command is really generic, move it over to Kconfig to allow
it to be defined by either a board's defconfig, menuconfig or some
config snippet merged via mergeconfig.sh.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e663b350 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

smbios: Expose in efi_loader as table

We can pass SMBIOS easily as EFI configuration table to an EFI payload. This
patch adds enablement for that case.

While at it, we also enable SMBIOS generation for ARM systems, since they support
EFI_LOADER.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4b6dddc2 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

x86: Move smbios generation into arch independent directory

We will need the SMBIOS generation function on ARM as well going forward,
so let's move it into a non arch specific location.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# ebf7fff2 05-Oct-2016 Heiko Schocher <hs@denx.de>

spl: move FDT_FIXUP_PARTITIONS to Kconfig

Move FDT_FIXUP_PARTITIONS to Kconfig and cleanup existing
uses.

Signed-off-by: Heiko Schocher <hs@denx.de>

# ddf67f71 05-Jul-2016 Maxime Ripard <maxime.ripard@free-electrons.com>

libfdt: Add overlay application function

The device tree overlays are a good way to deal with user-modifyable
boards or boards with some kind of an expansion mechanism where we can
easily plug new board in (like the BBB, the Raspberry Pi or the CHIP).

Add a new function to merge overlays with a base device tree.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>

# 91b86e21 26-May-2016 Marek Vasut <marex@denx.de>

lib: Enable private libgcc by default

This patch decouples U-Boot binary from the toolchain on systems where
private libgcc is available. Instead of pulling in functions provided
by the libgcc from the toolchain, U-Boot will use it's own set of libgcc
functions. These functions are usually imported from Linux kernel, which
also uses it's own libgcc functions instead of the ones provided by the
toolchain.

This patch solves a rather common problem. The toolchain can usually
generate code for many variants of target architecture and often even
different endianness. The libgcc on the other hand is usually compiled
for one particular configuration and the functions provided by it may
or may not be suited for use in U-Boot. This can manifest in two ways,
either the U-Boot fails to compile altogether and linker will complain
or, in the much worse case, the resulting U-Boot will build, but will
misbehave in very subtle and hard to debug ways.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 67976306 30-Mar-2016 Masahiro Yamada <masahiroy@kernel.org>

cosmetic: Fix typos "privide"

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# ed980b8c 03-Mar-2016 Alexander Graf <agraf@csgraf.de>

efi_loader: hook up in build environment

Now that we have all the bits and pieces ready for EFI payload loading
support, hook them up in Makefiles and KConfigs so that we can build.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
[trini: Enable only when we of OF_LIBFDT, disable on kwb and colibri_pxa270]
Signed-off-by: Tom Rini <trini@konsulko.com>

# aa34fbc0 22-Feb-2016 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt to be used in SPL

Add an option to enable libfdt in SPL. This can be useful when decoding
FIT files in SPL.

We need to make sure this option is not enabled in SPL by this change.
Also this option needs to be enabled in host builds. Si add a new
IMAGE_USE_LIBFDT #define which can be used in files that are built on the
host but must also build for U-Boot and SPL.

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

# 69e173eb 22-Feb-2016 Simon Glass <sjg@chromium.org>

Move CONFIG_OF_LIBFDT to Kconfig

Move this option to Kconfig and tidy up existing boards.

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

# a187559e 05-Feb-2016 Bin Meng <bmeng.cn@gmail.com>

Use correct spelling of "U-Boot"

Correct spelling of "U-Boot" shall be used in all written text
(documentation, comments in source files etc.).

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Minkyu Kang <mk7.kang@samsung.com>

# 947c626d 14-Jan-2016 Tom Rini <trini@konsulko.com>

vsprintf.c: Always enable CONFIG_SYS_VSNPRINTF

Enabling this function always removes some class of string saftey issues.
The size change here in general is about 400 bytes and this seems a reasonable
trade-off.

Cc: Peng Fan <peng.fan@nxp.com>
Cc: Peter Robinson <pbrobinson@gmail.com>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Adrian Alonso <aalonso@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 7d9cde10 22-Nov-2015 Stefan Roese <sr@denx.de>

lib/tiny-printf.c: Add tiny printf function for space limited environments

This patch adds a small printf() version that supports all basic formats.
Its intented to be used in U-Boot SPL versions on platforms with very
limited internal RAM sizes.

To enable it, just define CONFIG_USE_TINY_PRINTF in your defconfig. This
will result in the SPL using this tiny function and the main U-Boot
still using the full-blown printf() function.

This code was copied from:
http://www.sparetimelabs.com/printfrevisited
With mostly only coding style related changes so that its checkpatch
clean.

The size reduction is about 2.5KiB. Here a comparison for the db-mv784mp-gp
(Marvell AXP) SPL:

Without this patch:
58963 18536 1928 79427 13643 ./spl/u-boot-spl

With this patch:
56542 18536 1956 77034 12cea ./spl/u-boot-spl

Note:
To make it possible to compile tiny-printf.c instead of vsprintf.c when
CONFIG_USE_TINY_PRINTF is defined, the functions printf() and vprintf() are
moved from common/console.c into vsprintf.c in this patch.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>

# 2419cd16 03-Oct-2015 Simon Glass <sjg@chromium.org>

dm: tpm: Drop CONFIG_DM_TPM

Now that all TPM drivers use driver model, we can drop the special driver
model CONFIG option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>

# 027b728d 06-Oct-2015 Julius Werner <jwerner@chromium.org>

Add support for LZ4 decompression algorithm

This patch adds support for LZ4-compressed FIT image contents. This
algorithm has a slightly worse compression ration than LZO while being
nearly twice as fast to decompress. When loading images from a fast
storage medium this usually results in a boot time win.

Sandbox-tested only since I don't have a U-Boot development system set
up right now. The code was imported unchanged from coreboot where it's
proven to work, though. I'm mostly interested in getting this recognized
by mkImage for use in a downstream project.

Signed-off-by: Julius Werner <jwerner@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# a7d660bc 22-Aug-2015 Simon Glass <sjg@chromium.org>

tpm: Add Kconfig options for TPMs

Add new Kconfig options for TPMs in preparation for moving boards to use
Kconfig for TPM configuration.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 867a6ac8 31-Jul-2015 Simon Glass <sjg@chromium.org>

efi: Add start-up library code

When running as an EFI application, U-Boot must request memory from EFI,
and provide access to the boot services U-Boot needs.

Add library code to perform these tasks. This includes efi_main() which is
the entry point from EFI. U-Boot is built as a shared library.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d1389403 23-Jun-2015 Simon Glass <sjg@chromium.org>

Add a dhrystone benchmark command

Drystone provides a convenient sanity check that the CPU is running at full
speed. Add this as a command which can be enabled as needed.

Note: I investigated using Coremark for this but there was a license
agreement and I could not work out if it was GPL-compatible.

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

# f7848d90 22-Jun-2015 Joe Hershberger <joe.hershberger@ni.com>

Allow CONFIG_REGEX to be disabled when CONFIG_NET

Instead of selecting REGEX when NET is enabled, make it the default, but
allow boards that are tiny to disable it and lose functionality on all
but the first Ethernet adapter.

cm-bf548, bf538f-ezkit, and bf533-stamp need this. None appear to have
more than one Ethernet interface.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# 3850dbe8 11-Jun-2015 Masahiro Yamada <masahiroy@kernel.org>

blackfin: fix undefined reference to srand and rand

Commit 9ba9e85f3f1c (net: Fix NET_RANDOM_ETHADDR dependencies)
accidentally dropped CONFIG_LIB_RAND defines for 14 Blackfin boards.

Prior to that commit, those boards defined CONFIG_LIB_RAND, but not
CONFIG_NET_RANDOM_ETHADDR. So, commit 9ba9e85f3f1c should not have
touched them, but in fact it ripped CONFIG_LIB_RAND off from all the
header files, which caused undefined reference to srand and rand.
CONFIG_LIB_RAND=y must be revived for such boards.

BTW, this commit indeed makes it better, but even with this fix,
three boards (bf533-stamp, bf538f-ezkit, cm-bf548) still can not
build due to region 'ram' overflowed error. This was cause by
commit 6eed3786c68c (net: Move the CMD_NET config to defconfigs)
because CMD_NET selects NET, and NET selects REGEX. Eventually,
some boards were newly enabled with CONFIG_REGEX, increasing the
memory footprint. A patch is expected to fix the build error.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 9ba9e85f 25-May-2015 Michal Simek <michal.simek@amd.com>

net: Fix NET_RANDOM_ETHADDR dependencies

NET_RANDOM_ETHADDR depends on lib/rand.c. This patch adds dependency to
Kconfig to ensure that library is also compiled.

Remove the definitions from Blackfin boards' include/configs.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 6501ff62 20-Apr-2015 Przemyslaw Marczak <p.marczak@samsung.com>

lib: Kconfig: add entry for errno_str() function

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1a60650c 21-Apr-2015 Joe Hershberger <joe.hershberger@ni.com>

kconfig: Move REGEX to Kconfig

Having this as a Kconfig allows it to be a dependent feature.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8156345d 06-Mar-2015 Simon Glass <sjg@chromium.org>

sandbox: Move CONFIG_SYS_VSNPRINTF to Kconfig

Move this over to Kconfig and tidy up.

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

# 94e3c8c4 19-Feb-2015 gaurav rana <gaurav.rana@freescale.com>

crypto/fsl - Add progressive hashing support using hardware acceleration.

Currently only normal hashing is supported using hardware acceleration.
Added support for progressive hashing using hardware.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
Signed-off-by: Gaurav Rana <gaurav.rana@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>

# d9f23c7f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

lib/rsa: Add Kconfig for devices supporting RSA Modular Exponentiation

Kconfig option added for devices which support RSA Verification.
1. RSA_SOFTWARE_EXP
Enables driver for supporting RSA Modular Exponentiation in Software
2. RSA_FREESCALE_EXP
Enables driver for supporting RSA Modular Exponentiation using Freescale specific
driver

The above drivers use RSA uclass

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
(Removed duplicate line in Kconfig comment)

Change-Id: I7663c4d5350e2bfc3dfa2696f70ef777d6ccc6f6

# c4beb22f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

FIT: Modify option FIT_SIGNATURE in Kconfig

For FIT signature based approach to work, RSA library needs to be selected.
The FIT_SIGNATURE option in Kconfig is modified to automatically select RSA.
Selecting RSA compiles the RSA library required for image verification.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 45ccec8f 23-Oct-2014 Masahiro Yamada <masahiroy@kernel.org>

kconfig: move CONFIG_USE_PRIVATE_LIBGCC to Kconfig

The private libgcc is supported only on ARM, MIPS, PowerPC, SH, x86.
Those architectures should "select" HAVE_PRIVATE_LIBGCC and
CONFIG_USE_PRIVATE_LIBGCC should depend on it.

Currently, this option is enabled on Tegra boards and x86 architecture.
Move the definition from header files to Kconfig.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Tested-by: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: Tom Warren <twarren@nvidia.com>

# 8c688bc4 23-Oct-2014 Masahiro Yamada <masahiroy@kernel.org>

kconfig: move CONFIG_SYS_HZ to lib/Kconfig

CONFIG_SYS_HZ is always defined as 1000 in config_fallbacks.h
(but some boards still have redundant definitions).

This commit moves the definition and the document in README to
Kconfig. Since lib/Kconfig can assure that CONFIG_SYS_HZ is 1000,
the sanity check in lib/time.c should be removed.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Reviewed-by: Marek Vasut <marex@denx.de>

# b0928da6 16-Sep-2014 Masahiro Yamada <masahiroy@kernel.org>

kconfig: move CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED to Kconfig

If this option is enabled, the objects under lib/ directory
are compiled with speed optimization, not size optimization.
(Currently, only used by some Blackfin boards.)

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# ed36323f 16-Sep-2014 Masahiro Yamada <masahiroy@kernel.org>

kconfig: add blank Kconfig files

This would be useful to start moving various config options.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# 1373ffde 18-Dec-2023 Tom Rini <trini@konsulko.com>

Merge tag 'v2024.01-rc5' into next

Prepare v2024.01-rc5


# 253f939a 20-Nov-2023 Tom Rini <trini@konsulko.com>

lib/Kconfig: Correct typo about SYSINFO_SMBIOS in help message

The correct symbol to enable to have SMBIOS populate fields based on the
device tree is SYSINFO_SMBIOS and not SMBIOS_SYSINFO.

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 47cfdb21 27-Oct-2023 Sean Anderson <sean.anderson@seco.com>

arm: semihosting: Support semihosting fallback on 32-bit ARM

Add support for a semihosting fallback on 32-bit ARM. The assembly is
lightly adapted from the irq return code, except there is no offset
since lr already points to the correct instruction. The C side is mostly
like ARM64, except we have fewer cases to deal with.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>

# a4dc3d56 26-Oct-2023 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: uuid: move CONFIG_RANDOM_UUID

This option is independent from any commands and should be managed
under lib. For instance, drivers/block/rkmtd.c is a user.

It would be better to remove this configuration.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# d5d9770f 27-Oct-2023 Tom Rini <trini@konsulko.com>

Merge tag 'tpm-next-27102023' of https://source.denx.de/u-boot/custodians/u-boot-tpm

bootX measurements and measurement API moved to u-boot core:

Up to now, U-Boot could perform measurements and EventLog creation as
described by the TCG spec when booting via EFI.

The EFI code was residing in lib/efi_loader/efi_tcg2.c and contained
both EFI specific code + the API needed to access the TPM, extend PCRs
and create an EventLog. The non-EFI part proved modular enough and
moving it around to the TPM subsystem was straightforward.

With that in place we can have a common API for measuring binaries
regardless of the boot command, EFI or boot(m|i|z), and contructing an
EventLog.

I've tested all of the EFI cases -- booting with an empty EventLog and
booting with a previous stage loader providing one and found no
regressions. Eddie tested the bootX part.

Eddie also fixed the sandbox TPM which couldn't be used for the EFI code
and it now supports all the required capabilities. This had a slight
sideeffect in our testing since the EFI subsystem initializes the TPM
early and 'tpm2 init' failed during some python tests. That code only
opens the device though, so we can replace it with 'tpm2 autostart'
which doesn't error out and still allows you to perfom the rest of the
tests but doesn't report an error if the device is already opened.

There's a few minor issues with this PR as well but since testing and
verifying the changes takes a considerable amount of time, I prefer
merging it now.

Heinrich has already sent a PR for -master containing "efi_loader: fix
EFI_ENTRY point on get_active_pcr_banks" and I am not sure if that will
cause any conflicts, but in any case they should be trivial to resolve.

Both the EFI and non-EFI code have a Kconfig for measuring the loaded
Device Tree. The reason this is optional is that we can't reason
when/if devices add random info like kaslr-seed, mac addresses etc in
the DT. In that case measurements are random, board specific and
eventually useless. The reason it was difficult to fix it prior to this
patchset is because the EFI subsystem and thus measurements was brought
up late and DT fixups might have already been applied. With this
patchset we can measure the DT really early in the future.

Heinrich also pointed out that the two Kconfigs for the DTB measurements
can be squashed in a single one and that the documentation only explains
the non-EFI case. I agree on both but as I said this is a sane working
version, so let's pull this first it's aleady big enough and painful to
test.


# 97707f12 24-Oct-2023 Eddie James <eajames@linux.ibm.com>

tpm: Support boot measurements

Add TPM2 functions to support boot measurement. This includes
starting up the TPM, initializing/appending the event log, and
measuring the U-Boot version. Much of the code was used in the
EFI subsystem, so remove it there and use the common functions.

Signed-off-by: Eddie James <eajames@linux.ibm.com>
For the API moving around from EFI -> u-boot core
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
For EFI testing
Tested-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

# 44071cd5 14-Oct-2023 Sean Anderson <seanga2@gmail.com>

fs: ext4: Fix building ext4 in SPL if write is enabled

If EXT4_WRITE is enabled, write capabilities will be compiled into SPL, but
not CRC16. Add an option to enable CRC16 to avoid linker errors.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 53fab13a 20-Sep-2023 Simon Glass <sjg@chromium.org>

efi: Use the installed SMBIOS tables

U-Boot should set up the SMBIOS tables during startup, as it does on x86.
Ensure that it does this correctly on non-x86 machines too, by creating
an event spy for last-stage init.

Tidy up the installation-condition code while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 8c11d19e 19-Sep-2023 Simon Glass <sjg@chromium.org>

x86: smbios: Add a Kconfig indicating SMBIOS-table presence

When booted from coreboot, U-Boot does not build the SMBIOS tables, but
it should still pass them on to the OS. Add a new option which indicates
whether SMBIOS tables are present, however they were built.

Flip the ordering so that the dependency is listed first, which is less
confusing.

Adjust GENERATE_SMBIOS_TABLE to depend on this new symbol.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 0c45c76c 19-Sep-2023 Simon Glass <sjg@chromium.org>

x86: Allow APCI in SPL

This is needed so we can find the DBG2 table provided by coreboot. Add a
Kconfig so it can be enabled.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 040a6048 14-Sep-2023 Simon Glass <sjg@chromium.org>

boot: Join FDT_FIXUP_PARTITIONS with related options

Move this to be with the other devicetree-fixup options.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 4cc40f61 14-Sep-2023 Simon Glass <sjg@chromium.org>

FWU: Avoid showing an unselectable menu option

Use a menuconfig to avoid showing a menu which cannot be selected in many
cases.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

# a90b5946 14-Sep-2023 Simon Glass <sjg@chromium.org>

lib: rational: Move the Kconfigs into the correct place

These should not be part of the 'system tables' menu. Move them outside
on their own.

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: 7d0f3fbb93c ("lib: rational: copy the rational fraction lib...")
Reviewed-by: Tom Rini <trini@konsulko.com>

# a077ac13 02-Aug-2023 Tom Rini <trini@konsulko.com>

Kconfigs: Correct default of "0" on hex type entries

It is not a parse error to have a default value of "0" for a "hex" type
entry, instead of "0x0". However, "0" and "0x0" are not treated the
same even by the tools themselves. Correct this by changing the default
value from "0" to "0x0" for all hex type questions that had the
incorrect default. Fix one instance (in two configs) of a default of "0"
being used on a hex question to be "0x0". Remove the cases where a
defconfig had set a value of "0x0" to be used as the default had been
"0".

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# af62d83c 03-Aug-2023 Oleksandr Suvorov <oleksandr.suvorov@foundries.io>

spl: move SPL_CRC32 option to lib/Kconfig

All SPL hash algorithm options are collected in lib/Kconfig. Move
SPL_CRC32 there as well.

Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
Reviewed-by: Simon Glass <sjg@chromium.org>

# dfe00b34 13-Jul-2023 Manorit Chawdhry <m-chawdhry@ti.com>

lib: Kconfig: k3: Enable SHA512 for fit signature

We are using our custMpk for signing that is a 4096 bit key, 4096 bit
rsa key requires a SHA512 hashing algorithm to be enabled as per the
source. Even though it is not mandated but this is how it works and is
tested.

Enables SHA512 if fit signature is enabled on K3 platforms.

Signed-off-by: Manorit Chawdhry <m-chawdhry@ti.com>

# 0992a90d 04-May-2023 Simon Glass <sjg@chromium.org>

acpi: Create a new Kconfig for ACPI

We have several Kconfig options for ACPI, but all relate to specific
functions, such as generating tables and AML code.

Add a new option which controls including basic ACPI library code,
including the lib/acpi directory. This will allow us to add functions
which are available even if table generation is not supported.

Adjust the command to avoid a build error when ACPIGEN is not enabled.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 94c8da21 22-Mar-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: Fix LMB_MEMORY_REGIONS flag usage

Remove test on CONFIG_LMB_MEMORY_REGIONS introduced by commit
7c1860fce4e3 ("lmb: Fix lmb property's defination under struct lmb").

This code in lmb_init() is strange, because if CONFIG_LMB_USE_MAX_REGIONS
and CONFIG_LMB_MEMORY_REGIONS are not defined, the implicit #else is empty
and the required initialization is not done:
lmb->memory.max = ?
lmb->reserved.max = ?

But this setting is not possible:
- CONFIG_LMB_USE_MAX_REGIONS not defined
- CONFIG_LMB_MEMORY_REGIONS not defined
because CONFIG_LMB_MEMORY_REGIONS and CONFIG_LMB_RESERVED_REGIONS are
defined as soon as the CONFIG_LMB_USE_MAX_REGIONS is not defined.

This patch removes this impossible case #elif and I add some
explanation in lmb.h to explain why in the struct lmb {} the lmb
property is defined if CONFIG_LMB_MEMORY_REGIONS is NOT defined.

This patch also removes CONFIG_LMB_XXX dependency on CONFIG_LMB as these
defines are used in API file lmb.h and not only in library file.

Fixes: 5e2548c1d6e03 ("lmb: Fix LMB_MEMORY_REGIONS flag usage")
Reported-by: Mark Millard <marklmi@yahoo.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Acked-by: Michal Simek <michal.simek@amd.com>

# c61df340 18-Mar-2023 Marek Vasut <marek.vasut+renesas@mailbox.org>

lib: Fix SYS_TIMER_COUNTS_DOWN description in Kconfig

The SYS_TIMER_COUNTS_DOWN description contains a typo,
s@rathe@&r@ , fix it.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>

# 3b510807 22-Feb-2023 Simon Glass <sjg@chromium.org>

lib: Add an SPL config for LIB_UUID

This is selected by PARTITION_UUIDS which has a separate option for SPL.
Add an SPL option for LIB_UUID also, so that we can keep them consistent.

Also add one for PARTITION_TYPE_GUID to avoid a build error in part_efi.c
which wants to call a uuid function in SPL.

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

# 5a6bc166 22-Feb-2023 Simon Glass <sjg@chromium.org>

lib: Add VPL options for SHA1 and SHA256

Add these options so these algorithms can be used in VPL.

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

# ae625d92 22-Feb-2023 Simon Glass <sjg@chromium.org>

lib: Add a Kconfig for SPL_BZIP2

This is implicitly used in the source and seems useful, so add it.

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

# c33425c6 15-Jan-2023 Simon Glass <sjg@chromium.org>

trace: Reduce the default for TRACE_EARLY_CALL_DEPTH_LIMIT

This is a silly value at present, since U-Boot's call depth never reaches
200. Fix it.

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

# 2dc16a2c 19-Jan-2023 Sjoerd Simons <sjoerd@collabora.com>

Bump LMB_MAX_REGIONS default to 16

Since commit 06d514d77c37 ("lmb: consider EFI memory map") the EFI regions
are also pushed into the lmb if EFI_LOADER is enabled (which is by
default on most system). Which can cause the number of entries to go
over the maximum as it's default is only 8.

Specifically i ran into this case on an TI am62 which has an fdt with
4 reserved regions (in practice 3 lmb entries due to adjecent ranges).

As this is likely to impact more devices bump the default max
regions to 16 so there is a bit more slack.

Fixes: 06d514d77c ("lmb: consider EFI memory map")
Link: https://bugzilla.opensuse.org/show_bug.cgi?id=1207562
Reviewed-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Signed-off-by: Sjoerd Simons <sjoerd@collabora.com>
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
[trini: collect tags from the other equivalent patch]

# 948d3999 08-Feb-2023 Tom Rini <trini@konsulko.com>

Revert "lmb: Default to not-LMB_USE_MAX_REGIONS"

As explained by Philippe Schenker, I was misinterpreting what happened
in the case where we do not set LMB_USE_MAX_REGIONS and so had
re-introduced the problem I was attempting to more widely resolve.

This reverts commit 007ae5d108a37564905ea1588cb279f3a522cc3d.

Reported-by: Philippe Schenker <philippe.schenker@toradex.com>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 007ae5d1 25-Jan-2023 Tom Rini <trini@konsulko.com>

lmb: Default to not-LMB_USE_MAX_REGIONS

The LMB code allows for picking a hard limit on the number of regions it
can know of, or to dynamically allocate these regions. The reason for
this choice is to allow for the compiler to perform a size optimization
in the common case. This optimization however, is very small, ranging
from 196 bytes to 15 bytes saved, or in some cases, being larger. Now
that we also have more regions covered by LMB (in order to protect
various parts of our self at run time), the default of 8 is also much
easier to hit and leads to non-obvious error messages (which imply that
an area is protected, not that we're out of areas to add to the list).

Switch to the dynamic use as the default.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 53c47c59 19-Jan-2023 Tom Rini <trini@konsulko.com>

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


# 4b9b25d9 12-Jan-2023 Brandon Maier <brandon.maier@collins.com>

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

[1] https://github.com/torvalds/linux/commit/e0c1b49f5b674cca7b10549c53b3791d0bbc90a8
[2] https://github.com/facebook/zstd/blob/f302ad8811643c428c4e3498e28f53a0578020d3/lib/libzstd.mk#L31

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>

# ebc1d50a 21-Dec-2022 Simon Glass <sjg@chromium.org>

Revert "fdtdec: drop needlessly convoluted CONFIG_PHANDLE_CHECK_SEQ"

The fdt_path_offset() function is slow since it must scan the tree.
This substantial overhead now applies to all boards.

The original code may not be ideal but it is fit for purpose and is only
needed on a few boards.

Reverting this reduces time to set up driver model by about 30ms.

Before revert:

Accumulated time:
47,170 dm_r
53,237 dm_spl
572,986 dm_f

Accumulated time:
44,598 dm_r
50,347 dm_spl
549,133 dm_f

This reverts commit 26f981f295d00351b6f0c69b5317b254b2361cc0.

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

# 12619d4e 21-Dec-2022 Simon Glass <sjg@chromium.org>

trace: Don't require TIMER_EARLY

Some platforms cannot honour this and don't need trace before relocation.
Use 'imply' instead, so boards can disable this.

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

# 0c16fca9 07-Jan-2023 Simon Glass <sjg@chromium.org>

tpm: Add a proper Kconfig option for crc8 in SPL

The current approach is a bit of a hack and only works for the tpm
subsystem. Add a Kconfig so that crc8 can be enabled in SPL for other
purposes.

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

# 14f43797 19-Dec-2022 Tom Rini <trini@konsulko.com>

Merge tag 'v2023.01-rc4' into next

Prepare v2023.01-rc4

Signed-off-by: Tom Rini <trini@konsulko.com>


# ae3527f0 07-Dec-2022 Kautuk Consul <kconsul@ventanamicro.com>

arch/riscv: add semihosting support for RISC-V

We add RISC-V semihosting based serial console for JTAG based early
debugging.

The RISC-V semihosting specification is available at:
https://github.com/riscv/riscv-semihosting-spec/blob/main/riscv-semihosting-spec.adoc

Signed-off-by: Anup Patel <apatel@ventanamicro.com>
Signed-off-by: Kautuk Consul <kconsul@ventanamicro.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>

# 1c03ab9f 07-Dec-2022 Kautuk Consul <kconsul@ventanamicro.com>

lib: Add common semihosting library

We factor out the arch-independent parts of the ARM semihosting
implementation as a common library so that it can be shared
with RISC-V.

Signed-off-by: Kautuk Consul <kconsul@ventanamicro.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>

# 3b8dfc42 16-Nov-2022 Tom Rini <trini@konsulko.com>

Convert CONFIG_SYS_TIMER_COUNTS_DOWN to Kconfig

This converts the following to Kconfig:
CONFIG_SYS_TIMER_COUNTS_DOWN

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 86794052 21-Oct-2022 Sughosh Ganu <sughosh.ganu@linaro.org>

FWU: Add support for the FWU Multi Bank Update feature

The FWU Multi Bank Update feature supports updating firmware images
to one of multiple sets(also called banks) of images. The firmware
images are clubbed together in banks, with the system booting images
from the active bank. Information on the images such as which bank
they belong to is stored as part of the metadata structure, which is
stored on the same storage media as the firmware images on a dedicated
partition.

At the time of update, the metadata is read to identify the bank to
which the images need to be flashed(update bank). On a successful
update, the metadata is modified to set the updated bank as active
bank to subsequently boot from.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

# 40ed7be4 02-Aug-2022 Tom Rini <trini@konsulko.com>

Convert CONFIG_SYS_FDT_PAD to Kconfig

This converts the following to Kconfig:
CONFIG_SYS_FDT_PAD

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e67ffb5a 22-Jul-2022 Sughosh Ganu <sughosh.ganu@linaro.org>

tpm: rng: Add driver model interface for TPM RNG device

The TPM device has a builtin random number generator(RNG)
functionality. Expose the RNG functions of the TPM device to the
driver model so that they can be used by the EFI_RNG_PROTOCOL if the
protocol is installed.

Also change the function arguments and return type of the random
number functions to comply with the driver model api.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

# b340199f 10-Jun-2022 Tom Rini <trini@konsulko.com>

spl: Ensure all SPL symbols in Kconfig have some SPL dependency

Tighten up symbol dependencies in a number of places. Ensure that a SPL
specific option has at least a direct dependency on SPL. In places
where it's clear that we depend on something more specific, use that
dependency instead. This means in a very small number of places we can
drop redundant dependencies.

Reported-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 13ce351b 08-Jun-2022 Tom Rini <trini@konsulko.com>

vpl: Ensure all VPL symbols in Kconfig have some VPL dependency

Tighten up symbol dependencies in a number of places. Ensure that a VPL
specific option has at least a direct dependency on VPL. In places
where it's clear that we depend on something more specific, use that
dependency instead.

Reported-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 8bea4bf7 08-Jun-2022 Tom Rini <trini@konsulko.com>

tpl: Ensure all TPL symbols in Kconfig have some TPL dependency

Tighten up symbol dependencies in a number of places. Ensure that a TPL
specific option has at least a direct dependency on TPL. In places
where it's clear that we depend on something more specific, use that
dependency instead.

Reported-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 26f981f2 19-May-2022 Rasmus Villemoes <rasmus.villemoes@prevas.dk>

fdtdec: drop needlessly convoluted CONFIG_PHANDLE_CHECK_SEQ

Asking if the alias we found actually points at the device tree node
we passed in (in the guise of its offset from blob) can be done simply
by asking if the fdt_path_offset() of the alias' path is identical to
offset.

In fact, the current method suffers from the possibility of false
negatives: dtc does not necessarily emit a phandle property for a node
just because it is referenced in /aliases; it only emits a phandle
property for a node if it is referenced in <angle brackets>
somewhere. So if both the node we passed in and the alias node we're
considering don't have phandles, fdt_get_phandle() returns 0 for both.

Since the proper check is so simple, there's no reason to hide that
behind a config option (and if one really wanted that, it should be
called something else because there's no need to involve phandle in
the check).

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Acked-by: Aswath Govindraju <a-govindraju@ti.com>

# d30924f1 01-May-2022 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: fix selection of CONFIG_CHARSET

lib/charset.c is not optional for
EFI_APP || EFI_LOADER || UFS || UT_UNICODE.
These must select CONFIG_CHARSET.

Fixes: 726cd9836db0 ("efi: Make unicode printf available to the app")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>

# 747093dd 30-Apr-2022 Simon Glass <sjg@chromium.org>

vpl: Add Kconfig options for VPL

Add VPL versions of commonly used Kconfig options.

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

# 11232139 06-Apr-2022 Tom Rini <trini@konsulko.com>

nds32: Remove the architecture

As removal of nds32 has been ack'd for the Linux kernel, remove support
here as well.

Cc: Rick Chen <rick@andestech.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Rick Chen <rick@andestech.com>

# fd210fee 28-Mar-2022 Philippe Reynes <philippe.reynes@softathome.com>

lib: allow to build asn1 decoder and oid registry in SPL

This commit adds the options:
- SPL_ASN1_DECODER
- SPL_OID_REGISTRY

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>

# 7d44a985 28-Mar-2022 Philippe Reynes <philippe.reynes@softathome.com>

lib: Kconfig: enhance the help of OID_REGISTRY

Enhance the help for the config OID_REGISTRY.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>

# a0e71d96 28-Mar-2022 Philippe Reynes <philippe.reynes@softathome.com>

lib: Kconfig: enhance help for ASN1

Enhance the help for configs ASN1_COMPILER
and ASN1_decoder.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>

# 761a1786 27-Jan-2022 Tom Rini <trini@konsulko.com>

Merge tag 'dm-pull-26jan22' of https://source.denx.de/u-boot/custodians/u-boot-dm

acpi refactoring to allow non-x86 use
binman support for bintools (binary tools)
minor tools improvements in preparation for FDT signing
various minor fixes and improvements


# 334a9b9d 25-Nov-2021 Loic Poulain <loic.poulain@linaro.org>

lib/circbuf: Make circbuf selectable symbol

It is currenly only used from usbtty driver but make it properly
selectable via Kconfig symbol, for future usage.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>

# e1722fcb 01-Dec-2021 Simon Glass <sjg@chromium.org>

x86: Allow any arch to generate ACPI tables

These have sadly found their way to ARM now. Allow any arch to support
generating ACPI tables.

Disable this for the tools build.

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

# 7c3fd5c2 26-Dec-2021 Qu Wenruo <wqu@suse.com>

lib: add BLAKE2 hash support

The code is cross-ported from BLAKE2 reference implementation
(https://github.com/BLAKE2/BLAKE2).

With minimal change to remove unused macros/features.

Currently there is only one user inside U-boot (btrfs), and since it
only utilize BLAKE2B, all other favors are all removed.

Signed-off-by: Qu Wenruo <wqu@suse.com>
[trini: Rename ROUND to R to avoid clash with <linux/bitops.h>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 97f2a749 04-Jan-2022 Eugen Hristev <eugen.hristev@collabora.com>

lib: Kconfig: fix PHANDLE_CHECK_SEQ position outside of menu

CONFIG_PHANDLE_CHECK_SEQ is outside of the menu 'Library routines'
thus it's invisible in menuconfig and cannot be selected.
Fix this by moving the 'endmenu' after the PHANDLE_CHECK_SEQ definition

Fixes: c589132a1d ("fdt: Use phandle to distinguish DT nodes with same name")
Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
Reviewed-by: Aswath Govindraju <a-govindraju@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 726cd983 29-Dec-2021 Simon Glass <sjg@chromium.org>

efi: Make unicode printf available to the app

This is needed to show unicode strings. Enable this code in the app.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>

# 6405ab7a 24-Nov-2021 Simon Glass <sjg@chromium.org>

Convert CONFIG_PHYSMEM to Kconfig

This converts the following to Kconfig:
CONFIG_PHYSMEM

Signed-off-by: Simon Glass <sjg@chromium.org>
Suggested-by: Sean Anderson <seanga2@gmail.com>

# ac7606af 14-Nov-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

lmb: fix typo 'commun'

%s/commun/common/

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

# e7d285b2 25-Sep-2021 Simon Glass <sjg@chromium.org>

image: Use the correct checks for CRC32

Add a host Kconfig for CRC32. With this we can use CONFIG_IS_ENABLED(CRC32)
directly in the host build, so drop the unnecessary indirection.

Add a few more conditions to SPL_CRC32 to avoid build failures as well as
TPL_CRC32. Also update hash.c to make crc32 optional and to actually take
notice of SPL_CRC32.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# 2c21256b 25-Sep-2021 Simon Glass <sjg@chromium.org>

hash: Use Kconfig to enable hashing in host tools and SPL

At present when building host tools, we force CONFIG_SHAxxx to be enabled
regardless of the board Kconfig setting. This is done in the image.h
header file.

For SPL we currently just assume the algorithm is desired if U-Boot proper
enables it.

Clean this up by adding new Kconfig options to enable hashing on the host,
relying on CONFIG_IS_ENABLED() to deal with the different builds.

Add new SPL Kconfigs for hardware-accelerated hashing, to maintain the
current settings.

This allows us to drop the image.h code and the I_WANT_MD5 hack.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# 603d15a5 25-Sep-2021 Simon Glass <sjg@chromium.org>

spl: cypto: Bring back SPL_ versions of SHA

Unfortunately these were removed by mistake. This means that adding hash
support to SPL brings in all software algorithms, with a substantial
increase in code size.

The origin of the problem was renaming them to SPL_FIT_xxx and then these
were removed altogether in a later commit.

Add them back. This aligns with CONFIG_MD5, for example, which has an SPL
variant.

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: f5bc9c25f31 ("image: Rename SPL_SHAxxx_SUPPORT to SPL_FIT_SHAxxx")
Fixes: eb5171ddec9 ("common: Remove unused CONFIG_FIT_SHAxxx selectors")
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# 6674edaa 16-Sep-2021 Tom Rini <trini@konsulko.com>

Merge tag 'v2021.10-rc4' into next

Prepare v2021.10-rc4

Signed-off-by: Tom Rini <trini@konsulko.com>

# gpg: Signature made Tue 14 Sep 2021 06:58:32 PM EDT
# gpg: using RSA key 1A3C7F70E08FAB1707809BBF147C39FF9634B72C
# gpg: Good signature from "Thomas Rini <trini@konsulko.com>" [ultimate]

# Conflicts:
# board/Arcturus/ucp1020/spl.c
# cmd/mvebu/Kconfig
# common/Kconfig.boot
# common/image-fit.c
# configs/UCP1020_defconfig
# configs/sifive_unmatched_defconfig
# drivers/pci/Kconfig
# include/configs/UCP1020.h
# include/configs/sifive-unmatched.h
# lib/Makefile
# scripts/config_whitelist.txt


# 5145bc73 01-Sep-2021 Oleksandr Suvorov <oleksandr.suvorov@foundries.io>

lib: fix typos in Kconfig

There are trivial typos in the Kconfig file. Fixed them.
Also, fixed grammar in the descriptions with typos.

Fixes: d56b4b1974 ("configs: Migrate RBTREE, LZO, CMD_MTDPARTS, CMD_UBI and CMD_UBIFS")
Fixes: 7264f2928b ("spl: fit: Eanble GZIP support for image decompression")
Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# e60e4499 02-Sep-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

lib: Drop SHA512_ALGO in lieu of SHA512

SHA512_ALGO was used as a "either SHA512 or SHA384", although the
implementations of these two algorithms share a majority of code.

From a Kconfig interface perspective, it makes sense to present two
distinct options. This requires #ifdefing out the SHA512
implementation from sha512.c. The latter doesn't make any sense.

It's reasonable to say in Kconfig that SHA384 depends on SHA512, and
seems to be the more polite way to handle the selection.

Thus, automatically select SHA512 when SHA384 is enabled.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# b4c2c151 27-Aug-2021 Michal Simek <michal.simek@amd.com>

Kconfig: Remove all default n/no options

default n/no doesn't need to be specified. It is default option anyway.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
[trini: Rework FSP_USE_UPD portion]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 928a8be7 29-Jul-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

lib: ecdsa: Implement UCLASS_ECDSA verification on target

Implement the crypto_algo .verify() function for ecdsa256. Because
it backends on UCLASS_ECDSA, this change is focused on parsing the
keys from devicetree and passing this information to the specific
UCLASS driver.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# fa3f1f1d 24-Jul-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: disable CONFIG_SPL_HEXDUMP by default

CONFIG_HEXDUMP is needed to display UEFI variables using 'printenv -e'.

Enabling CONFIG_SPL_HEXDUMP only makes sense for debugging purposes.
Hence CONFIG_SPL_HEXDUMP should not be enabled by default.

The following boards currently have CONFIG_SPL_HEXDUMP=y. This includes
boards that don't use SPL at all.

axm_defconfig
imx8mm-cl-iot-gate_defconfig
imx8mm_venice_defconfig
imxrt1020-evk_defconfig
imxrt1050-evk_defconfig
kontron_sl28_defconfig
kp_imx53_defconfig
lx2160ardb_tfa_stmm_defconfig
mt7622_rfb_defconfig
octeon_ebb7304_defconfig
octeon_nic23_defconfig
qemu_arm64_defconfig
qemu_arm_defconfig
qemu-riscv32_defconfig
qemu-riscv32_smode_defconfig
qemu-riscv64_defconfig
qemu-riscv64_smode_defconfig
qemu-x86_64_defconfig
qemu-x86_defconfig
sandbox64_defconfig
sandbox_defconfig
stm32mp15_basic_defconfig
stm32mp15_trusted_defconfig
synquacer_developerbox_defconfig
taurus_defconfig
xilinx_versal_virt_defconfig

The patch only keeps it enabled on

sandbox_spl_defconfig

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 1a46cb6c 02-Jul-2021 Simon Glass <sjg@chromium.org>

lib: Create a new Kconfig option for charset conversion

Rather than looking at two KConfig options in the Makefile, create a new
Kconfig option for compiling lib/charset.c

Enable it for UFS also, which needs this support.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 26dd9936 08-Jul-2021 Steffen Jaeckel <jaeckel-floss@eyet-services.de>

lib: add crypt subsystem

Add the basic functionality required to support the standard crypt
format.
The files crypt-sha256.c and crypt-sha512.c originate from libxcrypt and
their formatting is therefor retained.
The integration is done via a crypt_compare() function in crypt.c.

```
libxcrypt $ git describe --long --always --all
tags/v4.4.17-0-g6b110bc
```

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 7d0f3fbb 11-Jun-2021 Tero Kristo <t-kristo@ti.com>

lib: rational: copy the rational fraction lib routines from Linux

Copy the best rational approximation calculation routines from Linux.
Typical usecase for these routines is to calculate the M/N divider
values for PLLs to reach a specific clock rate.

This is based on linux kernel commit:
"lib/math/rational.c: fix possible incorrect result from rational
fractions helper"
(sha1: 323dd2c3ed0641f49e89b4e420f9eef5d3d5a881)

Signed-off-by: Tero Kristo <t-kristo@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Tero Kristo <kristo@kernel.org>

# ec0512b1 24-May-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

Revert "lib: introduce HASH_CALCULATE option"

When we think of Kconfig, we usually think of features that we like
to enable or not. Ideally, we wouldn't use Kconfig to fix a build
issue, although sometimes it might make sense. With Kconfig it's hard
to guarantee that the fix is universal. We can only say that it works
for the set of tested configurations. In the majority of cases, it's
preferable to let the linker figure things out for us.

The reverted commit attempted to fix a build issue by adding an
invisible Kconfig option. This is wrong in several ways:

It invents a new Kconfig variable when CONFIG_HASH already
exists for the same purpose.
Second, hash-checksum.c makes use of the hash_progressive_lookup_algo()
symbol, which is only provided with CONFIG_HASH, but this dependency
was not expressed in the reverted patch.

It feels like Kconfig is turning into a listing of all available
source files, and a buffet to 'select' which ones to compile. The
purpose of this revert is to enable the next change to make use of
CONFIG_HASH instead of adding to Kconfig.

This reverts commit 87316da05f2fd49d3709275e64ef0c5980366ade.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Acked-by: Masahisa Kojima <masahisa.kojima@linaro.org>

# 1621d3c4 10-May-2021 Bin Meng <bmeng.cn@gmail.com>

lib: kconfig: Limit BINMAN_FDT for OF_SEPARATE or OF_EMBED

Generally speaking BINMAN_FDT makes sense for OF_SEPARATE or OF_EMBED.
For the other OF_CONTROL methods, it's quite possible binman node is
not available as binman is invoked during the build phase instead of
runtime. Let's only turn it on for OF_SEPARATE or OF_EMBED by default.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 87316da0 13-May-2021 Masahisa Kojima <masahisa.kojima@linaro.org>

lib: introduce HASH_CALCULATE option

Build error occurs when CONFIG_EFI_SECURE_BOOT or
CONFIG_EFI_CAPSULE_AUTHENTICATE is enabled,
because hash-checksum.c is not compiled.

Since hash_calculate() implemented in hash-checksum.c can be
commonly used aside from FIT image signature verification,
this commit itroduces HASH_CALCULATE option to decide
if hash-checksum.c shall be compiled.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# e2ae483c 13-May-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

hash: Kconfig option for SHA512 hardware acceleration

Commit a479f103dc1c ("hash: Allow for SHA512 hardware implementations")
defined function definitions for hardware accelerated SHA384 and SHA512.
If CONFIG_SHA_HW_ACCEL=y, these functions are used.

We already have boards using CONFIG_SHA_HW_ACCEL=y but none implements the
new functions hw_sha384() and hw_sha512().

For implementing the EFI TCG2 protocol we need SHA384 and SHA512. The
missing hardware acceleration functions lead to build errors on boards like
peach-pi_defconfig.

Introduce a new Kconfig symbol CONFIG_SHA512_HW_ACCEL to control if the
functions hw_sha384() and hw_sha512() shall be used to implement the SHA384
and SHA512 algorithms.

Fixes: a479f103dc1c ("hash: Allow for SHA512 hardware implementations")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

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

# 6d66502b 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: Add 2 config to define the max number of regions

Add 2 configs CONFIG_LMB_MEMORY_REGIONS and CONFIG_LMB_RESERVED_REGIONS
to change independently the max number of the regions in lmb
library.

When CONFIG_LMB_USE_MAX_REGIONS=y, move the lmb property arrays to
struct lmb and manage the array size with the element 'max' of struct
lmb_region; their are still allocated in stack.

When CONFIG_LMB_USE_MAX_REGIONS=n, keep the current location in
struct lmb_region to allow compiler optimization.

Increase CONFIG_LMB_RESERVED_REGIONS is useful to avoid lmb errors in
bootm when the number of reserved regions (not adjacent) is reached:
+ 1 region for relocated U-Boot
+ 1 region for initrd
+ 1 region for relocated linux device tree
+ reserved memory regions present in Linux device tree.

The current limit of 8 regions is reached with only 5 reserved regions
in DT.

see Linux kernel commit bf23c51f1f49 ("memblock: Move memblock arrays
to static storage in memblock.c and make their size a variable")

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# 4fa0150d 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: move MAX_LMB_REGIONS value in Kconfig

Move MAX_LMB_REGIONS value in Kconfig, the max number of the regions
in lmb library.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# 77b8cfef 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: move CONFIG_LMB in Kconfig

Migrate CONFIG_LMB in Kconfig.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# a479f103 16-Feb-2021 Joel Stanley <joel@jms.id.au>

hash: Allow for SHA512 hardware implementations

Similar to support for SHA1 and SHA256, allow the use of hardware hashing
engine by enabling the algorithm and setting CONFIG_SHA_HW_ACCEL /
CONFIG_SHA_PROG_HW_ACCEL.

Signed-off-by: Joel Stanley <joel@jms.id.au>

# f2c1442e 14-Mar-2021 Simon Glass <sjg@chromium.org>

bloblist: Make BLOBLIST_TABLES depend on BLOBLIST

Add an extra condition here since we cannot put x86 tables in a bloblist
when bloblists are not supported.

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

# e0103158 25-Feb-2021 Bin Meng <bmeng.cn@gmail.com>

lib: kconfig: Mention CONFIG_ADDR_MAP limitation in the help

Mention that CONFIG_ADDR_MAP only works in the post-relocation phase.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>

# 56e7257c 03-Feb-2021 Bin Meng <bmeng.cn@gmail.com>

lib: Fix BINMAN_FDT dependency

lib/binman.c references the following 3 ofnode APIs:
ofnode_first_subnode(), ofnode_path() and ofnode_read_bool().

These APIs get built only when DM is on. Fix the dependency then.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 59e4e391 18-Jan-2021 Tom Rini <trini@konsulko.com>

Merge https://gitlab.denx.de/u-boot/custodians/u-boot-riscv

- Update qemu-riscv.rst build instructions.
- Add support for SPI on Kendryte K210.
- Add Microchip PolarFire SoC Icicle Kit support.
- Add support for an early timer.
- Select TIMER_EARLY to avoid infinite recursion for Trace.


# a80f8513 17-Jan-2021 Pragnesh Patel <pragnesh.patel@sifive.com>

trace: select TIMER_EARLY to avoid infinite recursion

When tracing functions is enabled this adds calls to
__cyg_profile_func_enter() and __cyg_profile_func_exit() to the traced
functions.

__cyg_profile_func_enter() and __cyg_profile_func_exit() invoke
timer_get_us() to record the entry and exit time.

initr_dm() will make gd->dm_root = NULL and gd->timer = NULL, so
timer_get_us() -> get_ticks() -> dm_timer_init() will lead to an
indefinite recursion.

So select TIMER_EARLY when tracing got enabled.

Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Rick Chen <rick@andestech.com>

# 6205bbb1 04-Jan-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lib: cosmetic update of CONFIG_LIB_ELF description

Change 2 typo error in CONFIG_LIB_ELF description:
- Supoort => Support
- fir => for

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c589132a 02-Dec-2020 Aswath Govindraju <a-govindraju@ti.com>

fdt: Use phandle to distinguish DT nodes with same name

While assigning the sequence number to subsystem instances by reading the
aliases property, only DT nodes names are compared and not the complete
path. This causes a problem when there are two DT nodes with same name but
have different paths.

In arch/arm/dts/k3-am65-main.dtsi there are two USB controllers with the
same device tree node name but different path. When aliases are defined for
these USB controllers then fdtdec_get_alias_seq() fails to pick the correct
instance for a given index.

fdt_path_offset() function is slow and this would effect the U-Boot
startup. To avert the time penalty on all boards, apply this extra check
only when required by using a config option.

Fix it by comparing the phandles of DT nodes after the node names match,
under a config option.

Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Fix whitespace error in Kconfig:
Signed-off-by: Simon Glass <sjg@chromium.org>

# 28cef9ca 19-Nov-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

fs: fat: create correct short names

The current function set_name() used to create short names has the
following deficiencies resolved by this patch:

* Long names (e.g. FOO.TXT) are stored even if a short name is enough.
* Short names with spaces are created, e.g. "A ~1.TXT".
* Short names with illegal characters are created, e.g. "FOO++BAR".
* Debug output does not not consider that the short file name has no
concluding '\0'.

The solution for the following bug is split of into a separate patch:

* Short file names must be unique.

This patch only provides the loop over possible short file names.

Fixes: c30a15e590c ("FAT: Add FAT write feature")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# e4f8e543 05-Nov-2020 Simon Glass <sjg@chromium.org>

smbios: Drop the unused Kconfig options

Now that we can use devicetree to specify this information, drop the old
CONFIG options.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 44c74bdd 05-Nov-2020 Simon Glass <sjg@chromium.org>

sysinfo: Provide a default driver to set SMBIOS values

Some boards want to specify the manufacturer or product name but do not
need to have their own sysinfo driver.

Add a default driver which provides a way to specify this SMBIOS
information in the devicetree, without needing any board-specific
functionality.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d2cb7a22 04-Nov-2020 Simon Glass <sjg@chromium.org>

x86: Allow putting some tables in the bloblist

At present all tables are placed starting at address f0000 in memory, and
can be up to 64KB in size. If the tables are very large, this may not
provide enough space.

Also if the tables point to other tables (such as console log or a ramoops
area) then we must allocate other memory anyway.

The bloblist is a nice place to put these tables since it is contiguous,
which makes it easy to reserve this memory for linux using the 820 tables.

Add an option to put some of the tables in the bloblist. For SMBIOS and
ACPI, create suitable pointers from the f0000 region to the new location
of the tables.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
[bmeng: squashed in http://patchwork.ozlabs.org/project/uboot/patch/
20201105062407.1.I8091ad931cbbb5e3b6f6ababdf3f8d5db0d17bb9@changeid/]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# 415eab06 03-Nov-2020 Christian Gmeiner <christian.gmeiner@gmail.com>

smbios: add parsing API

Add a very simple API to be able to access SMBIOS strings
like vendor, model and bios version.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 72eda507 27-Oct-2020 Sean Anderson <seanga2@gmail.com>

lib: Add getopt

Some commands can get very unweildy if they have too many positional
arguments. Adding options makes them easier to read, remember, and
understand.

This implementation of getopt has been taken from barebox, which has had
option support for quite a while. I have made a few modifications to their
version, such as the removal of opterr in favor of a separate getopt_silent
function. In addition, I have moved all global variables into struct
getopt_context.

The getopt from barebox also re-orders the arguments passed to it so that
non-options are placed last. This allows users to specify options anywhere.
For example, `ls -l foo/ -R` would be re-ordered to `ls -l -R foo/` as
getopt parsed the options. However, this feature conflicts with the const
argv in cmd_tbl->cmd. This was originally added in 54841ab50c ("Make sure
that argv[] argument pointers are not modified."). The reason stated in
that commit is that hush requires argv to stay unmodified. Has this
situation changed? Barebox also uses hush, and does not have this problem.
Perhaps we could use their fix?

I have assigned maintenance of getopt to Simon Glass, as it is currently
only used by the log command. I would also be fine maintaining it.

Signed-off-by: Sean Anderson <seanga2@gmail.com>

# 26637e2e 12-Sep-2020 Simon Glass <sjg@chromium.org>

lib: Allow hexdump to be used in SPL

It is sometimes useful to output hex dumps in SPL. Add a config option to
allow this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# e87dfb05 05-Aug-2020 Andrii Anisov <andrii_anisov@epam.com>

lib: sscanf: add sscanf implementation

Port sscanf implementation from mini-os and introduce new
Kconfig option to enable it: CONFIG_SSCANF. Disable by default.

Signed-off-by: Andrii Anisov <andrii_anisov@epam.com>
Signed-off-by: Anastasiia Lukianenko <anastasiia_lukianenko@epam.com>
Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>

# 81014f73 30-Jul-2020 Joao Marcos Costa <joaomarcos.costa@bootlin.com>

include/u-boot, lib/zlib: add sources for zlib decompression

Add zlib (v1.2.11) uncompr() function to U-Boot. SquashFS depends on
this function to decompress data from a raw disk image. The actual
support for zlib into SquashFS sources will be added in a follow-up
commit.

Signed-off-by: Joao Marcos Costa <joaomarcos.costa@bootlin.com>

# 69be8fd1 03-Jun-2020 Marek Szyprowski <m.szyprowski@samsung.com>

powerpc: move ADDR_MAP to Kconfig

Move ADDR_MAP related config options from include/configs/*.h to the
proper place in lib/Kconfig. This has been done using
./tools/moveconfig.py and manual inspection of the generated changes.
This is a preparation to use ADDR_MAP helper on ARM 32bit Raspberry Pi4
board for mapping the PCIe XHCI MMIO, which is above the 4GiB identity
mapping limit.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# d16b38f4 15-Apr-2020 Reuben Dowle <reubendowle0@gmail.com>

Add support for SHA384 and SHA512

The current recommendation for best security practice from the US government
is to use SHA384 for TOP SECRET [1].

This patch adds support for SHA384 and SHA512 in the hash command, and also
allows FIT images to be hashed with these algorithms, and signed with
sha384,rsaXXXX and sha512,rsaXXXX

The SHA implementation is adapted from the linux kernel implementation.

[1] Commercial National Security Algorithm Suite
http://www.iad.gov/iad/programs/iad-initiatives/cnsa-suite.cfm

Signed-off-by: Reuben Dowle <reuben.dowle@4rf.com>

# 43e442a5 26-May-2020 Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

kconfig: fix some typos

Signed-off-by: Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

# eff5a547 22-May-2020 Michael Walle <michael@walle.cc>

cmd: zip: automatically pull in gzip()

Move the CONFIG_GZIP_COMPRESSED from a config.h macro to a Kconfig menu
item. It is not selectable by a user because there is no reason to do
so. Instead it will be automatically selected by the stuff which uses
gzip(), like the zip command.

Remove it from the config_whitelist.txt. Also remove
CONFIG_GZIP_COMPRESS_DEF_SZ as this was never used on any board. The
default seems to be sane, otherwise it should be added as a Kconfig
option.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8239be61 06-May-2020 Simon Glass <sjg@chromium.org>

lib: Allow MD5 to be enabled in SPL

At present the MD5 option cannot be enabled by board configs since it has
no Kconfig name. It is generally enabled, so long as FIT support is
present. But not all boards use FIT, particularly in SPL

Fix this and add an option for SPL as well. This allows board code to call
md5() even if FIT support is not enabled.

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

# 04cb3994 21-Apr-2020 Weijie Gao <weijie.gao@mediatek.com>

lib: enable lzma decompression support for SPL build

This patch enables LZMA decompression support for SPL build

Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>

# 2a2119e1 05-Mar-2020 Atish Patra <atishp@atishpatra.org>

lib: kconfig: Add option to set BZIP2 compression method

There is no way to select BZIP2 compression method.
Add it under library/compression config where all other
compression related configs are present.

Signed-off-by: Atish Patra <atish.patra@wdc.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 805b3cac 12-Feb-2020 Keerthy <j-keerthy@ti.com>

lib: elf: Move the generic elf loading/validating functions to lib

Move the generic elf loading/validating functions to lib/
so that they can be re-used and accessed by code existing
outside cmd.

While at it remove the duplicate static version of load_elf_image_phdr
under arch/arm/mach-imx/imx_bootaux.c.

Signed-off-by: Keerthy <j-keerthy@ti.com>
Suggested-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>

# 1611235b 19-Jan-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: Kconfig dependencies for pseudo-random library

drivers/rng/sandbox_rng.c requires rand() to be defined but configuration
option CONFIG_CONFIG_LIB_RAND selected in drivers/rng/Kconfig does not
exist.

test/lib/test_aes.c requires rand() to be defined.

Fix the selection criteria for choice "Pseudo-random library support type".

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 3c10dc95 06-Dec-2019 Simon Glass <sjg@chromium.org>

binman: Add a library to access binman entries

SPL and TPL can access information about binman entries using link-time
symbols but this is not available in U-Boot proper. Of course it could be
made available, but the intention is to just read the device tree.

Add support for this, so that U-Boot can locate entries.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# b4adf627 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: crypto: add x509 parser

Imported from linux kernel v5.3:
x509.asn1 without changes
x509_akid.asn1 without changes
x509_parser.h without changes
x509_cert_parser.c with changes marked as __UBOOT__
x509_public_key.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# a9b45e6e 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add oid registry utility

Imported from linux kernel v5.3:
build_OID_registry without changes
oid_registry.h without changes
oid_registry.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# ab8a0e06 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add asn1 decoder

Imported from linux kernel v5.3:
lib/asn1_decoder.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 2b12196d 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

cmd: add asn1_compiler

Imported from linux kernel v5.3:
asn1.h without changes
asn1_ber_bytecode.h without changes
asn1_decoder.h without changes
asn1_compiler.c without changes

This host command will be used to create a ASN1 parser, for example,
for pkcs7 messages or x509 certificates. More specifically, it will
generate *byte code* which will be interpreted by asn1 decoder library.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 05429b6c 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

rtc: move date.c from drivers/rtc/ to lib/

In the next commit, rtc_mktime(), for compatibility with linux, will be
implemented using rtc_mktime(), which is no longer drivers/rtc specific.
So move this file under lib/.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 37ef1774 10-Nov-2019 Thomas Hebb <tommyhebb@gmail.com>

Kconfig: disambiguate config names for tiny printf

27084c03d36a ("spl: Allow tiny printf() to be controlled in SPL and
TPL") split this option in two for TPL and SPL, but didn't change the
Kconfig names, making them hard to set quickly.

Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>

# 0d76afc0 27-Oct-2019 Simon Glass <sjg@chromium.org>

fdt: Add Kconfig options to control code size

For better or worse libfdt recent grew a lot of code that checks the
validity of the device tree in great detail. When using unsigned or
unverified data this makes things safer, but it does add to code size.

Add some controls to select the trade-off between safety and code size.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 27084c03 25-Sep-2019 Simon Glass <sjg@chromium.org>

spl: Allow tiny printf() to be controlled in SPL and TPL

At present there is only one control for this and it is used for both SPL
and TPL. But SPL might have a lot more space than TPL so the extra cost of
a full printf() might be acceptable.

Split the option into two, providing separate SPL and TPL controls. The
TPL setting defaults to the same as SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2a51e16b 07-Jun-2019 Tom Rini <trini@konsulko.com>

configs: Make USE_TINY_PRINTF depend on SPL||TPL and be default

The USE_TINY_PRINTF symbol only changes things within SPL and TPL
builds, so make it depend on that support. Next, make it default as
within these cases we should rarely have need of more advanced print
formats outside of the debug context.

To do this, in a few cases we need to correct our Kconfig dependencies
as we had cases of non-SPL targets select'ing this symbol. Finally, in
the case of a few boards we really do need the full printf
functionality.

Signed-off-by: Tom Rini <trini@konsulko.com>

# da0fb5fd 02-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: make call depth limit customizable

Up to now we had hard coded values for the call depth up to which trace
records are created: 200 for early tracing, 15 thereafter. UEFI
applications reach a call depth of 80 or above.

Provide customizing settings for the call trace depth limit and the early
call trace depth limit. Use the old values as defaults.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8509f22a 29-Apr-2019 Marek Behún <kabel@kernel.org>

lib: add Zstandard decompression support

Add the zstd library from Linux kernel (only decompression support).
There are minimal changes to build with U-Boot, otherwise the files are
identical to Linux commit dc35da16 from March 2018, the files had not
been touched since in kernel. Also SPDX lincese tags were added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 83a486b6 29-Apr-2019 Marek Behún <kabel@kernel.org>

lib: Add xxhash support

This adds the xxhash support from Linux. Files are almost identical to
those added to Linux in commit 5d240522 ("lib: Add xxhash module") (they
haven't been touched since in Linux). The only difference is to add some
includes to be compatible with U-Boot. Also SPDX lincese tags were
added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 5132361a 29-Apr-2019 Heiko Schocher <hs@denx.de>

lib: Kconfig: fix help text for GZIP

commit 95f4bbd581cf ("lib: fdt: Allow LZO and GZIP DT compression in U-Boot")

introduced Kconfig option for gzip in U-Boot, but help text
says gzip for SPL, which is wrong. Fix this.

Signed-off-by: Heiko Schocher <hs@denx.de>
Acked-by: Marek Vasut <marex@denx.de>

# 1c6eb075 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE_BUFFER_SIZE et al to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE_BUFFER_SIZE
CONFIG_TRACE_EARLY_SIZE
CONFIG_TRACE_EARLY
CONFIG_TRACE_EARLY_ADDR

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

# a24a78d7 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE

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

# 54969b40 21-Mar-2019 Thierry Reding <treding@nvidia.com>

fdtdec: Add Kconfig symbol for tests

Runtime tests are provided as a test_fdtdec command implementation. Add
a Kconfig symbol that allows this command to be built so that the tests
can be used.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 95f4bbd5 08-Mar-2019 Marek Vasut <marex@denx.de>

lib: fdt: Allow LZO and GZIP DT compression in U-Boot

Add required Kconfig symbols, Makefile bits and macro fixes in a
few places to support LZO and DT compression in U-Boot. This can
save a lot of space with multi-DTB fitImages.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>

# 6e705114 13-Jan-2019 Chris Packham <judge.packham@gmail.com>

lib: Kconfig: spelling fixes

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 048c6e89 06-Nov-2018 Simon Glass <sjg@chromium.org>

spl: lz4: Allow use of lz4 compression in SPL

In some cases U-Boot is compressed and it is useful to be able to
decompress it in SPL. Add a Kconfig and Makefile change to allow this.
Note that this does not actually implement decompression.

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

# 2895c4b7 15-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

kconfig: Introduce HAVE_ARCH_IOMAP

Introduce a new Kconfig option for architecture codes to control
whether it provides io{read,write}{8,16,32} I/O accessor functions.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5592a633 01-Oct-2018 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt in TPL

In some cases (e.g. sandbox with verified boot) it is useful to support
libfdt in TPL. Update the Kconfig to handle this.

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

# 6307896c 01-Oct-2018 Simon Glass <sjg@chromium.org>

tpm: Add support for SPL and TPL

At present the tpm can only be used in U-Boot proper. Updated it to work
in SPL and TPL also.

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

# ab948cd2 19-Jul-2018 Masahiro Yamada <masahiroy@kernel.org>

fdt_support: make FDT_FIXUP_PARTITIONS depend on CMD_MTDPARTS

fdt_fixup_mtdparts() calls mtdparts_init() and device_find(),
which are defined in cmd/mtdparts.c

The combination of FDT_FIXUP_PARTITIONS=y and CMD_MTDPARTS=n
emits the following link error:

common/fdt_support.c:903: undefined reference to `mtdparts_init'
common/fdt_support.c:914: undefined reference to `device_find'

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 3330584d 03-Jun-2018 Igor Opaniuk <igor.opaniuk@gmail.com>

avb2.0: integrate avb 2.0 into the build system

Integrate libavb into the build system. Introduce CONFIG_LIBAVB
build option.

Signed-off-by: Igor Opaniuk <igor.opaniuk@linaro.org>

# f8c987f8 05-Jun-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

lib: Add hexdump

Often during debugging session it's very interesting to see
what data we were dealing with. For example what we write or read
to/from memory or peripherals.

This change introduces functions that allow to dump binary
data with one simple function invocation like:
------------------->8----------------
print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, buf, len);
------------------->8----------------

which gives us the following:
------------------->8----------------
00000000: f2 b7 c9 88 62 61 75 64 72 61 74 65 3d 31 31 35 ....baudrate=115
00000010: 32 30 30 00 62 6f 6f 74 61 72 67 73 3d 63 6f 6e 200.bootargs=con
00000020: 73 6f 6c 65 3d 74 74 79 53 33 2c 31 31 35 32 30 sole=ttyS3,11520
00000030: 30 6e 38 00 62 6f 6f 74 64 65 6c 61 79 3d 33 00 0n8.bootdelay=3.
00000040: 62 6f 6f 74 66 69 6c 65 3d 75 49 6d 61 67 65 00 bootfile=uImage.
00000050: 66 64 74 63 6f 6e 74 72 6f 6c 61 64 64 72 3d 39 fdtcontroladdr=9
00000060: 66 66 62 31 62 61 30 00 6c 6f 61 64 61 64 64 72 ffb1ba0.loadaddr
00000070: 3d 30 78 38 32 30 30 30 30 30 30 00 73 74 64 65 =0x82000000.stde
00000080: 72 72 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 rr=serial0@e0022
00000090: 30 30 30 00 73 74 64 69 6e 3d 73 65 72 69 61 6c 000.stdin=serial
000000a0: 30 40 65 30 30 32 32 30 30 30 00 73 74 64 6f 75 0@e0022000.stdou
000000b0: 74 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 30 t=serial0@e00220
000000c0: 30 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00..............
...
------------------->8----------------

Source of hexdump.c was copied from Linux kernel v4.7-rc2.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Mario Six <mario.six@gdsys.cc>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Stefan Roese <sr@denx.de>

# c232d14d 29-May-2018 Alex Kiernan <alex.kiernan@gmail.com>

mmc: Separate "mmc swrite" from fastboot

Introduce CONFIG_IMAGE_SPARSE and CONFIG_CMD_MMC_SWRITE so the "mmc
swrite" command is separated from the fastboot code.

Move image-sparse from common to lib so it's clear it's library code.

Rename CONFIG_FASTBOOT_FLASH_FILLBUF_SIZE to CONFIG_IMAGE_SPARSE_FILLBUF_SIZE
and migrate it to Kconfig.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Acked-by: Jassi Brar <jaswinder.singh@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6417572e 08-May-2018 Tom Rini <trini@konsulko.com>

lib/Kconfig: Mark OF_LIBFDT_OVERLAY as depending on OF_LIBFDT

The overlay code is only useful when OF_LIBFDT is set, so mark it as
depending on that first.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 58a46f88 25-Apr-2018 Praneeth Bajjuri <praneeth@ti.com>

configs: TI: Enable FIT Library overlay support

Enable the FDT library overlay support for all TI SOC family.

Without this option, when Loading fdt from FIT image, the
following warning is seen.

"config with overlays but CONFIG_OF_LIBFDT_OVERLAY not set".

Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
Suggested-by: Andrew F.Davis <afd@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>

# 14ad44ab 18-Apr-2018 Alex Kiernan <alex.kiernan@gmail.com>

spl: Split sprintf, strto* from SPL serial in Kconfig

When SPL serial is disabled, callers who need sprintf or strtoul fail
because their inclusion is guarded by CONFIG_SPL_SERIAL_SUPPORT/
CONFIG_TPL_SERIAL_SUPPORT.

Split printf, sprintf and strto into their own entries and then select
all of them if SERIAL_SUPPORT is enabled to match the current behaviour.

Include panic.o unconditionally as it can be called from anywhere which
uses BUG_ON().

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>

# e294ba06 04-Apr-2018 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-sunxi

Signed-off-by: Tom Rini <trini@konsulko.com>


# d14db11d 03-Apr-2018 Andre Przywara <andre.przywara@arm.com>

sunxi: revert disabling of features

In January some commits were introduced to mitigate the U-Boot image
size issues we encountered on sunxi builds.
Now with the MMC environment removed we can bring them back, as we
practically don't have a size limit anymore.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 32ce6179 13-Mar-2018 Bryan O'Donoghue <bryan.odonoghue@linaro.org>

optee: Add lib entries for sharing OPTEE code across ports

This patch adds code to lib to enable sharing of useful OPTEE code between
board-ports and architectures. The code on lib/optee/optee.c comes from the
TI omap2 port. Eventually the OMAP2 code will be patched to include the
shared code. The intention here is to add more useful OPTEE specific code
as more functionality gets added.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Cc: Harinarayan Bhatta <harinarayan@ti.com>
Cc: Andrew F. Davis <afd@ti.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Kever Yang <kever.yang@rock-chips.com>
Cc: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Cc: Peng Fan <peng.fan@nxp.com>
Tested-by: Peng Fan <peng.fan@nxp.com>

# 36c1877c 06-Feb-2018 Faiz Abbas <faiz_abbas@ti.com>

lib: Kconfig: Move DYNAMIC_CRC_TABLE to Kconfig

Add CONFIG prefix to DYNAMIC_CRC_TABLE and implement it in
Kconfig.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>

# a451bc27 05-Feb-2018 Adam Ford <aford173@gmail.com>

Convert LIB_UUID to Kconfig

config_fallback.h has some logic that checks a variety of options
and selects LIB_UUID if it hasn't already been selected. This
will all LIB_UUID in Kconfig and select this option for the list
of options to allow us to remove the logic from fallbacks

Signed-off-by: Adam Ford <aford173@gmail.com>

# a5a37567 06-Feb-2018 Adam Ford <aford173@gmail.com>

Convert CONFIG LIB_HW_RAND to Kconfig

config_fallbacks.h had some logic to automatically select
LIB_RAND if RANDOM_UUID or CMD_UUID were set if LIB_HW_RAND wasn't
already selected. By migrating LIB_HW_RAND to Kconfig, we can
remove this check from config_fallbacks.h and put it into Kconfig

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
[trini: Turn into a choice, add NET_RANDOM_ETHADDR]
Signed-off-by: Tom Rini <trini@konsulko.com>

# acd4d334 16-Jan-2018 Maxime Ripard <maxime.ripard@free-electrons.com>

net: regex: Disable by default on sunXi

The sunXi arm64 build has overflown, leading to the main U-boot binary
overwriting the environment when flashing the new image, or even worse,
overwriting itself when we're calling saveenv.

Disable this option that is not critical until we can adress the issue
properly.

Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 7e3caa81 03-Dec-2017 Masahiro Yamada <masahiroy@kernel.org>

Move CONFIG_PANIC_HANG to Kconfig

Freescale (NXP) boards have lots of defconfig files per board.
I used "imply PANIC_HANG" for them.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# da5337a6 08-Nov-2017 Nandor Han <nandor.han@ge.com>

rtc: add support for s35392a

Add support for S35392A RTC. The driver supports both U-Boot driver
models.

Signed-off-by: Nandor Han <nandor.han@ge.com>
Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
Cc: Heiko Schocher <hs@denx.de>

# f52bdf4b 14-Sep-2017 Jean-Jacques Hiblot <jjhiblot@ti.com>

lib: allow building lzo for the SPL

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 85d8bf57 03-Sep-2017 Marek Behún <kabel@kernel.org>

lib: Add CRC32-C

This is needed for BTRFS.

Signed-off-by: Marek Behun <marek.behun@nic.cz>

create mode 100644 lib/crc32c.c

# 7264f292 15-Aug-2017 York Sun <york.sun@nxp.com>

spl: fit: Eanble GZIP support for image decompression

Add Kconfig option SPL_GZIP and SPL_ZLIB to enable gunzip support for
SPL boot, eg. falcon boot compressed kernel image.

Signed-off-by: York Sun <york.sun@nxp.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6ef2f901 11-Aug-2017 Adam Ford <aford173@gmail.com>

Convert CONFIG_BCH to Kconfig

This converts the following to Kconfig:
CONFIG_BCH

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1a7ba1d 18-Aug-2017 Anatolij Gustschin <agust@denx.de>

Fix 'notes' typos

s/notes/nodes

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 96b9082c 03-Aug-2017 Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

rockchip: rk3188: rock: adjust for SPL/TPL split

With the changes to split SPL/TPL for the RK3368, I apparently missed
some needed adjustments to the RK3188 Kconfig and rock_defconfig.

This fixes build-issues for the rock board after applying the RK3368
enablement (and SPL/TPL) set that resulted from TPL_SERIAL_SUPPORT,
TPL_ROCKCHIP_BACK_TO_BROM and TPL_TINY_MEMSET being separate symbols
now.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d56b4b19 22-Jul-2017 Tom Rini <trini@konsulko.com>

configs: Migrate RBTREE, LZO, CMD_MTDPARTS, CMD_UBI and CMD_UBIFS

The above CONFIG options are in Kconfig, and now have correct depends and
inter-dependencies. Migrate these to configs/ from include/configs/. In the
case of CMD_UBIFS also change it to be a default y if CMD_UBI.

Signed-off-by: Tom Rini <trini@konsulko.com>

# aed998aa 17-May-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_LZMA to Kconfig

This converts the following to Kconfig:
CONFIG_LZMA

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

# b1a873df 26-Apr-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_CMD_AES et al to Kconfig

This converts the following to Kconfig:
CONFIG_CMD_AES
CONFIG_AES

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Add select AES to CMD_AES]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 173aafbf 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

cmd: Expose a Kconfig option to enable UBIFS commands

Create a new Kconfig entry to allow CMD_UBIFS selection from Kconfig and
add an hidden LZO option that can be selected by CMD_UBIFS.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>

# aa049152 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

mtd: ubi: Select RBTREE option from MTD_UBI Kconfig entry

Expose the RBTREE feature through Kconfig and select this option from the
MTD_UBI option.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>
[Rebased on master]
Signed-off-by: Jagan Teki <jagan@openedev.com>

# ab4458bd 02-Apr-2017 Simon Glass <sjg@chromium.org>

string: Provide a slimmed-down memset()

Most of the time the optimised memset() is what we want. For extreme
situations such as TPL it may be too large. For example on the 'rock'
board, using a simple loop saves a useful 48 bytes. With gcc 4.9 and
the rodata bug, this patch is enough to reduce the TPL image below the
limit.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>

# bea79d7d 14-Mar-2017 Andre Przywara <andre.przywara@arm.com>

Kconfig: introduce md5sum command selection

So far CONFIG_MD5SUM would need to be set by a board's include file.
Since the command is really generic, move it over to Kconfig to allow
it to be defined by either a board's defconfig, menuconfig or some
config snippet merged via mergeconfig.sh.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e663b350 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

smbios: Expose in efi_loader as table

We can pass SMBIOS easily as EFI configuration table to an EFI payload. This
patch adds enablement for that case.

While at it, we also enable SMBIOS generation for ARM systems, since they support
EFI_LOADER.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4b6dddc2 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

x86: Move smbios generation into arch independent directory

We will need the SMBIOS generation function on ARM as well going forward,
so let's move it into a non arch specific location.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# ebf7fff2 05-Oct-2016 Heiko Schocher <hs@denx.de>

spl: move FDT_FIXUP_PARTITIONS to Kconfig

Move FDT_FIXUP_PARTITIONS to Kconfig and cleanup existing
uses.

Signed-off-by: Heiko Schocher <hs@denx.de>

# ddf67f71 05-Jul-2016 Maxime Ripard <maxime.ripard@free-electrons.com>

libfdt: Add overlay application function

The device tree overlays are a good way to deal with user-modifyable
boards or boards with some kind of an expansion mechanism where we can
easily plug new board in (like the BBB, the Raspberry Pi or the CHIP).

Add a new function to merge overlays with a base device tree.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>

# 91b86e21 26-May-2016 Marek Vasut <marex@denx.de>

lib: Enable private libgcc by default

This patch decouples U-Boot binary from the toolchain on systems where
private libgcc is available. Instead of pulling in functions provided
by the libgcc from the toolchain, U-Boot will use it's own set of libgcc
functions. These functions are usually imported from Linux kernel, which
also uses it's own libgcc functions instead of the ones provided by the
toolchain.

This patch solves a rather common problem. The toolchain can usually
generate code for many variants of target architecture and often even
different endianness. The libgcc on the other hand is usually compiled
for one particular configuration and the functions provided by it may
or may not be suited for use in U-Boot. This can manifest in two ways,
either the U-Boot fails to compile altogether and linker will complain
or, in the much worse case, the resulting U-Boot will build, but will
misbehave in very subtle and hard to debug ways.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 67976306 30-Mar-2016 Masahiro Yamada <masahiroy@kernel.org>

cosmetic: Fix typos "privide"

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# ed980b8c 03-Mar-2016 Alexander Graf <agraf@csgraf.de>

efi_loader: hook up in build environment

Now that we have all the bits and pieces ready for EFI payload loading
support, hook them up in Makefiles and KConfigs so that we can build.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
[trini: Enable only when we of OF_LIBFDT, disable on kwb and colibri_pxa270]
Signed-off-by: Tom Rini <trini@konsulko.com>

# aa34fbc0 22-Feb-2016 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt to be used in SPL

Add an option to enable libfdt in SPL. This can be useful when decoding
FIT files in SPL.

We need to make sure this option is not enabled in SPL by this change.
Also this option needs to be enabled in host builds. Si add a new
IMAGE_USE_LIBFDT #define which can be used in files that are built on the
host but must also build for U-Boot and SPL.

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

# 69e173eb 22-Feb-2016 Simon Glass <sjg@chromium.org>

Move CONFIG_OF_LIBFDT to Kconfig

Move this option to Kconfig and tidy up existing boards.

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

# a187559e 05-Feb-2016 Bin Meng <bmeng.cn@gmail.com>

Use correct spelling of "U-Boot"

Correct spelling of "U-Boot" shall be used in all written text
(documentation, comments in source files etc.).

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Minkyu Kang <mk7.kang@samsung.com>

# 947c626d 14-Jan-2016 Tom Rini <trini@konsulko.com>

vsprintf.c: Always enable CONFIG_SYS_VSNPRINTF

Enabling this function always removes some class of string saftey issues.
The size change here in general is about 400 bytes and this seems a reasonable
trade-off.

Cc: Peng Fan <peng.fan@nxp.com>
Cc: Peter Robinson <pbrobinson@gmail.com>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Adrian Alonso <aalonso@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 7d9cde10 22-Nov-2015 Stefan Roese <sr@denx.de>

lib/tiny-printf.c: Add tiny printf function for space limited environments

This patch adds a small printf() version that supports all basic formats.
Its intented to be used in U-Boot SPL versions on platforms with very
limited internal RAM sizes.

To enable it, just define CONFIG_USE_TINY_PRINTF in your defconfig. This
will result in the SPL using this tiny function and the main U-Boot
still using the full-blown printf() function.

This code was copied from:
http://www.sparetimelabs.com/printfrevisited
With mostly only coding style related changes so that its checkpatch
clean.

The size reduction is about 2.5KiB. Here a comparison for the db-mv784mp-gp
(Marvell AXP) SPL:

Without this patch:
58963 18536 1928 79427 13643 ./spl/u-boot-spl

With this patch:
56542 18536 1956 77034 12cea ./spl/u-boot-spl

Note:
To make it possible to compile tiny-printf.c instead of vsprintf.c when
CONFIG_USE_TINY_PRINTF is defined, the functions printf() and vprintf() are
moved from common/console.c into vsprintf.c in this patch.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>

# 2419cd16 03-Oct-2015 Simon Glass <sjg@chromium.org>

dm: tpm: Drop CONFIG_DM_TPM

Now that all TPM drivers use driver model, we can drop the special driver
model CONFIG option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>

# 027b728d 06-Oct-2015 Julius Werner <jwerner@chromium.org>

Add support for LZ4 decompression algorithm

This patch adds support for LZ4-compressed FIT image contents. This
algorithm has a slightly worse compression ration than LZO while being
nearly twice as fast to decompress. When loading images from a fast
storage medium this usually results in a boot time win.

Sandbox-tested only since I don't have a U-Boot development system set
up right now. The code was imported unchanged from coreboot where it's
proven to work, though. I'm mostly interested in getting this recognized
by mkImage for use in a downstream project.

Signed-off-by: Julius Werner <jwerner@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# a7d660bc 22-Aug-2015 Simon Glass <sjg@chromium.org>

tpm: Add Kconfig options for TPMs

Add new Kconfig options for TPMs in preparation for moving boards to use
Kconfig for TPM configuration.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 867a6ac8 31-Jul-2015 Simon Glass <sjg@chromium.org>

efi: Add start-up library code

When running as an EFI application, U-Boot must request memory from EFI,
and provide access to the boot services U-Boot needs.

Add library code to perform these tasks. This includes efi_main() which is
the entry point from EFI. U-Boot is built as a shared library.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d1389403 23-Jun-2015 Simon Glass <sjg@chromium.org>

Add a dhrystone benchmark command

Drystone provides a convenient sanity check that the CPU is running at full
speed. Add this as a command which can be enabled as needed.

Note: I investigated using Coremark for this but there was a license
agreement and I could not work out if it was GPL-compatible.

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

# f7848d90 22-Jun-2015 Joe Hershberger <joe.hershberger@ni.com>

Allow CONFIG_REGEX to be disabled when CONFIG_NET

Instead of selecting REGEX when NET is enabled, make it the default, but
allow boards that are tiny to disable it and lose functionality on all
but the first Ethernet adapter.

cm-bf548, bf538f-ezkit, and bf533-stamp need this. None appear to have
more than one Ethernet interface.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# 3850dbe8 11-Jun-2015 Masahiro Yamada <masahiroy@kernel.org>

blackfin: fix undefined reference to srand and rand

Commit 9ba9e85f3f1c (net: Fix NET_RANDOM_ETHADDR dependencies)
accidentally dropped CONFIG_LIB_RAND defines for 14 Blackfin boards.

Prior to that commit, those boards defined CONFIG_LIB_RAND, but not
CONFIG_NET_RANDOM_ETHADDR. So, commit 9ba9e85f3f1c should not have
touched them, but in fact it ripped CONFIG_LIB_RAND off from all the
header files, which caused undefined reference to srand and rand.
CONFIG_LIB_RAND=y must be revived for such boards.

BTW, this commit indeed makes it better, but even with this fix,
three boards (bf533-stamp, bf538f-ezkit, cm-bf548) still can not
build due to region 'ram' overflowed error. This was cause by
commit 6eed3786c68c (net: Move the CMD_NET config to defconfigs)
because CMD_NET selects NET, and NET selects REGEX. Eventually,
some boards were newly enabled with CONFIG_REGEX, increasing the
memory footprint. A patch is expected to fix the build error.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 9ba9e85f 25-May-2015 Michal Simek <michal.simek@amd.com>

net: Fix NET_RANDOM_ETHADDR dependencies

NET_RANDOM_ETHADDR depends on lib/rand.c. This patch adds dependency to
Kconfig to ensure that library is also compiled.

Remove the definitions from Blackfin boards' include/configs.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 6501ff62 20-Apr-2015 Przemyslaw Marczak <p.marczak@samsung.com>

lib: Kconfig: add entry for errno_str() function

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1a60650c 21-Apr-2015 Joe Hershberger <joe.hershberger@ni.com>

kconfig: Move REGEX to Kconfig

Having this as a Kconfig allows it to be a dependent feature.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8156345d 06-Mar-2015 Simon Glass <sjg@chromium.org>

sandbox: Move CONFIG_SYS_VSNPRINTF to Kconfig

Move this over to Kconfig and tidy up.

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

# 94e3c8c4 19-Feb-2015 gaurav rana <gaurav.rana@freescale.com>

crypto/fsl - Add progressive hashing support using hardware acceleration.

Currently only normal hashing is supported using hardware acceleration.
Added support for progressive hashing using hardware.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
Signed-off-by: Gaurav Rana <gaurav.rana@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>

# d9f23c7f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

lib/rsa: Add Kconfig for devices supporting RSA Modular Exponentiation

Kconfig option added for devices which support RSA Verification.
1. RSA_SOFTWARE_EXP
Enables driver for supporting RSA Modular Exponentiation in Software
2. RSA_FREESCALE_EXP
Enables driver for supporting RSA Modular Exponentiation using Freescale specific
driver

The above drivers use RSA uclass

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
(Removed duplicate line in Kconfig comment)

Change-Id: I7663c4d5350e2bfc3dfa2696f70ef777d6ccc6f6

# c4beb22f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

FIT: Modify option FIT_SIGNATURE in Kconfig

For FIT signature based approach to work, RSA library needs to be selected.
The FIT_SIGNATURE option in Kconfig is modified to automatically select RSA.
Selecting RSA compiles the RSA library required for image verification.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 45ccec8f 23-Oct-2014 Masahiro Yamada <masahiroy@kernel.org>

kconfig: move CONFIG_USE_PRIVATE_LIBGCC to Kconfig

The private libgcc is supported only on ARM, MIPS, PowerPC, SH, x86.
Those architectures should "select" HAVE_PRIVATE_LIBGCC and
CONFIG_USE_PRIVATE_LIBGCC should depend on it.

Currently, this option is enabled on Tegra boards and x86 architecture.
Move the definition from header files to Kconfig.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Tested-by: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: Tom Warren <twarren@nvidia.com>

# 8c688bc4 23-Oct-2014 Masahiro Yamada <masahiroy@kernel.org>

kconfig: move CONFIG_SYS_HZ to lib/Kconfig

CONFIG_SYS_HZ is always defined as 1000 in config_fallbacks.h
(but some boards still have redundant definitions).

This commit moves the definition and the document in README to
Kconfig. Since lib/Kconfig can assure that CONFIG_SYS_HZ is 1000,
the sanity check in lib/time.c should be removed.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Reviewed-by: Marek Vasut <marex@denx.de>

# b0928da6 16-Sep-2014 Masahiro Yamada <masahiroy@kernel.org>

kconfig: move CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED to Kconfig

If this option is enabled, the objects under lib/ directory
are compiled with speed optimization, not size optimization.
(Currently, only used by some Blackfin boards.)

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# ed36323f 16-Sep-2014 Masahiro Yamada <masahiroy@kernel.org>

kconfig: add blank Kconfig files

This would be useful to start moving various config options.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# 253f939a 20-Nov-2023 Tom Rini <trini@konsulko.com>

lib/Kconfig: Correct typo about SYSINFO_SMBIOS in help message

The correct symbol to enable to have SMBIOS populate fields based on the
device tree is SYSINFO_SMBIOS and not SMBIOS_SYSINFO.

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d5d9770f 27-Oct-2023 Tom Rini <trini@konsulko.com>

Merge tag 'tpm-next-27102023' of https://source.denx.de/u-boot/custodians/u-boot-tpm

bootX measurements and measurement API moved to u-boot core:

Up to now, U-Boot could perform measurements and EventLog creation as
described by the TCG spec when booting via EFI.

The EFI code was residing in lib/efi_loader/efi_tcg2.c and contained
both EFI specific code + the API needed to access the TPM, extend PCRs
and create an EventLog. The non-EFI part proved modular enough and
moving it around to the TPM subsystem was straightforward.

With that in place we can have a common API for measuring binaries
regardless of the boot command, EFI or boot(m|i|z), and contructing an
EventLog.

I've tested all of the EFI cases -- booting with an empty EventLog and
booting with a previous stage loader providing one and found no
regressions. Eddie tested the bootX part.

Eddie also fixed the sandbox TPM which couldn't be used for the EFI code
and it now supports all the required capabilities. This had a slight
sideeffect in our testing since the EFI subsystem initializes the TPM
early and 'tpm2 init' failed during some python tests. That code only
opens the device though, so we can replace it with 'tpm2 autostart'
which doesn't error out and still allows you to perfom the rest of the
tests but doesn't report an error if the device is already opened.

There's a few minor issues with this PR as well but since testing and
verifying the changes takes a considerable amount of time, I prefer
merging it now.

Heinrich has already sent a PR for -master containing "efi_loader: fix
EFI_ENTRY point on get_active_pcr_banks" and I am not sure if that will
cause any conflicts, but in any case they should be trivial to resolve.

Both the EFI and non-EFI code have a Kconfig for measuring the loaded
Device Tree. The reason this is optional is that we can't reason
when/if devices add random info like kaslr-seed, mac addresses etc in
the DT. In that case measurements are random, board specific and
eventually useless. The reason it was difficult to fix it prior to this
patchset is because the EFI subsystem and thus measurements was brought
up late and DT fixups might have already been applied. With this
patchset we can measure the DT really early in the future.

Heinrich also pointed out that the two Kconfigs for the DTB measurements
can be squashed in a single one and that the documentation only explains
the non-EFI case. I agree on both but as I said this is a sane working
version, so let's pull this first it's aleady big enough and painful to
test.


# 97707f12 24-Oct-2023 Eddie James <eajames@linux.ibm.com>

tpm: Support boot measurements

Add TPM2 functions to support boot measurement. This includes
starting up the TPM, initializing/appending the event log, and
measuring the U-Boot version. Much of the code was used in the
EFI subsystem, so remove it there and use the common functions.

Signed-off-by: Eddie James <eajames@linux.ibm.com>
For the API moving around from EFI -> u-boot core
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
For EFI testing
Tested-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

# 44071cd5 14-Oct-2023 Sean Anderson <seanga2@gmail.com>

fs: ext4: Fix building ext4 in SPL if write is enabled

If EXT4_WRITE is enabled, write capabilities will be compiled into SPL, but
not CRC16. Add an option to enable CRC16 to avoid linker errors.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 53fab13a 20-Sep-2023 Simon Glass <sjg@chromium.org>

efi: Use the installed SMBIOS tables

U-Boot should set up the SMBIOS tables during startup, as it does on x86.
Ensure that it does this correctly on non-x86 machines too, by creating
an event spy for last-stage init.

Tidy up the installation-condition code while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 8c11d19e 19-Sep-2023 Simon Glass <sjg@chromium.org>

x86: smbios: Add a Kconfig indicating SMBIOS-table presence

When booted from coreboot, U-Boot does not build the SMBIOS tables, but
it should still pass them on to the OS. Add a new option which indicates
whether SMBIOS tables are present, however they were built.

Flip the ordering so that the dependency is listed first, which is less
confusing.

Adjust GENERATE_SMBIOS_TABLE to depend on this new symbol.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 0c45c76c 19-Sep-2023 Simon Glass <sjg@chromium.org>

x86: Allow APCI in SPL

This is needed so we can find the DBG2 table provided by coreboot. Add a
Kconfig so it can be enabled.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 040a6048 14-Sep-2023 Simon Glass <sjg@chromium.org>

boot: Join FDT_FIXUP_PARTITIONS with related options

Move this to be with the other devicetree-fixup options.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 4cc40f61 14-Sep-2023 Simon Glass <sjg@chromium.org>

FWU: Avoid showing an unselectable menu option

Use a menuconfig to avoid showing a menu which cannot be selected in many
cases.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

# a90b5946 14-Sep-2023 Simon Glass <sjg@chromium.org>

lib: rational: Move the Kconfigs into the correct place

These should not be part of the 'system tables' menu. Move them outside
on their own.

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: 7d0f3fbb93c ("lib: rational: copy the rational fraction lib...")
Reviewed-by: Tom Rini <trini@konsulko.com>

# a077ac13 02-Aug-2023 Tom Rini <trini@konsulko.com>

Kconfigs: Correct default of "0" on hex type entries

It is not a parse error to have a default value of "0" for a "hex" type
entry, instead of "0x0". However, "0" and "0x0" are not treated the
same even by the tools themselves. Correct this by changing the default
value from "0" to "0x0" for all hex type questions that had the
incorrect default. Fix one instance (in two configs) of a default of "0"
being used on a hex question to be "0x0". Remove the cases where a
defconfig had set a value of "0x0" to be used as the default had been
"0".

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# af62d83c 03-Aug-2023 Oleksandr Suvorov <oleksandr.suvorov@foundries.io>

spl: move SPL_CRC32 option to lib/Kconfig

All SPL hash algorithm options are collected in lib/Kconfig. Move
SPL_CRC32 there as well.

Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
Reviewed-by: Simon Glass <sjg@chromium.org>

# dfe00b34 13-Jul-2023 Manorit Chawdhry <m-chawdhry@ti.com>

lib: Kconfig: k3: Enable SHA512 for fit signature

We are using our custMpk for signing that is a 4096 bit key, 4096 bit
rsa key requires a SHA512 hashing algorithm to be enabled as per the
source. Even though it is not mandated but this is how it works and is
tested.

Enables SHA512 if fit signature is enabled on K3 platforms.

Signed-off-by: Manorit Chawdhry <m-chawdhry@ti.com>

# 0992a90d 04-May-2023 Simon Glass <sjg@chromium.org>

acpi: Create a new Kconfig for ACPI

We have several Kconfig options for ACPI, but all relate to specific
functions, such as generating tables and AML code.

Add a new option which controls including basic ACPI library code,
including the lib/acpi directory. This will allow us to add functions
which are available even if table generation is not supported.

Adjust the command to avoid a build error when ACPIGEN is not enabled.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 94c8da21 22-Mar-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: Fix LMB_MEMORY_REGIONS flag usage

Remove test on CONFIG_LMB_MEMORY_REGIONS introduced by commit
7c1860fce4e3 ("lmb: Fix lmb property's defination under struct lmb").

This code in lmb_init() is strange, because if CONFIG_LMB_USE_MAX_REGIONS
and CONFIG_LMB_MEMORY_REGIONS are not defined, the implicit #else is empty
and the required initialization is not done:
lmb->memory.max = ?
lmb->reserved.max = ?

But this setting is not possible:
- CONFIG_LMB_USE_MAX_REGIONS not defined
- CONFIG_LMB_MEMORY_REGIONS not defined
because CONFIG_LMB_MEMORY_REGIONS and CONFIG_LMB_RESERVED_REGIONS are
defined as soon as the CONFIG_LMB_USE_MAX_REGIONS is not defined.

This patch removes this impossible case #elif and I add some
explanation in lmb.h to explain why in the struct lmb {} the lmb
property is defined if CONFIG_LMB_MEMORY_REGIONS is NOT defined.

This patch also removes CONFIG_LMB_XXX dependency on CONFIG_LMB as these
defines are used in API file lmb.h and not only in library file.

Fixes: 5e2548c1d6e03 ("lmb: Fix LMB_MEMORY_REGIONS flag usage")
Reported-by: Mark Millard <marklmi@yahoo.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Acked-by: Michal Simek <michal.simek@amd.com>

# c61df340 18-Mar-2023 Marek Vasut <marek.vasut+renesas@mailbox.org>

lib: Fix SYS_TIMER_COUNTS_DOWN description in Kconfig

The SYS_TIMER_COUNTS_DOWN description contains a typo,
s@rathe@&r@ , fix it.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>

# 3b510807 22-Feb-2023 Simon Glass <sjg@chromium.org>

lib: Add an SPL config for LIB_UUID

This is selected by PARTITION_UUIDS which has a separate option for SPL.
Add an SPL option for LIB_UUID also, so that we can keep them consistent.

Also add one for PARTITION_TYPE_GUID to avoid a build error in part_efi.c
which wants to call a uuid function in SPL.

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

# 5a6bc166 22-Feb-2023 Simon Glass <sjg@chromium.org>

lib: Add VPL options for SHA1 and SHA256

Add these options so these algorithms can be used in VPL.

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

# ae625d92 22-Feb-2023 Simon Glass <sjg@chromium.org>

lib: Add a Kconfig for SPL_BZIP2

This is implicitly used in the source and seems useful, so add it.

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

# c33425c6 15-Jan-2023 Simon Glass <sjg@chromium.org>

trace: Reduce the default for TRACE_EARLY_CALL_DEPTH_LIMIT

This is a silly value at present, since U-Boot's call depth never reaches
200. Fix it.

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

# 2dc16a2c 19-Jan-2023 Sjoerd Simons <sjoerd@collabora.com>

Bump LMB_MAX_REGIONS default to 16

Since commit 06d514d77c37 ("lmb: consider EFI memory map") the EFI regions
are also pushed into the lmb if EFI_LOADER is enabled (which is by
default on most system). Which can cause the number of entries to go
over the maximum as it's default is only 8.

Specifically i ran into this case on an TI am62 which has an fdt with
4 reserved regions (in practice 3 lmb entries due to adjecent ranges).

As this is likely to impact more devices bump the default max
regions to 16 so there is a bit more slack.

Fixes: 06d514d77c ("lmb: consider EFI memory map")
Link: https://bugzilla.opensuse.org/show_bug.cgi?id=1207562
Reviewed-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Signed-off-by: Sjoerd Simons <sjoerd@collabora.com>
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
[trini: collect tags from the other equivalent patch]

# 948d3999 08-Feb-2023 Tom Rini <trini@konsulko.com>

Revert "lmb: Default to not-LMB_USE_MAX_REGIONS"

As explained by Philippe Schenker, I was misinterpreting what happened
in the case where we do not set LMB_USE_MAX_REGIONS and so had
re-introduced the problem I was attempting to more widely resolve.

This reverts commit 007ae5d108a37564905ea1588cb279f3a522cc3d.

Reported-by: Philippe Schenker <philippe.schenker@toradex.com>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 007ae5d1 25-Jan-2023 Tom Rini <trini@konsulko.com>

lmb: Default to not-LMB_USE_MAX_REGIONS

The LMB code allows for picking a hard limit on the number of regions it
can know of, or to dynamically allocate these regions. The reason for
this choice is to allow for the compiler to perform a size optimization
in the common case. This optimization however, is very small, ranging
from 196 bytes to 15 bytes saved, or in some cases, being larger. Now
that we also have more regions covered by LMB (in order to protect
various parts of our self at run time), the default of 8 is also much
easier to hit and leads to non-obvious error messages (which imply that
an area is protected, not that we're out of areas to add to the list).

Switch to the dynamic use as the default.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 53c47c59 19-Jan-2023 Tom Rini <trini@konsulko.com>

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


# 4b9b25d9 12-Jan-2023 Brandon Maier <brandon.maier@collins.com>

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

[1] https://github.com/torvalds/linux/commit/e0c1b49f5b674cca7b10549c53b3791d0bbc90a8
[2] https://github.com/facebook/zstd/blob/f302ad8811643c428c4e3498e28f53a0578020d3/lib/libzstd.mk#L31

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>

# ebc1d50a 21-Dec-2022 Simon Glass <sjg@chromium.org>

Revert "fdtdec: drop needlessly convoluted CONFIG_PHANDLE_CHECK_SEQ"

The fdt_path_offset() function is slow since it must scan the tree.
This substantial overhead now applies to all boards.

The original code may not be ideal but it is fit for purpose and is only
needed on a few boards.

Reverting this reduces time to set up driver model by about 30ms.

Before revert:

Accumulated time:
47,170 dm_r
53,237 dm_spl
572,986 dm_f

Accumulated time:
44,598 dm_r
50,347 dm_spl
549,133 dm_f

This reverts commit 26f981f295d00351b6f0c69b5317b254b2361cc0.

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

# 12619d4e 21-Dec-2022 Simon Glass <sjg@chromium.org>

trace: Don't require TIMER_EARLY

Some platforms cannot honour this and don't need trace before relocation.
Use 'imply' instead, so boards can disable this.

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

# 0c16fca9 07-Jan-2023 Simon Glass <sjg@chromium.org>

tpm: Add a proper Kconfig option for crc8 in SPL

The current approach is a bit of a hack and only works for the tpm
subsystem. Add a Kconfig so that crc8 can be enabled in SPL for other
purposes.

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

# 14f43797 19-Dec-2022 Tom Rini <trini@konsulko.com>

Merge tag 'v2023.01-rc4' into next

Prepare v2023.01-rc4

Signed-off-by: Tom Rini <trini@konsulko.com>


# ae3527f0 07-Dec-2022 Kautuk Consul <kconsul@ventanamicro.com>

arch/riscv: add semihosting support for RISC-V

We add RISC-V semihosting based serial console for JTAG based early
debugging.

The RISC-V semihosting specification is available at:
https://github.com/riscv/riscv-semihosting-spec/blob/main/riscv-semihosting-spec.adoc

Signed-off-by: Anup Patel <apatel@ventanamicro.com>
Signed-off-by: Kautuk Consul <kconsul@ventanamicro.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>

# 1c03ab9f 07-Dec-2022 Kautuk Consul <kconsul@ventanamicro.com>

lib: Add common semihosting library

We factor out the arch-independent parts of the ARM semihosting
implementation as a common library so that it can be shared
with RISC-V.

Signed-off-by: Kautuk Consul <kconsul@ventanamicro.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>

# 3b8dfc42 16-Nov-2022 Tom Rini <trini@konsulko.com>

Convert CONFIG_SYS_TIMER_COUNTS_DOWN to Kconfig

This converts the following to Kconfig:
CONFIG_SYS_TIMER_COUNTS_DOWN

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 86794052 21-Oct-2022 Sughosh Ganu <sughosh.ganu@linaro.org>

FWU: Add support for the FWU Multi Bank Update feature

The FWU Multi Bank Update feature supports updating firmware images
to one of multiple sets(also called banks) of images. The firmware
images are clubbed together in banks, with the system booting images
from the active bank. Information on the images such as which bank
they belong to is stored as part of the metadata structure, which is
stored on the same storage media as the firmware images on a dedicated
partition.

At the time of update, the metadata is read to identify the bank to
which the images need to be flashed(update bank). On a successful
update, the metadata is modified to set the updated bank as active
bank to subsequently boot from.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

# 40ed7be4 02-Aug-2022 Tom Rini <trini@konsulko.com>

Convert CONFIG_SYS_FDT_PAD to Kconfig

This converts the following to Kconfig:
CONFIG_SYS_FDT_PAD

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e67ffb5a 22-Jul-2022 Sughosh Ganu <sughosh.ganu@linaro.org>

tpm: rng: Add driver model interface for TPM RNG device

The TPM device has a builtin random number generator(RNG)
functionality. Expose the RNG functions of the TPM device to the
driver model so that they can be used by the EFI_RNG_PROTOCOL if the
protocol is installed.

Also change the function arguments and return type of the random
number functions to comply with the driver model api.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

# b340199f 10-Jun-2022 Tom Rini <trini@konsulko.com>

spl: Ensure all SPL symbols in Kconfig have some SPL dependency

Tighten up symbol dependencies in a number of places. Ensure that a SPL
specific option has at least a direct dependency on SPL. In places
where it's clear that we depend on something more specific, use that
dependency instead. This means in a very small number of places we can
drop redundant dependencies.

Reported-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 13ce351b 08-Jun-2022 Tom Rini <trini@konsulko.com>

vpl: Ensure all VPL symbols in Kconfig have some VPL dependency

Tighten up symbol dependencies in a number of places. Ensure that a VPL
specific option has at least a direct dependency on VPL. In places
where it's clear that we depend on something more specific, use that
dependency instead.

Reported-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 8bea4bf7 08-Jun-2022 Tom Rini <trini@konsulko.com>

tpl: Ensure all TPL symbols in Kconfig have some TPL dependency

Tighten up symbol dependencies in a number of places. Ensure that a TPL
specific option has at least a direct dependency on TPL. In places
where it's clear that we depend on something more specific, use that
dependency instead.

Reported-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 26f981f2 19-May-2022 Rasmus Villemoes <rasmus.villemoes@prevas.dk>

fdtdec: drop needlessly convoluted CONFIG_PHANDLE_CHECK_SEQ

Asking if the alias we found actually points at the device tree node
we passed in (in the guise of its offset from blob) can be done simply
by asking if the fdt_path_offset() of the alias' path is identical to
offset.

In fact, the current method suffers from the possibility of false
negatives: dtc does not necessarily emit a phandle property for a node
just because it is referenced in /aliases; it only emits a phandle
property for a node if it is referenced in <angle brackets>
somewhere. So if both the node we passed in and the alias node we're
considering don't have phandles, fdt_get_phandle() returns 0 for both.

Since the proper check is so simple, there's no reason to hide that
behind a config option (and if one really wanted that, it should be
called something else because there's no need to involve phandle in
the check).

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Acked-by: Aswath Govindraju <a-govindraju@ti.com>

# d30924f1 01-May-2022 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: fix selection of CONFIG_CHARSET

lib/charset.c is not optional for
EFI_APP || EFI_LOADER || UFS || UT_UNICODE.
These must select CONFIG_CHARSET.

Fixes: 726cd9836db0 ("efi: Make unicode printf available to the app")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>

# 747093dd 30-Apr-2022 Simon Glass <sjg@chromium.org>

vpl: Add Kconfig options for VPL

Add VPL versions of commonly used Kconfig options.

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

# 11232139 06-Apr-2022 Tom Rini <trini@konsulko.com>

nds32: Remove the architecture

As removal of nds32 has been ack'd for the Linux kernel, remove support
here as well.

Cc: Rick Chen <rick@andestech.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Rick Chen <rick@andestech.com>

# fd210fee 28-Mar-2022 Philippe Reynes <philippe.reynes@softathome.com>

lib: allow to build asn1 decoder and oid registry in SPL

This commit adds the options:
- SPL_ASN1_DECODER
- SPL_OID_REGISTRY

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>

# 7d44a985 28-Mar-2022 Philippe Reynes <philippe.reynes@softathome.com>

lib: Kconfig: enhance the help of OID_REGISTRY

Enhance the help for the config OID_REGISTRY.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>

# a0e71d96 28-Mar-2022 Philippe Reynes <philippe.reynes@softathome.com>

lib: Kconfig: enhance help for ASN1

Enhance the help for configs ASN1_COMPILER
and ASN1_decoder.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>

# 761a1786 27-Jan-2022 Tom Rini <trini@konsulko.com>

Merge tag 'dm-pull-26jan22' of https://source.denx.de/u-boot/custodians/u-boot-dm

acpi refactoring to allow non-x86 use
binman support for bintools (binary tools)
minor tools improvements in preparation for FDT signing
various minor fixes and improvements


# 334a9b9d 25-Nov-2021 Loic Poulain <loic.poulain@linaro.org>

lib/circbuf: Make circbuf selectable symbol

It is currenly only used from usbtty driver but make it properly
selectable via Kconfig symbol, for future usage.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>

# e1722fcb 01-Dec-2021 Simon Glass <sjg@chromium.org>

x86: Allow any arch to generate ACPI tables

These have sadly found their way to ARM now. Allow any arch to support
generating ACPI tables.

Disable this for the tools build.

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

# 7c3fd5c2 26-Dec-2021 Qu Wenruo <wqu@suse.com>

lib: add BLAKE2 hash support

The code is cross-ported from BLAKE2 reference implementation
(https://github.com/BLAKE2/BLAKE2).

With minimal change to remove unused macros/features.

Currently there is only one user inside U-boot (btrfs), and since it
only utilize BLAKE2B, all other favors are all removed.

Signed-off-by: Qu Wenruo <wqu@suse.com>
[trini: Rename ROUND to R to avoid clash with <linux/bitops.h>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 97f2a749 04-Jan-2022 Eugen Hristev <eugen.hristev@collabora.com>

lib: Kconfig: fix PHANDLE_CHECK_SEQ position outside of menu

CONFIG_PHANDLE_CHECK_SEQ is outside of the menu 'Library routines'
thus it's invisible in menuconfig and cannot be selected.
Fix this by moving the 'endmenu' after the PHANDLE_CHECK_SEQ definition

Fixes: c589132a1d ("fdt: Use phandle to distinguish DT nodes with same name")
Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
Reviewed-by: Aswath Govindraju <a-govindraju@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 726cd983 29-Dec-2021 Simon Glass <sjg@chromium.org>

efi: Make unicode printf available to the app

This is needed to show unicode strings. Enable this code in the app.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>

# 6405ab7a 24-Nov-2021 Simon Glass <sjg@chromium.org>

Convert CONFIG_PHYSMEM to Kconfig

This converts the following to Kconfig:
CONFIG_PHYSMEM

Signed-off-by: Simon Glass <sjg@chromium.org>
Suggested-by: Sean Anderson <seanga2@gmail.com>

# ac7606af 14-Nov-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

lmb: fix typo 'commun'

%s/commun/common/

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

# e7d285b2 25-Sep-2021 Simon Glass <sjg@chromium.org>

image: Use the correct checks for CRC32

Add a host Kconfig for CRC32. With this we can use CONFIG_IS_ENABLED(CRC32)
directly in the host build, so drop the unnecessary indirection.

Add a few more conditions to SPL_CRC32 to avoid build failures as well as
TPL_CRC32. Also update hash.c to make crc32 optional and to actually take
notice of SPL_CRC32.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# 2c21256b 25-Sep-2021 Simon Glass <sjg@chromium.org>

hash: Use Kconfig to enable hashing in host tools and SPL

At present when building host tools, we force CONFIG_SHAxxx to be enabled
regardless of the board Kconfig setting. This is done in the image.h
header file.

For SPL we currently just assume the algorithm is desired if U-Boot proper
enables it.

Clean this up by adding new Kconfig options to enable hashing on the host,
relying on CONFIG_IS_ENABLED() to deal with the different builds.

Add new SPL Kconfigs for hardware-accelerated hashing, to maintain the
current settings.

This allows us to drop the image.h code and the I_WANT_MD5 hack.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# 603d15a5 25-Sep-2021 Simon Glass <sjg@chromium.org>

spl: cypto: Bring back SPL_ versions of SHA

Unfortunately these were removed by mistake. This means that adding hash
support to SPL brings in all software algorithms, with a substantial
increase in code size.

The origin of the problem was renaming them to SPL_FIT_xxx and then these
were removed altogether in a later commit.

Add them back. This aligns with CONFIG_MD5, for example, which has an SPL
variant.

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: f5bc9c25f31 ("image: Rename SPL_SHAxxx_SUPPORT to SPL_FIT_SHAxxx")
Fixes: eb5171ddec9 ("common: Remove unused CONFIG_FIT_SHAxxx selectors")
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# 6674edaa 16-Sep-2021 Tom Rini <trini@konsulko.com>

Merge tag 'v2021.10-rc4' into next

Prepare v2021.10-rc4

Signed-off-by: Tom Rini <trini@konsulko.com>

# gpg: Signature made Tue 14 Sep 2021 06:58:32 PM EDT
# gpg: using RSA key 1A3C7F70E08FAB1707809BBF147C39FF9634B72C
# gpg: Good signature from "Thomas Rini <trini@konsulko.com>" [ultimate]

# Conflicts:
# board/Arcturus/ucp1020/spl.c
# cmd/mvebu/Kconfig
# common/Kconfig.boot
# common/image-fit.c
# configs/UCP1020_defconfig
# configs/sifive_unmatched_defconfig
# drivers/pci/Kconfig
# include/configs/UCP1020.h
# include/configs/sifive-unmatched.h
# lib/Makefile
# scripts/config_whitelist.txt


# 5145bc73 01-Sep-2021 Oleksandr Suvorov <oleksandr.suvorov@foundries.io>

lib: fix typos in Kconfig

There are trivial typos in the Kconfig file. Fixed them.
Also, fixed grammar in the descriptions with typos.

Fixes: d56b4b1974 ("configs: Migrate RBTREE, LZO, CMD_MTDPARTS, CMD_UBI and CMD_UBIFS")
Fixes: 7264f2928b ("spl: fit: Eanble GZIP support for image decompression")
Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# e60e4499 02-Sep-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

lib: Drop SHA512_ALGO in lieu of SHA512

SHA512_ALGO was used as a "either SHA512 or SHA384", although the
implementations of these two algorithms share a majority of code.

From a Kconfig interface perspective, it makes sense to present two
distinct options. This requires #ifdefing out the SHA512
implementation from sha512.c. The latter doesn't make any sense.

It's reasonable to say in Kconfig that SHA384 depends on SHA512, and
seems to be the more polite way to handle the selection.

Thus, automatically select SHA512 when SHA384 is enabled.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# b4c2c151 27-Aug-2021 Michal Simek <michal.simek@amd.com>

Kconfig: Remove all default n/no options

default n/no doesn't need to be specified. It is default option anyway.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
[trini: Rework FSP_USE_UPD portion]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 928a8be7 29-Jul-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

lib: ecdsa: Implement UCLASS_ECDSA verification on target

Implement the crypto_algo .verify() function for ecdsa256. Because
it backends on UCLASS_ECDSA, this change is focused on parsing the
keys from devicetree and passing this information to the specific
UCLASS driver.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# fa3f1f1d 24-Jul-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: disable CONFIG_SPL_HEXDUMP by default

CONFIG_HEXDUMP is needed to display UEFI variables using 'printenv -e'.

Enabling CONFIG_SPL_HEXDUMP only makes sense for debugging purposes.
Hence CONFIG_SPL_HEXDUMP should not be enabled by default.

The following boards currently have CONFIG_SPL_HEXDUMP=y. This includes
boards that don't use SPL at all.

axm_defconfig
imx8mm-cl-iot-gate_defconfig
imx8mm_venice_defconfig
imxrt1020-evk_defconfig
imxrt1050-evk_defconfig
kontron_sl28_defconfig
kp_imx53_defconfig
lx2160ardb_tfa_stmm_defconfig
mt7622_rfb_defconfig
octeon_ebb7304_defconfig
octeon_nic23_defconfig
qemu_arm64_defconfig
qemu_arm_defconfig
qemu-riscv32_defconfig
qemu-riscv32_smode_defconfig
qemu-riscv64_defconfig
qemu-riscv64_smode_defconfig
qemu-x86_64_defconfig
qemu-x86_defconfig
sandbox64_defconfig
sandbox_defconfig
stm32mp15_basic_defconfig
stm32mp15_trusted_defconfig
synquacer_developerbox_defconfig
taurus_defconfig
xilinx_versal_virt_defconfig

The patch only keeps it enabled on

sandbox_spl_defconfig

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 1a46cb6c 02-Jul-2021 Simon Glass <sjg@chromium.org>

lib: Create a new Kconfig option for charset conversion

Rather than looking at two KConfig options in the Makefile, create a new
Kconfig option for compiling lib/charset.c

Enable it for UFS also, which needs this support.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 26dd9936 08-Jul-2021 Steffen Jaeckel <jaeckel-floss@eyet-services.de>

lib: add crypt subsystem

Add the basic functionality required to support the standard crypt
format.
The files crypt-sha256.c and crypt-sha512.c originate from libxcrypt and
their formatting is therefor retained.
The integration is done via a crypt_compare() function in crypt.c.

```
libxcrypt $ git describe --long --always --all
tags/v4.4.17-0-g6b110bc
```

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 7d0f3fbb 11-Jun-2021 Tero Kristo <t-kristo@ti.com>

lib: rational: copy the rational fraction lib routines from Linux

Copy the best rational approximation calculation routines from Linux.
Typical usecase for these routines is to calculate the M/N divider
values for PLLs to reach a specific clock rate.

This is based on linux kernel commit:
"lib/math/rational.c: fix possible incorrect result from rational
fractions helper"
(sha1: 323dd2c3ed0641f49e89b4e420f9eef5d3d5a881)

Signed-off-by: Tero Kristo <t-kristo@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Tero Kristo <kristo@kernel.org>

# ec0512b1 24-May-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

Revert "lib: introduce HASH_CALCULATE option"

When we think of Kconfig, we usually think of features that we like
to enable or not. Ideally, we wouldn't use Kconfig to fix a build
issue, although sometimes it might make sense. With Kconfig it's hard
to guarantee that the fix is universal. We can only say that it works
for the set of tested configurations. In the majority of cases, it's
preferable to let the linker figure things out for us.

The reverted commit attempted to fix a build issue by adding an
invisible Kconfig option. This is wrong in several ways:

It invents a new Kconfig variable when CONFIG_HASH already
exists for the same purpose.
Second, hash-checksum.c makes use of the hash_progressive_lookup_algo()
symbol, which is only provided with CONFIG_HASH, but this dependency
was not expressed in the reverted patch.

It feels like Kconfig is turning into a listing of all available
source files, and a buffet to 'select' which ones to compile. The
purpose of this revert is to enable the next change to make use of
CONFIG_HASH instead of adding to Kconfig.

This reverts commit 87316da05f2fd49d3709275e64ef0c5980366ade.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Acked-by: Masahisa Kojima <masahisa.kojima@linaro.org>

# 1621d3c4 10-May-2021 Bin Meng <bmeng.cn@gmail.com>

lib: kconfig: Limit BINMAN_FDT for OF_SEPARATE or OF_EMBED

Generally speaking BINMAN_FDT makes sense for OF_SEPARATE or OF_EMBED.
For the other OF_CONTROL methods, it's quite possible binman node is
not available as binman is invoked during the build phase instead of
runtime. Let's only turn it on for OF_SEPARATE or OF_EMBED by default.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 87316da0 13-May-2021 Masahisa Kojima <masahisa.kojima@linaro.org>

lib: introduce HASH_CALCULATE option

Build error occurs when CONFIG_EFI_SECURE_BOOT or
CONFIG_EFI_CAPSULE_AUTHENTICATE is enabled,
because hash-checksum.c is not compiled.

Since hash_calculate() implemented in hash-checksum.c can be
commonly used aside from FIT image signature verification,
this commit itroduces HASH_CALCULATE option to decide
if hash-checksum.c shall be compiled.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# e2ae483c 13-May-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

hash: Kconfig option for SHA512 hardware acceleration

Commit a479f103dc1c ("hash: Allow for SHA512 hardware implementations")
defined function definitions for hardware accelerated SHA384 and SHA512.
If CONFIG_SHA_HW_ACCEL=y, these functions are used.

We already have boards using CONFIG_SHA_HW_ACCEL=y but none implements the
new functions hw_sha384() and hw_sha512().

For implementing the EFI TCG2 protocol we need SHA384 and SHA512. The
missing hardware acceleration functions lead to build errors on boards like
peach-pi_defconfig.

Introduce a new Kconfig symbol CONFIG_SHA512_HW_ACCEL to control if the
functions hw_sha384() and hw_sha512() shall be used to implement the SHA384
and SHA512 algorithms.

Fixes: a479f103dc1c ("hash: Allow for SHA512 hardware implementations")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

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

# 6d66502b 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: Add 2 config to define the max number of regions

Add 2 configs CONFIG_LMB_MEMORY_REGIONS and CONFIG_LMB_RESERVED_REGIONS
to change independently the max number of the regions in lmb
library.

When CONFIG_LMB_USE_MAX_REGIONS=y, move the lmb property arrays to
struct lmb and manage the array size with the element 'max' of struct
lmb_region; their are still allocated in stack.

When CONFIG_LMB_USE_MAX_REGIONS=n, keep the current location in
struct lmb_region to allow compiler optimization.

Increase CONFIG_LMB_RESERVED_REGIONS is useful to avoid lmb errors in
bootm when the number of reserved regions (not adjacent) is reached:
+ 1 region for relocated U-Boot
+ 1 region for initrd
+ 1 region for relocated linux device tree
+ reserved memory regions present in Linux device tree.

The current limit of 8 regions is reached with only 5 reserved regions
in DT.

see Linux kernel commit bf23c51f1f49 ("memblock: Move memblock arrays
to static storage in memblock.c and make their size a variable")

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# 4fa0150d 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: move MAX_LMB_REGIONS value in Kconfig

Move MAX_LMB_REGIONS value in Kconfig, the max number of the regions
in lmb library.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# 77b8cfef 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: move CONFIG_LMB in Kconfig

Migrate CONFIG_LMB in Kconfig.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# a479f103 16-Feb-2021 Joel Stanley <joel@jms.id.au>

hash: Allow for SHA512 hardware implementations

Similar to support for SHA1 and SHA256, allow the use of hardware hashing
engine by enabling the algorithm and setting CONFIG_SHA_HW_ACCEL /
CONFIG_SHA_PROG_HW_ACCEL.

Signed-off-by: Joel Stanley <joel@jms.id.au>

# f2c1442e 14-Mar-2021 Simon Glass <sjg@chromium.org>

bloblist: Make BLOBLIST_TABLES depend on BLOBLIST

Add an extra condition here since we cannot put x86 tables in a bloblist
when bloblists are not supported.

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

# e0103158 25-Feb-2021 Bin Meng <bmeng.cn@gmail.com>

lib: kconfig: Mention CONFIG_ADDR_MAP limitation in the help

Mention that CONFIG_ADDR_MAP only works in the post-relocation phase.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>

# 56e7257c 03-Feb-2021 Bin Meng <bmeng.cn@gmail.com>

lib: Fix BINMAN_FDT dependency

lib/binman.c references the following 3 ofnode APIs:
ofnode_first_subnode(), ofnode_path() and ofnode_read_bool().

These APIs get built only when DM is on. Fix the dependency then.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 59e4e391 18-Jan-2021 Tom Rini <trini@konsulko.com>

Merge https://gitlab.denx.de/u-boot/custodians/u-boot-riscv

- Update qemu-riscv.rst build instructions.
- Add support for SPI on Kendryte K210.
- Add Microchip PolarFire SoC Icicle Kit support.
- Add support for an early timer.
- Select TIMER_EARLY to avoid infinite recursion for Trace.


# a80f8513 17-Jan-2021 Pragnesh Patel <pragnesh.patel@sifive.com>

trace: select TIMER_EARLY to avoid infinite recursion

When tracing functions is enabled this adds calls to
__cyg_profile_func_enter() and __cyg_profile_func_exit() to the traced
functions.

__cyg_profile_func_enter() and __cyg_profile_func_exit() invoke
timer_get_us() to record the entry and exit time.

initr_dm() will make gd->dm_root = NULL and gd->timer = NULL, so
timer_get_us() -> get_ticks() -> dm_timer_init() will lead to an
indefinite recursion.

So select TIMER_EARLY when tracing got enabled.

Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Rick Chen <rick@andestech.com>

# 6205bbb1 04-Jan-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lib: cosmetic update of CONFIG_LIB_ELF description

Change 2 typo error in CONFIG_LIB_ELF description:
- Supoort => Support
- fir => for

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c589132a 02-Dec-2020 Aswath Govindraju <a-govindraju@ti.com>

fdt: Use phandle to distinguish DT nodes with same name

While assigning the sequence number to subsystem instances by reading the
aliases property, only DT nodes names are compared and not the complete
path. This causes a problem when there are two DT nodes with same name but
have different paths.

In arch/arm/dts/k3-am65-main.dtsi there are two USB controllers with the
same device tree node name but different path. When aliases are defined for
these USB controllers then fdtdec_get_alias_seq() fails to pick the correct
instance for a given index.

fdt_path_offset() function is slow and this would effect the U-Boot
startup. To avert the time penalty on all boards, apply this extra check
only when required by using a config option.

Fix it by comparing the phandles of DT nodes after the node names match,
under a config option.

Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Fix whitespace error in Kconfig:
Signed-off-by: Simon Glass <sjg@chromium.org>

# 28cef9ca 19-Nov-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

fs: fat: create correct short names

The current function set_name() used to create short names has the
following deficiencies resolved by this patch:

* Long names (e.g. FOO.TXT) are stored even if a short name is enough.
* Short names with spaces are created, e.g. "A ~1.TXT".
* Short names with illegal characters are created, e.g. "FOO++BAR".
* Debug output does not not consider that the short file name has no
concluding '\0'.

The solution for the following bug is split of into a separate patch:

* Short file names must be unique.

This patch only provides the loop over possible short file names.

Fixes: c30a15e590c ("FAT: Add FAT write feature")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# e4f8e543 05-Nov-2020 Simon Glass <sjg@chromium.org>

smbios: Drop the unused Kconfig options

Now that we can use devicetree to specify this information, drop the old
CONFIG options.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 44c74bdd 05-Nov-2020 Simon Glass <sjg@chromium.org>

sysinfo: Provide a default driver to set SMBIOS values

Some boards want to specify the manufacturer or product name but do not
need to have their own sysinfo driver.

Add a default driver which provides a way to specify this SMBIOS
information in the devicetree, without needing any board-specific
functionality.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d2cb7a22 04-Nov-2020 Simon Glass <sjg@chromium.org>

x86: Allow putting some tables in the bloblist

At present all tables are placed starting at address f0000 in memory, and
can be up to 64KB in size. If the tables are very large, this may not
provide enough space.

Also if the tables point to other tables (such as console log or a ramoops
area) then we must allocate other memory anyway.

The bloblist is a nice place to put these tables since it is contiguous,
which makes it easy to reserve this memory for linux using the 820 tables.

Add an option to put some of the tables in the bloblist. For SMBIOS and
ACPI, create suitable pointers from the f0000 region to the new location
of the tables.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
[bmeng: squashed in http://patchwork.ozlabs.org/project/uboot/patch/
20201105062407.1.I8091ad931cbbb5e3b6f6ababdf3f8d5db0d17bb9@changeid/]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# 415eab06 03-Nov-2020 Christian Gmeiner <christian.gmeiner@gmail.com>

smbios: add parsing API

Add a very simple API to be able to access SMBIOS strings
like vendor, model and bios version.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 72eda507 27-Oct-2020 Sean Anderson <seanga2@gmail.com>

lib: Add getopt

Some commands can get very unweildy if they have too many positional
arguments. Adding options makes them easier to read, remember, and
understand.

This implementation of getopt has been taken from barebox, which has had
option support for quite a while. I have made a few modifications to their
version, such as the removal of opterr in favor of a separate getopt_silent
function. In addition, I have moved all global variables into struct
getopt_context.

The getopt from barebox also re-orders the arguments passed to it so that
non-options are placed last. This allows users to specify options anywhere.
For example, `ls -l foo/ -R` would be re-ordered to `ls -l -R foo/` as
getopt parsed the options. However, this feature conflicts with the const
argv in cmd_tbl->cmd. This was originally added in 54841ab50c ("Make sure
that argv[] argument pointers are not modified."). The reason stated in
that commit is that hush requires argv to stay unmodified. Has this
situation changed? Barebox also uses hush, and does not have this problem.
Perhaps we could use their fix?

I have assigned maintenance of getopt to Simon Glass, as it is currently
only used by the log command. I would also be fine maintaining it.

Signed-off-by: Sean Anderson <seanga2@gmail.com>

# 26637e2e 12-Sep-2020 Simon Glass <sjg@chromium.org>

lib: Allow hexdump to be used in SPL

It is sometimes useful to output hex dumps in SPL. Add a config option to
allow this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# e87dfb05 05-Aug-2020 Andrii Anisov <andrii_anisov@epam.com>

lib: sscanf: add sscanf implementation

Port sscanf implementation from mini-os and introduce new
Kconfig option to enable it: CONFIG_SSCANF. Disable by default.

Signed-off-by: Andrii Anisov <andrii_anisov@epam.com>
Signed-off-by: Anastasiia Lukianenko <anastasiia_lukianenko@epam.com>
Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>

# 81014f73 30-Jul-2020 Joao Marcos Costa <joaomarcos.costa@bootlin.com>

include/u-boot, lib/zlib: add sources for zlib decompression

Add zlib (v1.2.11) uncompr() function to U-Boot. SquashFS depends on
this function to decompress data from a raw disk image. The actual
support for zlib into SquashFS sources will be added in a follow-up
commit.

Signed-off-by: Joao Marcos Costa <joaomarcos.costa@bootlin.com>

# 69be8fd1 03-Jun-2020 Marek Szyprowski <m.szyprowski@samsung.com>

powerpc: move ADDR_MAP to Kconfig

Move ADDR_MAP related config options from include/configs/*.h to the
proper place in lib/Kconfig. This has been done using
./tools/moveconfig.py and manual inspection of the generated changes.
This is a preparation to use ADDR_MAP helper on ARM 32bit Raspberry Pi4
board for mapping the PCIe XHCI MMIO, which is above the 4GiB identity
mapping limit.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# d16b38f4 15-Apr-2020 Reuben Dowle <reubendowle0@gmail.com>

Add support for SHA384 and SHA512

The current recommendation for best security practice from the US government
is to use SHA384 for TOP SECRET [1].

This patch adds support for SHA384 and SHA512 in the hash command, and also
allows FIT images to be hashed with these algorithms, and signed with
sha384,rsaXXXX and sha512,rsaXXXX

The SHA implementation is adapted from the linux kernel implementation.

[1] Commercial National Security Algorithm Suite
http://www.iad.gov/iad/programs/iad-initiatives/cnsa-suite.cfm

Signed-off-by: Reuben Dowle <reuben.dowle@4rf.com>

# 43e442a5 26-May-2020 Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

kconfig: fix some typos

Signed-off-by: Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

# eff5a547 22-May-2020 Michael Walle <michael@walle.cc>

cmd: zip: automatically pull in gzip()

Move the CONFIG_GZIP_COMPRESSED from a config.h macro to a Kconfig menu
item. It is not selectable by a user because there is no reason to do
so. Instead it will be automatically selected by the stuff which uses
gzip(), like the zip command.

Remove it from the config_whitelist.txt. Also remove
CONFIG_GZIP_COMPRESS_DEF_SZ as this was never used on any board. The
default seems to be sane, otherwise it should be added as a Kconfig
option.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8239be61 06-May-2020 Simon Glass <sjg@chromium.org>

lib: Allow MD5 to be enabled in SPL

At present the MD5 option cannot be enabled by board configs since it has
no Kconfig name. It is generally enabled, so long as FIT support is
present. But not all boards use FIT, particularly in SPL

Fix this and add an option for SPL as well. This allows board code to call
md5() even if FIT support is not enabled.

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

# 04cb3994 21-Apr-2020 Weijie Gao <weijie.gao@mediatek.com>

lib: enable lzma decompression support for SPL build

This patch enables LZMA decompression support for SPL build

Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>

# 2a2119e1 05-Mar-2020 Atish Patra <atishp@atishpatra.org>

lib: kconfig: Add option to set BZIP2 compression method

There is no way to select BZIP2 compression method.
Add it under library/compression config where all other
compression related configs are present.

Signed-off-by: Atish Patra <atish.patra@wdc.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 805b3cac 12-Feb-2020 Keerthy <j-keerthy@ti.com>

lib: elf: Move the generic elf loading/validating functions to lib

Move the generic elf loading/validating functions to lib/
so that they can be re-used and accessed by code existing
outside cmd.

While at it remove the duplicate static version of load_elf_image_phdr
under arch/arm/mach-imx/imx_bootaux.c.

Signed-off-by: Keerthy <j-keerthy@ti.com>
Suggested-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>

# 1611235b 19-Jan-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: Kconfig dependencies for pseudo-random library

drivers/rng/sandbox_rng.c requires rand() to be defined but configuration
option CONFIG_CONFIG_LIB_RAND selected in drivers/rng/Kconfig does not
exist.

test/lib/test_aes.c requires rand() to be defined.

Fix the selection criteria for choice "Pseudo-random library support type".

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 3c10dc95 06-Dec-2019 Simon Glass <sjg@chromium.org>

binman: Add a library to access binman entries

SPL and TPL can access information about binman entries using link-time
symbols but this is not available in U-Boot proper. Of course it could be
made available, but the intention is to just read the device tree.

Add support for this, so that U-Boot can locate entries.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# b4adf627 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: crypto: add x509 parser

Imported from linux kernel v5.3:
x509.asn1 without changes
x509_akid.asn1 without changes
x509_parser.h without changes
x509_cert_parser.c with changes marked as __UBOOT__
x509_public_key.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# a9b45e6e 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add oid registry utility

Imported from linux kernel v5.3:
build_OID_registry without changes
oid_registry.h without changes
oid_registry.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# ab8a0e06 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add asn1 decoder

Imported from linux kernel v5.3:
lib/asn1_decoder.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 2b12196d 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

cmd: add asn1_compiler

Imported from linux kernel v5.3:
asn1.h without changes
asn1_ber_bytecode.h without changes
asn1_decoder.h without changes
asn1_compiler.c without changes

This host command will be used to create a ASN1 parser, for example,
for pkcs7 messages or x509 certificates. More specifically, it will
generate *byte code* which will be interpreted by asn1 decoder library.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 05429b6c 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

rtc: move date.c from drivers/rtc/ to lib/

In the next commit, rtc_mktime(), for compatibility with linux, will be
implemented using rtc_mktime(), which is no longer drivers/rtc specific.
So move this file under lib/.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 37ef1774 10-Nov-2019 Thomas Hebb <tommyhebb@gmail.com>

Kconfig: disambiguate config names for tiny printf

27084c03d36a ("spl: Allow tiny printf() to be controlled in SPL and
TPL") split this option in two for TPL and SPL, but didn't change the
Kconfig names, making them hard to set quickly.

Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>

# 0d76afc0 27-Oct-2019 Simon Glass <sjg@chromium.org>

fdt: Add Kconfig options to control code size

For better or worse libfdt recent grew a lot of code that checks the
validity of the device tree in great detail. When using unsigned or
unverified data this makes things safer, but it does add to code size.

Add some controls to select the trade-off between safety and code size.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 27084c03 25-Sep-2019 Simon Glass <sjg@chromium.org>

spl: Allow tiny printf() to be controlled in SPL and TPL

At present there is only one control for this and it is used for both SPL
and TPL. But SPL might have a lot more space than TPL so the extra cost of
a full printf() might be acceptable.

Split the option into two, providing separate SPL and TPL controls. The
TPL setting defaults to the same as SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2a51e16b 07-Jun-2019 Tom Rini <trini@konsulko.com>

configs: Make USE_TINY_PRINTF depend on SPL||TPL and be default

The USE_TINY_PRINTF symbol only changes things within SPL and TPL
builds, so make it depend on that support. Next, make it default as
within these cases we should rarely have need of more advanced print
formats outside of the debug context.

To do this, in a few cases we need to correct our Kconfig dependencies
as we had cases of non-SPL targets select'ing this symbol. Finally, in
the case of a few boards we really do need the full printf
functionality.

Signed-off-by: Tom Rini <trini@konsulko.com>

# da0fb5fd 02-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: make call depth limit customizable

Up to now we had hard coded values for the call depth up to which trace
records are created: 200 for early tracing, 15 thereafter. UEFI
applications reach a call depth of 80 or above.

Provide customizing settings for the call trace depth limit and the early
call trace depth limit. Use the old values as defaults.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8509f22a 29-Apr-2019 Marek Behún <kabel@kernel.org>

lib: add Zstandard decompression support

Add the zstd library from Linux kernel (only decompression support).
There are minimal changes to build with U-Boot, otherwise the files are
identical to Linux commit dc35da16 from March 2018, the files had not
been touched since in kernel. Also SPDX lincese tags were added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 83a486b6 29-Apr-2019 Marek Behún <kabel@kernel.org>

lib: Add xxhash support

This adds the xxhash support from Linux. Files are almost identical to
those added to Linux in commit 5d240522 ("lib: Add xxhash module") (they
haven't been touched since in Linux). The only difference is to add some
includes to be compatible with U-Boot. Also SPDX lincese tags were
added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 5132361a 29-Apr-2019 Heiko Schocher <hs@denx.de>

lib: Kconfig: fix help text for GZIP

commit 95f4bbd581cf ("lib: fdt: Allow LZO and GZIP DT compression in U-Boot")

introduced Kconfig option for gzip in U-Boot, but help text
says gzip for SPL, which is wrong. Fix this.

Signed-off-by: Heiko Schocher <hs@denx.de>
Acked-by: Marek Vasut <marex@denx.de>

# 1c6eb075 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE_BUFFER_SIZE et al to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE_BUFFER_SIZE
CONFIG_TRACE_EARLY_SIZE
CONFIG_TRACE_EARLY
CONFIG_TRACE_EARLY_ADDR

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

# a24a78d7 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE

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

# 54969b40 21-Mar-2019 Thierry Reding <treding@nvidia.com>

fdtdec: Add Kconfig symbol for tests

Runtime tests are provided as a test_fdtdec command implementation. Add
a Kconfig symbol that allows this command to be built so that the tests
can be used.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 95f4bbd5 08-Mar-2019 Marek Vasut <marex@denx.de>

lib: fdt: Allow LZO and GZIP DT compression in U-Boot

Add required Kconfig symbols, Makefile bits and macro fixes in a
few places to support LZO and DT compression in U-Boot. This can
save a lot of space with multi-DTB fitImages.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>

# 6e705114 13-Jan-2019 Chris Packham <judge.packham@gmail.com>

lib: Kconfig: spelling fixes

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 048c6e89 06-Nov-2018 Simon Glass <sjg@chromium.org>

spl: lz4: Allow use of lz4 compression in SPL

In some cases U-Boot is compressed and it is useful to be able to
decompress it in SPL. Add a Kconfig and Makefile change to allow this.
Note that this does not actually implement decompression.

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

# 2895c4b7 15-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

kconfig: Introduce HAVE_ARCH_IOMAP

Introduce a new Kconfig option for architecture codes to control
whether it provides io{read,write}{8,16,32} I/O accessor functions.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5592a633 01-Oct-2018 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt in TPL

In some cases (e.g. sandbox with verified boot) it is useful to support
libfdt in TPL. Update the Kconfig to handle this.

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

# 6307896c 01-Oct-2018 Simon Glass <sjg@chromium.org>

tpm: Add support for SPL and TPL

At present the tpm can only be used in U-Boot proper. Updated it to work
in SPL and TPL also.

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

# ab948cd2 19-Jul-2018 Masahiro Yamada <masahiroy@kernel.org>

fdt_support: make FDT_FIXUP_PARTITIONS depend on CMD_MTDPARTS

fdt_fixup_mtdparts() calls mtdparts_init() and device_find(),
which are defined in cmd/mtdparts.c

The combination of FDT_FIXUP_PARTITIONS=y and CMD_MTDPARTS=n
emits the following link error:

common/fdt_support.c:903: undefined reference to `mtdparts_init'
common/fdt_support.c:914: undefined reference to `device_find'

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 3330584d 03-Jun-2018 Igor Opaniuk <igor.opaniuk@gmail.com>

avb2.0: integrate avb 2.0 into the build system

Integrate libavb into the build system. Introduce CONFIG_LIBAVB
build option.

Signed-off-by: Igor Opaniuk <igor.opaniuk@linaro.org>

# f8c987f8 05-Jun-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

lib: Add hexdump

Often during debugging session it's very interesting to see
what data we were dealing with. For example what we write or read
to/from memory or peripherals.

This change introduces functions that allow to dump binary
data with one simple function invocation like:
------------------->8----------------
print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, buf, len);
------------------->8----------------

which gives us the following:
------------------->8----------------
00000000: f2 b7 c9 88 62 61 75 64 72 61 74 65 3d 31 31 35 ....baudrate=115
00000010: 32 30 30 00 62 6f 6f 74 61 72 67 73 3d 63 6f 6e 200.bootargs=con
00000020: 73 6f 6c 65 3d 74 74 79 53 33 2c 31 31 35 32 30 sole=ttyS3,11520
00000030: 30 6e 38 00 62 6f 6f 74 64 65 6c 61 79 3d 33 00 0n8.bootdelay=3.
00000040: 62 6f 6f 74 66 69 6c 65 3d 75 49 6d 61 67 65 00 bootfile=uImage.
00000050: 66 64 74 63 6f 6e 74 72 6f 6c 61 64 64 72 3d 39 fdtcontroladdr=9
00000060: 66 66 62 31 62 61 30 00 6c 6f 61 64 61 64 64 72 ffb1ba0.loadaddr
00000070: 3d 30 78 38 32 30 30 30 30 30 30 00 73 74 64 65 =0x82000000.stde
00000080: 72 72 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 rr=serial0@e0022
00000090: 30 30 30 00 73 74 64 69 6e 3d 73 65 72 69 61 6c 000.stdin=serial
000000a0: 30 40 65 30 30 32 32 30 30 30 00 73 74 64 6f 75 0@e0022000.stdou
000000b0: 74 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 30 t=serial0@e00220
000000c0: 30 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00..............
...
------------------->8----------------

Source of hexdump.c was copied from Linux kernel v4.7-rc2.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Mario Six <mario.six@gdsys.cc>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Stefan Roese <sr@denx.de>

# c232d14d 29-May-2018 Alex Kiernan <alex.kiernan@gmail.com>

mmc: Separate "mmc swrite" from fastboot

Introduce CONFIG_IMAGE_SPARSE and CONFIG_CMD_MMC_SWRITE so the "mmc
swrite" command is separated from the fastboot code.

Move image-sparse from common to lib so it's clear it's library code.

Rename CONFIG_FASTBOOT_FLASH_FILLBUF_SIZE to CONFIG_IMAGE_SPARSE_FILLBUF_SIZE
and migrate it to Kconfig.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Acked-by: Jassi Brar <jaswinder.singh@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6417572e 08-May-2018 Tom Rini <trini@konsulko.com>

lib/Kconfig: Mark OF_LIBFDT_OVERLAY as depending on OF_LIBFDT

The overlay code is only useful when OF_LIBFDT is set, so mark it as
depending on that first.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 58a46f88 25-Apr-2018 Praneeth Bajjuri <praneeth@ti.com>

configs: TI: Enable FIT Library overlay support

Enable the FDT library overlay support for all TI SOC family.

Without this option, when Loading fdt from FIT image, the
following warning is seen.

"config with overlays but CONFIG_OF_LIBFDT_OVERLAY not set".

Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
Suggested-by: Andrew F.Davis <afd@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>

# 14ad44ab 18-Apr-2018 Alex Kiernan <alex.kiernan@gmail.com>

spl: Split sprintf, strto* from SPL serial in Kconfig

When SPL serial is disabled, callers who need sprintf or strtoul fail
because their inclusion is guarded by CONFIG_SPL_SERIAL_SUPPORT/
CONFIG_TPL_SERIAL_SUPPORT.

Split printf, sprintf and strto into their own entries and then select
all of them if SERIAL_SUPPORT is enabled to match the current behaviour.

Include panic.o unconditionally as it can be called from anywhere which
uses BUG_ON().

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>

# e294ba06 04-Apr-2018 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-sunxi

Signed-off-by: Tom Rini <trini@konsulko.com>


# d14db11d 03-Apr-2018 Andre Przywara <andre.przywara@arm.com>

sunxi: revert disabling of features

In January some commits were introduced to mitigate the U-Boot image
size issues we encountered on sunxi builds.
Now with the MMC environment removed we can bring them back, as we
practically don't have a size limit anymore.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 32ce6179 13-Mar-2018 Bryan O'Donoghue <bryan.odonoghue@linaro.org>

optee: Add lib entries for sharing OPTEE code across ports

This patch adds code to lib to enable sharing of useful OPTEE code between
board-ports and architectures. The code on lib/optee/optee.c comes from the
TI omap2 port. Eventually the OMAP2 code will be patched to include the
shared code. The intention here is to add more useful OPTEE specific code
as more functionality gets added.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Cc: Harinarayan Bhatta <harinarayan@ti.com>
Cc: Andrew F. Davis <afd@ti.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Kever Yang <kever.yang@rock-chips.com>
Cc: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Cc: Peng Fan <peng.fan@nxp.com>
Tested-by: Peng Fan <peng.fan@nxp.com>

# 36c1877c 06-Feb-2018 Faiz Abbas <faiz_abbas@ti.com>

lib: Kconfig: Move DYNAMIC_CRC_TABLE to Kconfig

Add CONFIG prefix to DYNAMIC_CRC_TABLE and implement it in
Kconfig.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>

# a451bc27 05-Feb-2018 Adam Ford <aford173@gmail.com>

Convert LIB_UUID to Kconfig

config_fallback.h has some logic that checks a variety of options
and selects LIB_UUID if it hasn't already been selected. This
will all LIB_UUID in Kconfig and select this option for the list
of options to allow us to remove the logic from fallbacks

Signed-off-by: Adam Ford <aford173@gmail.com>

# a5a37567 06-Feb-2018 Adam Ford <aford173@gmail.com>

Convert CONFIG LIB_HW_RAND to Kconfig

config_fallbacks.h had some logic to automatically select
LIB_RAND if RANDOM_UUID or CMD_UUID were set if LIB_HW_RAND wasn't
already selected. By migrating LIB_HW_RAND to Kconfig, we can
remove this check from config_fallbacks.h and put it into Kconfig

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
[trini: Turn into a choice, add NET_RANDOM_ETHADDR]
Signed-off-by: Tom Rini <trini@konsulko.com>

# acd4d334 16-Jan-2018 Maxime Ripard <maxime.ripard@free-electrons.com>

net: regex: Disable by default on sunXi

The sunXi arm64 build has overflown, leading to the main U-boot binary
overwriting the environment when flashing the new image, or even worse,
overwriting itself when we're calling saveenv.

Disable this option that is not critical until we can adress the issue
properly.

Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 7e3caa81 03-Dec-2017 Masahiro Yamada <masahiroy@kernel.org>

Move CONFIG_PANIC_HANG to Kconfig

Freescale (NXP) boards have lots of defconfig files per board.
I used "imply PANIC_HANG" for them.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# da5337a6 08-Nov-2017 Nandor Han <nandor.han@ge.com>

rtc: add support for s35392a

Add support for S35392A RTC. The driver supports both U-Boot driver
models.

Signed-off-by: Nandor Han <nandor.han@ge.com>
Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
Cc: Heiko Schocher <hs@denx.de>

# f52bdf4b 14-Sep-2017 Jean-Jacques Hiblot <jjhiblot@ti.com>

lib: allow building lzo for the SPL

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 85d8bf57 03-Sep-2017 Marek Behún <kabel@kernel.org>

lib: Add CRC32-C

This is needed for BTRFS.

Signed-off-by: Marek Behun <marek.behun@nic.cz>

create mode 100644 lib/crc32c.c

# 7264f292 15-Aug-2017 York Sun <york.sun@nxp.com>

spl: fit: Eanble GZIP support for image decompression

Add Kconfig option SPL_GZIP and SPL_ZLIB to enable gunzip support for
SPL boot, eg. falcon boot compressed kernel image.

Signed-off-by: York Sun <york.sun@nxp.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6ef2f901 11-Aug-2017 Adam Ford <aford173@gmail.com>

Convert CONFIG_BCH to Kconfig

This converts the following to Kconfig:
CONFIG_BCH

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1a7ba1d 18-Aug-2017 Anatolij Gustschin <agust@denx.de>

Fix 'notes' typos

s/notes/nodes

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 96b9082c 03-Aug-2017 Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

rockchip: rk3188: rock: adjust for SPL/TPL split

With the changes to split SPL/TPL for the RK3368, I apparently missed
some needed adjustments to the RK3188 Kconfig and rock_defconfig.

This fixes build-issues for the rock board after applying the RK3368
enablement (and SPL/TPL) set that resulted from TPL_SERIAL_SUPPORT,
TPL_ROCKCHIP_BACK_TO_BROM and TPL_TINY_MEMSET being separate symbols
now.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d56b4b19 22-Jul-2017 Tom Rini <trini@konsulko.com>

configs: Migrate RBTREE, LZO, CMD_MTDPARTS, CMD_UBI and CMD_UBIFS

The above CONFIG options are in Kconfig, and now have correct depends and
inter-dependencies. Migrate these to configs/ from include/configs/. In the
case of CMD_UBIFS also change it to be a default y if CMD_UBI.

Signed-off-by: Tom Rini <trini@konsulko.com>

# aed998aa 17-May-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_LZMA to Kconfig

This converts the following to Kconfig:
CONFIG_LZMA

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

# b1a873df 26-Apr-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_CMD_AES et al to Kconfig

This converts the following to Kconfig:
CONFIG_CMD_AES
CONFIG_AES

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Add select AES to CMD_AES]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 173aafbf 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

cmd: Expose a Kconfig option to enable UBIFS commands

Create a new Kconfig entry to allow CMD_UBIFS selection from Kconfig and
add an hidden LZO option that can be selected by CMD_UBIFS.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>

# aa049152 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

mtd: ubi: Select RBTREE option from MTD_UBI Kconfig entry

Expose the RBTREE feature through Kconfig and select this option from the
MTD_UBI option.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>
[Rebased on master]
Signed-off-by: Jagan Teki <jagan@openedev.com>

# ab4458bd 02-Apr-2017 Simon Glass <sjg@chromium.org>

string: Provide a slimmed-down memset()

Most of the time the optimised memset() is what we want. For extreme
situations such as TPL it may be too large. For example on the 'rock'
board, using a simple loop saves a useful 48 bytes. With gcc 4.9 and
the rodata bug, this patch is enough to reduce the TPL image below the
limit.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>

# bea79d7d 14-Mar-2017 Andre Przywara <andre.przywara@arm.com>

Kconfig: introduce md5sum command selection

So far CONFIG_MD5SUM would need to be set by a board's include file.
Since the command is really generic, move it over to Kconfig to allow
it to be defined by either a board's defconfig, menuconfig or some
config snippet merged via mergeconfig.sh.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e663b350 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

smbios: Expose in efi_loader as table

We can pass SMBIOS easily as EFI configuration table to an EFI payload. This
patch adds enablement for that case.

While at it, we also enable SMBIOS generation for ARM systems, since they support
EFI_LOADER.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4b6dddc2 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

x86: Move smbios generation into arch independent directory

We will need the SMBIOS generation function on ARM as well going forward,
so let's move it into a non arch specific location.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# ebf7fff2 05-Oct-2016 Heiko Schocher <hs@denx.de>

spl: move FDT_FIXUP_PARTITIONS to Kconfig

Move FDT_FIXUP_PARTITIONS to Kconfig and cleanup existing
uses.

Signed-off-by: Heiko Schocher <hs@denx.de>

# ddf67f71 05-Jul-2016 Maxime Ripard <maxime.ripard@free-electrons.com>

libfdt: Add overlay application function

The device tree overlays are a good way to deal with user-modifyable
boards or boards with some kind of an expansion mechanism where we can
easily plug new board in (like the BBB, the Raspberry Pi or the CHIP).

Add a new function to merge overlays with a base device tree.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>

# 91b86e21 26-May-2016 Marek Vasut <marex@denx.de>

lib: Enable private libgcc by default

This patch decouples U-Boot binary from the toolchain on systems where
private libgcc is available. Instead of pulling in functions provided
by the libgcc from the toolchain, U-Boot will use it's own set of libgcc
functions. These functions are usually imported from Linux kernel, which
also uses it's own libgcc functions instead of the ones provided by the
toolchain.

This patch solves a rather common problem. The toolchain can usually
generate code for many variants of target architecture and often even
different endianness. The libgcc on the other hand is usually compiled
for one particular configuration and the functions provided by it may
or may not be suited for use in U-Boot. This can manifest in two ways,
either the U-Boot fails to compile altogether and linker will complain
or, in the much worse case, the resulting U-Boot will build, but will
misbehave in very subtle and hard to debug ways.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 67976306 30-Mar-2016 Masahiro Yamada <masahiroy@kernel.org>

cosmetic: Fix typos "privide"

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# ed980b8c 03-Mar-2016 Alexander Graf <agraf@csgraf.de>

efi_loader: hook up in build environment

Now that we have all the bits and pieces ready for EFI payload loading
support, hook them up in Makefiles and KConfigs so that we can build.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
[trini: Enable only when we of OF_LIBFDT, disable on kwb and colibri_pxa270]
Signed-off-by: Tom Rini <trini@konsulko.com>

# aa34fbc0 22-Feb-2016 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt to be used in SPL

Add an option to enable libfdt in SPL. This can be useful when decoding
FIT files in SPL.

We need to make sure this option is not enabled in SPL by this change.
Also this option needs to be enabled in host builds. Si add a new
IMAGE_USE_LIBFDT #define which can be used in files that are built on the
host but must also build for U-Boot and SPL.

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

# 69e173eb 22-Feb-2016 Simon Glass <sjg@chromium.org>

Move CONFIG_OF_LIBFDT to Kconfig

Move this option to Kconfig and tidy up existing boards.

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

# a187559e 05-Feb-2016 Bin Meng <bmeng.cn@gmail.com>

Use correct spelling of "U-Boot"

Correct spelling of "U-Boot" shall be used in all written text
(documentation, comments in source files etc.).

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Minkyu Kang <mk7.kang@samsung.com>

# 947c626d 14-Jan-2016 Tom Rini <trini@konsulko.com>

vsprintf.c: Always enable CONFIG_SYS_VSNPRINTF

Enabling this function always removes some class of string saftey issues.
The size change here in general is about 400 bytes and this seems a reasonable
trade-off.

Cc: Peng Fan <peng.fan@nxp.com>
Cc: Peter Robinson <pbrobinson@gmail.com>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Adrian Alonso <aalonso@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 7d9cde10 22-Nov-2015 Stefan Roese <sr@denx.de>

lib/tiny-printf.c: Add tiny printf function for space limited environments

This patch adds a small printf() version that supports all basic formats.
Its intented to be used in U-Boot SPL versions on platforms with very
limited internal RAM sizes.

To enable it, just define CONFIG_USE_TINY_PRINTF in your defconfig. This
will result in the SPL using this tiny function and the main U-Boot
still using the full-blown printf() function.

This code was copied from:
http://www.sparetimelabs.com/printfrevisited
With mostly only coding style related changes so that its checkpatch
clean.

The size reduction is about 2.5KiB. Here a comparison for the db-mv784mp-gp
(Marvell AXP) SPL:

Without this patch:
58963 18536 1928 79427 13643 ./spl/u-boot-spl

With this patch:
56542 18536 1956 77034 12cea ./spl/u-boot-spl

Note:
To make it possible to compile tiny-printf.c instead of vsprintf.c when
CONFIG_USE_TINY_PRINTF is defined, the functions printf() and vprintf() are
moved from common/console.c into vsprintf.c in this patch.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>

# 2419cd16 03-Oct-2015 Simon Glass <sjg@chromium.org>

dm: tpm: Drop CONFIG_DM_TPM

Now that all TPM drivers use driver model, we can drop the special driver
model CONFIG option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>

# 027b728d 06-Oct-2015 Julius Werner <jwerner@chromium.org>

Add support for LZ4 decompression algorithm

This patch adds support for LZ4-compressed FIT image contents. This
algorithm has a slightly worse compression ration than LZO while being
nearly twice as fast to decompress. When loading images from a fast
storage medium this usually results in a boot time win.

Sandbox-tested only since I don't have a U-Boot development system set
up right now. The code was imported unchanged from coreboot where it's
proven to work, though. I'm mostly interested in getting this recognized
by mkImage for use in a downstream project.

Signed-off-by: Julius Werner <jwerner@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# a7d660bc 22-Aug-2015 Simon Glass <sjg@chromium.org>

tpm: Add Kconfig options for TPMs

Add new Kconfig options for TPMs in preparation for moving boards to use
Kconfig for TPM configuration.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 867a6ac8 31-Jul-2015 Simon Glass <sjg@chromium.org>

efi: Add start-up library code

When running as an EFI application, U-Boot must request memory from EFI,
and provide access to the boot services U-Boot needs.

Add library code to perform these tasks. This includes efi_main() which is
the entry point from EFI. U-Boot is built as a shared library.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d1389403 23-Jun-2015 Simon Glass <sjg@chromium.org>

Add a dhrystone benchmark command

Drystone provides a convenient sanity check that the CPU is running at full
speed. Add this as a command which can be enabled as needed.

Note: I investigated using Coremark for this but there was a license
agreement and I could not work out if it was GPL-compatible.

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

# f7848d90 22-Jun-2015 Joe Hershberger <joe.hershberger@ni.com>

Allow CONFIG_REGEX to be disabled when CONFIG_NET

Instead of selecting REGEX when NET is enabled, make it the default, but
allow boards that are tiny to disable it and lose functionality on all
but the first Ethernet adapter.

cm-bf548, bf538f-ezkit, and bf533-stamp need this. None appear to have
more than one Ethernet interface.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# 3850dbe8 11-Jun-2015 Masahiro Yamada <masahiroy@kernel.org>

blackfin: fix undefined reference to srand and rand

Commit 9ba9e85f3f1c (net: Fix NET_RANDOM_ETHADDR dependencies)
accidentally dropped CONFIG_LIB_RAND defines for 14 Blackfin boards.

Prior to that commit, those boards defined CONFIG_LIB_RAND, but not
CONFIG_NET_RANDOM_ETHADDR. So, commit 9ba9e85f3f1c should not have
touched them, but in fact it ripped CONFIG_LIB_RAND off from all the
header files, which caused undefined reference to srand and rand.
CONFIG_LIB_RAND=y must be revived for such boards.

BTW, this commit indeed makes it better, but even with this fix,
three boards (bf533-stamp, bf538f-ezkit, cm-bf548) still can not
build due to region 'ram' overflowed error. This was cause by
commit 6eed3786c68c (net: Move the CMD_NET config to defconfigs)
because CMD_NET selects NET, and NET selects REGEX. Eventually,
some boards were newly enabled with CONFIG_REGEX, increasing the
memory footprint. A patch is expected to fix the build error.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 9ba9e85f 25-May-2015 Michal Simek <michal.simek@amd.com>

net: Fix NET_RANDOM_ETHADDR dependencies

NET_RANDOM_ETHADDR depends on lib/rand.c. This patch adds dependency to
Kconfig to ensure that library is also compiled.

Remove the definitions from Blackfin boards' include/configs.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 6501ff62 20-Apr-2015 Przemyslaw Marczak <p.marczak@samsung.com>

lib: Kconfig: add entry for errno_str() function

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1a60650c 21-Apr-2015 Joe Hershberger <joe.hershberger@ni.com>

kconfig: Move REGEX to Kconfig

Having this as a Kconfig allows it to be a dependent feature.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8156345d 06-Mar-2015 Simon Glass <sjg@chromium.org>

sandbox: Move CONFIG_SYS_VSNPRINTF to Kconfig

Move this over to Kconfig and tidy up.

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

# 94e3c8c4 19-Feb-2015 gaurav rana <gaurav.rana@freescale.com>

crypto/fsl - Add progressive hashing support using hardware acceleration.

Currently only normal hashing is supported using hardware acceleration.
Added support for progressive hashing using hardware.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
Signed-off-by: Gaurav Rana <gaurav.rana@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>

# d9f23c7f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

lib/rsa: Add Kconfig for devices supporting RSA Modular Exponentiation

Kconfig option added for devices which support RSA Verification.
1. RSA_SOFTWARE_EXP
Enables driver for supporting RSA Modular Exponentiation in Software
2. RSA_FREESCALE_EXP
Enables driver for supporting RSA Modular Exponentiation using Freescale specific
driver

The above drivers use RSA uclass

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
(Removed duplicate line in Kconfig comment)

Change-Id: I7663c4d5350e2bfc3dfa2696f70ef777d6ccc6f6

# c4beb22f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

FIT: Modify option FIT_SIGNATURE in Kconfig

For FIT signature based approach to work, RSA library needs to be selected.
The FIT_SIGNATURE option in Kconfig is modified to automatically select RSA.
Selecting RSA compiles the RSA library required for image verification.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 45ccec8f 23-Oct-2014 Masahiro Yamada <masahiroy@kernel.org>

kconfig: move CONFIG_USE_PRIVATE_LIBGCC to Kconfig

The private libgcc is supported only on ARM, MIPS, PowerPC, SH, x86.
Those architectures should "select" HAVE_PRIVATE_LIBGCC and
CONFIG_USE_PRIVATE_LIBGCC should depend on it.

Currently, this option is enabled on Tegra boards and x86 architecture.
Move the definition from header files to Kconfig.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Tested-by: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: Tom Warren <twarren@nvidia.com>

# 8c688bc4 23-Oct-2014 Masahiro Yamada <masahiroy@kernel.org>

kconfig: move CONFIG_SYS_HZ to lib/Kconfig

CONFIG_SYS_HZ is always defined as 1000 in config_fallbacks.h
(but some boards still have redundant definitions).

This commit moves the definition and the document in README to
Kconfig. Since lib/Kconfig can assure that CONFIG_SYS_HZ is 1000,
the sanity check in lib/time.c should be removed.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Reviewed-by: Marek Vasut <marex@denx.de>

# b0928da6 16-Sep-2014 Masahiro Yamada <masahiroy@kernel.org>

kconfig: move CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED to Kconfig

If this option is enabled, the objects under lib/ directory
are compiled with speed optimization, not size optimization.
(Currently, only used by some Blackfin boards.)

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# ed36323f 16-Sep-2014 Masahiro Yamada <masahiroy@kernel.org>

kconfig: add blank Kconfig files

This would be useful to start moving various config options.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# d5d9770f 27-Oct-2023 Tom Rini <trini@konsulko.com>

Merge tag 'tpm-next-27102023' of https://source.denx.de/u-boot/custodians/u-boot-tpm

bootX measurements and measurement API moved to u-boot core:

Up to now, U-Boot could perform measurements and EventLog creation as
described by the TCG spec when booting via EFI.

The EFI code was residing in lib/efi_loader/efi_tcg2.c and contained
both EFI specific code + the API needed to access the TPM, extend PCRs
and create an EventLog. The non-EFI part proved modular enough and
moving it around to the TPM subsystem was straightforward.

With that in place we can have a common API for measuring binaries
regardless of the boot command, EFI or boot(m|i|z), and contructing an
EventLog.

I've tested all of the EFI cases -- booting with an empty EventLog and
booting with a previous stage loader providing one and found no
regressions. Eddie tested the bootX part.

Eddie also fixed the sandbox TPM which couldn't be used for the EFI code
and it now supports all the required capabilities. This had a slight
sideeffect in our testing since the EFI subsystem initializes the TPM
early and 'tpm2 init' failed during some python tests. That code only
opens the device though, so we can replace it with 'tpm2 autostart'
which doesn't error out and still allows you to perfom the rest of the
tests but doesn't report an error if the device is already opened.

There's a few minor issues with this PR as well but since testing and
verifying the changes takes a considerable amount of time, I prefer
merging it now.

Heinrich has already sent a PR for -master containing "efi_loader: fix
EFI_ENTRY point on get_active_pcr_banks" and I am not sure if that will
cause any conflicts, but in any case they should be trivial to resolve.

Both the EFI and non-EFI code have a Kconfig for measuring the loaded
Device Tree. The reason this is optional is that we can't reason
when/if devices add random info like kaslr-seed, mac addresses etc in
the DT. In that case measurements are random, board specific and
eventually useless. The reason it was difficult to fix it prior to this
patchset is because the EFI subsystem and thus measurements was brought
up late and DT fixups might have already been applied. With this
patchset we can measure the DT really early in the future.

Heinrich also pointed out that the two Kconfigs for the DTB measurements
can be squashed in a single one and that the documentation only explains
the non-EFI case. I agree on both but as I said this is a sane working
version, so let's pull this first it's aleady big enough and painful to
test.


# 97707f12 24-Oct-2023 Eddie James <eajames@linux.ibm.com>

tpm: Support boot measurements

Add TPM2 functions to support boot measurement. This includes
starting up the TPM, initializing/appending the event log, and
measuring the U-Boot version. Much of the code was used in the
EFI subsystem, so remove it there and use the common functions.

Signed-off-by: Eddie James <eajames@linux.ibm.com>
For the API moving around from EFI -> u-boot core
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
For EFI testing
Tested-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

# 44071cd5 14-Oct-2023 Sean Anderson <seanga2@gmail.com>

fs: ext4: Fix building ext4 in SPL if write is enabled

If EXT4_WRITE is enabled, write capabilities will be compiled into SPL, but
not CRC16. Add an option to enable CRC16 to avoid linker errors.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 53fab13a 20-Sep-2023 Simon Glass <sjg@chromium.org>

efi: Use the installed SMBIOS tables

U-Boot should set up the SMBIOS tables during startup, as it does on x86.
Ensure that it does this correctly on non-x86 machines too, by creating
an event spy for last-stage init.

Tidy up the installation-condition code while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 8c11d19e 19-Sep-2023 Simon Glass <sjg@chromium.org>

x86: smbios: Add a Kconfig indicating SMBIOS-table presence

When booted from coreboot, U-Boot does not build the SMBIOS tables, but
it should still pass them on to the OS. Add a new option which indicates
whether SMBIOS tables are present, however they were built.

Flip the ordering so that the dependency is listed first, which is less
confusing.

Adjust GENERATE_SMBIOS_TABLE to depend on this new symbol.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 0c45c76c 19-Sep-2023 Simon Glass <sjg@chromium.org>

x86: Allow APCI in SPL

This is needed so we can find the DBG2 table provided by coreboot. Add a
Kconfig so it can be enabled.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 040a6048 14-Sep-2023 Simon Glass <sjg@chromium.org>

boot: Join FDT_FIXUP_PARTITIONS with related options

Move this to be with the other devicetree-fixup options.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 4cc40f61 14-Sep-2023 Simon Glass <sjg@chromium.org>

FWU: Avoid showing an unselectable menu option

Use a menuconfig to avoid showing a menu which cannot be selected in many
cases.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

# a90b5946 14-Sep-2023 Simon Glass <sjg@chromium.org>

lib: rational: Move the Kconfigs into the correct place

These should not be part of the 'system tables' menu. Move them outside
on their own.

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: 7d0f3fbb93c ("lib: rational: copy the rational fraction lib...")
Reviewed-by: Tom Rini <trini@konsulko.com>

# a077ac13 02-Aug-2023 Tom Rini <trini@konsulko.com>

Kconfigs: Correct default of "0" on hex type entries

It is not a parse error to have a default value of "0" for a "hex" type
entry, instead of "0x0". However, "0" and "0x0" are not treated the
same even by the tools themselves. Correct this by changing the default
value from "0" to "0x0" for all hex type questions that had the
incorrect default. Fix one instance (in two configs) of a default of "0"
being used on a hex question to be "0x0". Remove the cases where a
defconfig had set a value of "0x0" to be used as the default had been
"0".

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# af62d83c 03-Aug-2023 Oleksandr Suvorov <oleksandr.suvorov@foundries.io>

spl: move SPL_CRC32 option to lib/Kconfig

All SPL hash algorithm options are collected in lib/Kconfig. Move
SPL_CRC32 there as well.

Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
Reviewed-by: Simon Glass <sjg@chromium.org>

# dfe00b34 13-Jul-2023 Manorit Chawdhry <m-chawdhry@ti.com>

lib: Kconfig: k3: Enable SHA512 for fit signature

We are using our custMpk for signing that is a 4096 bit key, 4096 bit
rsa key requires a SHA512 hashing algorithm to be enabled as per the
source. Even though it is not mandated but this is how it works and is
tested.

Enables SHA512 if fit signature is enabled on K3 platforms.

Signed-off-by: Manorit Chawdhry <m-chawdhry@ti.com>

# 0992a90d 04-May-2023 Simon Glass <sjg@chromium.org>

acpi: Create a new Kconfig for ACPI

We have several Kconfig options for ACPI, but all relate to specific
functions, such as generating tables and AML code.

Add a new option which controls including basic ACPI library code,
including the lib/acpi directory. This will allow us to add functions
which are available even if table generation is not supported.

Adjust the command to avoid a build error when ACPIGEN is not enabled.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 94c8da21 22-Mar-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: Fix LMB_MEMORY_REGIONS flag usage

Remove test on CONFIG_LMB_MEMORY_REGIONS introduced by commit
7c1860fce4e3 ("lmb: Fix lmb property's defination under struct lmb").

This code in lmb_init() is strange, because if CONFIG_LMB_USE_MAX_REGIONS
and CONFIG_LMB_MEMORY_REGIONS are not defined, the implicit #else is empty
and the required initialization is not done:
lmb->memory.max = ?
lmb->reserved.max = ?

But this setting is not possible:
- CONFIG_LMB_USE_MAX_REGIONS not defined
- CONFIG_LMB_MEMORY_REGIONS not defined
because CONFIG_LMB_MEMORY_REGIONS and CONFIG_LMB_RESERVED_REGIONS are
defined as soon as the CONFIG_LMB_USE_MAX_REGIONS is not defined.

This patch removes this impossible case #elif and I add some
explanation in lmb.h to explain why in the struct lmb {} the lmb
property is defined if CONFIG_LMB_MEMORY_REGIONS is NOT defined.

This patch also removes CONFIG_LMB_XXX dependency on CONFIG_LMB as these
defines are used in API file lmb.h and not only in library file.

Fixes: 5e2548c1d6e03 ("lmb: Fix LMB_MEMORY_REGIONS flag usage")
Reported-by: Mark Millard <marklmi@yahoo.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Acked-by: Michal Simek <michal.simek@amd.com>

# c61df340 18-Mar-2023 Marek Vasut <marek.vasut+renesas@mailbox.org>

lib: Fix SYS_TIMER_COUNTS_DOWN description in Kconfig

The SYS_TIMER_COUNTS_DOWN description contains a typo,
s@rathe@&r@ , fix it.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>

# 3b510807 22-Feb-2023 Simon Glass <sjg@chromium.org>

lib: Add an SPL config for LIB_UUID

This is selected by PARTITION_UUIDS which has a separate option for SPL.
Add an SPL option for LIB_UUID also, so that we can keep them consistent.

Also add one for PARTITION_TYPE_GUID to avoid a build error in part_efi.c
which wants to call a uuid function in SPL.

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

# 5a6bc166 22-Feb-2023 Simon Glass <sjg@chromium.org>

lib: Add VPL options for SHA1 and SHA256

Add these options so these algorithms can be used in VPL.

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

# ae625d92 22-Feb-2023 Simon Glass <sjg@chromium.org>

lib: Add a Kconfig for SPL_BZIP2

This is implicitly used in the source and seems useful, so add it.

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

# c33425c6 15-Jan-2023 Simon Glass <sjg@chromium.org>

trace: Reduce the default for TRACE_EARLY_CALL_DEPTH_LIMIT

This is a silly value at present, since U-Boot's call depth never reaches
200. Fix it.

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

# 2dc16a2c 19-Jan-2023 Sjoerd Simons <sjoerd@collabora.com>

Bump LMB_MAX_REGIONS default to 16

Since commit 06d514d77c37 ("lmb: consider EFI memory map") the EFI regions
are also pushed into the lmb if EFI_LOADER is enabled (which is by
default on most system). Which can cause the number of entries to go
over the maximum as it's default is only 8.

Specifically i ran into this case on an TI am62 which has an fdt with
4 reserved regions (in practice 3 lmb entries due to adjecent ranges).

As this is likely to impact more devices bump the default max
regions to 16 so there is a bit more slack.

Fixes: 06d514d77c ("lmb: consider EFI memory map")
Link: https://bugzilla.opensuse.org/show_bug.cgi?id=1207562
Reviewed-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Signed-off-by: Sjoerd Simons <sjoerd@collabora.com>
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
[trini: collect tags from the other equivalent patch]

# 948d3999 08-Feb-2023 Tom Rini <trini@konsulko.com>

Revert "lmb: Default to not-LMB_USE_MAX_REGIONS"

As explained by Philippe Schenker, I was misinterpreting what happened
in the case where we do not set LMB_USE_MAX_REGIONS and so had
re-introduced the problem I was attempting to more widely resolve.

This reverts commit 007ae5d108a37564905ea1588cb279f3a522cc3d.

Reported-by: Philippe Schenker <philippe.schenker@toradex.com>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 007ae5d1 25-Jan-2023 Tom Rini <trini@konsulko.com>

lmb: Default to not-LMB_USE_MAX_REGIONS

The LMB code allows for picking a hard limit on the number of regions it
can know of, or to dynamically allocate these regions. The reason for
this choice is to allow for the compiler to perform a size optimization
in the common case. This optimization however, is very small, ranging
from 196 bytes to 15 bytes saved, or in some cases, being larger. Now
that we also have more regions covered by LMB (in order to protect
various parts of our self at run time), the default of 8 is also much
easier to hit and leads to non-obvious error messages (which imply that
an area is protected, not that we're out of areas to add to the list).

Switch to the dynamic use as the default.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 53c47c59 19-Jan-2023 Tom Rini <trini@konsulko.com>

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


# 4b9b25d9 12-Jan-2023 Brandon Maier <brandon.maier@collins.com>

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

[1] https://github.com/torvalds/linux/commit/e0c1b49f5b674cca7b10549c53b3791d0bbc90a8
[2] https://github.com/facebook/zstd/blob/f302ad8811643c428c4e3498e28f53a0578020d3/lib/libzstd.mk#L31

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>

# ebc1d50a 21-Dec-2022 Simon Glass <sjg@chromium.org>

Revert "fdtdec: drop needlessly convoluted CONFIG_PHANDLE_CHECK_SEQ"

The fdt_path_offset() function is slow since it must scan the tree.
This substantial overhead now applies to all boards.

The original code may not be ideal but it is fit for purpose and is only
needed on a few boards.

Reverting this reduces time to set up driver model by about 30ms.

Before revert:

Accumulated time:
47,170 dm_r
53,237 dm_spl
572,986 dm_f

Accumulated time:
44,598 dm_r
50,347 dm_spl
549,133 dm_f

This reverts commit 26f981f295d00351b6f0c69b5317b254b2361cc0.

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

# 12619d4e 21-Dec-2022 Simon Glass <sjg@chromium.org>

trace: Don't require TIMER_EARLY

Some platforms cannot honour this and don't need trace before relocation.
Use 'imply' instead, so boards can disable this.

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

# 0c16fca9 07-Jan-2023 Simon Glass <sjg@chromium.org>

tpm: Add a proper Kconfig option for crc8 in SPL

The current approach is a bit of a hack and only works for the tpm
subsystem. Add a Kconfig so that crc8 can be enabled in SPL for other
purposes.

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

# 14f43797 19-Dec-2022 Tom Rini <trini@konsulko.com>

Merge tag 'v2023.01-rc4' into next

Prepare v2023.01-rc4

Signed-off-by: Tom Rini <trini@konsulko.com>


# ae3527f0 07-Dec-2022 Kautuk Consul <kconsul@ventanamicro.com>

arch/riscv: add semihosting support for RISC-V

We add RISC-V semihosting based serial console for JTAG based early
debugging.

The RISC-V semihosting specification is available at:
https://github.com/riscv/riscv-semihosting-spec/blob/main/riscv-semihosting-spec.adoc

Signed-off-by: Anup Patel <apatel@ventanamicro.com>
Signed-off-by: Kautuk Consul <kconsul@ventanamicro.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>

# 1c03ab9f 07-Dec-2022 Kautuk Consul <kconsul@ventanamicro.com>

lib: Add common semihosting library

We factor out the arch-independent parts of the ARM semihosting
implementation as a common library so that it can be shared
with RISC-V.

Signed-off-by: Kautuk Consul <kconsul@ventanamicro.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>

# 3b8dfc42 16-Nov-2022 Tom Rini <trini@konsulko.com>

Convert CONFIG_SYS_TIMER_COUNTS_DOWN to Kconfig

This converts the following to Kconfig:
CONFIG_SYS_TIMER_COUNTS_DOWN

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 86794052 21-Oct-2022 Sughosh Ganu <sughosh.ganu@linaro.org>

FWU: Add support for the FWU Multi Bank Update feature

The FWU Multi Bank Update feature supports updating firmware images
to one of multiple sets(also called banks) of images. The firmware
images are clubbed together in banks, with the system booting images
from the active bank. Information on the images such as which bank
they belong to is stored as part of the metadata structure, which is
stored on the same storage media as the firmware images on a dedicated
partition.

At the time of update, the metadata is read to identify the bank to
which the images need to be flashed(update bank). On a successful
update, the metadata is modified to set the updated bank as active
bank to subsequently boot from.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

# 40ed7be4 02-Aug-2022 Tom Rini <trini@konsulko.com>

Convert CONFIG_SYS_FDT_PAD to Kconfig

This converts the following to Kconfig:
CONFIG_SYS_FDT_PAD

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e67ffb5a 22-Jul-2022 Sughosh Ganu <sughosh.ganu@linaro.org>

tpm: rng: Add driver model interface for TPM RNG device

The TPM device has a builtin random number generator(RNG)
functionality. Expose the RNG functions of the TPM device to the
driver model so that they can be used by the EFI_RNG_PROTOCOL if the
protocol is installed.

Also change the function arguments and return type of the random
number functions to comply with the driver model api.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

# b340199f 10-Jun-2022 Tom Rini <trini@konsulko.com>

spl: Ensure all SPL symbols in Kconfig have some SPL dependency

Tighten up symbol dependencies in a number of places. Ensure that a SPL
specific option has at least a direct dependency on SPL. In places
where it's clear that we depend on something more specific, use that
dependency instead. This means in a very small number of places we can
drop redundant dependencies.

Reported-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 13ce351b 08-Jun-2022 Tom Rini <trini@konsulko.com>

vpl: Ensure all VPL symbols in Kconfig have some VPL dependency

Tighten up symbol dependencies in a number of places. Ensure that a VPL
specific option has at least a direct dependency on VPL. In places
where it's clear that we depend on something more specific, use that
dependency instead.

Reported-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 8bea4bf7 08-Jun-2022 Tom Rini <trini@konsulko.com>

tpl: Ensure all TPL symbols in Kconfig have some TPL dependency

Tighten up symbol dependencies in a number of places. Ensure that a TPL
specific option has at least a direct dependency on TPL. In places
where it's clear that we depend on something more specific, use that
dependency instead.

Reported-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 26f981f2 19-May-2022 Rasmus Villemoes <rasmus.villemoes@prevas.dk>

fdtdec: drop needlessly convoluted CONFIG_PHANDLE_CHECK_SEQ

Asking if the alias we found actually points at the device tree node
we passed in (in the guise of its offset from blob) can be done simply
by asking if the fdt_path_offset() of the alias' path is identical to
offset.

In fact, the current method suffers from the possibility of false
negatives: dtc does not necessarily emit a phandle property for a node
just because it is referenced in /aliases; it only emits a phandle
property for a node if it is referenced in <angle brackets>
somewhere. So if both the node we passed in and the alias node we're
considering don't have phandles, fdt_get_phandle() returns 0 for both.

Since the proper check is so simple, there's no reason to hide that
behind a config option (and if one really wanted that, it should be
called something else because there's no need to involve phandle in
the check).

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Acked-by: Aswath Govindraju <a-govindraju@ti.com>

# d30924f1 01-May-2022 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: fix selection of CONFIG_CHARSET

lib/charset.c is not optional for
EFI_APP || EFI_LOADER || UFS || UT_UNICODE.
These must select CONFIG_CHARSET.

Fixes: 726cd9836db0 ("efi: Make unicode printf available to the app")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>

# 747093dd 30-Apr-2022 Simon Glass <sjg@chromium.org>

vpl: Add Kconfig options for VPL

Add VPL versions of commonly used Kconfig options.

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

# 11232139 06-Apr-2022 Tom Rini <trini@konsulko.com>

nds32: Remove the architecture

As removal of nds32 has been ack'd for the Linux kernel, remove support
here as well.

Cc: Rick Chen <rick@andestech.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Rick Chen <rick@andestech.com>

# fd210fee 28-Mar-2022 Philippe Reynes <philippe.reynes@softathome.com>

lib: allow to build asn1 decoder and oid registry in SPL

This commit adds the options:
- SPL_ASN1_DECODER
- SPL_OID_REGISTRY

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>

# 7d44a985 28-Mar-2022 Philippe Reynes <philippe.reynes@softathome.com>

lib: Kconfig: enhance the help of OID_REGISTRY

Enhance the help for the config OID_REGISTRY.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>

# a0e71d96 28-Mar-2022 Philippe Reynes <philippe.reynes@softathome.com>

lib: Kconfig: enhance help for ASN1

Enhance the help for configs ASN1_COMPILER
and ASN1_decoder.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>

# 761a1786 27-Jan-2022 Tom Rini <trini@konsulko.com>

Merge tag 'dm-pull-26jan22' of https://source.denx.de/u-boot/custodians/u-boot-dm

acpi refactoring to allow non-x86 use
binman support for bintools (binary tools)
minor tools improvements in preparation for FDT signing
various minor fixes and improvements


# 334a9b9d 25-Nov-2021 Loic Poulain <loic.poulain@linaro.org>

lib/circbuf: Make circbuf selectable symbol

It is currenly only used from usbtty driver but make it properly
selectable via Kconfig symbol, for future usage.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>

# e1722fcb 01-Dec-2021 Simon Glass <sjg@chromium.org>

x86: Allow any arch to generate ACPI tables

These have sadly found their way to ARM now. Allow any arch to support
generating ACPI tables.

Disable this for the tools build.

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

# 7c3fd5c2 26-Dec-2021 Qu Wenruo <wqu@suse.com>

lib: add BLAKE2 hash support

The code is cross-ported from BLAKE2 reference implementation
(https://github.com/BLAKE2/BLAKE2).

With minimal change to remove unused macros/features.

Currently there is only one user inside U-boot (btrfs), and since it
only utilize BLAKE2B, all other favors are all removed.

Signed-off-by: Qu Wenruo <wqu@suse.com>
[trini: Rename ROUND to R to avoid clash with <linux/bitops.h>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 97f2a749 04-Jan-2022 Eugen Hristev <eugen.hristev@collabora.com>

lib: Kconfig: fix PHANDLE_CHECK_SEQ position outside of menu

CONFIG_PHANDLE_CHECK_SEQ is outside of the menu 'Library routines'
thus it's invisible in menuconfig and cannot be selected.
Fix this by moving the 'endmenu' after the PHANDLE_CHECK_SEQ definition

Fixes: c589132a1d ("fdt: Use phandle to distinguish DT nodes with same name")
Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
Reviewed-by: Aswath Govindraju <a-govindraju@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 726cd983 29-Dec-2021 Simon Glass <sjg@chromium.org>

efi: Make unicode printf available to the app

This is needed to show unicode strings. Enable this code in the app.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>

# 6405ab7a 24-Nov-2021 Simon Glass <sjg@chromium.org>

Convert CONFIG_PHYSMEM to Kconfig

This converts the following to Kconfig:
CONFIG_PHYSMEM

Signed-off-by: Simon Glass <sjg@chromium.org>
Suggested-by: Sean Anderson <seanga2@gmail.com>

# ac7606af 14-Nov-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

lmb: fix typo 'commun'

%s/commun/common/

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

# e7d285b2 25-Sep-2021 Simon Glass <sjg@chromium.org>

image: Use the correct checks for CRC32

Add a host Kconfig for CRC32. With this we can use CONFIG_IS_ENABLED(CRC32)
directly in the host build, so drop the unnecessary indirection.

Add a few more conditions to SPL_CRC32 to avoid build failures as well as
TPL_CRC32. Also update hash.c to make crc32 optional and to actually take
notice of SPL_CRC32.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# 2c21256b 25-Sep-2021 Simon Glass <sjg@chromium.org>

hash: Use Kconfig to enable hashing in host tools and SPL

At present when building host tools, we force CONFIG_SHAxxx to be enabled
regardless of the board Kconfig setting. This is done in the image.h
header file.

For SPL we currently just assume the algorithm is desired if U-Boot proper
enables it.

Clean this up by adding new Kconfig options to enable hashing on the host,
relying on CONFIG_IS_ENABLED() to deal with the different builds.

Add new SPL Kconfigs for hardware-accelerated hashing, to maintain the
current settings.

This allows us to drop the image.h code and the I_WANT_MD5 hack.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# 603d15a5 25-Sep-2021 Simon Glass <sjg@chromium.org>

spl: cypto: Bring back SPL_ versions of SHA

Unfortunately these were removed by mistake. This means that adding hash
support to SPL brings in all software algorithms, with a substantial
increase in code size.

The origin of the problem was renaming them to SPL_FIT_xxx and then these
were removed altogether in a later commit.

Add them back. This aligns with CONFIG_MD5, for example, which has an SPL
variant.

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: f5bc9c25f31 ("image: Rename SPL_SHAxxx_SUPPORT to SPL_FIT_SHAxxx")
Fixes: eb5171ddec9 ("common: Remove unused CONFIG_FIT_SHAxxx selectors")
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# 6674edaa 16-Sep-2021 Tom Rini <trini@konsulko.com>

Merge tag 'v2021.10-rc4' into next

Prepare v2021.10-rc4

Signed-off-by: Tom Rini <trini@konsulko.com>

# gpg: Signature made Tue 14 Sep 2021 06:58:32 PM EDT
# gpg: using RSA key 1A3C7F70E08FAB1707809BBF147C39FF9634B72C
# gpg: Good signature from "Thomas Rini <trini@konsulko.com>" [ultimate]

# Conflicts:
# board/Arcturus/ucp1020/spl.c
# cmd/mvebu/Kconfig
# common/Kconfig.boot
# common/image-fit.c
# configs/UCP1020_defconfig
# configs/sifive_unmatched_defconfig
# drivers/pci/Kconfig
# include/configs/UCP1020.h
# include/configs/sifive-unmatched.h
# lib/Makefile
# scripts/config_whitelist.txt


# 5145bc73 01-Sep-2021 Oleksandr Suvorov <oleksandr.suvorov@foundries.io>

lib: fix typos in Kconfig

There are trivial typos in the Kconfig file. Fixed them.
Also, fixed grammar in the descriptions with typos.

Fixes: d56b4b1974 ("configs: Migrate RBTREE, LZO, CMD_MTDPARTS, CMD_UBI and CMD_UBIFS")
Fixes: 7264f2928b ("spl: fit: Eanble GZIP support for image decompression")
Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# e60e4499 02-Sep-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

lib: Drop SHA512_ALGO in lieu of SHA512

SHA512_ALGO was used as a "either SHA512 or SHA384", although the
implementations of these two algorithms share a majority of code.

From a Kconfig interface perspective, it makes sense to present two
distinct options. This requires #ifdefing out the SHA512
implementation from sha512.c. The latter doesn't make any sense.

It's reasonable to say in Kconfig that SHA384 depends on SHA512, and
seems to be the more polite way to handle the selection.

Thus, automatically select SHA512 when SHA384 is enabled.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# b4c2c151 27-Aug-2021 Michal Simek <michal.simek@amd.com>

Kconfig: Remove all default n/no options

default n/no doesn't need to be specified. It is default option anyway.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
[trini: Rework FSP_USE_UPD portion]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 928a8be7 29-Jul-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

lib: ecdsa: Implement UCLASS_ECDSA verification on target

Implement the crypto_algo .verify() function for ecdsa256. Because
it backends on UCLASS_ECDSA, this change is focused on parsing the
keys from devicetree and passing this information to the specific
UCLASS driver.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# fa3f1f1d 24-Jul-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: disable CONFIG_SPL_HEXDUMP by default

CONFIG_HEXDUMP is needed to display UEFI variables using 'printenv -e'.

Enabling CONFIG_SPL_HEXDUMP only makes sense for debugging purposes.
Hence CONFIG_SPL_HEXDUMP should not be enabled by default.

The following boards currently have CONFIG_SPL_HEXDUMP=y. This includes
boards that don't use SPL at all.

axm_defconfig
imx8mm-cl-iot-gate_defconfig
imx8mm_venice_defconfig
imxrt1020-evk_defconfig
imxrt1050-evk_defconfig
kontron_sl28_defconfig
kp_imx53_defconfig
lx2160ardb_tfa_stmm_defconfig
mt7622_rfb_defconfig
octeon_ebb7304_defconfig
octeon_nic23_defconfig
qemu_arm64_defconfig
qemu_arm_defconfig
qemu-riscv32_defconfig
qemu-riscv32_smode_defconfig
qemu-riscv64_defconfig
qemu-riscv64_smode_defconfig
qemu-x86_64_defconfig
qemu-x86_defconfig
sandbox64_defconfig
sandbox_defconfig
stm32mp15_basic_defconfig
stm32mp15_trusted_defconfig
synquacer_developerbox_defconfig
taurus_defconfig
xilinx_versal_virt_defconfig

The patch only keeps it enabled on

sandbox_spl_defconfig

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 1a46cb6c 02-Jul-2021 Simon Glass <sjg@chromium.org>

lib: Create a new Kconfig option for charset conversion

Rather than looking at two KConfig options in the Makefile, create a new
Kconfig option for compiling lib/charset.c

Enable it for UFS also, which needs this support.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 26dd9936 08-Jul-2021 Steffen Jaeckel <jaeckel-floss@eyet-services.de>

lib: add crypt subsystem

Add the basic functionality required to support the standard crypt
format.
The files crypt-sha256.c and crypt-sha512.c originate from libxcrypt and
their formatting is therefor retained.
The integration is done via a crypt_compare() function in crypt.c.

```
libxcrypt $ git describe --long --always --all
tags/v4.4.17-0-g6b110bc
```

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 7d0f3fbb 11-Jun-2021 Tero Kristo <t-kristo@ti.com>

lib: rational: copy the rational fraction lib routines from Linux

Copy the best rational approximation calculation routines from Linux.
Typical usecase for these routines is to calculate the M/N divider
values for PLLs to reach a specific clock rate.

This is based on linux kernel commit:
"lib/math/rational.c: fix possible incorrect result from rational
fractions helper"
(sha1: 323dd2c3ed0641f49e89b4e420f9eef5d3d5a881)

Signed-off-by: Tero Kristo <t-kristo@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Tero Kristo <kristo@kernel.org>

# ec0512b1 24-May-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

Revert "lib: introduce HASH_CALCULATE option"

When we think of Kconfig, we usually think of features that we like
to enable or not. Ideally, we wouldn't use Kconfig to fix a build
issue, although sometimes it might make sense. With Kconfig it's hard
to guarantee that the fix is universal. We can only say that it works
for the set of tested configurations. In the majority of cases, it's
preferable to let the linker figure things out for us.

The reverted commit attempted to fix a build issue by adding an
invisible Kconfig option. This is wrong in several ways:

It invents a new Kconfig variable when CONFIG_HASH already
exists for the same purpose.
Second, hash-checksum.c makes use of the hash_progressive_lookup_algo()
symbol, which is only provided with CONFIG_HASH, but this dependency
was not expressed in the reverted patch.

It feels like Kconfig is turning into a listing of all available
source files, and a buffet to 'select' which ones to compile. The
purpose of this revert is to enable the next change to make use of
CONFIG_HASH instead of adding to Kconfig.

This reverts commit 87316da05f2fd49d3709275e64ef0c5980366ade.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Acked-by: Masahisa Kojima <masahisa.kojima@linaro.org>

# 1621d3c4 10-May-2021 Bin Meng <bmeng.cn@gmail.com>

lib: kconfig: Limit BINMAN_FDT for OF_SEPARATE or OF_EMBED

Generally speaking BINMAN_FDT makes sense for OF_SEPARATE or OF_EMBED.
For the other OF_CONTROL methods, it's quite possible binman node is
not available as binman is invoked during the build phase instead of
runtime. Let's only turn it on for OF_SEPARATE or OF_EMBED by default.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 87316da0 13-May-2021 Masahisa Kojima <masahisa.kojima@linaro.org>

lib: introduce HASH_CALCULATE option

Build error occurs when CONFIG_EFI_SECURE_BOOT or
CONFIG_EFI_CAPSULE_AUTHENTICATE is enabled,
because hash-checksum.c is not compiled.

Since hash_calculate() implemented in hash-checksum.c can be
commonly used aside from FIT image signature verification,
this commit itroduces HASH_CALCULATE option to decide
if hash-checksum.c shall be compiled.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# e2ae483c 13-May-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

hash: Kconfig option for SHA512 hardware acceleration

Commit a479f103dc1c ("hash: Allow for SHA512 hardware implementations")
defined function definitions for hardware accelerated SHA384 and SHA512.
If CONFIG_SHA_HW_ACCEL=y, these functions are used.

We already have boards using CONFIG_SHA_HW_ACCEL=y but none implements the
new functions hw_sha384() and hw_sha512().

For implementing the EFI TCG2 protocol we need SHA384 and SHA512. The
missing hardware acceleration functions lead to build errors on boards like
peach-pi_defconfig.

Introduce a new Kconfig symbol CONFIG_SHA512_HW_ACCEL to control if the
functions hw_sha384() and hw_sha512() shall be used to implement the SHA384
and SHA512 algorithms.

Fixes: a479f103dc1c ("hash: Allow for SHA512 hardware implementations")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

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

# 6d66502b 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: Add 2 config to define the max number of regions

Add 2 configs CONFIG_LMB_MEMORY_REGIONS and CONFIG_LMB_RESERVED_REGIONS
to change independently the max number of the regions in lmb
library.

When CONFIG_LMB_USE_MAX_REGIONS=y, move the lmb property arrays to
struct lmb and manage the array size with the element 'max' of struct
lmb_region; their are still allocated in stack.

When CONFIG_LMB_USE_MAX_REGIONS=n, keep the current location in
struct lmb_region to allow compiler optimization.

Increase CONFIG_LMB_RESERVED_REGIONS is useful to avoid lmb errors in
bootm when the number of reserved regions (not adjacent) is reached:
+ 1 region for relocated U-Boot
+ 1 region for initrd
+ 1 region for relocated linux device tree
+ reserved memory regions present in Linux device tree.

The current limit of 8 regions is reached with only 5 reserved regions
in DT.

see Linux kernel commit bf23c51f1f49 ("memblock: Move memblock arrays
to static storage in memblock.c and make their size a variable")

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# 4fa0150d 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: move MAX_LMB_REGIONS value in Kconfig

Move MAX_LMB_REGIONS value in Kconfig, the max number of the regions
in lmb library.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# 77b8cfef 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: move CONFIG_LMB in Kconfig

Migrate CONFIG_LMB in Kconfig.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# a479f103 16-Feb-2021 Joel Stanley <joel@jms.id.au>

hash: Allow for SHA512 hardware implementations

Similar to support for SHA1 and SHA256, allow the use of hardware hashing
engine by enabling the algorithm and setting CONFIG_SHA_HW_ACCEL /
CONFIG_SHA_PROG_HW_ACCEL.

Signed-off-by: Joel Stanley <joel@jms.id.au>

# f2c1442e 14-Mar-2021 Simon Glass <sjg@chromium.org>

bloblist: Make BLOBLIST_TABLES depend on BLOBLIST

Add an extra condition here since we cannot put x86 tables in a bloblist
when bloblists are not supported.

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

# e0103158 25-Feb-2021 Bin Meng <bmeng.cn@gmail.com>

lib: kconfig: Mention CONFIG_ADDR_MAP limitation in the help

Mention that CONFIG_ADDR_MAP only works in the post-relocation phase.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>

# 56e7257c 03-Feb-2021 Bin Meng <bmeng.cn@gmail.com>

lib: Fix BINMAN_FDT dependency

lib/binman.c references the following 3 ofnode APIs:
ofnode_first_subnode(), ofnode_path() and ofnode_read_bool().

These APIs get built only when DM is on. Fix the dependency then.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 59e4e391 18-Jan-2021 Tom Rini <trini@konsulko.com>

Merge https://gitlab.denx.de/u-boot/custodians/u-boot-riscv

- Update qemu-riscv.rst build instructions.
- Add support for SPI on Kendryte K210.
- Add Microchip PolarFire SoC Icicle Kit support.
- Add support for an early timer.
- Select TIMER_EARLY to avoid infinite recursion for Trace.


# a80f8513 17-Jan-2021 Pragnesh Patel <pragnesh.patel@sifive.com>

trace: select TIMER_EARLY to avoid infinite recursion

When tracing functions is enabled this adds calls to
__cyg_profile_func_enter() and __cyg_profile_func_exit() to the traced
functions.

__cyg_profile_func_enter() and __cyg_profile_func_exit() invoke
timer_get_us() to record the entry and exit time.

initr_dm() will make gd->dm_root = NULL and gd->timer = NULL, so
timer_get_us() -> get_ticks() -> dm_timer_init() will lead to an
indefinite recursion.

So select TIMER_EARLY when tracing got enabled.

Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Rick Chen <rick@andestech.com>

# 6205bbb1 04-Jan-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lib: cosmetic update of CONFIG_LIB_ELF description

Change 2 typo error in CONFIG_LIB_ELF description:
- Supoort => Support
- fir => for

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c589132a 02-Dec-2020 Aswath Govindraju <a-govindraju@ti.com>

fdt: Use phandle to distinguish DT nodes with same name

While assigning the sequence number to subsystem instances by reading the
aliases property, only DT nodes names are compared and not the complete
path. This causes a problem when there are two DT nodes with same name but
have different paths.

In arch/arm/dts/k3-am65-main.dtsi there are two USB controllers with the
same device tree node name but different path. When aliases are defined for
these USB controllers then fdtdec_get_alias_seq() fails to pick the correct
instance for a given index.

fdt_path_offset() function is slow and this would effect the U-Boot
startup. To avert the time penalty on all boards, apply this extra check
only when required by using a config option.

Fix it by comparing the phandles of DT nodes after the node names match,
under a config option.

Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Fix whitespace error in Kconfig:
Signed-off-by: Simon Glass <sjg@chromium.org>

# 28cef9ca 19-Nov-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

fs: fat: create correct short names

The current function set_name() used to create short names has the
following deficiencies resolved by this patch:

* Long names (e.g. FOO.TXT) are stored even if a short name is enough.
* Short names with spaces are created, e.g. "A ~1.TXT".
* Short names with illegal characters are created, e.g. "FOO++BAR".
* Debug output does not not consider that the short file name has no
concluding '\0'.

The solution for the following bug is split of into a separate patch:

* Short file names must be unique.

This patch only provides the loop over possible short file names.

Fixes: c30a15e590c ("FAT: Add FAT write feature")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# e4f8e543 05-Nov-2020 Simon Glass <sjg@chromium.org>

smbios: Drop the unused Kconfig options

Now that we can use devicetree to specify this information, drop the old
CONFIG options.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 44c74bdd 05-Nov-2020 Simon Glass <sjg@chromium.org>

sysinfo: Provide a default driver to set SMBIOS values

Some boards want to specify the manufacturer or product name but do not
need to have their own sysinfo driver.

Add a default driver which provides a way to specify this SMBIOS
information in the devicetree, without needing any board-specific
functionality.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d2cb7a22 04-Nov-2020 Simon Glass <sjg@chromium.org>

x86: Allow putting some tables in the bloblist

At present all tables are placed starting at address f0000 in memory, and
can be up to 64KB in size. If the tables are very large, this may not
provide enough space.

Also if the tables point to other tables (such as console log or a ramoops
area) then we must allocate other memory anyway.

The bloblist is a nice place to put these tables since it is contiguous,
which makes it easy to reserve this memory for linux using the 820 tables.

Add an option to put some of the tables in the bloblist. For SMBIOS and
ACPI, create suitable pointers from the f0000 region to the new location
of the tables.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
[bmeng: squashed in http://patchwork.ozlabs.org/project/uboot/patch/
20201105062407.1.I8091ad931cbbb5e3b6f6ababdf3f8d5db0d17bb9@changeid/]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# 415eab06 03-Nov-2020 Christian Gmeiner <christian.gmeiner@gmail.com>

smbios: add parsing API

Add a very simple API to be able to access SMBIOS strings
like vendor, model and bios version.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 72eda507 27-Oct-2020 Sean Anderson <seanga2@gmail.com>

lib: Add getopt

Some commands can get very unweildy if they have too many positional
arguments. Adding options makes them easier to read, remember, and
understand.

This implementation of getopt has been taken from barebox, which has had
option support for quite a while. I have made a few modifications to their
version, such as the removal of opterr in favor of a separate getopt_silent
function. In addition, I have moved all global variables into struct
getopt_context.

The getopt from barebox also re-orders the arguments passed to it so that
non-options are placed last. This allows users to specify options anywhere.
For example, `ls -l foo/ -R` would be re-ordered to `ls -l -R foo/` as
getopt parsed the options. However, this feature conflicts with the const
argv in cmd_tbl->cmd. This was originally added in 54841ab50c ("Make sure
that argv[] argument pointers are not modified."). The reason stated in
that commit is that hush requires argv to stay unmodified. Has this
situation changed? Barebox also uses hush, and does not have this problem.
Perhaps we could use their fix?

I have assigned maintenance of getopt to Simon Glass, as it is currently
only used by the log command. I would also be fine maintaining it.

Signed-off-by: Sean Anderson <seanga2@gmail.com>

# 26637e2e 12-Sep-2020 Simon Glass <sjg@chromium.org>

lib: Allow hexdump to be used in SPL

It is sometimes useful to output hex dumps in SPL. Add a config option to
allow this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# e87dfb05 05-Aug-2020 Andrii Anisov <andrii_anisov@epam.com>

lib: sscanf: add sscanf implementation

Port sscanf implementation from mini-os and introduce new
Kconfig option to enable it: CONFIG_SSCANF. Disable by default.

Signed-off-by: Andrii Anisov <andrii_anisov@epam.com>
Signed-off-by: Anastasiia Lukianenko <anastasiia_lukianenko@epam.com>
Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>

# 81014f73 30-Jul-2020 Joao Marcos Costa <joaomarcos.costa@bootlin.com>

include/u-boot, lib/zlib: add sources for zlib decompression

Add zlib (v1.2.11) uncompr() function to U-Boot. SquashFS depends on
this function to decompress data from a raw disk image. The actual
support for zlib into SquashFS sources will be added in a follow-up
commit.

Signed-off-by: Joao Marcos Costa <joaomarcos.costa@bootlin.com>

# 69be8fd1 03-Jun-2020 Marek Szyprowski <m.szyprowski@samsung.com>

powerpc: move ADDR_MAP to Kconfig

Move ADDR_MAP related config options from include/configs/*.h to the
proper place in lib/Kconfig. This has been done using
./tools/moveconfig.py and manual inspection of the generated changes.
This is a preparation to use ADDR_MAP helper on ARM 32bit Raspberry Pi4
board for mapping the PCIe XHCI MMIO, which is above the 4GiB identity
mapping limit.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# d16b38f4 15-Apr-2020 Reuben Dowle <reubendowle0@gmail.com>

Add support for SHA384 and SHA512

The current recommendation for best security practice from the US government
is to use SHA384 for TOP SECRET [1].

This patch adds support for SHA384 and SHA512 in the hash command, and also
allows FIT images to be hashed with these algorithms, and signed with
sha384,rsaXXXX and sha512,rsaXXXX

The SHA implementation is adapted from the linux kernel implementation.

[1] Commercial National Security Algorithm Suite
http://www.iad.gov/iad/programs/iad-initiatives/cnsa-suite.cfm

Signed-off-by: Reuben Dowle <reuben.dowle@4rf.com>

# 43e442a5 26-May-2020 Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

kconfig: fix some typos

Signed-off-by: Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

# eff5a547 22-May-2020 Michael Walle <michael@walle.cc>

cmd: zip: automatically pull in gzip()

Move the CONFIG_GZIP_COMPRESSED from a config.h macro to a Kconfig menu
item. It is not selectable by a user because there is no reason to do
so. Instead it will be automatically selected by the stuff which uses
gzip(), like the zip command.

Remove it from the config_whitelist.txt. Also remove
CONFIG_GZIP_COMPRESS_DEF_SZ as this was never used on any board. The
default seems to be sane, otherwise it should be added as a Kconfig
option.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8239be61 06-May-2020 Simon Glass <sjg@chromium.org>

lib: Allow MD5 to be enabled in SPL

At present the MD5 option cannot be enabled by board configs since it has
no Kconfig name. It is generally enabled, so long as FIT support is
present. But not all boards use FIT, particularly in SPL

Fix this and add an option for SPL as well. This allows board code to call
md5() even if FIT support is not enabled.

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

# 04cb3994 21-Apr-2020 Weijie Gao <weijie.gao@mediatek.com>

lib: enable lzma decompression support for SPL build

This patch enables LZMA decompression support for SPL build

Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>

# 2a2119e1 05-Mar-2020 Atish Patra <atishp@atishpatra.org>

lib: kconfig: Add option to set BZIP2 compression method

There is no way to select BZIP2 compression method.
Add it under library/compression config where all other
compression related configs are present.

Signed-off-by: Atish Patra <atish.patra@wdc.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 805b3cac 12-Feb-2020 Keerthy <j-keerthy@ti.com>

lib: elf: Move the generic elf loading/validating functions to lib

Move the generic elf loading/validating functions to lib/
so that they can be re-used and accessed by code existing
outside cmd.

While at it remove the duplicate static version of load_elf_image_phdr
under arch/arm/mach-imx/imx_bootaux.c.

Signed-off-by: Keerthy <j-keerthy@ti.com>
Suggested-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>

# 1611235b 19-Jan-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: Kconfig dependencies for pseudo-random library

drivers/rng/sandbox_rng.c requires rand() to be defined but configuration
option CONFIG_CONFIG_LIB_RAND selected in drivers/rng/Kconfig does not
exist.

test/lib/test_aes.c requires rand() to be defined.

Fix the selection criteria for choice "Pseudo-random library support type".

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 3c10dc95 06-Dec-2019 Simon Glass <sjg@chromium.org>

binman: Add a library to access binman entries

SPL and TPL can access information about binman entries using link-time
symbols but this is not available in U-Boot proper. Of course it could be
made available, but the intention is to just read the device tree.

Add support for this, so that U-Boot can locate entries.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# b4adf627 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: crypto: add x509 parser

Imported from linux kernel v5.3:
x509.asn1 without changes
x509_akid.asn1 without changes
x509_parser.h without changes
x509_cert_parser.c with changes marked as __UBOOT__
x509_public_key.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# a9b45e6e 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add oid registry utility

Imported from linux kernel v5.3:
build_OID_registry without changes
oid_registry.h without changes
oid_registry.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# ab8a0e06 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add asn1 decoder

Imported from linux kernel v5.3:
lib/asn1_decoder.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 2b12196d 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

cmd: add asn1_compiler

Imported from linux kernel v5.3:
asn1.h without changes
asn1_ber_bytecode.h without changes
asn1_decoder.h without changes
asn1_compiler.c without changes

This host command will be used to create a ASN1 parser, for example,
for pkcs7 messages or x509 certificates. More specifically, it will
generate *byte code* which will be interpreted by asn1 decoder library.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 05429b6c 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

rtc: move date.c from drivers/rtc/ to lib/

In the next commit, rtc_mktime(), for compatibility with linux, will be
implemented using rtc_mktime(), which is no longer drivers/rtc specific.
So move this file under lib/.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 37ef1774 10-Nov-2019 Thomas Hebb <tommyhebb@gmail.com>

Kconfig: disambiguate config names for tiny printf

27084c03d36a ("spl: Allow tiny printf() to be controlled in SPL and
TPL") split this option in two for TPL and SPL, but didn't change the
Kconfig names, making them hard to set quickly.

Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>

# 0d76afc0 27-Oct-2019 Simon Glass <sjg@chromium.org>

fdt: Add Kconfig options to control code size

For better or worse libfdt recent grew a lot of code that checks the
validity of the device tree in great detail. When using unsigned or
unverified data this makes things safer, but it does add to code size.

Add some controls to select the trade-off between safety and code size.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 27084c03 25-Sep-2019 Simon Glass <sjg@chromium.org>

spl: Allow tiny printf() to be controlled in SPL and TPL

At present there is only one control for this and it is used for both SPL
and TPL. But SPL might have a lot more space than TPL so the extra cost of
a full printf() might be acceptable.

Split the option into two, providing separate SPL and TPL controls. The
TPL setting defaults to the same as SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2a51e16b 07-Jun-2019 Tom Rini <trini@konsulko.com>

configs: Make USE_TINY_PRINTF depend on SPL||TPL and be default

The USE_TINY_PRINTF symbol only changes things within SPL and TPL
builds, so make it depend on that support. Next, make it default as
within these cases we should rarely have need of more advanced print
formats outside of the debug context.

To do this, in a few cases we need to correct our Kconfig dependencies
as we had cases of non-SPL targets select'ing this symbol. Finally, in
the case of a few boards we really do need the full printf
functionality.

Signed-off-by: Tom Rini <trini@konsulko.com>

# da0fb5fd 02-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: make call depth limit customizable

Up to now we had hard coded values for the call depth up to which trace
records are created: 200 for early tracing, 15 thereafter. UEFI
applications reach a call depth of 80 or above.

Provide customizing settings for the call trace depth limit and the early
call trace depth limit. Use the old values as defaults.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8509f22a 29-Apr-2019 Marek Behún <kabel@kernel.org>

lib: add Zstandard decompression support

Add the zstd library from Linux kernel (only decompression support).
There are minimal changes to build with U-Boot, otherwise the files are
identical to Linux commit dc35da16 from March 2018, the files had not
been touched since in kernel. Also SPDX lincese tags were added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 83a486b6 29-Apr-2019 Marek Behún <kabel@kernel.org>

lib: Add xxhash support

This adds the xxhash support from Linux. Files are almost identical to
those added to Linux in commit 5d240522 ("lib: Add xxhash module") (they
haven't been touched since in Linux). The only difference is to add some
includes to be compatible with U-Boot. Also SPDX lincese tags were
added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 5132361a 29-Apr-2019 Heiko Schocher <hs@denx.de>

lib: Kconfig: fix help text for GZIP

commit 95f4bbd581cf ("lib: fdt: Allow LZO and GZIP DT compression in U-Boot")

introduced Kconfig option for gzip in U-Boot, but help text
says gzip for SPL, which is wrong. Fix this.

Signed-off-by: Heiko Schocher <hs@denx.de>
Acked-by: Marek Vasut <marex@denx.de>

# 1c6eb075 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE_BUFFER_SIZE et al to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE_BUFFER_SIZE
CONFIG_TRACE_EARLY_SIZE
CONFIG_TRACE_EARLY
CONFIG_TRACE_EARLY_ADDR

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

# a24a78d7 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE

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

# 54969b40 21-Mar-2019 Thierry Reding <treding@nvidia.com>

fdtdec: Add Kconfig symbol for tests

Runtime tests are provided as a test_fdtdec command implementation. Add
a Kconfig symbol that allows this command to be built so that the tests
can be used.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 95f4bbd5 08-Mar-2019 Marek Vasut <marex@denx.de>

lib: fdt: Allow LZO and GZIP DT compression in U-Boot

Add required Kconfig symbols, Makefile bits and macro fixes in a
few places to support LZO and DT compression in U-Boot. This can
save a lot of space with multi-DTB fitImages.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>

# 6e705114 13-Jan-2019 Chris Packham <judge.packham@gmail.com>

lib: Kconfig: spelling fixes

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 048c6e89 06-Nov-2018 Simon Glass <sjg@chromium.org>

spl: lz4: Allow use of lz4 compression in SPL

In some cases U-Boot is compressed and it is useful to be able to
decompress it in SPL. Add a Kconfig and Makefile change to allow this.
Note that this does not actually implement decompression.

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

# 2895c4b7 15-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

kconfig: Introduce HAVE_ARCH_IOMAP

Introduce a new Kconfig option for architecture codes to control
whether it provides io{read,write}{8,16,32} I/O accessor functions.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5592a633 01-Oct-2018 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt in TPL

In some cases (e.g. sandbox with verified boot) it is useful to support
libfdt in TPL. Update the Kconfig to handle this.

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

# 6307896c 01-Oct-2018 Simon Glass <sjg@chromium.org>

tpm: Add support for SPL and TPL

At present the tpm can only be used in U-Boot proper. Updated it to work
in SPL and TPL also.

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

# ab948cd2 19-Jul-2018 Masahiro Yamada <masahiroy@kernel.org>

fdt_support: make FDT_FIXUP_PARTITIONS depend on CMD_MTDPARTS

fdt_fixup_mtdparts() calls mtdparts_init() and device_find(),
which are defined in cmd/mtdparts.c

The combination of FDT_FIXUP_PARTITIONS=y and CMD_MTDPARTS=n
emits the following link error:

common/fdt_support.c:903: undefined reference to `mtdparts_init'
common/fdt_support.c:914: undefined reference to `device_find'

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 3330584d 03-Jun-2018 Igor Opaniuk <igor.opaniuk@gmail.com>

avb2.0: integrate avb 2.0 into the build system

Integrate libavb into the build system. Introduce CONFIG_LIBAVB
build option.

Signed-off-by: Igor Opaniuk <igor.opaniuk@linaro.org>

# f8c987f8 05-Jun-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

lib: Add hexdump

Often during debugging session it's very interesting to see
what data we were dealing with. For example what we write or read
to/from memory or peripherals.

This change introduces functions that allow to dump binary
data with one simple function invocation like:
------------------->8----------------
print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, buf, len);
------------------->8----------------

which gives us the following:
------------------->8----------------
00000000: f2 b7 c9 88 62 61 75 64 72 61 74 65 3d 31 31 35 ....baudrate=115
00000010: 32 30 30 00 62 6f 6f 74 61 72 67 73 3d 63 6f 6e 200.bootargs=con
00000020: 73 6f 6c 65 3d 74 74 79 53 33 2c 31 31 35 32 30 sole=ttyS3,11520
00000030: 30 6e 38 00 62 6f 6f 74 64 65 6c 61 79 3d 33 00 0n8.bootdelay=3.
00000040: 62 6f 6f 74 66 69 6c 65 3d 75 49 6d 61 67 65 00 bootfile=uImage.
00000050: 66 64 74 63 6f 6e 74 72 6f 6c 61 64 64 72 3d 39 fdtcontroladdr=9
00000060: 66 66 62 31 62 61 30 00 6c 6f 61 64 61 64 64 72 ffb1ba0.loadaddr
00000070: 3d 30 78 38 32 30 30 30 30 30 30 00 73 74 64 65 =0x82000000.stde
00000080: 72 72 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 rr=serial0@e0022
00000090: 30 30 30 00 73 74 64 69 6e 3d 73 65 72 69 61 6c 000.stdin=serial
000000a0: 30 40 65 30 30 32 32 30 30 30 00 73 74 64 6f 75 0@e0022000.stdou
000000b0: 74 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 30 t=serial0@e00220
000000c0: 30 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00..............
...
------------------->8----------------

Source of hexdump.c was copied from Linux kernel v4.7-rc2.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Mario Six <mario.six@gdsys.cc>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Stefan Roese <sr@denx.de>

# c232d14d 29-May-2018 Alex Kiernan <alex.kiernan@gmail.com>

mmc: Separate "mmc swrite" from fastboot

Introduce CONFIG_IMAGE_SPARSE and CONFIG_CMD_MMC_SWRITE so the "mmc
swrite" command is separated from the fastboot code.

Move image-sparse from common to lib so it's clear it's library code.

Rename CONFIG_FASTBOOT_FLASH_FILLBUF_SIZE to CONFIG_IMAGE_SPARSE_FILLBUF_SIZE
and migrate it to Kconfig.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Acked-by: Jassi Brar <jaswinder.singh@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6417572e 08-May-2018 Tom Rini <trini@konsulko.com>

lib/Kconfig: Mark OF_LIBFDT_OVERLAY as depending on OF_LIBFDT

The overlay code is only useful when OF_LIBFDT is set, so mark it as
depending on that first.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 58a46f88 25-Apr-2018 Praneeth Bajjuri <praneeth@ti.com>

configs: TI: Enable FIT Library overlay support

Enable the FDT library overlay support for all TI SOC family.

Without this option, when Loading fdt from FIT image, the
following warning is seen.

"config with overlays but CONFIG_OF_LIBFDT_OVERLAY not set".

Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
Suggested-by: Andrew F.Davis <afd@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>

# 14ad44ab 18-Apr-2018 Alex Kiernan <alex.kiernan@gmail.com>

spl: Split sprintf, strto* from SPL serial in Kconfig

When SPL serial is disabled, callers who need sprintf or strtoul fail
because their inclusion is guarded by CONFIG_SPL_SERIAL_SUPPORT/
CONFIG_TPL_SERIAL_SUPPORT.

Split printf, sprintf and strto into their own entries and then select
all of them if SERIAL_SUPPORT is enabled to match the current behaviour.

Include panic.o unconditionally as it can be called from anywhere which
uses BUG_ON().

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>

# e294ba06 04-Apr-2018 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-sunxi

Signed-off-by: Tom Rini <trini@konsulko.com>


# d14db11d 03-Apr-2018 Andre Przywara <andre.przywara@arm.com>

sunxi: revert disabling of features

In January some commits were introduced to mitigate the U-Boot image
size issues we encountered on sunxi builds.
Now with the MMC environment removed we can bring them back, as we
practically don't have a size limit anymore.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 32ce6179 13-Mar-2018 Bryan O'Donoghue <bryan.odonoghue@linaro.org>

optee: Add lib entries for sharing OPTEE code across ports

This patch adds code to lib to enable sharing of useful OPTEE code between
board-ports and architectures. The code on lib/optee/optee.c comes from the
TI omap2 port. Eventually the OMAP2 code will be patched to include the
shared code. The intention here is to add more useful OPTEE specific code
as more functionality gets added.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Cc: Harinarayan Bhatta <harinarayan@ti.com>
Cc: Andrew F. Davis <afd@ti.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Kever Yang <kever.yang@rock-chips.com>
Cc: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Cc: Peng Fan <peng.fan@nxp.com>
Tested-by: Peng Fan <peng.fan@nxp.com>

# 36c1877c 06-Feb-2018 Faiz Abbas <faiz_abbas@ti.com>

lib: Kconfig: Move DYNAMIC_CRC_TABLE to Kconfig

Add CONFIG prefix to DYNAMIC_CRC_TABLE and implement it in
Kconfig.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>

# a451bc27 05-Feb-2018 Adam Ford <aford173@gmail.com>

Convert LIB_UUID to Kconfig

config_fallback.h has some logic that checks a variety of options
and selects LIB_UUID if it hasn't already been selected. This
will all LIB_UUID in Kconfig and select this option for the list
of options to allow us to remove the logic from fallbacks

Signed-off-by: Adam Ford <aford173@gmail.com>

# a5a37567 06-Feb-2018 Adam Ford <aford173@gmail.com>

Convert CONFIG LIB_HW_RAND to Kconfig

config_fallbacks.h had some logic to automatically select
LIB_RAND if RANDOM_UUID or CMD_UUID were set if LIB_HW_RAND wasn't
already selected. By migrating LIB_HW_RAND to Kconfig, we can
remove this check from config_fallbacks.h and put it into Kconfig

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
[trini: Turn into a choice, add NET_RANDOM_ETHADDR]
Signed-off-by: Tom Rini <trini@konsulko.com>

# acd4d334 16-Jan-2018 Maxime Ripard <maxime.ripard@free-electrons.com>

net: regex: Disable by default on sunXi

The sunXi arm64 build has overflown, leading to the main U-boot binary
overwriting the environment when flashing the new image, or even worse,
overwriting itself when we're calling saveenv.

Disable this option that is not critical until we can adress the issue
properly.

Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 7e3caa81 03-Dec-2017 Masahiro Yamada <masahiroy@kernel.org>

Move CONFIG_PANIC_HANG to Kconfig

Freescale (NXP) boards have lots of defconfig files per board.
I used "imply PANIC_HANG" for them.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# da5337a6 08-Nov-2017 Nandor Han <nandor.han@ge.com>

rtc: add support for s35392a

Add support for S35392A RTC. The driver supports both U-Boot driver
models.

Signed-off-by: Nandor Han <nandor.han@ge.com>
Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
Cc: Heiko Schocher <hs@denx.de>

# f52bdf4b 14-Sep-2017 Jean-Jacques Hiblot <jjhiblot@ti.com>

lib: allow building lzo for the SPL

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 85d8bf57 03-Sep-2017 Marek Behún <kabel@kernel.org>

lib: Add CRC32-C

This is needed for BTRFS.

Signed-off-by: Marek Behun <marek.behun@nic.cz>

create mode 100644 lib/crc32c.c

# 7264f292 15-Aug-2017 York Sun <york.sun@nxp.com>

spl: fit: Eanble GZIP support for image decompression

Add Kconfig option SPL_GZIP and SPL_ZLIB to enable gunzip support for
SPL boot, eg. falcon boot compressed kernel image.

Signed-off-by: York Sun <york.sun@nxp.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6ef2f901 11-Aug-2017 Adam Ford <aford173@gmail.com>

Convert CONFIG_BCH to Kconfig

This converts the following to Kconfig:
CONFIG_BCH

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1a7ba1d 18-Aug-2017 Anatolij Gustschin <agust@denx.de>

Fix 'notes' typos

s/notes/nodes

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 96b9082c 03-Aug-2017 Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

rockchip: rk3188: rock: adjust for SPL/TPL split

With the changes to split SPL/TPL for the RK3368, I apparently missed
some needed adjustments to the RK3188 Kconfig and rock_defconfig.

This fixes build-issues for the rock board after applying the RK3368
enablement (and SPL/TPL) set that resulted from TPL_SERIAL_SUPPORT,
TPL_ROCKCHIP_BACK_TO_BROM and TPL_TINY_MEMSET being separate symbols
now.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d56b4b19 22-Jul-2017 Tom Rini <trini@konsulko.com>

configs: Migrate RBTREE, LZO, CMD_MTDPARTS, CMD_UBI and CMD_UBIFS

The above CONFIG options are in Kconfig, and now have correct depends and
inter-dependencies. Migrate these to configs/ from include/configs/. In the
case of CMD_UBIFS also change it to be a default y if CMD_UBI.

Signed-off-by: Tom Rini <trini@konsulko.com>

# aed998aa 17-May-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_LZMA to Kconfig

This converts the following to Kconfig:
CONFIG_LZMA

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

# b1a873df 26-Apr-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_CMD_AES et al to Kconfig

This converts the following to Kconfig:
CONFIG_CMD_AES
CONFIG_AES

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Add select AES to CMD_AES]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 173aafbf 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

cmd: Expose a Kconfig option to enable UBIFS commands

Create a new Kconfig entry to allow CMD_UBIFS selection from Kconfig and
add an hidden LZO option that can be selected by CMD_UBIFS.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>

# aa049152 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

mtd: ubi: Select RBTREE option from MTD_UBI Kconfig entry

Expose the RBTREE feature through Kconfig and select this option from the
MTD_UBI option.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>
[Rebased on master]
Signed-off-by: Jagan Teki <jagan@openedev.com>

# ab4458bd 02-Apr-2017 Simon Glass <sjg@chromium.org>

string: Provide a slimmed-down memset()

Most of the time the optimised memset() is what we want. For extreme
situations such as TPL it may be too large. For example on the 'rock'
board, using a simple loop saves a useful 48 bytes. With gcc 4.9 and
the rodata bug, this patch is enough to reduce the TPL image below the
limit.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>

# bea79d7d 14-Mar-2017 Andre Przywara <andre.przywara@arm.com>

Kconfig: introduce md5sum command selection

So far CONFIG_MD5SUM would need to be set by a board's include file.
Since the command is really generic, move it over to Kconfig to allow
it to be defined by either a board's defconfig, menuconfig or some
config snippet merged via mergeconfig.sh.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e663b350 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

smbios: Expose in efi_loader as table

We can pass SMBIOS easily as EFI configuration table to an EFI payload. This
patch adds enablement for that case.

While at it, we also enable SMBIOS generation for ARM systems, since they support
EFI_LOADER.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4b6dddc2 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

x86: Move smbios generation into arch independent directory

We will need the SMBIOS generation function on ARM as well going forward,
so let's move it into a non arch specific location.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# ebf7fff2 05-Oct-2016 Heiko Schocher <hs@denx.de>

spl: move FDT_FIXUP_PARTITIONS to Kconfig

Move FDT_FIXUP_PARTITIONS to Kconfig and cleanup existing
uses.

Signed-off-by: Heiko Schocher <hs@denx.de>

# ddf67f71 05-Jul-2016 Maxime Ripard <maxime.ripard@free-electrons.com>

libfdt: Add overlay application function

The device tree overlays are a good way to deal with user-modifyable
boards or boards with some kind of an expansion mechanism where we can
easily plug new board in (like the BBB, the Raspberry Pi or the CHIP).

Add a new function to merge overlays with a base device tree.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>

# 91b86e21 26-May-2016 Marek Vasut <marex@denx.de>

lib: Enable private libgcc by default

This patch decouples U-Boot binary from the toolchain on systems where
private libgcc is available. Instead of pulling in functions provided
by the libgcc from the toolchain, U-Boot will use it's own set of libgcc
functions. These functions are usually imported from Linux kernel, which
also uses it's own libgcc functions instead of the ones provided by the
toolchain.

This patch solves a rather common problem. The toolchain can usually
generate code for many variants of target architecture and often even
different endianness. The libgcc on the other hand is usually compiled
for one particular configuration and the functions provided by it may
or may not be suited for use in U-Boot. This can manifest in two ways,
either the U-Boot fails to compile altogether and linker will complain
or, in the much worse case, the resulting U-Boot will build, but will
misbehave in very subtle and hard to debug ways.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 67976306 30-Mar-2016 Masahiro Yamada <masahiroy@kernel.org>

cosmetic: Fix typos "privide"

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# ed980b8c 03-Mar-2016 Alexander Graf <agraf@csgraf.de>

efi_loader: hook up in build environment

Now that we have all the bits and pieces ready for EFI payload loading
support, hook them up in Makefiles and KConfigs so that we can build.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
[trini: Enable only when we of OF_LIBFDT, disable on kwb and colibri_pxa270]
Signed-off-by: Tom Rini <trini@konsulko.com>

# aa34fbc0 22-Feb-2016 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt to be used in SPL

Add an option to enable libfdt in SPL. This can be useful when decoding
FIT files in SPL.

We need to make sure this option is not enabled in SPL by this change.
Also this option needs to be enabled in host builds. Si add a new
IMAGE_USE_LIBFDT #define which can be used in files that are built on the
host but must also build for U-Boot and SPL.

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

# 69e173eb 22-Feb-2016 Simon Glass <sjg@chromium.org>

Move CONFIG_OF_LIBFDT to Kconfig

Move this option to Kconfig and tidy up existing boards.

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

# a187559e 05-Feb-2016 Bin Meng <bmeng.cn@gmail.com>

Use correct spelling of "U-Boot"

Correct spelling of "U-Boot" shall be used in all written text
(documentation, comments in source files etc.).

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Minkyu Kang <mk7.kang@samsung.com>

# 947c626d 14-Jan-2016 Tom Rini <trini@konsulko.com>

vsprintf.c: Always enable CONFIG_SYS_VSNPRINTF

Enabling this function always removes some class of string saftey issues.
The size change here in general is about 400 bytes and this seems a reasonable
trade-off.

Cc: Peng Fan <peng.fan@nxp.com>
Cc: Peter Robinson <pbrobinson@gmail.com>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Adrian Alonso <aalonso@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 7d9cde10 22-Nov-2015 Stefan Roese <sr@denx.de>

lib/tiny-printf.c: Add tiny printf function for space limited environments

This patch adds a small printf() version that supports all basic formats.
Its intented to be used in U-Boot SPL versions on platforms with very
limited internal RAM sizes.

To enable it, just define CONFIG_USE_TINY_PRINTF in your defconfig. This
will result in the SPL using this tiny function and the main U-Boot
still using the full-blown printf() function.

This code was copied from:
http://www.sparetimelabs.com/printfrevisited
With mostly only coding style related changes so that its checkpatch
clean.

The size reduction is about 2.5KiB. Here a comparison for the db-mv784mp-gp
(Marvell AXP) SPL:

Without this patch:
58963 18536 1928 79427 13643 ./spl/u-boot-spl

With this patch:
56542 18536 1956 77034 12cea ./spl/u-boot-spl

Note:
To make it possible to compile tiny-printf.c instead of vsprintf.c when
CONFIG_USE_TINY_PRINTF is defined, the functions printf() and vprintf() are
moved from common/console.c into vsprintf.c in this patch.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>

# 2419cd16 03-Oct-2015 Simon Glass <sjg@chromium.org>

dm: tpm: Drop CONFIG_DM_TPM

Now that all TPM drivers use driver model, we can drop the special driver
model CONFIG option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>

# 027b728d 06-Oct-2015 Julius Werner <jwerner@chromium.org>

Add support for LZ4 decompression algorithm

This patch adds support for LZ4-compressed FIT image contents. This
algorithm has a slightly worse compression ration than LZO while being
nearly twice as fast to decompress. When loading images from a fast
storage medium this usually results in a boot time win.

Sandbox-tested only since I don't have a U-Boot development system set
up right now. The code was imported unchanged from coreboot where it's
proven to work, though. I'm mostly interested in getting this recognized
by mkImage for use in a downstream project.

Signed-off-by: Julius Werner <jwerner@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# a7d660bc 22-Aug-2015 Simon Glass <sjg@chromium.org>

tpm: Add Kconfig options for TPMs

Add new Kconfig options for TPMs in preparation for moving boards to use
Kconfig for TPM configuration.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 867a6ac8 31-Jul-2015 Simon Glass <sjg@chromium.org>

efi: Add start-up library code

When running as an EFI application, U-Boot must request memory from EFI,
and provide access to the boot services U-Boot needs.

Add library code to perform these tasks. This includes efi_main() which is
the entry point from EFI. U-Boot is built as a shared library.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d1389403 23-Jun-2015 Simon Glass <sjg@chromium.org>

Add a dhrystone benchmark command

Drystone provides a convenient sanity check that the CPU is running at full
speed. Add this as a command which can be enabled as needed.

Note: I investigated using Coremark for this but there was a license
agreement and I could not work out if it was GPL-compatible.

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

# f7848d90 22-Jun-2015 Joe Hershberger <joe.hershberger@ni.com>

Allow CONFIG_REGEX to be disabled when CONFIG_NET

Instead of selecting REGEX when NET is enabled, make it the default, but
allow boards that are tiny to disable it and lose functionality on all
but the first Ethernet adapter.

cm-bf548, bf538f-ezkit, and bf533-stamp need this. None appear to have
more than one Ethernet interface.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# 3850dbe8 11-Jun-2015 Masahiro Yamada <masahiroy@kernel.org>

blackfin: fix undefined reference to srand and rand

Commit 9ba9e85f3f1c (net: Fix NET_RANDOM_ETHADDR dependencies)
accidentally dropped CONFIG_LIB_RAND defines for 14 Blackfin boards.

Prior to that commit, those boards defined CONFIG_LIB_RAND, but not
CONFIG_NET_RANDOM_ETHADDR. So, commit 9ba9e85f3f1c should not have
touched them, but in fact it ripped CONFIG_LIB_RAND off from all the
header files, which caused undefined reference to srand and rand.
CONFIG_LIB_RAND=y must be revived for such boards.

BTW, this commit indeed makes it better, but even with this fix,
three boards (bf533-stamp, bf538f-ezkit, cm-bf548) still can not
build due to region 'ram' overflowed error. This was cause by
commit 6eed3786c68c (net: Move the CMD_NET config to defconfigs)
because CMD_NET selects NET, and NET selects REGEX. Eventually,
some boards were newly enabled with CONFIG_REGEX, increasing the
memory footprint. A patch is expected to fix the build error.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 9ba9e85f 25-May-2015 Michal Simek <michal.simek@amd.com>

net: Fix NET_RANDOM_ETHADDR dependencies

NET_RANDOM_ETHADDR depends on lib/rand.c. This patch adds dependency to
Kconfig to ensure that library is also compiled.

Remove the definitions from Blackfin boards' include/configs.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 6501ff62 20-Apr-2015 Przemyslaw Marczak <p.marczak@samsung.com>

lib: Kconfig: add entry for errno_str() function

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1a60650c 21-Apr-2015 Joe Hershberger <joe.hershberger@ni.com>

kconfig: Move REGEX to Kconfig

Having this as a Kconfig allows it to be a dependent feature.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8156345d 06-Mar-2015 Simon Glass <sjg@chromium.org>

sandbox: Move CONFIG_SYS_VSNPRINTF to Kconfig

Move this over to Kconfig and tidy up.

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

# 94e3c8c4 19-Feb-2015 gaurav rana <gaurav.rana@freescale.com>

crypto/fsl - Add progressive hashing support using hardware acceleration.

Currently only normal hashing is supported using hardware acceleration.
Added support for progressive hashing using hardware.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
Signed-off-by: Gaurav Rana <gaurav.rana@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>

# d9f23c7f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

lib/rsa: Add Kconfig for devices supporting RSA Modular Exponentiation

Kconfig option added for devices which support RSA Verification.
1. RSA_SOFTWARE_EXP
Enables driver for supporting RSA Modular Exponentiation in Software
2. RSA_FREESCALE_EXP
Enables driver for supporting RSA Modular Exponentiation using Freescale specific
driver

The above drivers use RSA uclass

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
(Removed duplicate line in Kconfig comment)

Change-Id: I7663c4d5350e2bfc3dfa2696f70ef777d6ccc6f6

# c4beb22f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

FIT: Modify option FIT_SIGNATURE in Kconfig

For FIT signature based approach to work, RSA library needs to be selected.
The FIT_SIGNATURE option in Kconfig is modified to automatically select RSA.
Selecting RSA compiles the RSA library required for image verification.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 45ccec8f 23-Oct-2014 Masahiro Yamada <masahiroy@kernel.org>

kconfig: move CONFIG_USE_PRIVATE_LIBGCC to Kconfig

The private libgcc is supported only on ARM, MIPS, PowerPC, SH, x86.
Those architectures should "select" HAVE_PRIVATE_LIBGCC and
CONFIG_USE_PRIVATE_LIBGCC should depend on it.

Currently, this option is enabled on Tegra boards and x86 architecture.
Move the definition from header files to Kconfig.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Tested-by: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: Tom Warren <twarren@nvidia.com>

# 8c688bc4 23-Oct-2014 Masahiro Yamada <masahiroy@kernel.org>

kconfig: move CONFIG_SYS_HZ to lib/Kconfig

CONFIG_SYS_HZ is always defined as 1000 in config_fallbacks.h
(but some boards still have redundant definitions).

This commit moves the definition and the document in README to
Kconfig. Since lib/Kconfig can assure that CONFIG_SYS_HZ is 1000,
the sanity check in lib/time.c should be removed.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Reviewed-by: Marek Vasut <marex@denx.de>

# b0928da6 16-Sep-2014 Masahiro Yamada <masahiroy@kernel.org>

kconfig: move CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED to Kconfig

If this option is enabled, the objects under lib/ directory
are compiled with speed optimization, not size optimization.
(Currently, only used by some Blackfin boards.)

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# ed36323f 16-Sep-2014 Masahiro Yamada <masahiroy@kernel.org>

kconfig: add blank Kconfig files

This would be useful to start moving various config options.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# 44071cd5 14-Oct-2023 Sean Anderson <seanga2@gmail.com>

fs: ext4: Fix building ext4 in SPL if write is enabled

If EXT4_WRITE is enabled, write capabilities will be compiled into SPL, but
not CRC16. Add an option to enable CRC16 to avoid linker errors.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 53fab13a 20-Sep-2023 Simon Glass <sjg@chromium.org>

efi: Use the installed SMBIOS tables

U-Boot should set up the SMBIOS tables during startup, as it does on x86.
Ensure that it does this correctly on non-x86 machines too, by creating
an event spy for last-stage init.

Tidy up the installation-condition code while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 8c11d19e 19-Sep-2023 Simon Glass <sjg@chromium.org>

x86: smbios: Add a Kconfig indicating SMBIOS-table presence

When booted from coreboot, U-Boot does not build the SMBIOS tables, but
it should still pass them on to the OS. Add a new option which indicates
whether SMBIOS tables are present, however they were built.

Flip the ordering so that the dependency is listed first, which is less
confusing.

Adjust GENERATE_SMBIOS_TABLE to depend on this new symbol.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 0c45c76c 19-Sep-2023 Simon Glass <sjg@chromium.org>

x86: Allow APCI in SPL

This is needed so we can find the DBG2 table provided by coreboot. Add a
Kconfig so it can be enabled.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 040a6048 14-Sep-2023 Simon Glass <sjg@chromium.org>

boot: Join FDT_FIXUP_PARTITIONS with related options

Move this to be with the other devicetree-fixup options.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 4cc40f61 14-Sep-2023 Simon Glass <sjg@chromium.org>

FWU: Avoid showing an unselectable menu option

Use a menuconfig to avoid showing a menu which cannot be selected in many
cases.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

# a90b5946 14-Sep-2023 Simon Glass <sjg@chromium.org>

lib: rational: Move the Kconfigs into the correct place

These should not be part of the 'system tables' menu. Move them outside
on their own.

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: 7d0f3fbb93c ("lib: rational: copy the rational fraction lib...")
Reviewed-by: Tom Rini <trini@konsulko.com>

# a077ac13 02-Aug-2023 Tom Rini <trini@konsulko.com>

Kconfigs: Correct default of "0" on hex type entries

It is not a parse error to have a default value of "0" for a "hex" type
entry, instead of "0x0". However, "0" and "0x0" are not treated the
same even by the tools themselves. Correct this by changing the default
value from "0" to "0x0" for all hex type questions that had the
incorrect default. Fix one instance (in two configs) of a default of "0"
being used on a hex question to be "0x0". Remove the cases where a
defconfig had set a value of "0x0" to be used as the default had been
"0".

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# af62d83c 03-Aug-2023 Oleksandr Suvorov <oleksandr.suvorov@foundries.io>

spl: move SPL_CRC32 option to lib/Kconfig

All SPL hash algorithm options are collected in lib/Kconfig. Move
SPL_CRC32 there as well.

Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
Reviewed-by: Simon Glass <sjg@chromium.org>

# dfe00b34 13-Jul-2023 Manorit Chawdhry <m-chawdhry@ti.com>

lib: Kconfig: k3: Enable SHA512 for fit signature

We are using our custMpk for signing that is a 4096 bit key, 4096 bit
rsa key requires a SHA512 hashing algorithm to be enabled as per the
source. Even though it is not mandated but this is how it works and is
tested.

Enables SHA512 if fit signature is enabled on K3 platforms.

Signed-off-by: Manorit Chawdhry <m-chawdhry@ti.com>

# 0992a90d 04-May-2023 Simon Glass <sjg@chromium.org>

acpi: Create a new Kconfig for ACPI

We have several Kconfig options for ACPI, but all relate to specific
functions, such as generating tables and AML code.

Add a new option which controls including basic ACPI library code,
including the lib/acpi directory. This will allow us to add functions
which are available even if table generation is not supported.

Adjust the command to avoid a build error when ACPIGEN is not enabled.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 94c8da21 22-Mar-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: Fix LMB_MEMORY_REGIONS flag usage

Remove test on CONFIG_LMB_MEMORY_REGIONS introduced by commit
7c1860fce4e3 ("lmb: Fix lmb property's defination under struct lmb").

This code in lmb_init() is strange, because if CONFIG_LMB_USE_MAX_REGIONS
and CONFIG_LMB_MEMORY_REGIONS are not defined, the implicit #else is empty
and the required initialization is not done:
lmb->memory.max = ?
lmb->reserved.max = ?

But this setting is not possible:
- CONFIG_LMB_USE_MAX_REGIONS not defined
- CONFIG_LMB_MEMORY_REGIONS not defined
because CONFIG_LMB_MEMORY_REGIONS and CONFIG_LMB_RESERVED_REGIONS are
defined as soon as the CONFIG_LMB_USE_MAX_REGIONS is not defined.

This patch removes this impossible case #elif and I add some
explanation in lmb.h to explain why in the struct lmb {} the lmb
property is defined if CONFIG_LMB_MEMORY_REGIONS is NOT defined.

This patch also removes CONFIG_LMB_XXX dependency on CONFIG_LMB as these
defines are used in API file lmb.h and not only in library file.

Fixes: 5e2548c1d6e03 ("lmb: Fix LMB_MEMORY_REGIONS flag usage")
Reported-by: Mark Millard <marklmi@yahoo.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Acked-by: Michal Simek <michal.simek@amd.com>

# c61df340 18-Mar-2023 Marek Vasut <marek.vasut+renesas@mailbox.org>

lib: Fix SYS_TIMER_COUNTS_DOWN description in Kconfig

The SYS_TIMER_COUNTS_DOWN description contains a typo,
s@rathe@&r@ , fix it.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>

# 3b510807 22-Feb-2023 Simon Glass <sjg@chromium.org>

lib: Add an SPL config for LIB_UUID

This is selected by PARTITION_UUIDS which has a separate option for SPL.
Add an SPL option for LIB_UUID also, so that we can keep them consistent.

Also add one for PARTITION_TYPE_GUID to avoid a build error in part_efi.c
which wants to call a uuid function in SPL.

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

# 5a6bc166 22-Feb-2023 Simon Glass <sjg@chromium.org>

lib: Add VPL options for SHA1 and SHA256

Add these options so these algorithms can be used in VPL.

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

# ae625d92 22-Feb-2023 Simon Glass <sjg@chromium.org>

lib: Add a Kconfig for SPL_BZIP2

This is implicitly used in the source and seems useful, so add it.

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

# c33425c6 15-Jan-2023 Simon Glass <sjg@chromium.org>

trace: Reduce the default for TRACE_EARLY_CALL_DEPTH_LIMIT

This is a silly value at present, since U-Boot's call depth never reaches
200. Fix it.

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

# 2dc16a2c 19-Jan-2023 Sjoerd Simons <sjoerd@collabora.com>

Bump LMB_MAX_REGIONS default to 16

Since commit 06d514d77c37 ("lmb: consider EFI memory map") the EFI regions
are also pushed into the lmb if EFI_LOADER is enabled (which is by
default on most system). Which can cause the number of entries to go
over the maximum as it's default is only 8.

Specifically i ran into this case on an TI am62 which has an fdt with
4 reserved regions (in practice 3 lmb entries due to adjecent ranges).

As this is likely to impact more devices bump the default max
regions to 16 so there is a bit more slack.

Fixes: 06d514d77c ("lmb: consider EFI memory map")
Link: https://bugzilla.opensuse.org/show_bug.cgi?id=1207562
Reviewed-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Signed-off-by: Sjoerd Simons <sjoerd@collabora.com>
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
[trini: collect tags from the other equivalent patch]

# 948d3999 08-Feb-2023 Tom Rini <trini@konsulko.com>

Revert "lmb: Default to not-LMB_USE_MAX_REGIONS"

As explained by Philippe Schenker, I was misinterpreting what happened
in the case where we do not set LMB_USE_MAX_REGIONS and so had
re-introduced the problem I was attempting to more widely resolve.

This reverts commit 007ae5d108a37564905ea1588cb279f3a522cc3d.

Reported-by: Philippe Schenker <philippe.schenker@toradex.com>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 007ae5d1 25-Jan-2023 Tom Rini <trini@konsulko.com>

lmb: Default to not-LMB_USE_MAX_REGIONS

The LMB code allows for picking a hard limit on the number of regions it
can know of, or to dynamically allocate these regions. The reason for
this choice is to allow for the compiler to perform a size optimization
in the common case. This optimization however, is very small, ranging
from 196 bytes to 15 bytes saved, or in some cases, being larger. Now
that we also have more regions covered by LMB (in order to protect
various parts of our self at run time), the default of 8 is also much
easier to hit and leads to non-obvious error messages (which imply that
an area is protected, not that we're out of areas to add to the list).

Switch to the dynamic use as the default.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 53c47c59 19-Jan-2023 Tom Rini <trini@konsulko.com>

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


# 4b9b25d9 12-Jan-2023 Brandon Maier <brandon.maier@collins.com>

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

[1] https://github.com/torvalds/linux/commit/e0c1b49f5b674cca7b10549c53b3791d0bbc90a8
[2] https://github.com/facebook/zstd/blob/f302ad8811643c428c4e3498e28f53a0578020d3/lib/libzstd.mk#L31

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>

# ebc1d50a 21-Dec-2022 Simon Glass <sjg@chromium.org>

Revert "fdtdec: drop needlessly convoluted CONFIG_PHANDLE_CHECK_SEQ"

The fdt_path_offset() function is slow since it must scan the tree.
This substantial overhead now applies to all boards.

The original code may not be ideal but it is fit for purpose and is only
needed on a few boards.

Reverting this reduces time to set up driver model by about 30ms.

Before revert:

Accumulated time:
47,170 dm_r
53,237 dm_spl
572,986 dm_f

Accumulated time:
44,598 dm_r
50,347 dm_spl
549,133 dm_f

This reverts commit 26f981f295d00351b6f0c69b5317b254b2361cc0.

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

# 12619d4e 21-Dec-2022 Simon Glass <sjg@chromium.org>

trace: Don't require TIMER_EARLY

Some platforms cannot honour this and don't need trace before relocation.
Use 'imply' instead, so boards can disable this.

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

# 0c16fca9 07-Jan-2023 Simon Glass <sjg@chromium.org>

tpm: Add a proper Kconfig option for crc8 in SPL

The current approach is a bit of a hack and only works for the tpm
subsystem. Add a Kconfig so that crc8 can be enabled in SPL for other
purposes.

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

# 14f43797 19-Dec-2022 Tom Rini <trini@konsulko.com>

Merge tag 'v2023.01-rc4' into next

Prepare v2023.01-rc4

Signed-off-by: Tom Rini <trini@konsulko.com>


# ae3527f0 07-Dec-2022 Kautuk Consul <kconsul@ventanamicro.com>

arch/riscv: add semihosting support for RISC-V

We add RISC-V semihosting based serial console for JTAG based early
debugging.

The RISC-V semihosting specification is available at:
https://github.com/riscv/riscv-semihosting-spec/blob/main/riscv-semihosting-spec.adoc

Signed-off-by: Anup Patel <apatel@ventanamicro.com>
Signed-off-by: Kautuk Consul <kconsul@ventanamicro.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>

# 1c03ab9f 07-Dec-2022 Kautuk Consul <kconsul@ventanamicro.com>

lib: Add common semihosting library

We factor out the arch-independent parts of the ARM semihosting
implementation as a common library so that it can be shared
with RISC-V.

Signed-off-by: Kautuk Consul <kconsul@ventanamicro.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>

# 3b8dfc42 16-Nov-2022 Tom Rini <trini@konsulko.com>

Convert CONFIG_SYS_TIMER_COUNTS_DOWN to Kconfig

This converts the following to Kconfig:
CONFIG_SYS_TIMER_COUNTS_DOWN

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 86794052 21-Oct-2022 Sughosh Ganu <sughosh.ganu@linaro.org>

FWU: Add support for the FWU Multi Bank Update feature

The FWU Multi Bank Update feature supports updating firmware images
to one of multiple sets(also called banks) of images. The firmware
images are clubbed together in banks, with the system booting images
from the active bank. Information on the images such as which bank
they belong to is stored as part of the metadata structure, which is
stored on the same storage media as the firmware images on a dedicated
partition.

At the time of update, the metadata is read to identify the bank to
which the images need to be flashed(update bank). On a successful
update, the metadata is modified to set the updated bank as active
bank to subsequently boot from.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

# 40ed7be4 02-Aug-2022 Tom Rini <trini@konsulko.com>

Convert CONFIG_SYS_FDT_PAD to Kconfig

This converts the following to Kconfig:
CONFIG_SYS_FDT_PAD

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e67ffb5a 22-Jul-2022 Sughosh Ganu <sughosh.ganu@linaro.org>

tpm: rng: Add driver model interface for TPM RNG device

The TPM device has a builtin random number generator(RNG)
functionality. Expose the RNG functions of the TPM device to the
driver model so that they can be used by the EFI_RNG_PROTOCOL if the
protocol is installed.

Also change the function arguments and return type of the random
number functions to comply with the driver model api.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

# b340199f 10-Jun-2022 Tom Rini <trini@konsulko.com>

spl: Ensure all SPL symbols in Kconfig have some SPL dependency

Tighten up symbol dependencies in a number of places. Ensure that a SPL
specific option has at least a direct dependency on SPL. In places
where it's clear that we depend on something more specific, use that
dependency instead. This means in a very small number of places we can
drop redundant dependencies.

Reported-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 13ce351b 08-Jun-2022 Tom Rini <trini@konsulko.com>

vpl: Ensure all VPL symbols in Kconfig have some VPL dependency

Tighten up symbol dependencies in a number of places. Ensure that a VPL
specific option has at least a direct dependency on VPL. In places
where it's clear that we depend on something more specific, use that
dependency instead.

Reported-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 8bea4bf7 08-Jun-2022 Tom Rini <trini@konsulko.com>

tpl: Ensure all TPL symbols in Kconfig have some TPL dependency

Tighten up symbol dependencies in a number of places. Ensure that a TPL
specific option has at least a direct dependency on TPL. In places
where it's clear that we depend on something more specific, use that
dependency instead.

Reported-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 26f981f2 19-May-2022 Rasmus Villemoes <rasmus.villemoes@prevas.dk>

fdtdec: drop needlessly convoluted CONFIG_PHANDLE_CHECK_SEQ

Asking if the alias we found actually points at the device tree node
we passed in (in the guise of its offset from blob) can be done simply
by asking if the fdt_path_offset() of the alias' path is identical to
offset.

In fact, the current method suffers from the possibility of false
negatives: dtc does not necessarily emit a phandle property for a node
just because it is referenced in /aliases; it only emits a phandle
property for a node if it is referenced in <angle brackets>
somewhere. So if both the node we passed in and the alias node we're
considering don't have phandles, fdt_get_phandle() returns 0 for both.

Since the proper check is so simple, there's no reason to hide that
behind a config option (and if one really wanted that, it should be
called something else because there's no need to involve phandle in
the check).

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Acked-by: Aswath Govindraju <a-govindraju@ti.com>

# d30924f1 01-May-2022 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: fix selection of CONFIG_CHARSET

lib/charset.c is not optional for
EFI_APP || EFI_LOADER || UFS || UT_UNICODE.
These must select CONFIG_CHARSET.

Fixes: 726cd9836db0 ("efi: Make unicode printf available to the app")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>

# 747093dd 30-Apr-2022 Simon Glass <sjg@chromium.org>

vpl: Add Kconfig options for VPL

Add VPL versions of commonly used Kconfig options.

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

# 11232139 06-Apr-2022 Tom Rini <trini@konsulko.com>

nds32: Remove the architecture

As removal of nds32 has been ack'd for the Linux kernel, remove support
here as well.

Cc: Rick Chen <rick@andestech.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Rick Chen <rick@andestech.com>

# fd210fee 28-Mar-2022 Philippe Reynes <philippe.reynes@softathome.com>

lib: allow to build asn1 decoder and oid registry in SPL

This commit adds the options:
- SPL_ASN1_DECODER
- SPL_OID_REGISTRY

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>

# 7d44a985 28-Mar-2022 Philippe Reynes <philippe.reynes@softathome.com>

lib: Kconfig: enhance the help of OID_REGISTRY

Enhance the help for the config OID_REGISTRY.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>

# a0e71d96 28-Mar-2022 Philippe Reynes <philippe.reynes@softathome.com>

lib: Kconfig: enhance help for ASN1

Enhance the help for configs ASN1_COMPILER
and ASN1_decoder.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>

# 761a1786 27-Jan-2022 Tom Rini <trini@konsulko.com>

Merge tag 'dm-pull-26jan22' of https://source.denx.de/u-boot/custodians/u-boot-dm

acpi refactoring to allow non-x86 use
binman support for bintools (binary tools)
minor tools improvements in preparation for FDT signing
various minor fixes and improvements


# 334a9b9d 25-Nov-2021 Loic Poulain <loic.poulain@linaro.org>

lib/circbuf: Make circbuf selectable symbol

It is currenly only used from usbtty driver but make it properly
selectable via Kconfig symbol, for future usage.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>

# e1722fcb 01-Dec-2021 Simon Glass <sjg@chromium.org>

x86: Allow any arch to generate ACPI tables

These have sadly found their way to ARM now. Allow any arch to support
generating ACPI tables.

Disable this for the tools build.

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

# 7c3fd5c2 26-Dec-2021 Qu Wenruo <wqu@suse.com>

lib: add BLAKE2 hash support

The code is cross-ported from BLAKE2 reference implementation
(https://github.com/BLAKE2/BLAKE2).

With minimal change to remove unused macros/features.

Currently there is only one user inside U-boot (btrfs), and since it
only utilize BLAKE2B, all other favors are all removed.

Signed-off-by: Qu Wenruo <wqu@suse.com>
[trini: Rename ROUND to R to avoid clash with <linux/bitops.h>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 97f2a749 04-Jan-2022 Eugen Hristev <eugen.hristev@collabora.com>

lib: Kconfig: fix PHANDLE_CHECK_SEQ position outside of menu

CONFIG_PHANDLE_CHECK_SEQ is outside of the menu 'Library routines'
thus it's invisible in menuconfig and cannot be selected.
Fix this by moving the 'endmenu' after the PHANDLE_CHECK_SEQ definition

Fixes: c589132a1d ("fdt: Use phandle to distinguish DT nodes with same name")
Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
Reviewed-by: Aswath Govindraju <a-govindraju@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 726cd983 29-Dec-2021 Simon Glass <sjg@chromium.org>

efi: Make unicode printf available to the app

This is needed to show unicode strings. Enable this code in the app.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>

# 6405ab7a 24-Nov-2021 Simon Glass <sjg@chromium.org>

Convert CONFIG_PHYSMEM to Kconfig

This converts the following to Kconfig:
CONFIG_PHYSMEM

Signed-off-by: Simon Glass <sjg@chromium.org>
Suggested-by: Sean Anderson <seanga2@gmail.com>

# ac7606af 14-Nov-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

lmb: fix typo 'commun'

%s/commun/common/

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

# e7d285b2 25-Sep-2021 Simon Glass <sjg@chromium.org>

image: Use the correct checks for CRC32

Add a host Kconfig for CRC32. With this we can use CONFIG_IS_ENABLED(CRC32)
directly in the host build, so drop the unnecessary indirection.

Add a few more conditions to SPL_CRC32 to avoid build failures as well as
TPL_CRC32. Also update hash.c to make crc32 optional and to actually take
notice of SPL_CRC32.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# 2c21256b 25-Sep-2021 Simon Glass <sjg@chromium.org>

hash: Use Kconfig to enable hashing in host tools and SPL

At present when building host tools, we force CONFIG_SHAxxx to be enabled
regardless of the board Kconfig setting. This is done in the image.h
header file.

For SPL we currently just assume the algorithm is desired if U-Boot proper
enables it.

Clean this up by adding new Kconfig options to enable hashing on the host,
relying on CONFIG_IS_ENABLED() to deal with the different builds.

Add new SPL Kconfigs for hardware-accelerated hashing, to maintain the
current settings.

This allows us to drop the image.h code and the I_WANT_MD5 hack.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# 603d15a5 25-Sep-2021 Simon Glass <sjg@chromium.org>

spl: cypto: Bring back SPL_ versions of SHA

Unfortunately these were removed by mistake. This means that adding hash
support to SPL brings in all software algorithms, with a substantial
increase in code size.

The origin of the problem was renaming them to SPL_FIT_xxx and then these
were removed altogether in a later commit.

Add them back. This aligns with CONFIG_MD5, for example, which has an SPL
variant.

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: f5bc9c25f31 ("image: Rename SPL_SHAxxx_SUPPORT to SPL_FIT_SHAxxx")
Fixes: eb5171ddec9 ("common: Remove unused CONFIG_FIT_SHAxxx selectors")
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# 6674edaa 16-Sep-2021 Tom Rini <trini@konsulko.com>

Merge tag 'v2021.10-rc4' into next

Prepare v2021.10-rc4

Signed-off-by: Tom Rini <trini@konsulko.com>

# gpg: Signature made Tue 14 Sep 2021 06:58:32 PM EDT
# gpg: using RSA key 1A3C7F70E08FAB1707809BBF147C39FF9634B72C
# gpg: Good signature from "Thomas Rini <trini@konsulko.com>" [ultimate]

# Conflicts:
# board/Arcturus/ucp1020/spl.c
# cmd/mvebu/Kconfig
# common/Kconfig.boot
# common/image-fit.c
# configs/UCP1020_defconfig
# configs/sifive_unmatched_defconfig
# drivers/pci/Kconfig
# include/configs/UCP1020.h
# include/configs/sifive-unmatched.h
# lib/Makefile
# scripts/config_whitelist.txt


# 5145bc73 01-Sep-2021 Oleksandr Suvorov <oleksandr.suvorov@foundries.io>

lib: fix typos in Kconfig

There are trivial typos in the Kconfig file. Fixed them.
Also, fixed grammar in the descriptions with typos.

Fixes: d56b4b1974 ("configs: Migrate RBTREE, LZO, CMD_MTDPARTS, CMD_UBI and CMD_UBIFS")
Fixes: 7264f2928b ("spl: fit: Eanble GZIP support for image decompression")
Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# e60e4499 02-Sep-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

lib: Drop SHA512_ALGO in lieu of SHA512

SHA512_ALGO was used as a "either SHA512 or SHA384", although the
implementations of these two algorithms share a majority of code.

From a Kconfig interface perspective, it makes sense to present two
distinct options. This requires #ifdefing out the SHA512
implementation from sha512.c. The latter doesn't make any sense.

It's reasonable to say in Kconfig that SHA384 depends on SHA512, and
seems to be the more polite way to handle the selection.

Thus, automatically select SHA512 when SHA384 is enabled.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# b4c2c151 27-Aug-2021 Michal Simek <michal.simek@amd.com>

Kconfig: Remove all default n/no options

default n/no doesn't need to be specified. It is default option anyway.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
[trini: Rework FSP_USE_UPD portion]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 928a8be7 29-Jul-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

lib: ecdsa: Implement UCLASS_ECDSA verification on target

Implement the crypto_algo .verify() function for ecdsa256. Because
it backends on UCLASS_ECDSA, this change is focused on parsing the
keys from devicetree and passing this information to the specific
UCLASS driver.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# fa3f1f1d 24-Jul-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: disable CONFIG_SPL_HEXDUMP by default

CONFIG_HEXDUMP is needed to display UEFI variables using 'printenv -e'.

Enabling CONFIG_SPL_HEXDUMP only makes sense for debugging purposes.
Hence CONFIG_SPL_HEXDUMP should not be enabled by default.

The following boards currently have CONFIG_SPL_HEXDUMP=y. This includes
boards that don't use SPL at all.

axm_defconfig
imx8mm-cl-iot-gate_defconfig
imx8mm_venice_defconfig
imxrt1020-evk_defconfig
imxrt1050-evk_defconfig
kontron_sl28_defconfig
kp_imx53_defconfig
lx2160ardb_tfa_stmm_defconfig
mt7622_rfb_defconfig
octeon_ebb7304_defconfig
octeon_nic23_defconfig
qemu_arm64_defconfig
qemu_arm_defconfig
qemu-riscv32_defconfig
qemu-riscv32_smode_defconfig
qemu-riscv64_defconfig
qemu-riscv64_smode_defconfig
qemu-x86_64_defconfig
qemu-x86_defconfig
sandbox64_defconfig
sandbox_defconfig
stm32mp15_basic_defconfig
stm32mp15_trusted_defconfig
synquacer_developerbox_defconfig
taurus_defconfig
xilinx_versal_virt_defconfig

The patch only keeps it enabled on

sandbox_spl_defconfig

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 1a46cb6c 02-Jul-2021 Simon Glass <sjg@chromium.org>

lib: Create a new Kconfig option for charset conversion

Rather than looking at two KConfig options in the Makefile, create a new
Kconfig option for compiling lib/charset.c

Enable it for UFS also, which needs this support.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 26dd9936 08-Jul-2021 Steffen Jaeckel <jaeckel-floss@eyet-services.de>

lib: add crypt subsystem

Add the basic functionality required to support the standard crypt
format.
The files crypt-sha256.c and crypt-sha512.c originate from libxcrypt and
their formatting is therefor retained.
The integration is done via a crypt_compare() function in crypt.c.

```
libxcrypt $ git describe --long --always --all
tags/v4.4.17-0-g6b110bc
```

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 7d0f3fbb 11-Jun-2021 Tero Kristo <t-kristo@ti.com>

lib: rational: copy the rational fraction lib routines from Linux

Copy the best rational approximation calculation routines from Linux.
Typical usecase for these routines is to calculate the M/N divider
values for PLLs to reach a specific clock rate.

This is based on linux kernel commit:
"lib/math/rational.c: fix possible incorrect result from rational
fractions helper"
(sha1: 323dd2c3ed0641f49e89b4e420f9eef5d3d5a881)

Signed-off-by: Tero Kristo <t-kristo@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Tero Kristo <kristo@kernel.org>

# ec0512b1 24-May-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

Revert "lib: introduce HASH_CALCULATE option"

When we think of Kconfig, we usually think of features that we like
to enable or not. Ideally, we wouldn't use Kconfig to fix a build
issue, although sometimes it might make sense. With Kconfig it's hard
to guarantee that the fix is universal. We can only say that it works
for the set of tested configurations. In the majority of cases, it's
preferable to let the linker figure things out for us.

The reverted commit attempted to fix a build issue by adding an
invisible Kconfig option. This is wrong in several ways:

It invents a new Kconfig variable when CONFIG_HASH already
exists for the same purpose.
Second, hash-checksum.c makes use of the hash_progressive_lookup_algo()
symbol, which is only provided with CONFIG_HASH, but this dependency
was not expressed in the reverted patch.

It feels like Kconfig is turning into a listing of all available
source files, and a buffet to 'select' which ones to compile. The
purpose of this revert is to enable the next change to make use of
CONFIG_HASH instead of adding to Kconfig.

This reverts commit 87316da05f2fd49d3709275e64ef0c5980366ade.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Acked-by: Masahisa Kojima <masahisa.kojima@linaro.org>

# 1621d3c4 10-May-2021 Bin Meng <bmeng.cn@gmail.com>

lib: kconfig: Limit BINMAN_FDT for OF_SEPARATE or OF_EMBED

Generally speaking BINMAN_FDT makes sense for OF_SEPARATE or OF_EMBED.
For the other OF_CONTROL methods, it's quite possible binman node is
not available as binman is invoked during the build phase instead of
runtime. Let's only turn it on for OF_SEPARATE or OF_EMBED by default.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 87316da0 13-May-2021 Masahisa Kojima <masahisa.kojima@linaro.org>

lib: introduce HASH_CALCULATE option

Build error occurs when CONFIG_EFI_SECURE_BOOT or
CONFIG_EFI_CAPSULE_AUTHENTICATE is enabled,
because hash-checksum.c is not compiled.

Since hash_calculate() implemented in hash-checksum.c can be
commonly used aside from FIT image signature verification,
this commit itroduces HASH_CALCULATE option to decide
if hash-checksum.c shall be compiled.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# e2ae483c 13-May-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

hash: Kconfig option for SHA512 hardware acceleration

Commit a479f103dc1c ("hash: Allow for SHA512 hardware implementations")
defined function definitions for hardware accelerated SHA384 and SHA512.
If CONFIG_SHA_HW_ACCEL=y, these functions are used.

We already have boards using CONFIG_SHA_HW_ACCEL=y but none implements the
new functions hw_sha384() and hw_sha512().

For implementing the EFI TCG2 protocol we need SHA384 and SHA512. The
missing hardware acceleration functions lead to build errors on boards like
peach-pi_defconfig.

Introduce a new Kconfig symbol CONFIG_SHA512_HW_ACCEL to control if the
functions hw_sha384() and hw_sha512() shall be used to implement the SHA384
and SHA512 algorithms.

Fixes: a479f103dc1c ("hash: Allow for SHA512 hardware implementations")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

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

# 6d66502b 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: Add 2 config to define the max number of regions

Add 2 configs CONFIG_LMB_MEMORY_REGIONS and CONFIG_LMB_RESERVED_REGIONS
to change independently the max number of the regions in lmb
library.

When CONFIG_LMB_USE_MAX_REGIONS=y, move the lmb property arrays to
struct lmb and manage the array size with the element 'max' of struct
lmb_region; their are still allocated in stack.

When CONFIG_LMB_USE_MAX_REGIONS=n, keep the current location in
struct lmb_region to allow compiler optimization.

Increase CONFIG_LMB_RESERVED_REGIONS is useful to avoid lmb errors in
bootm when the number of reserved regions (not adjacent) is reached:
+ 1 region for relocated U-Boot
+ 1 region for initrd
+ 1 region for relocated linux device tree
+ reserved memory regions present in Linux device tree.

The current limit of 8 regions is reached with only 5 reserved regions
in DT.

see Linux kernel commit bf23c51f1f49 ("memblock: Move memblock arrays
to static storage in memblock.c and make their size a variable")

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# 4fa0150d 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: move MAX_LMB_REGIONS value in Kconfig

Move MAX_LMB_REGIONS value in Kconfig, the max number of the regions
in lmb library.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# 77b8cfef 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: move CONFIG_LMB in Kconfig

Migrate CONFIG_LMB in Kconfig.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# a479f103 16-Feb-2021 Joel Stanley <joel@jms.id.au>

hash: Allow for SHA512 hardware implementations

Similar to support for SHA1 and SHA256, allow the use of hardware hashing
engine by enabling the algorithm and setting CONFIG_SHA_HW_ACCEL /
CONFIG_SHA_PROG_HW_ACCEL.

Signed-off-by: Joel Stanley <joel@jms.id.au>

# f2c1442e 14-Mar-2021 Simon Glass <sjg@chromium.org>

bloblist: Make BLOBLIST_TABLES depend on BLOBLIST

Add an extra condition here since we cannot put x86 tables in a bloblist
when bloblists are not supported.

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

# e0103158 25-Feb-2021 Bin Meng <bmeng.cn@gmail.com>

lib: kconfig: Mention CONFIG_ADDR_MAP limitation in the help

Mention that CONFIG_ADDR_MAP only works in the post-relocation phase.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>

# 56e7257c 03-Feb-2021 Bin Meng <bmeng.cn@gmail.com>

lib: Fix BINMAN_FDT dependency

lib/binman.c references the following 3 ofnode APIs:
ofnode_first_subnode(), ofnode_path() and ofnode_read_bool().

These APIs get built only when DM is on. Fix the dependency then.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 59e4e391 18-Jan-2021 Tom Rini <trini@konsulko.com>

Merge https://gitlab.denx.de/u-boot/custodians/u-boot-riscv

- Update qemu-riscv.rst build instructions.
- Add support for SPI on Kendryte K210.
- Add Microchip PolarFire SoC Icicle Kit support.
- Add support for an early timer.
- Select TIMER_EARLY to avoid infinite recursion for Trace.


# a80f8513 17-Jan-2021 Pragnesh Patel <pragnesh.patel@sifive.com>

trace: select TIMER_EARLY to avoid infinite recursion

When tracing functions is enabled this adds calls to
__cyg_profile_func_enter() and __cyg_profile_func_exit() to the traced
functions.

__cyg_profile_func_enter() and __cyg_profile_func_exit() invoke
timer_get_us() to record the entry and exit time.

initr_dm() will make gd->dm_root = NULL and gd->timer = NULL, so
timer_get_us() -> get_ticks() -> dm_timer_init() will lead to an
indefinite recursion.

So select TIMER_EARLY when tracing got enabled.

Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Rick Chen <rick@andestech.com>

# 6205bbb1 04-Jan-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lib: cosmetic update of CONFIG_LIB_ELF description

Change 2 typo error in CONFIG_LIB_ELF description:
- Supoort => Support
- fir => for

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c589132a 02-Dec-2020 Aswath Govindraju <a-govindraju@ti.com>

fdt: Use phandle to distinguish DT nodes with same name

While assigning the sequence number to subsystem instances by reading the
aliases property, only DT nodes names are compared and not the complete
path. This causes a problem when there are two DT nodes with same name but
have different paths.

In arch/arm/dts/k3-am65-main.dtsi there are two USB controllers with the
same device tree node name but different path. When aliases are defined for
these USB controllers then fdtdec_get_alias_seq() fails to pick the correct
instance for a given index.

fdt_path_offset() function is slow and this would effect the U-Boot
startup. To avert the time penalty on all boards, apply this extra check
only when required by using a config option.

Fix it by comparing the phandles of DT nodes after the node names match,
under a config option.

Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Fix whitespace error in Kconfig:
Signed-off-by: Simon Glass <sjg@chromium.org>

# 28cef9ca 19-Nov-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

fs: fat: create correct short names

The current function set_name() used to create short names has the
following deficiencies resolved by this patch:

* Long names (e.g. FOO.TXT) are stored even if a short name is enough.
* Short names with spaces are created, e.g. "A ~1.TXT".
* Short names with illegal characters are created, e.g. "FOO++BAR".
* Debug output does not not consider that the short file name has no
concluding '\0'.

The solution for the following bug is split of into a separate patch:

* Short file names must be unique.

This patch only provides the loop over possible short file names.

Fixes: c30a15e590c ("FAT: Add FAT write feature")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# e4f8e543 05-Nov-2020 Simon Glass <sjg@chromium.org>

smbios: Drop the unused Kconfig options

Now that we can use devicetree to specify this information, drop the old
CONFIG options.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 44c74bdd 05-Nov-2020 Simon Glass <sjg@chromium.org>

sysinfo: Provide a default driver to set SMBIOS values

Some boards want to specify the manufacturer or product name but do not
need to have their own sysinfo driver.

Add a default driver which provides a way to specify this SMBIOS
information in the devicetree, without needing any board-specific
functionality.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d2cb7a22 04-Nov-2020 Simon Glass <sjg@chromium.org>

x86: Allow putting some tables in the bloblist

At present all tables are placed starting at address f0000 in memory, and
can be up to 64KB in size. If the tables are very large, this may not
provide enough space.

Also if the tables point to other tables (such as console log or a ramoops
area) then we must allocate other memory anyway.

The bloblist is a nice place to put these tables since it is contiguous,
which makes it easy to reserve this memory for linux using the 820 tables.

Add an option to put some of the tables in the bloblist. For SMBIOS and
ACPI, create suitable pointers from the f0000 region to the new location
of the tables.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
[bmeng: squashed in http://patchwork.ozlabs.org/project/uboot/patch/
20201105062407.1.I8091ad931cbbb5e3b6f6ababdf3f8d5db0d17bb9@changeid/]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# 415eab06 03-Nov-2020 Christian Gmeiner <christian.gmeiner@gmail.com>

smbios: add parsing API

Add a very simple API to be able to access SMBIOS strings
like vendor, model and bios version.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 72eda507 27-Oct-2020 Sean Anderson <seanga2@gmail.com>

lib: Add getopt

Some commands can get very unweildy if they have too many positional
arguments. Adding options makes them easier to read, remember, and
understand.

This implementation of getopt has been taken from barebox, which has had
option support for quite a while. I have made a few modifications to their
version, such as the removal of opterr in favor of a separate getopt_silent
function. In addition, I have moved all global variables into struct
getopt_context.

The getopt from barebox also re-orders the arguments passed to it so that
non-options are placed last. This allows users to specify options anywhere.
For example, `ls -l foo/ -R` would be re-ordered to `ls -l -R foo/` as
getopt parsed the options. However, this feature conflicts with the const
argv in cmd_tbl->cmd. This was originally added in 54841ab50c ("Make sure
that argv[] argument pointers are not modified."). The reason stated in
that commit is that hush requires argv to stay unmodified. Has this
situation changed? Barebox also uses hush, and does not have this problem.
Perhaps we could use their fix?

I have assigned maintenance of getopt to Simon Glass, as it is currently
only used by the log command. I would also be fine maintaining it.

Signed-off-by: Sean Anderson <seanga2@gmail.com>

# 26637e2e 12-Sep-2020 Simon Glass <sjg@chromium.org>

lib: Allow hexdump to be used in SPL

It is sometimes useful to output hex dumps in SPL. Add a config option to
allow this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# e87dfb05 05-Aug-2020 Andrii Anisov <andrii_anisov@epam.com>

lib: sscanf: add sscanf implementation

Port sscanf implementation from mini-os and introduce new
Kconfig option to enable it: CONFIG_SSCANF. Disable by default.

Signed-off-by: Andrii Anisov <andrii_anisov@epam.com>
Signed-off-by: Anastasiia Lukianenko <anastasiia_lukianenko@epam.com>
Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>

# 81014f73 30-Jul-2020 Joao Marcos Costa <joaomarcos.costa@bootlin.com>

include/u-boot, lib/zlib: add sources for zlib decompression

Add zlib (v1.2.11) uncompr() function to U-Boot. SquashFS depends on
this function to decompress data from a raw disk image. The actual
support for zlib into SquashFS sources will be added in a follow-up
commit.

Signed-off-by: Joao Marcos Costa <joaomarcos.costa@bootlin.com>

# 69be8fd1 03-Jun-2020 Marek Szyprowski <m.szyprowski@samsung.com>

powerpc: move ADDR_MAP to Kconfig

Move ADDR_MAP related config options from include/configs/*.h to the
proper place in lib/Kconfig. This has been done using
./tools/moveconfig.py and manual inspection of the generated changes.
This is a preparation to use ADDR_MAP helper on ARM 32bit Raspberry Pi4
board for mapping the PCIe XHCI MMIO, which is above the 4GiB identity
mapping limit.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# d16b38f4 15-Apr-2020 Reuben Dowle <reubendowle0@gmail.com>

Add support for SHA384 and SHA512

The current recommendation for best security practice from the US government
is to use SHA384 for TOP SECRET [1].

This patch adds support for SHA384 and SHA512 in the hash command, and also
allows FIT images to be hashed with these algorithms, and signed with
sha384,rsaXXXX and sha512,rsaXXXX

The SHA implementation is adapted from the linux kernel implementation.

[1] Commercial National Security Algorithm Suite
http://www.iad.gov/iad/programs/iad-initiatives/cnsa-suite.cfm

Signed-off-by: Reuben Dowle <reuben.dowle@4rf.com>

# 43e442a5 26-May-2020 Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

kconfig: fix some typos

Signed-off-by: Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

# eff5a547 22-May-2020 Michael Walle <michael@walle.cc>

cmd: zip: automatically pull in gzip()

Move the CONFIG_GZIP_COMPRESSED from a config.h macro to a Kconfig menu
item. It is not selectable by a user because there is no reason to do
so. Instead it will be automatically selected by the stuff which uses
gzip(), like the zip command.

Remove it from the config_whitelist.txt. Also remove
CONFIG_GZIP_COMPRESS_DEF_SZ as this was never used on any board. The
default seems to be sane, otherwise it should be added as a Kconfig
option.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8239be61 06-May-2020 Simon Glass <sjg@chromium.org>

lib: Allow MD5 to be enabled in SPL

At present the MD5 option cannot be enabled by board configs since it has
no Kconfig name. It is generally enabled, so long as FIT support is
present. But not all boards use FIT, particularly in SPL

Fix this and add an option for SPL as well. This allows board code to call
md5() even if FIT support is not enabled.

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

# 04cb3994 21-Apr-2020 Weijie Gao <weijie.gao@mediatek.com>

lib: enable lzma decompression support for SPL build

This patch enables LZMA decompression support for SPL build

Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>

# 2a2119e1 05-Mar-2020 Atish Patra <atishp@atishpatra.org>

lib: kconfig: Add option to set BZIP2 compression method

There is no way to select BZIP2 compression method.
Add it under library/compression config where all other
compression related configs are present.

Signed-off-by: Atish Patra <atish.patra@wdc.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 805b3cac 12-Feb-2020 Keerthy <j-keerthy@ti.com>

lib: elf: Move the generic elf loading/validating functions to lib

Move the generic elf loading/validating functions to lib/
so that they can be re-used and accessed by code existing
outside cmd.

While at it remove the duplicate static version of load_elf_image_phdr
under arch/arm/mach-imx/imx_bootaux.c.

Signed-off-by: Keerthy <j-keerthy@ti.com>
Suggested-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>

# 1611235b 19-Jan-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: Kconfig dependencies for pseudo-random library

drivers/rng/sandbox_rng.c requires rand() to be defined but configuration
option CONFIG_CONFIG_LIB_RAND selected in drivers/rng/Kconfig does not
exist.

test/lib/test_aes.c requires rand() to be defined.

Fix the selection criteria for choice "Pseudo-random library support type".

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 3c10dc95 06-Dec-2019 Simon Glass <sjg@chromium.org>

binman: Add a library to access binman entries

SPL and TPL can access information about binman entries using link-time
symbols but this is not available in U-Boot proper. Of course it could be
made available, but the intention is to just read the device tree.

Add support for this, so that U-Boot can locate entries.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# b4adf627 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: crypto: add x509 parser

Imported from linux kernel v5.3:
x509.asn1 without changes
x509_akid.asn1 without changes
x509_parser.h without changes
x509_cert_parser.c with changes marked as __UBOOT__
x509_public_key.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# a9b45e6e 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add oid registry utility

Imported from linux kernel v5.3:
build_OID_registry without changes
oid_registry.h without changes
oid_registry.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# ab8a0e06 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add asn1 decoder

Imported from linux kernel v5.3:
lib/asn1_decoder.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 2b12196d 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

cmd: add asn1_compiler

Imported from linux kernel v5.3:
asn1.h without changes
asn1_ber_bytecode.h without changes
asn1_decoder.h without changes
asn1_compiler.c without changes

This host command will be used to create a ASN1 parser, for example,
for pkcs7 messages or x509 certificates. More specifically, it will
generate *byte code* which will be interpreted by asn1 decoder library.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 05429b6c 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

rtc: move date.c from drivers/rtc/ to lib/

In the next commit, rtc_mktime(), for compatibility with linux, will be
implemented using rtc_mktime(), which is no longer drivers/rtc specific.
So move this file under lib/.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 37ef1774 10-Nov-2019 Thomas Hebb <tommyhebb@gmail.com>

Kconfig: disambiguate config names for tiny printf

27084c03d36a ("spl: Allow tiny printf() to be controlled in SPL and
TPL") split this option in two for TPL and SPL, but didn't change the
Kconfig names, making them hard to set quickly.

Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>

# 0d76afc0 27-Oct-2019 Simon Glass <sjg@chromium.org>

fdt: Add Kconfig options to control code size

For better or worse libfdt recent grew a lot of code that checks the
validity of the device tree in great detail. When using unsigned or
unverified data this makes things safer, but it does add to code size.

Add some controls to select the trade-off between safety and code size.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 27084c03 25-Sep-2019 Simon Glass <sjg@chromium.org>

spl: Allow tiny printf() to be controlled in SPL and TPL

At present there is only one control for this and it is used for both SPL
and TPL. But SPL might have a lot more space than TPL so the extra cost of
a full printf() might be acceptable.

Split the option into two, providing separate SPL and TPL controls. The
TPL setting defaults to the same as SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2a51e16b 07-Jun-2019 Tom Rini <trini@konsulko.com>

configs: Make USE_TINY_PRINTF depend on SPL||TPL and be default

The USE_TINY_PRINTF symbol only changes things within SPL and TPL
builds, so make it depend on that support. Next, make it default as
within these cases we should rarely have need of more advanced print
formats outside of the debug context.

To do this, in a few cases we need to correct our Kconfig dependencies
as we had cases of non-SPL targets select'ing this symbol. Finally, in
the case of a few boards we really do need the full printf
functionality.

Signed-off-by: Tom Rini <trini@konsulko.com>

# da0fb5fd 02-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: make call depth limit customizable

Up to now we had hard coded values for the call depth up to which trace
records are created: 200 for early tracing, 15 thereafter. UEFI
applications reach a call depth of 80 or above.

Provide customizing settings for the call trace depth limit and the early
call trace depth limit. Use the old values as defaults.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8509f22a 29-Apr-2019 Marek Behún <kabel@kernel.org>

lib: add Zstandard decompression support

Add the zstd library from Linux kernel (only decompression support).
There are minimal changes to build with U-Boot, otherwise the files are
identical to Linux commit dc35da16 from March 2018, the files had not
been touched since in kernel. Also SPDX lincese tags were added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 83a486b6 29-Apr-2019 Marek Behún <kabel@kernel.org>

lib: Add xxhash support

This adds the xxhash support from Linux. Files are almost identical to
those added to Linux in commit 5d240522 ("lib: Add xxhash module") (they
haven't been touched since in Linux). The only difference is to add some
includes to be compatible with U-Boot. Also SPDX lincese tags were
added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 5132361a 29-Apr-2019 Heiko Schocher <hs@denx.de>

lib: Kconfig: fix help text for GZIP

commit 95f4bbd581cf ("lib: fdt: Allow LZO and GZIP DT compression in U-Boot")

introduced Kconfig option for gzip in U-Boot, but help text
says gzip for SPL, which is wrong. Fix this.

Signed-off-by: Heiko Schocher <hs@denx.de>
Acked-by: Marek Vasut <marex@denx.de>

# 1c6eb075 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE_BUFFER_SIZE et al to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE_BUFFER_SIZE
CONFIG_TRACE_EARLY_SIZE
CONFIG_TRACE_EARLY
CONFIG_TRACE_EARLY_ADDR

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

# a24a78d7 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE

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

# 54969b40 21-Mar-2019 Thierry Reding <treding@nvidia.com>

fdtdec: Add Kconfig symbol for tests

Runtime tests are provided as a test_fdtdec command implementation. Add
a Kconfig symbol that allows this command to be built so that the tests
can be used.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 95f4bbd5 08-Mar-2019 Marek Vasut <marex@denx.de>

lib: fdt: Allow LZO and GZIP DT compression in U-Boot

Add required Kconfig symbols, Makefile bits and macro fixes in a
few places to support LZO and DT compression in U-Boot. This can
save a lot of space with multi-DTB fitImages.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>

# 6e705114 13-Jan-2019 Chris Packham <judge.packham@gmail.com>

lib: Kconfig: spelling fixes

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 048c6e89 06-Nov-2018 Simon Glass <sjg@chromium.org>

spl: lz4: Allow use of lz4 compression in SPL

In some cases U-Boot is compressed and it is useful to be able to
decompress it in SPL. Add a Kconfig and Makefile change to allow this.
Note that this does not actually implement decompression.

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

# 2895c4b7 15-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

kconfig: Introduce HAVE_ARCH_IOMAP

Introduce a new Kconfig option for architecture codes to control
whether it provides io{read,write}{8,16,32} I/O accessor functions.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5592a633 01-Oct-2018 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt in TPL

In some cases (e.g. sandbox with verified boot) it is useful to support
libfdt in TPL. Update the Kconfig to handle this.

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

# 6307896c 01-Oct-2018 Simon Glass <sjg@chromium.org>

tpm: Add support for SPL and TPL

At present the tpm can only be used in U-Boot proper. Updated it to work
in SPL and TPL also.

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

# ab948cd2 19-Jul-2018 Masahiro Yamada <masahiroy@kernel.org>

fdt_support: make FDT_FIXUP_PARTITIONS depend on CMD_MTDPARTS

fdt_fixup_mtdparts() calls mtdparts_init() and device_find(),
which are defined in cmd/mtdparts.c

The combination of FDT_FIXUP_PARTITIONS=y and CMD_MTDPARTS=n
emits the following link error:

common/fdt_support.c:903: undefined reference to `mtdparts_init'
common/fdt_support.c:914: undefined reference to `device_find'

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 3330584d 03-Jun-2018 Igor Opaniuk <igor.opaniuk@gmail.com>

avb2.0: integrate avb 2.0 into the build system

Integrate libavb into the build system. Introduce CONFIG_LIBAVB
build option.

Signed-off-by: Igor Opaniuk <igor.opaniuk@linaro.org>

# f8c987f8 05-Jun-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

lib: Add hexdump

Often during debugging session it's very interesting to see
what data we were dealing with. For example what we write or read
to/from memory or peripherals.

This change introduces functions that allow to dump binary
data with one simple function invocation like:
------------------->8----------------
print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, buf, len);
------------------->8----------------

which gives us the following:
------------------->8----------------
00000000: f2 b7 c9 88 62 61 75 64 72 61 74 65 3d 31 31 35 ....baudrate=115
00000010: 32 30 30 00 62 6f 6f 74 61 72 67 73 3d 63 6f 6e 200.bootargs=con
00000020: 73 6f 6c 65 3d 74 74 79 53 33 2c 31 31 35 32 30 sole=ttyS3,11520
00000030: 30 6e 38 00 62 6f 6f 74 64 65 6c 61 79 3d 33 00 0n8.bootdelay=3.
00000040: 62 6f 6f 74 66 69 6c 65 3d 75 49 6d 61 67 65 00 bootfile=uImage.
00000050: 66 64 74 63 6f 6e 74 72 6f 6c 61 64 64 72 3d 39 fdtcontroladdr=9
00000060: 66 66 62 31 62 61 30 00 6c 6f 61 64 61 64 64 72 ffb1ba0.loadaddr
00000070: 3d 30 78 38 32 30 30 30 30 30 30 00 73 74 64 65 =0x82000000.stde
00000080: 72 72 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 rr=serial0@e0022
00000090: 30 30 30 00 73 74 64 69 6e 3d 73 65 72 69 61 6c 000.stdin=serial
000000a0: 30 40 65 30 30 32 32 30 30 30 00 73 74 64 6f 75 0@e0022000.stdou
000000b0: 74 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 30 t=serial0@e00220
000000c0: 30 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00..............
...
------------------->8----------------

Source of hexdump.c was copied from Linux kernel v4.7-rc2.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Mario Six <mario.six@gdsys.cc>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Stefan Roese <sr@denx.de>

# c232d14d 29-May-2018 Alex Kiernan <alex.kiernan@gmail.com>

mmc: Separate "mmc swrite" from fastboot

Introduce CONFIG_IMAGE_SPARSE and CONFIG_CMD_MMC_SWRITE so the "mmc
swrite" command is separated from the fastboot code.

Move image-sparse from common to lib so it's clear it's library code.

Rename CONFIG_FASTBOOT_FLASH_FILLBUF_SIZE to CONFIG_IMAGE_SPARSE_FILLBUF_SIZE
and migrate it to Kconfig.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Acked-by: Jassi Brar <jaswinder.singh@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6417572e 08-May-2018 Tom Rini <trini@konsulko.com>

lib/Kconfig: Mark OF_LIBFDT_OVERLAY as depending on OF_LIBFDT

The overlay code is only useful when OF_LIBFDT is set, so mark it as
depending on that first.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 58a46f88 25-Apr-2018 Praneeth Bajjuri <praneeth@ti.com>

configs: TI: Enable FIT Library overlay support

Enable the FDT library overlay support for all TI SOC family.

Without this option, when Loading fdt from FIT image, the
following warning is seen.

"config with overlays but CONFIG_OF_LIBFDT_OVERLAY not set".

Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
Suggested-by: Andrew F.Davis <afd@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>

# 14ad44ab 18-Apr-2018 Alex Kiernan <alex.kiernan@gmail.com>

spl: Split sprintf, strto* from SPL serial in Kconfig

When SPL serial is disabled, callers who need sprintf or strtoul fail
because their inclusion is guarded by CONFIG_SPL_SERIAL_SUPPORT/
CONFIG_TPL_SERIAL_SUPPORT.

Split printf, sprintf and strto into their own entries and then select
all of them if SERIAL_SUPPORT is enabled to match the current behaviour.

Include panic.o unconditionally as it can be called from anywhere which
uses BUG_ON().

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>

# e294ba06 04-Apr-2018 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-sunxi

Signed-off-by: Tom Rini <trini@konsulko.com>


# d14db11d 03-Apr-2018 Andre Przywara <andre.przywara@arm.com>

sunxi: revert disabling of features

In January some commits were introduced to mitigate the U-Boot image
size issues we encountered on sunxi builds.
Now with the MMC environment removed we can bring them back, as we
practically don't have a size limit anymore.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 32ce6179 13-Mar-2018 Bryan O'Donoghue <bryan.odonoghue@linaro.org>

optee: Add lib entries for sharing OPTEE code across ports

This patch adds code to lib to enable sharing of useful OPTEE code between
board-ports and architectures. The code on lib/optee/optee.c comes from the
TI omap2 port. Eventually the OMAP2 code will be patched to include the
shared code. The intention here is to add more useful OPTEE specific code
as more functionality gets added.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Cc: Harinarayan Bhatta <harinarayan@ti.com>
Cc: Andrew F. Davis <afd@ti.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Kever Yang <kever.yang@rock-chips.com>
Cc: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Cc: Peng Fan <peng.fan@nxp.com>
Tested-by: Peng Fan <peng.fan@nxp.com>

# 36c1877c 06-Feb-2018 Faiz Abbas <faiz_abbas@ti.com>

lib: Kconfig: Move DYNAMIC_CRC_TABLE to Kconfig

Add CONFIG prefix to DYNAMIC_CRC_TABLE and implement it in
Kconfig.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>

# a451bc27 05-Feb-2018 Adam Ford <aford173@gmail.com>

Convert LIB_UUID to Kconfig

config_fallback.h has some logic that checks a variety of options
and selects LIB_UUID if it hasn't already been selected. This
will all LIB_UUID in Kconfig and select this option for the list
of options to allow us to remove the logic from fallbacks

Signed-off-by: Adam Ford <aford173@gmail.com>

# a5a37567 06-Feb-2018 Adam Ford <aford173@gmail.com>

Convert CONFIG LIB_HW_RAND to Kconfig

config_fallbacks.h had some logic to automatically select
LIB_RAND if RANDOM_UUID or CMD_UUID were set if LIB_HW_RAND wasn't
already selected. By migrating LIB_HW_RAND to Kconfig, we can
remove this check from config_fallbacks.h and put it into Kconfig

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
[trini: Turn into a choice, add NET_RANDOM_ETHADDR]
Signed-off-by: Tom Rini <trini@konsulko.com>

# acd4d334 16-Jan-2018 Maxime Ripard <maxime.ripard@free-electrons.com>

net: regex: Disable by default on sunXi

The sunXi arm64 build has overflown, leading to the main U-boot binary
overwriting the environment when flashing the new image, or even worse,
overwriting itself when we're calling saveenv.

Disable this option that is not critical until we can adress the issue
properly.

Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 7e3caa81 03-Dec-2017 Masahiro Yamada <masahiroy@kernel.org>

Move CONFIG_PANIC_HANG to Kconfig

Freescale (NXP) boards have lots of defconfig files per board.
I used "imply PANIC_HANG" for them.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# da5337a6 08-Nov-2017 Nandor Han <nandor.han@ge.com>

rtc: add support for s35392a

Add support for S35392A RTC. The driver supports both U-Boot driver
models.

Signed-off-by: Nandor Han <nandor.han@ge.com>
Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
Cc: Heiko Schocher <hs@denx.de>

# f52bdf4b 14-Sep-2017 Jean-Jacques Hiblot <jjhiblot@ti.com>

lib: allow building lzo for the SPL

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 85d8bf57 03-Sep-2017 Marek Behún <kabel@kernel.org>

lib: Add CRC32-C

This is needed for BTRFS.

Signed-off-by: Marek Behun <marek.behun@nic.cz>

create mode 100644 lib/crc32c.c

# 7264f292 15-Aug-2017 York Sun <york.sun@nxp.com>

spl: fit: Eanble GZIP support for image decompression

Add Kconfig option SPL_GZIP and SPL_ZLIB to enable gunzip support for
SPL boot, eg. falcon boot compressed kernel image.

Signed-off-by: York Sun <york.sun@nxp.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6ef2f901 11-Aug-2017 Adam Ford <aford173@gmail.com>

Convert CONFIG_BCH to Kconfig

This converts the following to Kconfig:
CONFIG_BCH

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1a7ba1d 18-Aug-2017 Anatolij Gustschin <agust@denx.de>

Fix 'notes' typos

s/notes/nodes

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 96b9082c 03-Aug-2017 Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

rockchip: rk3188: rock: adjust for SPL/TPL split

With the changes to split SPL/TPL for the RK3368, I apparently missed
some needed adjustments to the RK3188 Kconfig and rock_defconfig.

This fixes build-issues for the rock board after applying the RK3368
enablement (and SPL/TPL) set that resulted from TPL_SERIAL_SUPPORT,
TPL_ROCKCHIP_BACK_TO_BROM and TPL_TINY_MEMSET being separate symbols
now.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d56b4b19 22-Jul-2017 Tom Rini <trini@konsulko.com>

configs: Migrate RBTREE, LZO, CMD_MTDPARTS, CMD_UBI and CMD_UBIFS

The above CONFIG options are in Kconfig, and now have correct depends and
inter-dependencies. Migrate these to configs/ from include/configs/. In the
case of CMD_UBIFS also change it to be a default y if CMD_UBI.

Signed-off-by: Tom Rini <trini@konsulko.com>

# aed998aa 17-May-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_LZMA to Kconfig

This converts the following to Kconfig:
CONFIG_LZMA

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

# b1a873df 26-Apr-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_CMD_AES et al to Kconfig

This converts the following to Kconfig:
CONFIG_CMD_AES
CONFIG_AES

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Add select AES to CMD_AES]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 173aafbf 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

cmd: Expose a Kconfig option to enable UBIFS commands

Create a new Kconfig entry to allow CMD_UBIFS selection from Kconfig and
add an hidden LZO option that can be selected by CMD_UBIFS.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>

# aa049152 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

mtd: ubi: Select RBTREE option from MTD_UBI Kconfig entry

Expose the RBTREE feature through Kconfig and select this option from the
MTD_UBI option.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>
[Rebased on master]
Signed-off-by: Jagan Teki <jagan@openedev.com>

# ab4458bd 02-Apr-2017 Simon Glass <sjg@chromium.org>

string: Provide a slimmed-down memset()

Most of the time the optimised memset() is what we want. For extreme
situations such as TPL it may be too large. For example on the 'rock'
board, using a simple loop saves a useful 48 bytes. With gcc 4.9 and
the rodata bug, this patch is enough to reduce the TPL image below the
limit.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>

# bea79d7d 14-Mar-2017 Andre Przywara <andre.przywara@arm.com>

Kconfig: introduce md5sum command selection

So far CONFIG_MD5SUM would need to be set by a board's include file.
Since the command is really generic, move it over to Kconfig to allow
it to be defined by either a board's defconfig, menuconfig or some
config snippet merged via mergeconfig.sh.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e663b350 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

smbios: Expose in efi_loader as table

We can pass SMBIOS easily as EFI configuration table to an EFI payload. This
patch adds enablement for that case.

While at it, we also enable SMBIOS generation for ARM systems, since they support
EFI_LOADER.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4b6dddc2 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

x86: Move smbios generation into arch independent directory

We will need the SMBIOS generation function on ARM as well going forward,
so let's move it into a non arch specific location.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# ebf7fff2 05-Oct-2016 Heiko Schocher <hs@denx.de>

spl: move FDT_FIXUP_PARTITIONS to Kconfig

Move FDT_FIXUP_PARTITIONS to Kconfig and cleanup existing
uses.

Signed-off-by: Heiko Schocher <hs@denx.de>

# ddf67f71 05-Jul-2016 Maxime Ripard <maxime.ripard@free-electrons.com>

libfdt: Add overlay application function

The device tree overlays are a good way to deal with user-modifyable
boards or boards with some kind of an expansion mechanism where we can
easily plug new board in (like the BBB, the Raspberry Pi or the CHIP).

Add a new function to merge overlays with a base device tree.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>

# 91b86e21 26-May-2016 Marek Vasut <marex@denx.de>

lib: Enable private libgcc by default

This patch decouples U-Boot binary from the toolchain on systems where
private libgcc is available. Instead of pulling in functions provided
by the libgcc from the toolchain, U-Boot will use it's own set of libgcc
functions. These functions are usually imported from Linux kernel, which
also uses it's own libgcc functions instead of the ones provided by the
toolchain.

This patch solves a rather common problem. The toolchain can usually
generate code for many variants of target architecture and often even
different endianness. The libgcc on the other hand is usually compiled
for one particular configuration and the functions provided by it may
or may not be suited for use in U-Boot. This can manifest in two ways,
either the U-Boot fails to compile altogether and linker will complain
or, in the much worse case, the resulting U-Boot will build, but will
misbehave in very subtle and hard to debug ways.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 67976306 30-Mar-2016 Masahiro Yamada <masahiroy@kernel.org>

cosmetic: Fix typos "privide"

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# ed980b8c 03-Mar-2016 Alexander Graf <agraf@csgraf.de>

efi_loader: hook up in build environment

Now that we have all the bits and pieces ready for EFI payload loading
support, hook them up in Makefiles and KConfigs so that we can build.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
[trini: Enable only when we of OF_LIBFDT, disable on kwb and colibri_pxa270]
Signed-off-by: Tom Rini <trini@konsulko.com>

# aa34fbc0 22-Feb-2016 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt to be used in SPL

Add an option to enable libfdt in SPL. This can be useful when decoding
FIT files in SPL.

We need to make sure this option is not enabled in SPL by this change.
Also this option needs to be enabled in host builds. Si add a new
IMAGE_USE_LIBFDT #define which can be used in files that are built on the
host but must also build for U-Boot and SPL.

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

# 69e173eb 22-Feb-2016 Simon Glass <sjg@chromium.org>

Move CONFIG_OF_LIBFDT to Kconfig

Move this option to Kconfig and tidy up existing boards.

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

# a187559e 05-Feb-2016 Bin Meng <bmeng.cn@gmail.com>

Use correct spelling of "U-Boot"

Correct spelling of "U-Boot" shall be used in all written text
(documentation, comments in source files etc.).

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Minkyu Kang <mk7.kang@samsung.com>

# 947c626d 14-Jan-2016 Tom Rini <trini@konsulko.com>

vsprintf.c: Always enable CONFIG_SYS_VSNPRINTF

Enabling this function always removes some class of string saftey issues.
The size change here in general is about 400 bytes and this seems a reasonable
trade-off.

Cc: Peng Fan <peng.fan@nxp.com>
Cc: Peter Robinson <pbrobinson@gmail.com>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Adrian Alonso <aalonso@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 7d9cde10 22-Nov-2015 Stefan Roese <sr@denx.de>

lib/tiny-printf.c: Add tiny printf function for space limited environments

This patch adds a small printf() version that supports all basic formats.
Its intented to be used in U-Boot SPL versions on platforms with very
limited internal RAM sizes.

To enable it, just define CONFIG_USE_TINY_PRINTF in your defconfig. This
will result in the SPL using this tiny function and the main U-Boot
still using the full-blown printf() function.

This code was copied from:
http://www.sparetimelabs.com/printfrevisited
With mostly only coding style related changes so that its checkpatch
clean.

The size reduction is about 2.5KiB. Here a comparison for the db-mv784mp-gp
(Marvell AXP) SPL:

Without this patch:
58963 18536 1928 79427 13643 ./spl/u-boot-spl

With this patch:
56542 18536 1956 77034 12cea ./spl/u-boot-spl

Note:
To make it possible to compile tiny-printf.c instead of vsprintf.c when
CONFIG_USE_TINY_PRINTF is defined, the functions printf() and vprintf() are
moved from common/console.c into vsprintf.c in this patch.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>

# 2419cd16 03-Oct-2015 Simon Glass <sjg@chromium.org>

dm: tpm: Drop CONFIG_DM_TPM

Now that all TPM drivers use driver model, we can drop the special driver
model CONFIG option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>

# 027b728d 06-Oct-2015 Julius Werner <jwerner@chromium.org>

Add support for LZ4 decompression algorithm

This patch adds support for LZ4-compressed FIT image contents. This
algorithm has a slightly worse compression ration than LZO while being
nearly twice as fast to decompress. When loading images from a fast
storage medium this usually results in a boot time win.

Sandbox-tested only since I don't have a U-Boot development system set
up right now. The code was imported unchanged from coreboot where it's
proven to work, though. I'm mostly interested in getting this recognized
by mkImage for use in a downstream project.

Signed-off-by: Julius Werner <jwerner@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# a7d660bc 22-Aug-2015 Simon Glass <sjg@chromium.org>

tpm: Add Kconfig options for TPMs

Add new Kconfig options for TPMs in preparation for moving boards to use
Kconfig for TPM configuration.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 867a6ac8 31-Jul-2015 Simon Glass <sjg@chromium.org>

efi: Add start-up library code

When running as an EFI application, U-Boot must request memory from EFI,
and provide access to the boot services U-Boot needs.

Add library code to perform these tasks. This includes efi_main() which is
the entry point from EFI. U-Boot is built as a shared library.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d1389403 23-Jun-2015 Simon Glass <sjg@chromium.org>

Add a dhrystone benchmark command

Drystone provides a convenient sanity check that the CPU is running at full
speed. Add this as a command which can be enabled as needed.

Note: I investigated using Coremark for this but there was a license
agreement and I could not work out if it was GPL-compatible.

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

# f7848d90 22-Jun-2015 Joe Hershberger <joe.hershberger@ni.com>

Allow CONFIG_REGEX to be disabled when CONFIG_NET

Instead of selecting REGEX when NET is enabled, make it the default, but
allow boards that are tiny to disable it and lose functionality on all
but the first Ethernet adapter.

cm-bf548, bf538f-ezkit, and bf533-stamp need this. None appear to have
more than one Ethernet interface.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# 3850dbe8 11-Jun-2015 Masahiro Yamada <masahiroy@kernel.org>

blackfin: fix undefined reference to srand and rand

Commit 9ba9e85f3f1c (net: Fix NET_RANDOM_ETHADDR dependencies)
accidentally dropped CONFIG_LIB_RAND defines for 14 Blackfin boards.

Prior to that commit, those boards defined CONFIG_LIB_RAND, but not
CONFIG_NET_RANDOM_ETHADDR. So, commit 9ba9e85f3f1c should not have
touched them, but in fact it ripped CONFIG_LIB_RAND off from all the
header files, which caused undefined reference to srand and rand.
CONFIG_LIB_RAND=y must be revived for such boards.

BTW, this commit indeed makes it better, but even with this fix,
three boards (bf533-stamp, bf538f-ezkit, cm-bf548) still can not
build due to region 'ram' overflowed error. This was cause by
commit 6eed3786c68c (net: Move the CMD_NET config to defconfigs)
because CMD_NET selects NET, and NET selects REGEX. Eventually,
some boards were newly enabled with CONFIG_REGEX, increasing the
memory footprint. A patch is expected to fix the build error.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 9ba9e85f 25-May-2015 Michal Simek <michal.simek@amd.com>

net: Fix NET_RANDOM_ETHADDR dependencies

NET_RANDOM_ETHADDR depends on lib/rand.c. This patch adds dependency to
Kconfig to ensure that library is also compiled.

Remove the definitions from Blackfin boards' include/configs.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 6501ff62 20-Apr-2015 Przemyslaw Marczak <p.marczak@samsung.com>

lib: Kconfig: add entry for errno_str() function

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1a60650c 21-Apr-2015 Joe Hershberger <joe.hershberger@ni.com>

kconfig: Move REGEX to Kconfig

Having this as a Kconfig allows it to be a dependent feature.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8156345d 06-Mar-2015 Simon Glass <sjg@chromium.org>

sandbox: Move CONFIG_SYS_VSNPRINTF to Kconfig

Move this over to Kconfig and tidy up.

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

# 94e3c8c4 19-Feb-2015 gaurav rana <gaurav.rana@freescale.com>

crypto/fsl - Add progressive hashing support using hardware acceleration.

Currently only normal hashing is supported using hardware acceleration.
Added support for progressive hashing using hardware.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
Signed-off-by: Gaurav Rana <gaurav.rana@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>

# d9f23c7f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

lib/rsa: Add Kconfig for devices supporting RSA Modular Exponentiation

Kconfig option added for devices which support RSA Verification.
1. RSA_SOFTWARE_EXP
Enables driver for supporting RSA Modular Exponentiation in Software
2. RSA_FREESCALE_EXP
Enables driver for supporting RSA Modular Exponentiation using Freescale specific
driver

The above drivers use RSA uclass

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
(Removed duplicate line in Kconfig comment)

Change-Id: I7663c4d5350e2bfc3dfa2696f70ef777d6ccc6f6

# c4beb22f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

FIT: Modify option FIT_SIGNATURE in Kconfig

For FIT signature based approach to work, RSA library needs to be selected.
The FIT_SIGNATURE option in Kconfig is modified to automatically select RSA.
Selecting RSA compiles the RSA library required for image verification.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 45ccec8f 23-Oct-2014 Masahiro Yamada <masahiroy@kernel.org>

kconfig: move CONFIG_USE_PRIVATE_LIBGCC to Kconfig

The private libgcc is supported only on ARM, MIPS, PowerPC, SH, x86.
Those architectures should "select" HAVE_PRIVATE_LIBGCC and
CONFIG_USE_PRIVATE_LIBGCC should depend on it.

Currently, this option is enabled on Tegra boards and x86 architecture.
Move the definition from header files to Kconfig.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Tested-by: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: Tom Warren <twarren@nvidia.com>

# 8c688bc4 23-Oct-2014 Masahiro Yamada <masahiroy@kernel.org>

kconfig: move CONFIG_SYS_HZ to lib/Kconfig

CONFIG_SYS_HZ is always defined as 1000 in config_fallbacks.h
(but some boards still have redundant definitions).

This commit moves the definition and the document in README to
Kconfig. Since lib/Kconfig can assure that CONFIG_SYS_HZ is 1000,
the sanity check in lib/time.c should be removed.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Reviewed-by: Marek Vasut <marex@denx.de>

# b0928da6 16-Sep-2014 Masahiro Yamada <masahiroy@kernel.org>

kconfig: move CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED to Kconfig

If this option is enabled, the objects under lib/ directory
are compiled with speed optimization, not size optimization.
(Currently, only used by some Blackfin boards.)

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# ed36323f 16-Sep-2014 Masahiro Yamada <masahiroy@kernel.org>

kconfig: add blank Kconfig files

This would be useful to start moving various config options.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# 53fab13a 20-Sep-2023 Simon Glass <sjg@chromium.org>

efi: Use the installed SMBIOS tables

U-Boot should set up the SMBIOS tables during startup, as it does on x86.
Ensure that it does this correctly on non-x86 machines too, by creating
an event spy for last-stage init.

Tidy up the installation-condition code while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 8c11d19e 19-Sep-2023 Simon Glass <sjg@chromium.org>

x86: smbios: Add a Kconfig indicating SMBIOS-table presence

When booted from coreboot, U-Boot does not build the SMBIOS tables, but
it should still pass them on to the OS. Add a new option which indicates
whether SMBIOS tables are present, however they were built.

Flip the ordering so that the dependency is listed first, which is less
confusing.

Adjust GENERATE_SMBIOS_TABLE to depend on this new symbol.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 0c45c76c 19-Sep-2023 Simon Glass <sjg@chromium.org>

x86: Allow APCI in SPL

This is needed so we can find the DBG2 table provided by coreboot. Add a
Kconfig so it can be enabled.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 040a6048 14-Sep-2023 Simon Glass <sjg@chromium.org>

boot: Join FDT_FIXUP_PARTITIONS with related options

Move this to be with the other devicetree-fixup options.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 4cc40f61 14-Sep-2023 Simon Glass <sjg@chromium.org>

FWU: Avoid showing an unselectable menu option

Use a menuconfig to avoid showing a menu which cannot be selected in many
cases.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

# a90b5946 14-Sep-2023 Simon Glass <sjg@chromium.org>

lib: rational: Move the Kconfigs into the correct place

These should not be part of the 'system tables' menu. Move them outside
on their own.

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: 7d0f3fbb93c ("lib: rational: copy the rational fraction lib...")
Reviewed-by: Tom Rini <trini@konsulko.com>

# a077ac13 02-Aug-2023 Tom Rini <trini@konsulko.com>

Kconfigs: Correct default of "0" on hex type entries

It is not a parse error to have a default value of "0" for a "hex" type
entry, instead of "0x0". However, "0" and "0x0" are not treated the
same even by the tools themselves. Correct this by changing the default
value from "0" to "0x0" for all hex type questions that had the
incorrect default. Fix one instance (in two configs) of a default of "0"
being used on a hex question to be "0x0". Remove the cases where a
defconfig had set a value of "0x0" to be used as the default had been
"0".

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# af62d83c 03-Aug-2023 Oleksandr Suvorov <oleksandr.suvorov@foundries.io>

spl: move SPL_CRC32 option to lib/Kconfig

All SPL hash algorithm options are collected in lib/Kconfig. Move
SPL_CRC32 there as well.

Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
Reviewed-by: Simon Glass <sjg@chromium.org>

# dfe00b34 13-Jul-2023 Manorit Chawdhry <m-chawdhry@ti.com>

lib: Kconfig: k3: Enable SHA512 for fit signature

We are using our custMpk for signing that is a 4096 bit key, 4096 bit
rsa key requires a SHA512 hashing algorithm to be enabled as per the
source. Even though it is not mandated but this is how it works and is
tested.

Enables SHA512 if fit signature is enabled on K3 platforms.

Signed-off-by: Manorit Chawdhry <m-chawdhry@ti.com>

# 0992a90d 04-May-2023 Simon Glass <sjg@chromium.org>

acpi: Create a new Kconfig for ACPI

We have several Kconfig options for ACPI, but all relate to specific
functions, such as generating tables and AML code.

Add a new option which controls including basic ACPI library code,
including the lib/acpi directory. This will allow us to add functions
which are available even if table generation is not supported.

Adjust the command to avoid a build error when ACPIGEN is not enabled.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 94c8da21 22-Mar-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: Fix LMB_MEMORY_REGIONS flag usage

Remove test on CONFIG_LMB_MEMORY_REGIONS introduced by commit
7c1860fce4e3 ("lmb: Fix lmb property's defination under struct lmb").

This code in lmb_init() is strange, because if CONFIG_LMB_USE_MAX_REGIONS
and CONFIG_LMB_MEMORY_REGIONS are not defined, the implicit #else is empty
and the required initialization is not done:
lmb->memory.max = ?
lmb->reserved.max = ?

But this setting is not possible:
- CONFIG_LMB_USE_MAX_REGIONS not defined
- CONFIG_LMB_MEMORY_REGIONS not defined
because CONFIG_LMB_MEMORY_REGIONS and CONFIG_LMB_RESERVED_REGIONS are
defined as soon as the CONFIG_LMB_USE_MAX_REGIONS is not defined.

This patch removes this impossible case #elif and I add some
explanation in lmb.h to explain why in the struct lmb {} the lmb
property is defined if CONFIG_LMB_MEMORY_REGIONS is NOT defined.

This patch also removes CONFIG_LMB_XXX dependency on CONFIG_LMB as these
defines are used in API file lmb.h and not only in library file.

Fixes: 5e2548c1d6e03 ("lmb: Fix LMB_MEMORY_REGIONS flag usage")
Reported-by: Mark Millard <marklmi@yahoo.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Acked-by: Michal Simek <michal.simek@amd.com>

# c61df340 18-Mar-2023 Marek Vasut <marek.vasut+renesas@mailbox.org>

lib: Fix SYS_TIMER_COUNTS_DOWN description in Kconfig

The SYS_TIMER_COUNTS_DOWN description contains a typo,
s@rathe@&r@ , fix it.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>

# 3b510807 22-Feb-2023 Simon Glass <sjg@chromium.org>

lib: Add an SPL config for LIB_UUID

This is selected by PARTITION_UUIDS which has a separate option for SPL.
Add an SPL option for LIB_UUID also, so that we can keep them consistent.

Also add one for PARTITION_TYPE_GUID to avoid a build error in part_efi.c
which wants to call a uuid function in SPL.

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

# 5a6bc166 22-Feb-2023 Simon Glass <sjg@chromium.org>

lib: Add VPL options for SHA1 and SHA256

Add these options so these algorithms can be used in VPL.

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

# ae625d92 22-Feb-2023 Simon Glass <sjg@chromium.org>

lib: Add a Kconfig for SPL_BZIP2

This is implicitly used in the source and seems useful, so add it.

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

# c33425c6 15-Jan-2023 Simon Glass <sjg@chromium.org>

trace: Reduce the default for TRACE_EARLY_CALL_DEPTH_LIMIT

This is a silly value at present, since U-Boot's call depth never reaches
200. Fix it.

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

# 2dc16a2c 19-Jan-2023 Sjoerd Simons <sjoerd@collabora.com>

Bump LMB_MAX_REGIONS default to 16

Since commit 06d514d77c37 ("lmb: consider EFI memory map") the EFI regions
are also pushed into the lmb if EFI_LOADER is enabled (which is by
default on most system). Which can cause the number of entries to go
over the maximum as it's default is only 8.

Specifically i ran into this case on an TI am62 which has an fdt with
4 reserved regions (in practice 3 lmb entries due to adjecent ranges).

As this is likely to impact more devices bump the default max
regions to 16 so there is a bit more slack.

Fixes: 06d514d77c ("lmb: consider EFI memory map")
Link: https://bugzilla.opensuse.org/show_bug.cgi?id=1207562
Reviewed-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Signed-off-by: Sjoerd Simons <sjoerd@collabora.com>
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
[trini: collect tags from the other equivalent patch]

# 948d3999 08-Feb-2023 Tom Rini <trini@konsulko.com>

Revert "lmb: Default to not-LMB_USE_MAX_REGIONS"

As explained by Philippe Schenker, I was misinterpreting what happened
in the case where we do not set LMB_USE_MAX_REGIONS and so had
re-introduced the problem I was attempting to more widely resolve.

This reverts commit 007ae5d108a37564905ea1588cb279f3a522cc3d.

Reported-by: Philippe Schenker <philippe.schenker@toradex.com>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 007ae5d1 25-Jan-2023 Tom Rini <trini@konsulko.com>

lmb: Default to not-LMB_USE_MAX_REGIONS

The LMB code allows for picking a hard limit on the number of regions it
can know of, or to dynamically allocate these regions. The reason for
this choice is to allow for the compiler to perform a size optimization
in the common case. This optimization however, is very small, ranging
from 196 bytes to 15 bytes saved, or in some cases, being larger. Now
that we also have more regions covered by LMB (in order to protect
various parts of our self at run time), the default of 8 is also much
easier to hit and leads to non-obvious error messages (which imply that
an area is protected, not that we're out of areas to add to the list).

Switch to the dynamic use as the default.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 53c47c59 19-Jan-2023 Tom Rini <trini@konsulko.com>

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


# 4b9b25d9 12-Jan-2023 Brandon Maier <brandon.maier@collins.com>

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

[1] https://github.com/torvalds/linux/commit/e0c1b49f5b674cca7b10549c53b3791d0bbc90a8
[2] https://github.com/facebook/zstd/blob/f302ad8811643c428c4e3498e28f53a0578020d3/lib/libzstd.mk#L31

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>

# ebc1d50a 21-Dec-2022 Simon Glass <sjg@chromium.org>

Revert "fdtdec: drop needlessly convoluted CONFIG_PHANDLE_CHECK_SEQ"

The fdt_path_offset() function is slow since it must scan the tree.
This substantial overhead now applies to all boards.

The original code may not be ideal but it is fit for purpose and is only
needed on a few boards.

Reverting this reduces time to set up driver model by about 30ms.

Before revert:

Accumulated time:
47,170 dm_r
53,237 dm_spl
572,986 dm_f

Accumulated time:
44,598 dm_r
50,347 dm_spl
549,133 dm_f

This reverts commit 26f981f295d00351b6f0c69b5317b254b2361cc0.

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

# 12619d4e 21-Dec-2022 Simon Glass <sjg@chromium.org>

trace: Don't require TIMER_EARLY

Some platforms cannot honour this and don't need trace before relocation.
Use 'imply' instead, so boards can disable this.

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

# 0c16fca9 07-Jan-2023 Simon Glass <sjg@chromium.org>

tpm: Add a proper Kconfig option for crc8 in SPL

The current approach is a bit of a hack and only works for the tpm
subsystem. Add a Kconfig so that crc8 can be enabled in SPL for other
purposes.

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

# 14f43797 19-Dec-2022 Tom Rini <trini@konsulko.com>

Merge tag 'v2023.01-rc4' into next

Prepare v2023.01-rc4

Signed-off-by: Tom Rini <trini@konsulko.com>


# ae3527f0 07-Dec-2022 Kautuk Consul <kconsul@ventanamicro.com>

arch/riscv: add semihosting support for RISC-V

We add RISC-V semihosting based serial console for JTAG based early
debugging.

The RISC-V semihosting specification is available at:
https://github.com/riscv/riscv-semihosting-spec/blob/main/riscv-semihosting-spec.adoc

Signed-off-by: Anup Patel <apatel@ventanamicro.com>
Signed-off-by: Kautuk Consul <kconsul@ventanamicro.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>

# 1c03ab9f 07-Dec-2022 Kautuk Consul <kconsul@ventanamicro.com>

lib: Add common semihosting library

We factor out the arch-independent parts of the ARM semihosting
implementation as a common library so that it can be shared
with RISC-V.

Signed-off-by: Kautuk Consul <kconsul@ventanamicro.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>

# 3b8dfc42 16-Nov-2022 Tom Rini <trini@konsulko.com>

Convert CONFIG_SYS_TIMER_COUNTS_DOWN to Kconfig

This converts the following to Kconfig:
CONFIG_SYS_TIMER_COUNTS_DOWN

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 86794052 21-Oct-2022 Sughosh Ganu <sughosh.ganu@linaro.org>

FWU: Add support for the FWU Multi Bank Update feature

The FWU Multi Bank Update feature supports updating firmware images
to one of multiple sets(also called banks) of images. The firmware
images are clubbed together in banks, with the system booting images
from the active bank. Information on the images such as which bank
they belong to is stored as part of the metadata structure, which is
stored on the same storage media as the firmware images on a dedicated
partition.

At the time of update, the metadata is read to identify the bank to
which the images need to be flashed(update bank). On a successful
update, the metadata is modified to set the updated bank as active
bank to subsequently boot from.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

# 40ed7be4 02-Aug-2022 Tom Rini <trini@konsulko.com>

Convert CONFIG_SYS_FDT_PAD to Kconfig

This converts the following to Kconfig:
CONFIG_SYS_FDT_PAD

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e67ffb5a 22-Jul-2022 Sughosh Ganu <sughosh.ganu@linaro.org>

tpm: rng: Add driver model interface for TPM RNG device

The TPM device has a builtin random number generator(RNG)
functionality. Expose the RNG functions of the TPM device to the
driver model so that they can be used by the EFI_RNG_PROTOCOL if the
protocol is installed.

Also change the function arguments and return type of the random
number functions to comply with the driver model api.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

# b340199f 10-Jun-2022 Tom Rini <trini@konsulko.com>

spl: Ensure all SPL symbols in Kconfig have some SPL dependency

Tighten up symbol dependencies in a number of places. Ensure that a SPL
specific option has at least a direct dependency on SPL. In places
where it's clear that we depend on something more specific, use that
dependency instead. This means in a very small number of places we can
drop redundant dependencies.

Reported-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 13ce351b 08-Jun-2022 Tom Rini <trini@konsulko.com>

vpl: Ensure all VPL symbols in Kconfig have some VPL dependency

Tighten up symbol dependencies in a number of places. Ensure that a VPL
specific option has at least a direct dependency on VPL. In places
where it's clear that we depend on something more specific, use that
dependency instead.

Reported-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 8bea4bf7 08-Jun-2022 Tom Rini <trini@konsulko.com>

tpl: Ensure all TPL symbols in Kconfig have some TPL dependency

Tighten up symbol dependencies in a number of places. Ensure that a TPL
specific option has at least a direct dependency on TPL. In places
where it's clear that we depend on something more specific, use that
dependency instead.

Reported-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 26f981f2 19-May-2022 Rasmus Villemoes <rasmus.villemoes@prevas.dk>

fdtdec: drop needlessly convoluted CONFIG_PHANDLE_CHECK_SEQ

Asking if the alias we found actually points at the device tree node
we passed in (in the guise of its offset from blob) can be done simply
by asking if the fdt_path_offset() of the alias' path is identical to
offset.

In fact, the current method suffers from the possibility of false
negatives: dtc does not necessarily emit a phandle property for a node
just because it is referenced in /aliases; it only emits a phandle
property for a node if it is referenced in <angle brackets>
somewhere. So if both the node we passed in and the alias node we're
considering don't have phandles, fdt_get_phandle() returns 0 for both.

Since the proper check is so simple, there's no reason to hide that
behind a config option (and if one really wanted that, it should be
called something else because there's no need to involve phandle in
the check).

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Acked-by: Aswath Govindraju <a-govindraju@ti.com>

# d30924f1 01-May-2022 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: fix selection of CONFIG_CHARSET

lib/charset.c is not optional for
EFI_APP || EFI_LOADER || UFS || UT_UNICODE.
These must select CONFIG_CHARSET.

Fixes: 726cd9836db0 ("efi: Make unicode printf available to the app")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>

# 747093dd 30-Apr-2022 Simon Glass <sjg@chromium.org>

vpl: Add Kconfig options for VPL

Add VPL versions of commonly used Kconfig options.

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

# 11232139 06-Apr-2022 Tom Rini <trini@konsulko.com>

nds32: Remove the architecture

As removal of nds32 has been ack'd for the Linux kernel, remove support
here as well.

Cc: Rick Chen <rick@andestech.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Rick Chen <rick@andestech.com>

# fd210fee 28-Mar-2022 Philippe Reynes <philippe.reynes@softathome.com>

lib: allow to build asn1 decoder and oid registry in SPL

This commit adds the options:
- SPL_ASN1_DECODER
- SPL_OID_REGISTRY

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>

# 7d44a985 28-Mar-2022 Philippe Reynes <philippe.reynes@softathome.com>

lib: Kconfig: enhance the help of OID_REGISTRY

Enhance the help for the config OID_REGISTRY.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>

# a0e71d96 28-Mar-2022 Philippe Reynes <philippe.reynes@softathome.com>

lib: Kconfig: enhance help for ASN1

Enhance the help for configs ASN1_COMPILER
and ASN1_decoder.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>

# 761a1786 27-Jan-2022 Tom Rini <trini@konsulko.com>

Merge tag 'dm-pull-26jan22' of https://source.denx.de/u-boot/custodians/u-boot-dm

acpi refactoring to allow non-x86 use
binman support for bintools (binary tools)
minor tools improvements in preparation for FDT signing
various minor fixes and improvements


# 334a9b9d 25-Nov-2021 Loic Poulain <loic.poulain@linaro.org>

lib/circbuf: Make circbuf selectable symbol

It is currenly only used from usbtty driver but make it properly
selectable via Kconfig symbol, for future usage.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>

# e1722fcb 01-Dec-2021 Simon Glass <sjg@chromium.org>

x86: Allow any arch to generate ACPI tables

These have sadly found their way to ARM now. Allow any arch to support
generating ACPI tables.

Disable this for the tools build.

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

# 7c3fd5c2 26-Dec-2021 Qu Wenruo <wqu@suse.com>

lib: add BLAKE2 hash support

The code is cross-ported from BLAKE2 reference implementation
(https://github.com/BLAKE2/BLAKE2).

With minimal change to remove unused macros/features.

Currently there is only one user inside U-boot (btrfs), and since it
only utilize BLAKE2B, all other favors are all removed.

Signed-off-by: Qu Wenruo <wqu@suse.com>
[trini: Rename ROUND to R to avoid clash with <linux/bitops.h>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 97f2a749 04-Jan-2022 Eugen Hristev <eugen.hristev@collabora.com>

lib: Kconfig: fix PHANDLE_CHECK_SEQ position outside of menu

CONFIG_PHANDLE_CHECK_SEQ is outside of the menu 'Library routines'
thus it's invisible in menuconfig and cannot be selected.
Fix this by moving the 'endmenu' after the PHANDLE_CHECK_SEQ definition

Fixes: c589132a1d ("fdt: Use phandle to distinguish DT nodes with same name")
Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
Reviewed-by: Aswath Govindraju <a-govindraju@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 726cd983 29-Dec-2021 Simon Glass <sjg@chromium.org>

efi: Make unicode printf available to the app

This is needed to show unicode strings. Enable this code in the app.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>

# 6405ab7a 24-Nov-2021 Simon Glass <sjg@chromium.org>

Convert CONFIG_PHYSMEM to Kconfig

This converts the following to Kconfig:
CONFIG_PHYSMEM

Signed-off-by: Simon Glass <sjg@chromium.org>
Suggested-by: Sean Anderson <seanga2@gmail.com>

# ac7606af 14-Nov-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

lmb: fix typo 'commun'

%s/commun/common/

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

# e7d285b2 25-Sep-2021 Simon Glass <sjg@chromium.org>

image: Use the correct checks for CRC32

Add a host Kconfig for CRC32. With this we can use CONFIG_IS_ENABLED(CRC32)
directly in the host build, so drop the unnecessary indirection.

Add a few more conditions to SPL_CRC32 to avoid build failures as well as
TPL_CRC32. Also update hash.c to make crc32 optional and to actually take
notice of SPL_CRC32.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# 2c21256b 25-Sep-2021 Simon Glass <sjg@chromium.org>

hash: Use Kconfig to enable hashing in host tools and SPL

At present when building host tools, we force CONFIG_SHAxxx to be enabled
regardless of the board Kconfig setting. This is done in the image.h
header file.

For SPL we currently just assume the algorithm is desired if U-Boot proper
enables it.

Clean this up by adding new Kconfig options to enable hashing on the host,
relying on CONFIG_IS_ENABLED() to deal with the different builds.

Add new SPL Kconfigs for hardware-accelerated hashing, to maintain the
current settings.

This allows us to drop the image.h code and the I_WANT_MD5 hack.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# 603d15a5 25-Sep-2021 Simon Glass <sjg@chromium.org>

spl: cypto: Bring back SPL_ versions of SHA

Unfortunately these were removed by mistake. This means that adding hash
support to SPL brings in all software algorithms, with a substantial
increase in code size.

The origin of the problem was renaming them to SPL_FIT_xxx and then these
were removed altogether in a later commit.

Add them back. This aligns with CONFIG_MD5, for example, which has an SPL
variant.

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: f5bc9c25f31 ("image: Rename SPL_SHAxxx_SUPPORT to SPL_FIT_SHAxxx")
Fixes: eb5171ddec9 ("common: Remove unused CONFIG_FIT_SHAxxx selectors")
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# 6674edaa 16-Sep-2021 Tom Rini <trini@konsulko.com>

Merge tag 'v2021.10-rc4' into next

Prepare v2021.10-rc4

Signed-off-by: Tom Rini <trini@konsulko.com>

# gpg: Signature made Tue 14 Sep 2021 06:58:32 PM EDT
# gpg: using RSA key 1A3C7F70E08FAB1707809BBF147C39FF9634B72C
# gpg: Good signature from "Thomas Rini <trini@konsulko.com>" [ultimate]

# Conflicts:
# board/Arcturus/ucp1020/spl.c
# cmd/mvebu/Kconfig
# common/Kconfig.boot
# common/image-fit.c
# configs/UCP1020_defconfig
# configs/sifive_unmatched_defconfig
# drivers/pci/Kconfig
# include/configs/UCP1020.h
# include/configs/sifive-unmatched.h
# lib/Makefile
# scripts/config_whitelist.txt


# 5145bc73 01-Sep-2021 Oleksandr Suvorov <oleksandr.suvorov@foundries.io>

lib: fix typos in Kconfig

There are trivial typos in the Kconfig file. Fixed them.
Also, fixed grammar in the descriptions with typos.

Fixes: d56b4b1974 ("configs: Migrate RBTREE, LZO, CMD_MTDPARTS, CMD_UBI and CMD_UBIFS")
Fixes: 7264f2928b ("spl: fit: Eanble GZIP support for image decompression")
Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# e60e4499 02-Sep-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

lib: Drop SHA512_ALGO in lieu of SHA512

SHA512_ALGO was used as a "either SHA512 or SHA384", although the
implementations of these two algorithms share a majority of code.

From a Kconfig interface perspective, it makes sense to present two
distinct options. This requires #ifdefing out the SHA512
implementation from sha512.c. The latter doesn't make any sense.

It's reasonable to say in Kconfig that SHA384 depends on SHA512, and
seems to be the more polite way to handle the selection.

Thus, automatically select SHA512 when SHA384 is enabled.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# b4c2c151 27-Aug-2021 Michal Simek <michal.simek@amd.com>

Kconfig: Remove all default n/no options

default n/no doesn't need to be specified. It is default option anyway.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
[trini: Rework FSP_USE_UPD portion]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 928a8be7 29-Jul-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

lib: ecdsa: Implement UCLASS_ECDSA verification on target

Implement the crypto_algo .verify() function for ecdsa256. Because
it backends on UCLASS_ECDSA, this change is focused on parsing the
keys from devicetree and passing this information to the specific
UCLASS driver.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# fa3f1f1d 24-Jul-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: disable CONFIG_SPL_HEXDUMP by default

CONFIG_HEXDUMP is needed to display UEFI variables using 'printenv -e'.

Enabling CONFIG_SPL_HEXDUMP only makes sense for debugging purposes.
Hence CONFIG_SPL_HEXDUMP should not be enabled by default.

The following boards currently have CONFIG_SPL_HEXDUMP=y. This includes
boards that don't use SPL at all.

axm_defconfig
imx8mm-cl-iot-gate_defconfig
imx8mm_venice_defconfig
imxrt1020-evk_defconfig
imxrt1050-evk_defconfig
kontron_sl28_defconfig
kp_imx53_defconfig
lx2160ardb_tfa_stmm_defconfig
mt7622_rfb_defconfig
octeon_ebb7304_defconfig
octeon_nic23_defconfig
qemu_arm64_defconfig
qemu_arm_defconfig
qemu-riscv32_defconfig
qemu-riscv32_smode_defconfig
qemu-riscv64_defconfig
qemu-riscv64_smode_defconfig
qemu-x86_64_defconfig
qemu-x86_defconfig
sandbox64_defconfig
sandbox_defconfig
stm32mp15_basic_defconfig
stm32mp15_trusted_defconfig
synquacer_developerbox_defconfig
taurus_defconfig
xilinx_versal_virt_defconfig

The patch only keeps it enabled on

sandbox_spl_defconfig

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 1a46cb6c 02-Jul-2021 Simon Glass <sjg@chromium.org>

lib: Create a new Kconfig option for charset conversion

Rather than looking at two KConfig options in the Makefile, create a new
Kconfig option for compiling lib/charset.c

Enable it for UFS also, which needs this support.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 26dd9936 08-Jul-2021 Steffen Jaeckel <jaeckel-floss@eyet-services.de>

lib: add crypt subsystem

Add the basic functionality required to support the standard crypt
format.
The files crypt-sha256.c and crypt-sha512.c originate from libxcrypt and
their formatting is therefor retained.
The integration is done via a crypt_compare() function in crypt.c.

```
libxcrypt $ git describe --long --always --all
tags/v4.4.17-0-g6b110bc
```

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 7d0f3fbb 11-Jun-2021 Tero Kristo <t-kristo@ti.com>

lib: rational: copy the rational fraction lib routines from Linux

Copy the best rational approximation calculation routines from Linux.
Typical usecase for these routines is to calculate the M/N divider
values for PLLs to reach a specific clock rate.

This is based on linux kernel commit:
"lib/math/rational.c: fix possible incorrect result from rational
fractions helper"
(sha1: 323dd2c3ed0641f49e89b4e420f9eef5d3d5a881)

Signed-off-by: Tero Kristo <t-kristo@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Tero Kristo <kristo@kernel.org>

# ec0512b1 24-May-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

Revert "lib: introduce HASH_CALCULATE option"

When we think of Kconfig, we usually think of features that we like
to enable or not. Ideally, we wouldn't use Kconfig to fix a build
issue, although sometimes it might make sense. With Kconfig it's hard
to guarantee that the fix is universal. We can only say that it works
for the set of tested configurations. In the majority of cases, it's
preferable to let the linker figure things out for us.

The reverted commit attempted to fix a build issue by adding an
invisible Kconfig option. This is wrong in several ways:

It invents a new Kconfig variable when CONFIG_HASH already
exists for the same purpose.
Second, hash-checksum.c makes use of the hash_progressive_lookup_algo()
symbol, which is only provided with CONFIG_HASH, but this dependency
was not expressed in the reverted patch.

It feels like Kconfig is turning into a listing of all available
source files, and a buffet to 'select' which ones to compile. The
purpose of this revert is to enable the next change to make use of
CONFIG_HASH instead of adding to Kconfig.

This reverts commit 87316da05f2fd49d3709275e64ef0c5980366ade.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Acked-by: Masahisa Kojima <masahisa.kojima@linaro.org>

# 1621d3c4 10-May-2021 Bin Meng <bmeng.cn@gmail.com>

lib: kconfig: Limit BINMAN_FDT for OF_SEPARATE or OF_EMBED

Generally speaking BINMAN_FDT makes sense for OF_SEPARATE or OF_EMBED.
For the other OF_CONTROL methods, it's quite possible binman node is
not available as binman is invoked during the build phase instead of
runtime. Let's only turn it on for OF_SEPARATE or OF_EMBED by default.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 87316da0 13-May-2021 Masahisa Kojima <masahisa.kojima@linaro.org>

lib: introduce HASH_CALCULATE option

Build error occurs when CONFIG_EFI_SECURE_BOOT or
CONFIG_EFI_CAPSULE_AUTHENTICATE is enabled,
because hash-checksum.c is not compiled.

Since hash_calculate() implemented in hash-checksum.c can be
commonly used aside from FIT image signature verification,
this commit itroduces HASH_CALCULATE option to decide
if hash-checksum.c shall be compiled.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# e2ae483c 13-May-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

hash: Kconfig option for SHA512 hardware acceleration

Commit a479f103dc1c ("hash: Allow for SHA512 hardware implementations")
defined function definitions for hardware accelerated SHA384 and SHA512.
If CONFIG_SHA_HW_ACCEL=y, these functions are used.

We already have boards using CONFIG_SHA_HW_ACCEL=y but none implements the
new functions hw_sha384() and hw_sha512().

For implementing the EFI TCG2 protocol we need SHA384 and SHA512. The
missing hardware acceleration functions lead to build errors on boards like
peach-pi_defconfig.

Introduce a new Kconfig symbol CONFIG_SHA512_HW_ACCEL to control if the
functions hw_sha384() and hw_sha512() shall be used to implement the SHA384
and SHA512 algorithms.

Fixes: a479f103dc1c ("hash: Allow for SHA512 hardware implementations")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

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

# 6d66502b 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: Add 2 config to define the max number of regions

Add 2 configs CONFIG_LMB_MEMORY_REGIONS and CONFIG_LMB_RESERVED_REGIONS
to change independently the max number of the regions in lmb
library.

When CONFIG_LMB_USE_MAX_REGIONS=y, move the lmb property arrays to
struct lmb and manage the array size with the element 'max' of struct
lmb_region; their are still allocated in stack.

When CONFIG_LMB_USE_MAX_REGIONS=n, keep the current location in
struct lmb_region to allow compiler optimization.

Increase CONFIG_LMB_RESERVED_REGIONS is useful to avoid lmb errors in
bootm when the number of reserved regions (not adjacent) is reached:
+ 1 region for relocated U-Boot
+ 1 region for initrd
+ 1 region for relocated linux device tree
+ reserved memory regions present in Linux device tree.

The current limit of 8 regions is reached with only 5 reserved regions
in DT.

see Linux kernel commit bf23c51f1f49 ("memblock: Move memblock arrays
to static storage in memblock.c and make their size a variable")

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# 4fa0150d 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: move MAX_LMB_REGIONS value in Kconfig

Move MAX_LMB_REGIONS value in Kconfig, the max number of the regions
in lmb library.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# 77b8cfef 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: move CONFIG_LMB in Kconfig

Migrate CONFIG_LMB in Kconfig.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# a479f103 16-Feb-2021 Joel Stanley <joel@jms.id.au>

hash: Allow for SHA512 hardware implementations

Similar to support for SHA1 and SHA256, allow the use of hardware hashing
engine by enabling the algorithm and setting CONFIG_SHA_HW_ACCEL /
CONFIG_SHA_PROG_HW_ACCEL.

Signed-off-by: Joel Stanley <joel@jms.id.au>

# f2c1442e 14-Mar-2021 Simon Glass <sjg@chromium.org>

bloblist: Make BLOBLIST_TABLES depend on BLOBLIST

Add an extra condition here since we cannot put x86 tables in a bloblist
when bloblists are not supported.

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

# e0103158 25-Feb-2021 Bin Meng <bmeng.cn@gmail.com>

lib: kconfig: Mention CONFIG_ADDR_MAP limitation in the help

Mention that CONFIG_ADDR_MAP only works in the post-relocation phase.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>

# 56e7257c 03-Feb-2021 Bin Meng <bmeng.cn@gmail.com>

lib: Fix BINMAN_FDT dependency

lib/binman.c references the following 3 ofnode APIs:
ofnode_first_subnode(), ofnode_path() and ofnode_read_bool().

These APIs get built only when DM is on. Fix the dependency then.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 59e4e391 18-Jan-2021 Tom Rini <trini@konsulko.com>

Merge https://gitlab.denx.de/u-boot/custodians/u-boot-riscv

- Update qemu-riscv.rst build instructions.
- Add support for SPI on Kendryte K210.
- Add Microchip PolarFire SoC Icicle Kit support.
- Add support for an early timer.
- Select TIMER_EARLY to avoid infinite recursion for Trace.


# a80f8513 17-Jan-2021 Pragnesh Patel <pragnesh.patel@sifive.com>

trace: select TIMER_EARLY to avoid infinite recursion

When tracing functions is enabled this adds calls to
__cyg_profile_func_enter() and __cyg_profile_func_exit() to the traced
functions.

__cyg_profile_func_enter() and __cyg_profile_func_exit() invoke
timer_get_us() to record the entry and exit time.

initr_dm() will make gd->dm_root = NULL and gd->timer = NULL, so
timer_get_us() -> get_ticks() -> dm_timer_init() will lead to an
indefinite recursion.

So select TIMER_EARLY when tracing got enabled.

Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Rick Chen <rick@andestech.com>

# 6205bbb1 04-Jan-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lib: cosmetic update of CONFIG_LIB_ELF description

Change 2 typo error in CONFIG_LIB_ELF description:
- Supoort => Support
- fir => for

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c589132a 02-Dec-2020 Aswath Govindraju <a-govindraju@ti.com>

fdt: Use phandle to distinguish DT nodes with same name

While assigning the sequence number to subsystem instances by reading the
aliases property, only DT nodes names are compared and not the complete
path. This causes a problem when there are two DT nodes with same name but
have different paths.

In arch/arm/dts/k3-am65-main.dtsi there are two USB controllers with the
same device tree node name but different path. When aliases are defined for
these USB controllers then fdtdec_get_alias_seq() fails to pick the correct
instance for a given index.

fdt_path_offset() function is slow and this would effect the U-Boot
startup. To avert the time penalty on all boards, apply this extra check
only when required by using a config option.

Fix it by comparing the phandles of DT nodes after the node names match,
under a config option.

Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Fix whitespace error in Kconfig:
Signed-off-by: Simon Glass <sjg@chromium.org>

# 28cef9ca 19-Nov-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

fs: fat: create correct short names

The current function set_name() used to create short names has the
following deficiencies resolved by this patch:

* Long names (e.g. FOO.TXT) are stored even if a short name is enough.
* Short names with spaces are created, e.g. "A ~1.TXT".
* Short names with illegal characters are created, e.g. "FOO++BAR".
* Debug output does not not consider that the short file name has no
concluding '\0'.

The solution for the following bug is split of into a separate patch:

* Short file names must be unique.

This patch only provides the loop over possible short file names.

Fixes: c30a15e590c ("FAT: Add FAT write feature")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# e4f8e543 05-Nov-2020 Simon Glass <sjg@chromium.org>

smbios: Drop the unused Kconfig options

Now that we can use devicetree to specify this information, drop the old
CONFIG options.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 44c74bdd 05-Nov-2020 Simon Glass <sjg@chromium.org>

sysinfo: Provide a default driver to set SMBIOS values

Some boards want to specify the manufacturer or product name but do not
need to have their own sysinfo driver.

Add a default driver which provides a way to specify this SMBIOS
information in the devicetree, without needing any board-specific
functionality.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d2cb7a22 04-Nov-2020 Simon Glass <sjg@chromium.org>

x86: Allow putting some tables in the bloblist

At present all tables are placed starting at address f0000 in memory, and
can be up to 64KB in size. If the tables are very large, this may not
provide enough space.

Also if the tables point to other tables (such as console log or a ramoops
area) then we must allocate other memory anyway.

The bloblist is a nice place to put these tables since it is contiguous,
which makes it easy to reserve this memory for linux using the 820 tables.

Add an option to put some of the tables in the bloblist. For SMBIOS and
ACPI, create suitable pointers from the f0000 region to the new location
of the tables.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
[bmeng: squashed in http://patchwork.ozlabs.org/project/uboot/patch/
20201105062407.1.I8091ad931cbbb5e3b6f6ababdf3f8d5db0d17bb9@changeid/]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# 415eab06 03-Nov-2020 Christian Gmeiner <christian.gmeiner@gmail.com>

smbios: add parsing API

Add a very simple API to be able to access SMBIOS strings
like vendor, model and bios version.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 72eda507 27-Oct-2020 Sean Anderson <seanga2@gmail.com>

lib: Add getopt

Some commands can get very unweildy if they have too many positional
arguments. Adding options makes them easier to read, remember, and
understand.

This implementation of getopt has been taken from barebox, which has had
option support for quite a while. I have made a few modifications to their
version, such as the removal of opterr in favor of a separate getopt_silent
function. In addition, I have moved all global variables into struct
getopt_context.

The getopt from barebox also re-orders the arguments passed to it so that
non-options are placed last. This allows users to specify options anywhere.
For example, `ls -l foo/ -R` would be re-ordered to `ls -l -R foo/` as
getopt parsed the options. However, this feature conflicts with the const
argv in cmd_tbl->cmd. This was originally added in 54841ab50c ("Make sure
that argv[] argument pointers are not modified."). The reason stated in
that commit is that hush requires argv to stay unmodified. Has this
situation changed? Barebox also uses hush, and does not have this problem.
Perhaps we could use their fix?

I have assigned maintenance of getopt to Simon Glass, as it is currently
only used by the log command. I would also be fine maintaining it.

Signed-off-by: Sean Anderson <seanga2@gmail.com>

# 26637e2e 12-Sep-2020 Simon Glass <sjg@chromium.org>

lib: Allow hexdump to be used in SPL

It is sometimes useful to output hex dumps in SPL. Add a config option to
allow this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# e87dfb05 05-Aug-2020 Andrii Anisov <andrii_anisov@epam.com>

lib: sscanf: add sscanf implementation

Port sscanf implementation from mini-os and introduce new
Kconfig option to enable it: CONFIG_SSCANF. Disable by default.

Signed-off-by: Andrii Anisov <andrii_anisov@epam.com>
Signed-off-by: Anastasiia Lukianenko <anastasiia_lukianenko@epam.com>
Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>

# 81014f73 30-Jul-2020 Joao Marcos Costa <joaomarcos.costa@bootlin.com>

include/u-boot, lib/zlib: add sources for zlib decompression

Add zlib (v1.2.11) uncompr() function to U-Boot. SquashFS depends on
this function to decompress data from a raw disk image. The actual
support for zlib into SquashFS sources will be added in a follow-up
commit.

Signed-off-by: Joao Marcos Costa <joaomarcos.costa@bootlin.com>

# 69be8fd1 03-Jun-2020 Marek Szyprowski <m.szyprowski@samsung.com>

powerpc: move ADDR_MAP to Kconfig

Move ADDR_MAP related config options from include/configs/*.h to the
proper place in lib/Kconfig. This has been done using
./tools/moveconfig.py and manual inspection of the generated changes.
This is a preparation to use ADDR_MAP helper on ARM 32bit Raspberry Pi4
board for mapping the PCIe XHCI MMIO, which is above the 4GiB identity
mapping limit.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# d16b38f4 15-Apr-2020 Reuben Dowle <reubendowle0@gmail.com>

Add support for SHA384 and SHA512

The current recommendation for best security practice from the US government
is to use SHA384 for TOP SECRET [1].

This patch adds support for SHA384 and SHA512 in the hash command, and also
allows FIT images to be hashed with these algorithms, and signed with
sha384,rsaXXXX and sha512,rsaXXXX

The SHA implementation is adapted from the linux kernel implementation.

[1] Commercial National Security Algorithm Suite
http://www.iad.gov/iad/programs/iad-initiatives/cnsa-suite.cfm

Signed-off-by: Reuben Dowle <reuben.dowle@4rf.com>

# 43e442a5 26-May-2020 Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

kconfig: fix some typos

Signed-off-by: Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

# eff5a547 22-May-2020 Michael Walle <michael@walle.cc>

cmd: zip: automatically pull in gzip()

Move the CONFIG_GZIP_COMPRESSED from a config.h macro to a Kconfig menu
item. It is not selectable by a user because there is no reason to do
so. Instead it will be automatically selected by the stuff which uses
gzip(), like the zip command.

Remove it from the config_whitelist.txt. Also remove
CONFIG_GZIP_COMPRESS_DEF_SZ as this was never used on any board. The
default seems to be sane, otherwise it should be added as a Kconfig
option.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8239be61 06-May-2020 Simon Glass <sjg@chromium.org>

lib: Allow MD5 to be enabled in SPL

At present the MD5 option cannot be enabled by board configs since it has
no Kconfig name. It is generally enabled, so long as FIT support is
present. But not all boards use FIT, particularly in SPL

Fix this and add an option for SPL as well. This allows board code to call
md5() even if FIT support is not enabled.

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

# 04cb3994 21-Apr-2020 Weijie Gao <weijie.gao@mediatek.com>

lib: enable lzma decompression support for SPL build

This patch enables LZMA decompression support for SPL build

Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>

# 2a2119e1 05-Mar-2020 Atish Patra <atishp@atishpatra.org>

lib: kconfig: Add option to set BZIP2 compression method

There is no way to select BZIP2 compression method.
Add it under library/compression config where all other
compression related configs are present.

Signed-off-by: Atish Patra <atish.patra@wdc.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 805b3cac 12-Feb-2020 Keerthy <j-keerthy@ti.com>

lib: elf: Move the generic elf loading/validating functions to lib

Move the generic elf loading/validating functions to lib/
so that they can be re-used and accessed by code existing
outside cmd.

While at it remove the duplicate static version of load_elf_image_phdr
under arch/arm/mach-imx/imx_bootaux.c.

Signed-off-by: Keerthy <j-keerthy@ti.com>
Suggested-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>

# 1611235b 19-Jan-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: Kconfig dependencies for pseudo-random library

drivers/rng/sandbox_rng.c requires rand() to be defined but configuration
option CONFIG_CONFIG_LIB_RAND selected in drivers/rng/Kconfig does not
exist.

test/lib/test_aes.c requires rand() to be defined.

Fix the selection criteria for choice "Pseudo-random library support type".

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 3c10dc95 06-Dec-2019 Simon Glass <sjg@chromium.org>

binman: Add a library to access binman entries

SPL and TPL can access information about binman entries using link-time
symbols but this is not available in U-Boot proper. Of course it could be
made available, but the intention is to just read the device tree.

Add support for this, so that U-Boot can locate entries.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# b4adf627 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: crypto: add x509 parser

Imported from linux kernel v5.3:
x509.asn1 without changes
x509_akid.asn1 without changes
x509_parser.h without changes
x509_cert_parser.c with changes marked as __UBOOT__
x509_public_key.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# a9b45e6e 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add oid registry utility

Imported from linux kernel v5.3:
build_OID_registry without changes
oid_registry.h without changes
oid_registry.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# ab8a0e06 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add asn1 decoder

Imported from linux kernel v5.3:
lib/asn1_decoder.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 2b12196d 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

cmd: add asn1_compiler

Imported from linux kernel v5.3:
asn1.h without changes
asn1_ber_bytecode.h without changes
asn1_decoder.h without changes
asn1_compiler.c without changes

This host command will be used to create a ASN1 parser, for example,
for pkcs7 messages or x509 certificates. More specifically, it will
generate *byte code* which will be interpreted by asn1 decoder library.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 05429b6c 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

rtc: move date.c from drivers/rtc/ to lib/

In the next commit, rtc_mktime(), for compatibility with linux, will be
implemented using rtc_mktime(), which is no longer drivers/rtc specific.
So move this file under lib/.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 37ef1774 10-Nov-2019 Thomas Hebb <tommyhebb@gmail.com>

Kconfig: disambiguate config names for tiny printf

27084c03d36a ("spl: Allow tiny printf() to be controlled in SPL and
TPL") split this option in two for TPL and SPL, but didn't change the
Kconfig names, making them hard to set quickly.

Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>

# 0d76afc0 27-Oct-2019 Simon Glass <sjg@chromium.org>

fdt: Add Kconfig options to control code size

For better or worse libfdt recent grew a lot of code that checks the
validity of the device tree in great detail. When using unsigned or
unverified data this makes things safer, but it does add to code size.

Add some controls to select the trade-off between safety and code size.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 27084c03 25-Sep-2019 Simon Glass <sjg@chromium.org>

spl: Allow tiny printf() to be controlled in SPL and TPL

At present there is only one control for this and it is used for both SPL
and TPL. But SPL might have a lot more space than TPL so the extra cost of
a full printf() might be acceptable.

Split the option into two, providing separate SPL and TPL controls. The
TPL setting defaults to the same as SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2a51e16b 07-Jun-2019 Tom Rini <trini@konsulko.com>

configs: Make USE_TINY_PRINTF depend on SPL||TPL and be default

The USE_TINY_PRINTF symbol only changes things within SPL and TPL
builds, so make it depend on that support. Next, make it default as
within these cases we should rarely have need of more advanced print
formats outside of the debug context.

To do this, in a few cases we need to correct our Kconfig dependencies
as we had cases of non-SPL targets select'ing this symbol. Finally, in
the case of a few boards we really do need the full printf
functionality.

Signed-off-by: Tom Rini <trini@konsulko.com>

# da0fb5fd 02-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: make call depth limit customizable

Up to now we had hard coded values for the call depth up to which trace
records are created: 200 for early tracing, 15 thereafter. UEFI
applications reach a call depth of 80 or above.

Provide customizing settings for the call trace depth limit and the early
call trace depth limit. Use the old values as defaults.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8509f22a 29-Apr-2019 Marek Behún <kabel@kernel.org>

lib: add Zstandard decompression support

Add the zstd library from Linux kernel (only decompression support).
There are minimal changes to build with U-Boot, otherwise the files are
identical to Linux commit dc35da16 from March 2018, the files had not
been touched since in kernel. Also SPDX lincese tags were added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 83a486b6 29-Apr-2019 Marek Behún <kabel@kernel.org>

lib: Add xxhash support

This adds the xxhash support from Linux. Files are almost identical to
those added to Linux in commit 5d240522 ("lib: Add xxhash module") (they
haven't been touched since in Linux). The only difference is to add some
includes to be compatible with U-Boot. Also SPDX lincese tags were
added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 5132361a 29-Apr-2019 Heiko Schocher <hs@denx.de>

lib: Kconfig: fix help text for GZIP

commit 95f4bbd581cf ("lib: fdt: Allow LZO and GZIP DT compression in U-Boot")

introduced Kconfig option for gzip in U-Boot, but help text
says gzip for SPL, which is wrong. Fix this.

Signed-off-by: Heiko Schocher <hs@denx.de>
Acked-by: Marek Vasut <marex@denx.de>

# 1c6eb075 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE_BUFFER_SIZE et al to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE_BUFFER_SIZE
CONFIG_TRACE_EARLY_SIZE
CONFIG_TRACE_EARLY
CONFIG_TRACE_EARLY_ADDR

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

# a24a78d7 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE

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

# 54969b40 21-Mar-2019 Thierry Reding <treding@nvidia.com>

fdtdec: Add Kconfig symbol for tests

Runtime tests are provided as a test_fdtdec command implementation. Add
a Kconfig symbol that allows this command to be built so that the tests
can be used.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 95f4bbd5 08-Mar-2019 Marek Vasut <marex@denx.de>

lib: fdt: Allow LZO and GZIP DT compression in U-Boot

Add required Kconfig symbols, Makefile bits and macro fixes in a
few places to support LZO and DT compression in U-Boot. This can
save a lot of space with multi-DTB fitImages.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>

# 6e705114 13-Jan-2019 Chris Packham <judge.packham@gmail.com>

lib: Kconfig: spelling fixes

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 048c6e89 06-Nov-2018 Simon Glass <sjg@chromium.org>

spl: lz4: Allow use of lz4 compression in SPL

In some cases U-Boot is compressed and it is useful to be able to
decompress it in SPL. Add a Kconfig and Makefile change to allow this.
Note that this does not actually implement decompression.

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

# 2895c4b7 15-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

kconfig: Introduce HAVE_ARCH_IOMAP

Introduce a new Kconfig option for architecture codes to control
whether it provides io{read,write}{8,16,32} I/O accessor functions.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5592a633 01-Oct-2018 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt in TPL

In some cases (e.g. sandbox with verified boot) it is useful to support
libfdt in TPL. Update the Kconfig to handle this.

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

# 6307896c 01-Oct-2018 Simon Glass <sjg@chromium.org>

tpm: Add support for SPL and TPL

At present the tpm can only be used in U-Boot proper. Updated it to work
in SPL and TPL also.

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

# ab948cd2 19-Jul-2018 Masahiro Yamada <masahiroy@kernel.org>

fdt_support: make FDT_FIXUP_PARTITIONS depend on CMD_MTDPARTS

fdt_fixup_mtdparts() calls mtdparts_init() and device_find(),
which are defined in cmd/mtdparts.c

The combination of FDT_FIXUP_PARTITIONS=y and CMD_MTDPARTS=n
emits the following link error:

common/fdt_support.c:903: undefined reference to `mtdparts_init'
common/fdt_support.c:914: undefined reference to `device_find'

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 3330584d 03-Jun-2018 Igor Opaniuk <igor.opaniuk@gmail.com>

avb2.0: integrate avb 2.0 into the build system

Integrate libavb into the build system. Introduce CONFIG_LIBAVB
build option.

Signed-off-by: Igor Opaniuk <igor.opaniuk@linaro.org>

# f8c987f8 05-Jun-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

lib: Add hexdump

Often during debugging session it's very interesting to see
what data we were dealing with. For example what we write or read
to/from memory or peripherals.

This change introduces functions that allow to dump binary
data with one simple function invocation like:
------------------->8----------------
print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, buf, len);
------------------->8----------------

which gives us the following:
------------------->8----------------
00000000: f2 b7 c9 88 62 61 75 64 72 61 74 65 3d 31 31 35 ....baudrate=115
00000010: 32 30 30 00 62 6f 6f 74 61 72 67 73 3d 63 6f 6e 200.bootargs=con
00000020: 73 6f 6c 65 3d 74 74 79 53 33 2c 31 31 35 32 30 sole=ttyS3,11520
00000030: 30 6e 38 00 62 6f 6f 74 64 65 6c 61 79 3d 33 00 0n8.bootdelay=3.
00000040: 62 6f 6f 74 66 69 6c 65 3d 75 49 6d 61 67 65 00 bootfile=uImage.
00000050: 66 64 74 63 6f 6e 74 72 6f 6c 61 64 64 72 3d 39 fdtcontroladdr=9
00000060: 66 66 62 31 62 61 30 00 6c 6f 61 64 61 64 64 72 ffb1ba0.loadaddr
00000070: 3d 30 78 38 32 30 30 30 30 30 30 00 73 74 64 65 =0x82000000.stde
00000080: 72 72 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 rr=serial0@e0022
00000090: 30 30 30 00 73 74 64 69 6e 3d 73 65 72 69 61 6c 000.stdin=serial
000000a0: 30 40 65 30 30 32 32 30 30 30 00 73 74 64 6f 75 0@e0022000.stdou
000000b0: 74 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 30 t=serial0@e00220
000000c0: 30 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00..............
...
------------------->8----------------

Source of hexdump.c was copied from Linux kernel v4.7-rc2.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Mario Six <mario.six@gdsys.cc>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Stefan Roese <sr@denx.de>

# c232d14d 29-May-2018 Alex Kiernan <alex.kiernan@gmail.com>

mmc: Separate "mmc swrite" from fastboot

Introduce CONFIG_IMAGE_SPARSE and CONFIG_CMD_MMC_SWRITE so the "mmc
swrite" command is separated from the fastboot code.

Move image-sparse from common to lib so it's clear it's library code.

Rename CONFIG_FASTBOOT_FLASH_FILLBUF_SIZE to CONFIG_IMAGE_SPARSE_FILLBUF_SIZE
and migrate it to Kconfig.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Acked-by: Jassi Brar <jaswinder.singh@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6417572e 08-May-2018 Tom Rini <trini@konsulko.com>

lib/Kconfig: Mark OF_LIBFDT_OVERLAY as depending on OF_LIBFDT

The overlay code is only useful when OF_LIBFDT is set, so mark it as
depending on that first.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 58a46f88 25-Apr-2018 Praneeth Bajjuri <praneeth@ti.com>

configs: TI: Enable FIT Library overlay support

Enable the FDT library overlay support for all TI SOC family.

Without this option, when Loading fdt from FIT image, the
following warning is seen.

"config with overlays but CONFIG_OF_LIBFDT_OVERLAY not set".

Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
Suggested-by: Andrew F.Davis <afd@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>

# 14ad44ab 18-Apr-2018 Alex Kiernan <alex.kiernan@gmail.com>

spl: Split sprintf, strto* from SPL serial in Kconfig

When SPL serial is disabled, callers who need sprintf or strtoul fail
because their inclusion is guarded by CONFIG_SPL_SERIAL_SUPPORT/
CONFIG_TPL_SERIAL_SUPPORT.

Split printf, sprintf and strto into their own entries and then select
all of them if SERIAL_SUPPORT is enabled to match the current behaviour.

Include panic.o unconditionally as it can be called from anywhere which
uses BUG_ON().

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>

# e294ba06 04-Apr-2018 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-sunxi

Signed-off-by: Tom Rini <trini@konsulko.com>


# d14db11d 03-Apr-2018 Andre Przywara <andre.przywara@arm.com>

sunxi: revert disabling of features

In January some commits were introduced to mitigate the U-Boot image
size issues we encountered on sunxi builds.
Now with the MMC environment removed we can bring them back, as we
practically don't have a size limit anymore.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 32ce6179 13-Mar-2018 Bryan O'Donoghue <bryan.odonoghue@linaro.org>

optee: Add lib entries for sharing OPTEE code across ports

This patch adds code to lib to enable sharing of useful OPTEE code between
board-ports and architectures. The code on lib/optee/optee.c comes from the
TI omap2 port. Eventually the OMAP2 code will be patched to include the
shared code. The intention here is to add more useful OPTEE specific code
as more functionality gets added.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Cc: Harinarayan Bhatta <harinarayan@ti.com>
Cc: Andrew F. Davis <afd@ti.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Kever Yang <kever.yang@rock-chips.com>
Cc: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Cc: Peng Fan <peng.fan@nxp.com>
Tested-by: Peng Fan <peng.fan@nxp.com>

# 36c1877c 06-Feb-2018 Faiz Abbas <faiz_abbas@ti.com>

lib: Kconfig: Move DYNAMIC_CRC_TABLE to Kconfig

Add CONFIG prefix to DYNAMIC_CRC_TABLE and implement it in
Kconfig.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>

# a451bc27 05-Feb-2018 Adam Ford <aford173@gmail.com>

Convert LIB_UUID to Kconfig

config_fallback.h has some logic that checks a variety of options
and selects LIB_UUID if it hasn't already been selected. This
will all LIB_UUID in Kconfig and select this option for the list
of options to allow us to remove the logic from fallbacks

Signed-off-by: Adam Ford <aford173@gmail.com>

# a5a37567 06-Feb-2018 Adam Ford <aford173@gmail.com>

Convert CONFIG LIB_HW_RAND to Kconfig

config_fallbacks.h had some logic to automatically select
LIB_RAND if RANDOM_UUID or CMD_UUID were set if LIB_HW_RAND wasn't
already selected. By migrating LIB_HW_RAND to Kconfig, we can
remove this check from config_fallbacks.h and put it into Kconfig

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
[trini: Turn into a choice, add NET_RANDOM_ETHADDR]
Signed-off-by: Tom Rini <trini@konsulko.com>

# acd4d334 16-Jan-2018 Maxime Ripard <maxime.ripard@free-electrons.com>

net: regex: Disable by default on sunXi

The sunXi arm64 build has overflown, leading to the main U-boot binary
overwriting the environment when flashing the new image, or even worse,
overwriting itself when we're calling saveenv.

Disable this option that is not critical until we can adress the issue
properly.

Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 7e3caa81 03-Dec-2017 Masahiro Yamada <masahiroy@kernel.org>

Move CONFIG_PANIC_HANG to Kconfig

Freescale (NXP) boards have lots of defconfig files per board.
I used "imply PANIC_HANG" for them.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# da5337a6 08-Nov-2017 Nandor Han <nandor.han@ge.com>

rtc: add support for s35392a

Add support for S35392A RTC. The driver supports both U-Boot driver
models.

Signed-off-by: Nandor Han <nandor.han@ge.com>
Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
Cc: Heiko Schocher <hs@denx.de>

# f52bdf4b 14-Sep-2017 Jean-Jacques Hiblot <jjhiblot@ti.com>

lib: allow building lzo for the SPL

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 85d8bf57 03-Sep-2017 Marek Behún <kabel@kernel.org>

lib: Add CRC32-C

This is needed for BTRFS.

Signed-off-by: Marek Behun <marek.behun@nic.cz>

create mode 100644 lib/crc32c.c

# 7264f292 15-Aug-2017 York Sun <york.sun@nxp.com>

spl: fit: Eanble GZIP support for image decompression

Add Kconfig option SPL_GZIP and SPL_ZLIB to enable gunzip support for
SPL boot, eg. falcon boot compressed kernel image.

Signed-off-by: York Sun <york.sun@nxp.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6ef2f901 11-Aug-2017 Adam Ford <aford173@gmail.com>

Convert CONFIG_BCH to Kconfig

This converts the following to Kconfig:
CONFIG_BCH

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1a7ba1d 18-Aug-2017 Anatolij Gustschin <agust@denx.de>

Fix 'notes' typos

s/notes/nodes

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 96b9082c 03-Aug-2017 Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

rockchip: rk3188: rock: adjust for SPL/TPL split

With the changes to split SPL/TPL for the RK3368, I apparently missed
some needed adjustments to the RK3188 Kconfig and rock_defconfig.

This fixes build-issues for the rock board after applying the RK3368
enablement (and SPL/TPL) set that resulted from TPL_SERIAL_SUPPORT,
TPL_ROCKCHIP_BACK_TO_BROM and TPL_TINY_MEMSET being separate symbols
now.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d56b4b19 22-Jul-2017 Tom Rini <trini@konsulko.com>

configs: Migrate RBTREE, LZO, CMD_MTDPARTS, CMD_UBI and CMD_UBIFS

The above CONFIG options are in Kconfig, and now have correct depends and
inter-dependencies. Migrate these to configs/ from include/configs/. In the
case of CMD_UBIFS also change it to be a default y if CMD_UBI.

Signed-off-by: Tom Rini <trini@konsulko.com>

# aed998aa 17-May-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_LZMA to Kconfig

This converts the following to Kconfig:
CONFIG_LZMA

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

# b1a873df 26-Apr-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_CMD_AES et al to Kconfig

This converts the following to Kconfig:
CONFIG_CMD_AES
CONFIG_AES

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Add select AES to CMD_AES]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 173aafbf 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

cmd: Expose a Kconfig option to enable UBIFS commands

Create a new Kconfig entry to allow CMD_UBIFS selection from Kconfig and
add an hidden LZO option that can be selected by CMD_UBIFS.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>

# aa049152 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

mtd: ubi: Select RBTREE option from MTD_UBI Kconfig entry

Expose the RBTREE feature through Kconfig and select this option from the
MTD_UBI option.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>
[Rebased on master]
Signed-off-by: Jagan Teki <jagan@openedev.com>

# ab4458bd 02-Apr-2017 Simon Glass <sjg@chromium.org>

string: Provide a slimmed-down memset()

Most of the time the optimised memset() is what we want. For extreme
situations such as TPL it may be too large. For example on the 'rock'
board, using a simple loop saves a useful 48 bytes. With gcc 4.9 and
the rodata bug, this patch is enough to reduce the TPL image below the
limit.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>

# bea79d7d 14-Mar-2017 Andre Przywara <andre.przywara@arm.com>

Kconfig: introduce md5sum command selection

So far CONFIG_MD5SUM would need to be set by a board's include file.
Since the command is really generic, move it over to Kconfig to allow
it to be defined by either a board's defconfig, menuconfig or some
config snippet merged via mergeconfig.sh.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e663b350 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

smbios: Expose in efi_loader as table

We can pass SMBIOS easily as EFI configuration table to an EFI payload. This
patch adds enablement for that case.

While at it, we also enable SMBIOS generation for ARM systems, since they support
EFI_LOADER.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4b6dddc2 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

x86: Move smbios generation into arch independent directory

We will need the SMBIOS generation function on ARM as well going forward,
so let's move it into a non arch specific location.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# ebf7fff2 05-Oct-2016 Heiko Schocher <hs@denx.de>

spl: move FDT_FIXUP_PARTITIONS to Kconfig

Move FDT_FIXUP_PARTITIONS to Kconfig and cleanup existing
uses.

Signed-off-by: Heiko Schocher <hs@denx.de>

# ddf67f71 05-Jul-2016 Maxime Ripard <maxime.ripard@free-electrons.com>

libfdt: Add overlay application function

The device tree overlays are a good way to deal with user-modifyable
boards or boards with some kind of an expansion mechanism where we can
easily plug new board in (like the BBB, the Raspberry Pi or the CHIP).

Add a new function to merge overlays with a base device tree.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>

# 91b86e21 26-May-2016 Marek Vasut <marex@denx.de>

lib: Enable private libgcc by default

This patch decouples U-Boot binary from the toolchain on systems where
private libgcc is available. Instead of pulling in functions provided
by the libgcc from the toolchain, U-Boot will use it's own set of libgcc
functions. These functions are usually imported from Linux kernel, which
also uses it's own libgcc functions instead of the ones provided by the
toolchain.

This patch solves a rather common problem. The toolchain can usually
generate code for many variants of target architecture and often even
different endianness. The libgcc on the other hand is usually compiled
for one particular configuration and the functions provided by it may
or may not be suited for use in U-Boot. This can manifest in two ways,
either the U-Boot fails to compile altogether and linker will complain
or, in the much worse case, the resulting U-Boot will build, but will
misbehave in very subtle and hard to debug ways.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 67976306 30-Mar-2016 Masahiro Yamada <masahiroy@kernel.org>

cosmetic: Fix typos "privide"

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# ed980b8c 03-Mar-2016 Alexander Graf <agraf@csgraf.de>

efi_loader: hook up in build environment

Now that we have all the bits and pieces ready for EFI payload loading
support, hook them up in Makefiles and KConfigs so that we can build.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
[trini: Enable only when we of OF_LIBFDT, disable on kwb and colibri_pxa270]
Signed-off-by: Tom Rini <trini@konsulko.com>

# aa34fbc0 22-Feb-2016 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt to be used in SPL

Add an option to enable libfdt in SPL. This can be useful when decoding
FIT files in SPL.

We need to make sure this option is not enabled in SPL by this change.
Also this option needs to be enabled in host builds. Si add a new
IMAGE_USE_LIBFDT #define which can be used in files that are built on the
host but must also build for U-Boot and SPL.

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

# 69e173eb 22-Feb-2016 Simon Glass <sjg@chromium.org>

Move CONFIG_OF_LIBFDT to Kconfig

Move this option to Kconfig and tidy up existing boards.

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

# a187559e 05-Feb-2016 Bin Meng <bmeng.cn@gmail.com>

Use correct spelling of "U-Boot"

Correct spelling of "U-Boot" shall be used in all written text
(documentation, comments in source files etc.).

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Minkyu Kang <mk7.kang@samsung.com>

# 947c626d 14-Jan-2016 Tom Rini <trini@konsulko.com>

vsprintf.c: Always enable CONFIG_SYS_VSNPRINTF

Enabling this function always removes some class of string saftey issues.
The size change here in general is about 400 bytes and this seems a reasonable
trade-off.

Cc: Peng Fan <peng.fan@nxp.com>
Cc: Peter Robinson <pbrobinson@gmail.com>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Adrian Alonso <aalonso@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 7d9cde10 22-Nov-2015 Stefan Roese <sr@denx.de>

lib/tiny-printf.c: Add tiny printf function for space limited environments

This patch adds a small printf() version that supports all basic formats.
Its intented to be used in U-Boot SPL versions on platforms with very
limited internal RAM sizes.

To enable it, just define CONFIG_USE_TINY_PRINTF in your defconfig. This
will result in the SPL using this tiny function and the main U-Boot
still using the full-blown printf() function.

This code was copied from:
http://www.sparetimelabs.com/printfrevisited
With mostly only coding style related changes so that its checkpatch
clean.

The size reduction is about 2.5KiB. Here a comparison for the db-mv784mp-gp
(Marvell AXP) SPL:

Without this patch:
58963 18536 1928 79427 13643 ./spl/u-boot-spl

With this patch:
56542 18536 1956 77034 12cea ./spl/u-boot-spl

Note:
To make it possible to compile tiny-printf.c instead of vsprintf.c when
CONFIG_USE_TINY_PRINTF is defined, the functions printf() and vprintf() are
moved from common/console.c into vsprintf.c in this patch.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>

# 2419cd16 03-Oct-2015 Simon Glass <sjg@chromium.org>

dm: tpm: Drop CONFIG_DM_TPM

Now that all TPM drivers use driver model, we can drop the special driver
model CONFIG option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>

# 027b728d 06-Oct-2015 Julius Werner <jwerner@chromium.org>

Add support for LZ4 decompression algorithm

This patch adds support for LZ4-compressed FIT image contents. This
algorithm has a slightly worse compression ration than LZO while being
nearly twice as fast to decompress. When loading images from a fast
storage medium this usually results in a boot time win.

Sandbox-tested only since I don't have a U-Boot development system set
up right now. The code was imported unchanged from coreboot where it's
proven to work, though. I'm mostly interested in getting this recognized
by mkImage for use in a downstream project.

Signed-off-by: Julius Werner <jwerner@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# a7d660bc 22-Aug-2015 Simon Glass <sjg@chromium.org>

tpm: Add Kconfig options for TPMs

Add new Kconfig options for TPMs in preparation for moving boards to use
Kconfig for TPM configuration.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 867a6ac8 31-Jul-2015 Simon Glass <sjg@chromium.org>

efi: Add start-up library code

When running as an EFI application, U-Boot must request memory from EFI,
and provide access to the boot services U-Boot needs.

Add library code to perform these tasks. This includes efi_main() which is
the entry point from EFI. U-Boot is built as a shared library.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d1389403 23-Jun-2015 Simon Glass <sjg@chromium.org>

Add a dhrystone benchmark command

Drystone provides a convenient sanity check that the CPU is running at full
speed. Add this as a command which can be enabled as needed.

Note: I investigated using Coremark for this but there was a license
agreement and I could not work out if it was GPL-compatible.

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

# f7848d90 22-Jun-2015 Joe Hershberger <joe.hershberger@ni.com>

Allow CONFIG_REGEX to be disabled when CONFIG_NET

Instead of selecting REGEX when NET is enabled, make it the default, but
allow boards that are tiny to disable it and lose functionality on all
but the first Ethernet adapter.

cm-bf548, bf538f-ezkit, and bf533-stamp need this. None appear to have
more than one Ethernet interface.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# 3850dbe8 11-Jun-2015 Masahiro Yamada <masahiroy@kernel.org>

blackfin: fix undefined reference to srand and rand

Commit 9ba9e85f3f1c (net: Fix NET_RANDOM_ETHADDR dependencies)
accidentally dropped CONFIG_LIB_RAND defines for 14 Blackfin boards.

Prior to that commit, those boards defined CONFIG_LIB_RAND, but not
CONFIG_NET_RANDOM_ETHADDR. So, commit 9ba9e85f3f1c should not have
touched them, but in fact it ripped CONFIG_LIB_RAND off from all the
header files, which caused undefined reference to srand and rand.
CONFIG_LIB_RAND=y must be revived for such boards.

BTW, this commit indeed makes it better, but even with this fix,
three boards (bf533-stamp, bf538f-ezkit, cm-bf548) still can not
build due to region 'ram' overflowed error. This was cause by
commit 6eed3786c68c (net: Move the CMD_NET config to defconfigs)
because CMD_NET selects NET, and NET selects REGEX. Eventually,
some boards were newly enabled with CONFIG_REGEX, increasing the
memory footprint. A patch is expected to fix the build error.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 9ba9e85f 25-May-2015 Michal Simek <michal.simek@amd.com>

net: Fix NET_RANDOM_ETHADDR dependencies

NET_RANDOM_ETHADDR depends on lib/rand.c. This patch adds dependency to
Kconfig to ensure that library is also compiled.

Remove the definitions from Blackfin boards' include/configs.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 6501ff62 20-Apr-2015 Przemyslaw Marczak <p.marczak@samsung.com>

lib: Kconfig: add entry for errno_str() function

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1a60650c 21-Apr-2015 Joe Hershberger <joe.hershberger@ni.com>

kconfig: Move REGEX to Kconfig

Having this as a Kconfig allows it to be a dependent feature.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8156345d 06-Mar-2015 Simon Glass <sjg@chromium.org>

sandbox: Move CONFIG_SYS_VSNPRINTF to Kconfig

Move this over to Kconfig and tidy up.

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

# 94e3c8c4 19-Feb-2015 gaurav rana <gaurav.rana@freescale.com>

crypto/fsl - Add progressive hashing support using hardware acceleration.

Currently only normal hashing is supported using hardware acceleration.
Added support for progressive hashing using hardware.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
Signed-off-by: Gaurav Rana <gaurav.rana@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>

# d9f23c7f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

lib/rsa: Add Kconfig for devices supporting RSA Modular Exponentiation

Kconfig option added for devices which support RSA Verification.
1. RSA_SOFTWARE_EXP
Enables driver for supporting RSA Modular Exponentiation in Software
2. RSA_FREESCALE_EXP
Enables driver for supporting RSA Modular Exponentiation using Freescale specific
driver

The above drivers use RSA uclass

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
(Removed duplicate line in Kconfig comment)

Change-Id: I7663c4d5350e2bfc3dfa2696f70ef777d6ccc6f6

# c4beb22f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

FIT: Modify option FIT_SIGNATURE in Kconfig

For FIT signature based approach to work, RSA library needs to be selected.
The FIT_SIGNATURE option in Kconfig is modified to automatically select RSA.
Selecting RSA compiles the RSA library required for image verification.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 45ccec8f 23-Oct-2014 Masahiro Yamada <masahiroy@kernel.org>

kconfig: move CONFIG_USE_PRIVATE_LIBGCC to Kconfig

The private libgcc is supported only on ARM, MIPS, PowerPC, SH, x86.
Those architectures should "select" HAVE_PRIVATE_LIBGCC and
CONFIG_USE_PRIVATE_LIBGCC should depend on it.

Currently, this option is enabled on Tegra boards and x86 architecture.
Move the definition from header files to Kconfig.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Tested-by: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: Tom Warren <twarren@nvidia.com>

# 8c688bc4 23-Oct-2014 Masahiro Yamada <masahiroy@kernel.org>

kconfig: move CONFIG_SYS_HZ to lib/Kconfig

CONFIG_SYS_HZ is always defined as 1000 in config_fallbacks.h
(but some boards still have redundant definitions).

This commit moves the definition and the document in README to
Kconfig. Since lib/Kconfig can assure that CONFIG_SYS_HZ is 1000,
the sanity check in lib/time.c should be removed.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Reviewed-by: Marek Vasut <marex@denx.de>

# b0928da6 16-Sep-2014 Masahiro Yamada <masahiroy@kernel.org>

kconfig: move CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED to Kconfig

If this option is enabled, the objects under lib/ directory
are compiled with speed optimization, not size optimization.
(Currently, only used by some Blackfin boards.)

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# ed36323f 16-Sep-2014 Masahiro Yamada <masahiroy@kernel.org>

kconfig: add blank Kconfig files

This would be useful to start moving various config options.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# af62d83c 03-Aug-2023 Oleksandr Suvorov <oleksandr.suvorov@foundries.io>

spl: move SPL_CRC32 option to lib/Kconfig

All SPL hash algorithm options are collected in lib/Kconfig. Move
SPL_CRC32 there as well.

Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
Reviewed-by: Simon Glass <sjg@chromium.org>

# dfe00b34 13-Jul-2023 Manorit Chawdhry <m-chawdhry@ti.com>

lib: Kconfig: k3: Enable SHA512 for fit signature

We are using our custMpk for signing that is a 4096 bit key, 4096 bit
rsa key requires a SHA512 hashing algorithm to be enabled as per the
source. Even though it is not mandated but this is how it works and is
tested.

Enables SHA512 if fit signature is enabled on K3 platforms.

Signed-off-by: Manorit Chawdhry <m-chawdhry@ti.com>

# 0992a90d 04-May-2023 Simon Glass <sjg@chromium.org>

acpi: Create a new Kconfig for ACPI

We have several Kconfig options for ACPI, but all relate to specific
functions, such as generating tables and AML code.

Add a new option which controls including basic ACPI library code,
including the lib/acpi directory. This will allow us to add functions
which are available even if table generation is not supported.

Adjust the command to avoid a build error when ACPIGEN is not enabled.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 94c8da21 22-Mar-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: Fix LMB_MEMORY_REGIONS flag usage

Remove test on CONFIG_LMB_MEMORY_REGIONS introduced by commit
7c1860fce4e3 ("lmb: Fix lmb property's defination under struct lmb").

This code in lmb_init() is strange, because if CONFIG_LMB_USE_MAX_REGIONS
and CONFIG_LMB_MEMORY_REGIONS are not defined, the implicit #else is empty
and the required initialization is not done:
lmb->memory.max = ?
lmb->reserved.max = ?

But this setting is not possible:
- CONFIG_LMB_USE_MAX_REGIONS not defined
- CONFIG_LMB_MEMORY_REGIONS not defined
because CONFIG_LMB_MEMORY_REGIONS and CONFIG_LMB_RESERVED_REGIONS are
defined as soon as the CONFIG_LMB_USE_MAX_REGIONS is not defined.

This patch removes this impossible case #elif and I add some
explanation in lmb.h to explain why in the struct lmb {} the lmb
property is defined if CONFIG_LMB_MEMORY_REGIONS is NOT defined.

This patch also removes CONFIG_LMB_XXX dependency on CONFIG_LMB as these
defines are used in API file lmb.h and not only in library file.

Fixes: 5e2548c1d6e03 ("lmb: Fix LMB_MEMORY_REGIONS flag usage")
Reported-by: Mark Millard <marklmi@yahoo.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Acked-by: Michal Simek <michal.simek@amd.com>

# c61df340 18-Mar-2023 Marek Vasut <marek.vasut+renesas@mailbox.org>

lib: Fix SYS_TIMER_COUNTS_DOWN description in Kconfig

The SYS_TIMER_COUNTS_DOWN description contains a typo,
s@rathe@&r@ , fix it.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>

# 3b510807 22-Feb-2023 Simon Glass <sjg@chromium.org>

lib: Add an SPL config for LIB_UUID

This is selected by PARTITION_UUIDS which has a separate option for SPL.
Add an SPL option for LIB_UUID also, so that we can keep them consistent.

Also add one for PARTITION_TYPE_GUID to avoid a build error in part_efi.c
which wants to call a uuid function in SPL.

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

# 5a6bc166 22-Feb-2023 Simon Glass <sjg@chromium.org>

lib: Add VPL options for SHA1 and SHA256

Add these options so these algorithms can be used in VPL.

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

# ae625d92 22-Feb-2023 Simon Glass <sjg@chromium.org>

lib: Add a Kconfig for SPL_BZIP2

This is implicitly used in the source and seems useful, so add it.

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

# c33425c6 15-Jan-2023 Simon Glass <sjg@chromium.org>

trace: Reduce the default for TRACE_EARLY_CALL_DEPTH_LIMIT

This is a silly value at present, since U-Boot's call depth never reaches
200. Fix it.

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

# 2dc16a2c 19-Jan-2023 Sjoerd Simons <sjoerd@collabora.com>

Bump LMB_MAX_REGIONS default to 16

Since commit 06d514d77c37 ("lmb: consider EFI memory map") the EFI regions
are also pushed into the lmb if EFI_LOADER is enabled (which is by
default on most system). Which can cause the number of entries to go
over the maximum as it's default is only 8.

Specifically i ran into this case on an TI am62 which has an fdt with
4 reserved regions (in practice 3 lmb entries due to adjecent ranges).

As this is likely to impact more devices bump the default max
regions to 16 so there is a bit more slack.

Fixes: 06d514d77c ("lmb: consider EFI memory map")
Link: https://bugzilla.opensuse.org/show_bug.cgi?id=1207562
Reviewed-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Signed-off-by: Sjoerd Simons <sjoerd@collabora.com>
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
[trini: collect tags from the other equivalent patch]

# 948d3999 08-Feb-2023 Tom Rini <trini@konsulko.com>

Revert "lmb: Default to not-LMB_USE_MAX_REGIONS"

As explained by Philippe Schenker, I was misinterpreting what happened
in the case where we do not set LMB_USE_MAX_REGIONS and so had
re-introduced the problem I was attempting to more widely resolve.

This reverts commit 007ae5d108a37564905ea1588cb279f3a522cc3d.

Reported-by: Philippe Schenker <philippe.schenker@toradex.com>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 007ae5d1 25-Jan-2023 Tom Rini <trini@konsulko.com>

lmb: Default to not-LMB_USE_MAX_REGIONS

The LMB code allows for picking a hard limit on the number of regions it
can know of, or to dynamically allocate these regions. The reason for
this choice is to allow for the compiler to perform a size optimization
in the common case. This optimization however, is very small, ranging
from 196 bytes to 15 bytes saved, or in some cases, being larger. Now
that we also have more regions covered by LMB (in order to protect
various parts of our self at run time), the default of 8 is also much
easier to hit and leads to non-obvious error messages (which imply that
an area is protected, not that we're out of areas to add to the list).

Switch to the dynamic use as the default.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 53c47c59 19-Jan-2023 Tom Rini <trini@konsulko.com>

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


# 4b9b25d9 12-Jan-2023 Brandon Maier <brandon.maier@collins.com>

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

[1] https://github.com/torvalds/linux/commit/e0c1b49f5b674cca7b10549c53b3791d0bbc90a8
[2] https://github.com/facebook/zstd/blob/f302ad8811643c428c4e3498e28f53a0578020d3/lib/libzstd.mk#L31

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>

# ebc1d50a 21-Dec-2022 Simon Glass <sjg@chromium.org>

Revert "fdtdec: drop needlessly convoluted CONFIG_PHANDLE_CHECK_SEQ"

The fdt_path_offset() function is slow since it must scan the tree.
This substantial overhead now applies to all boards.

The original code may not be ideal but it is fit for purpose and is only
needed on a few boards.

Reverting this reduces time to set up driver model by about 30ms.

Before revert:

Accumulated time:
47,170 dm_r
53,237 dm_spl
572,986 dm_f

Accumulated time:
44,598 dm_r
50,347 dm_spl
549,133 dm_f

This reverts commit 26f981f295d00351b6f0c69b5317b254b2361cc0.

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

# 12619d4e 21-Dec-2022 Simon Glass <sjg@chromium.org>

trace: Don't require TIMER_EARLY

Some platforms cannot honour this and don't need trace before relocation.
Use 'imply' instead, so boards can disable this.

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

# 0c16fca9 07-Jan-2023 Simon Glass <sjg@chromium.org>

tpm: Add a proper Kconfig option for crc8 in SPL

The current approach is a bit of a hack and only works for the tpm
subsystem. Add a Kconfig so that crc8 can be enabled in SPL for other
purposes.

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

# 14f43797 19-Dec-2022 Tom Rini <trini@konsulko.com>

Merge tag 'v2023.01-rc4' into next

Prepare v2023.01-rc4

Signed-off-by: Tom Rini <trini@konsulko.com>


# ae3527f0 07-Dec-2022 Kautuk Consul <kconsul@ventanamicro.com>

arch/riscv: add semihosting support for RISC-V

We add RISC-V semihosting based serial console for JTAG based early
debugging.

The RISC-V semihosting specification is available at:
https://github.com/riscv/riscv-semihosting-spec/blob/main/riscv-semihosting-spec.adoc

Signed-off-by: Anup Patel <apatel@ventanamicro.com>
Signed-off-by: Kautuk Consul <kconsul@ventanamicro.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>

# 1c03ab9f 07-Dec-2022 Kautuk Consul <kconsul@ventanamicro.com>

lib: Add common semihosting library

We factor out the arch-independent parts of the ARM semihosting
implementation as a common library so that it can be shared
with RISC-V.

Signed-off-by: Kautuk Consul <kconsul@ventanamicro.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>

# 3b8dfc42 16-Nov-2022 Tom Rini <trini@konsulko.com>

Convert CONFIG_SYS_TIMER_COUNTS_DOWN to Kconfig

This converts the following to Kconfig:
CONFIG_SYS_TIMER_COUNTS_DOWN

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 86794052 21-Oct-2022 Sughosh Ganu <sughosh.ganu@linaro.org>

FWU: Add support for the FWU Multi Bank Update feature

The FWU Multi Bank Update feature supports updating firmware images
to one of multiple sets(also called banks) of images. The firmware
images are clubbed together in banks, with the system booting images
from the active bank. Information on the images such as which bank
they belong to is stored as part of the metadata structure, which is
stored on the same storage media as the firmware images on a dedicated
partition.

At the time of update, the metadata is read to identify the bank to
which the images need to be flashed(update bank). On a successful
update, the metadata is modified to set the updated bank as active
bank to subsequently boot from.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

# 40ed7be4 02-Aug-2022 Tom Rini <trini@konsulko.com>

Convert CONFIG_SYS_FDT_PAD to Kconfig

This converts the following to Kconfig:
CONFIG_SYS_FDT_PAD

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e67ffb5a 22-Jul-2022 Sughosh Ganu <sughosh.ganu@linaro.org>

tpm: rng: Add driver model interface for TPM RNG device

The TPM device has a builtin random number generator(RNG)
functionality. Expose the RNG functions of the TPM device to the
driver model so that they can be used by the EFI_RNG_PROTOCOL if the
protocol is installed.

Also change the function arguments and return type of the random
number functions to comply with the driver model api.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

# b340199f 10-Jun-2022 Tom Rini <trini@konsulko.com>

spl: Ensure all SPL symbols in Kconfig have some SPL dependency

Tighten up symbol dependencies in a number of places. Ensure that a SPL
specific option has at least a direct dependency on SPL. In places
where it's clear that we depend on something more specific, use that
dependency instead. This means in a very small number of places we can
drop redundant dependencies.

Reported-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 13ce351b 08-Jun-2022 Tom Rini <trini@konsulko.com>

vpl: Ensure all VPL symbols in Kconfig have some VPL dependency

Tighten up symbol dependencies in a number of places. Ensure that a VPL
specific option has at least a direct dependency on VPL. In places
where it's clear that we depend on something more specific, use that
dependency instead.

Reported-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 8bea4bf7 08-Jun-2022 Tom Rini <trini@konsulko.com>

tpl: Ensure all TPL symbols in Kconfig have some TPL dependency

Tighten up symbol dependencies in a number of places. Ensure that a TPL
specific option has at least a direct dependency on TPL. In places
where it's clear that we depend on something more specific, use that
dependency instead.

Reported-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 26f981f2 19-May-2022 Rasmus Villemoes <rasmus.villemoes@prevas.dk>

fdtdec: drop needlessly convoluted CONFIG_PHANDLE_CHECK_SEQ

Asking if the alias we found actually points at the device tree node
we passed in (in the guise of its offset from blob) can be done simply
by asking if the fdt_path_offset() of the alias' path is identical to
offset.

In fact, the current method suffers from the possibility of false
negatives: dtc does not necessarily emit a phandle property for a node
just because it is referenced in /aliases; it only emits a phandle
property for a node if it is referenced in <angle brackets>
somewhere. So if both the node we passed in and the alias node we're
considering don't have phandles, fdt_get_phandle() returns 0 for both.

Since the proper check is so simple, there's no reason to hide that
behind a config option (and if one really wanted that, it should be
called something else because there's no need to involve phandle in
the check).

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Acked-by: Aswath Govindraju <a-govindraju@ti.com>

# d30924f1 01-May-2022 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: fix selection of CONFIG_CHARSET

lib/charset.c is not optional for
EFI_APP || EFI_LOADER || UFS || UT_UNICODE.
These must select CONFIG_CHARSET.

Fixes: 726cd9836db0 ("efi: Make unicode printf available to the app")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>

# 747093dd 30-Apr-2022 Simon Glass <sjg@chromium.org>

vpl: Add Kconfig options for VPL

Add VPL versions of commonly used Kconfig options.

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

# 11232139 06-Apr-2022 Tom Rini <trini@konsulko.com>

nds32: Remove the architecture

As removal of nds32 has been ack'd for the Linux kernel, remove support
here as well.

Cc: Rick Chen <rick@andestech.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Rick Chen <rick@andestech.com>

# fd210fee 28-Mar-2022 Philippe Reynes <philippe.reynes@softathome.com>

lib: allow to build asn1 decoder and oid registry in SPL

This commit adds the options:
- SPL_ASN1_DECODER
- SPL_OID_REGISTRY

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>

# 7d44a985 28-Mar-2022 Philippe Reynes <philippe.reynes@softathome.com>

lib: Kconfig: enhance the help of OID_REGISTRY

Enhance the help for the config OID_REGISTRY.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>

# a0e71d96 28-Mar-2022 Philippe Reynes <philippe.reynes@softathome.com>

lib: Kconfig: enhance help for ASN1

Enhance the help for configs ASN1_COMPILER
and ASN1_decoder.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>

# 761a1786 27-Jan-2022 Tom Rini <trini@konsulko.com>

Merge tag 'dm-pull-26jan22' of https://source.denx.de/u-boot/custodians/u-boot-dm

acpi refactoring to allow non-x86 use
binman support for bintools (binary tools)
minor tools improvements in preparation for FDT signing
various minor fixes and improvements


# 334a9b9d 25-Nov-2021 Loic Poulain <loic.poulain@linaro.org>

lib/circbuf: Make circbuf selectable symbol

It is currenly only used from usbtty driver but make it properly
selectable via Kconfig symbol, for future usage.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>

# e1722fcb 01-Dec-2021 Simon Glass <sjg@chromium.org>

x86: Allow any arch to generate ACPI tables

These have sadly found their way to ARM now. Allow any arch to support
generating ACPI tables.

Disable this for the tools build.

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

# 7c3fd5c2 26-Dec-2021 Qu Wenruo <wqu@suse.com>

lib: add BLAKE2 hash support

The code is cross-ported from BLAKE2 reference implementation
(https://github.com/BLAKE2/BLAKE2).

With minimal change to remove unused macros/features.

Currently there is only one user inside U-boot (btrfs), and since it
only utilize BLAKE2B, all other favors are all removed.

Signed-off-by: Qu Wenruo <wqu@suse.com>
[trini: Rename ROUND to R to avoid clash with <linux/bitops.h>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 97f2a749 04-Jan-2022 Eugen Hristev <eugen.hristev@collabora.com>

lib: Kconfig: fix PHANDLE_CHECK_SEQ position outside of menu

CONFIG_PHANDLE_CHECK_SEQ is outside of the menu 'Library routines'
thus it's invisible in menuconfig and cannot be selected.
Fix this by moving the 'endmenu' after the PHANDLE_CHECK_SEQ definition

Fixes: c589132a1d ("fdt: Use phandle to distinguish DT nodes with same name")
Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
Reviewed-by: Aswath Govindraju <a-govindraju@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 726cd983 29-Dec-2021 Simon Glass <sjg@chromium.org>

efi: Make unicode printf available to the app

This is needed to show unicode strings. Enable this code in the app.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>

# 6405ab7a 24-Nov-2021 Simon Glass <sjg@chromium.org>

Convert CONFIG_PHYSMEM to Kconfig

This converts the following to Kconfig:
CONFIG_PHYSMEM

Signed-off-by: Simon Glass <sjg@chromium.org>
Suggested-by: Sean Anderson <seanga2@gmail.com>

# ac7606af 14-Nov-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

lmb: fix typo 'commun'

%s/commun/common/

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

# e7d285b2 25-Sep-2021 Simon Glass <sjg@chromium.org>

image: Use the correct checks for CRC32

Add a host Kconfig for CRC32. With this we can use CONFIG_IS_ENABLED(CRC32)
directly in the host build, so drop the unnecessary indirection.

Add a few more conditions to SPL_CRC32 to avoid build failures as well as
TPL_CRC32. Also update hash.c to make crc32 optional and to actually take
notice of SPL_CRC32.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# 2c21256b 25-Sep-2021 Simon Glass <sjg@chromium.org>

hash: Use Kconfig to enable hashing in host tools and SPL

At present when building host tools, we force CONFIG_SHAxxx to be enabled
regardless of the board Kconfig setting. This is done in the image.h
header file.

For SPL we currently just assume the algorithm is desired if U-Boot proper
enables it.

Clean this up by adding new Kconfig options to enable hashing on the host,
relying on CONFIG_IS_ENABLED() to deal with the different builds.

Add new SPL Kconfigs for hardware-accelerated hashing, to maintain the
current settings.

This allows us to drop the image.h code and the I_WANT_MD5 hack.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# 603d15a5 25-Sep-2021 Simon Glass <sjg@chromium.org>

spl: cypto: Bring back SPL_ versions of SHA

Unfortunately these were removed by mistake. This means that adding hash
support to SPL brings in all software algorithms, with a substantial
increase in code size.

The origin of the problem was renaming them to SPL_FIT_xxx and then these
were removed altogether in a later commit.

Add them back. This aligns with CONFIG_MD5, for example, which has an SPL
variant.

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: f5bc9c25f31 ("image: Rename SPL_SHAxxx_SUPPORT to SPL_FIT_SHAxxx")
Fixes: eb5171ddec9 ("common: Remove unused CONFIG_FIT_SHAxxx selectors")
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# 6674edaa 16-Sep-2021 Tom Rini <trini@konsulko.com>

Merge tag 'v2021.10-rc4' into next

Prepare v2021.10-rc4

Signed-off-by: Tom Rini <trini@konsulko.com>

# gpg: Signature made Tue 14 Sep 2021 06:58:32 PM EDT
# gpg: using RSA key 1A3C7F70E08FAB1707809BBF147C39FF9634B72C
# gpg: Good signature from "Thomas Rini <trini@konsulko.com>" [ultimate]

# Conflicts:
# board/Arcturus/ucp1020/spl.c
# cmd/mvebu/Kconfig
# common/Kconfig.boot
# common/image-fit.c
# configs/UCP1020_defconfig
# configs/sifive_unmatched_defconfig
# drivers/pci/Kconfig
# include/configs/UCP1020.h
# include/configs/sifive-unmatched.h
# lib/Makefile
# scripts/config_whitelist.txt


# 5145bc73 01-Sep-2021 Oleksandr Suvorov <oleksandr.suvorov@foundries.io>

lib: fix typos in Kconfig

There are trivial typos in the Kconfig file. Fixed them.
Also, fixed grammar in the descriptions with typos.

Fixes: d56b4b1974 ("configs: Migrate RBTREE, LZO, CMD_MTDPARTS, CMD_UBI and CMD_UBIFS")
Fixes: 7264f2928b ("spl: fit: Eanble GZIP support for image decompression")
Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# e60e4499 02-Sep-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

lib: Drop SHA512_ALGO in lieu of SHA512

SHA512_ALGO was used as a "either SHA512 or SHA384", although the
implementations of these two algorithms share a majority of code.

From a Kconfig interface perspective, it makes sense to present two
distinct options. This requires #ifdefing out the SHA512
implementation from sha512.c. The latter doesn't make any sense.

It's reasonable to say in Kconfig that SHA384 depends on SHA512, and
seems to be the more polite way to handle the selection.

Thus, automatically select SHA512 when SHA384 is enabled.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# b4c2c151 27-Aug-2021 Michal Simek <michal.simek@amd.com>

Kconfig: Remove all default n/no options

default n/no doesn't need to be specified. It is default option anyway.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
[trini: Rework FSP_USE_UPD portion]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 928a8be7 29-Jul-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

lib: ecdsa: Implement UCLASS_ECDSA verification on target

Implement the crypto_algo .verify() function for ecdsa256. Because
it backends on UCLASS_ECDSA, this change is focused on parsing the
keys from devicetree and passing this information to the specific
UCLASS driver.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# fa3f1f1d 24-Jul-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: disable CONFIG_SPL_HEXDUMP by default

CONFIG_HEXDUMP is needed to display UEFI variables using 'printenv -e'.

Enabling CONFIG_SPL_HEXDUMP only makes sense for debugging purposes.
Hence CONFIG_SPL_HEXDUMP should not be enabled by default.

The following boards currently have CONFIG_SPL_HEXDUMP=y. This includes
boards that don't use SPL at all.

axm_defconfig
imx8mm-cl-iot-gate_defconfig
imx8mm_venice_defconfig
imxrt1020-evk_defconfig
imxrt1050-evk_defconfig
kontron_sl28_defconfig
kp_imx53_defconfig
lx2160ardb_tfa_stmm_defconfig
mt7622_rfb_defconfig
octeon_ebb7304_defconfig
octeon_nic23_defconfig
qemu_arm64_defconfig
qemu_arm_defconfig
qemu-riscv32_defconfig
qemu-riscv32_smode_defconfig
qemu-riscv64_defconfig
qemu-riscv64_smode_defconfig
qemu-x86_64_defconfig
qemu-x86_defconfig
sandbox64_defconfig
sandbox_defconfig
stm32mp15_basic_defconfig
stm32mp15_trusted_defconfig
synquacer_developerbox_defconfig
taurus_defconfig
xilinx_versal_virt_defconfig

The patch only keeps it enabled on

sandbox_spl_defconfig

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 1a46cb6c 02-Jul-2021 Simon Glass <sjg@chromium.org>

lib: Create a new Kconfig option for charset conversion

Rather than looking at two KConfig options in the Makefile, create a new
Kconfig option for compiling lib/charset.c

Enable it for UFS also, which needs this support.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 26dd9936 08-Jul-2021 Steffen Jaeckel <jaeckel-floss@eyet-services.de>

lib: add crypt subsystem

Add the basic functionality required to support the standard crypt
format.
The files crypt-sha256.c and crypt-sha512.c originate from libxcrypt and
their formatting is therefor retained.
The integration is done via a crypt_compare() function in crypt.c.

```
libxcrypt $ git describe --long --always --all
tags/v4.4.17-0-g6b110bc
```

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 7d0f3fbb 11-Jun-2021 Tero Kristo <t-kristo@ti.com>

lib: rational: copy the rational fraction lib routines from Linux

Copy the best rational approximation calculation routines from Linux.
Typical usecase for these routines is to calculate the M/N divider
values for PLLs to reach a specific clock rate.

This is based on linux kernel commit:
"lib/math/rational.c: fix possible incorrect result from rational
fractions helper"
(sha1: 323dd2c3ed0641f49e89b4e420f9eef5d3d5a881)

Signed-off-by: Tero Kristo <t-kristo@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Tero Kristo <kristo@kernel.org>

# ec0512b1 24-May-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

Revert "lib: introduce HASH_CALCULATE option"

When we think of Kconfig, we usually think of features that we like
to enable or not. Ideally, we wouldn't use Kconfig to fix a build
issue, although sometimes it might make sense. With Kconfig it's hard
to guarantee that the fix is universal. We can only say that it works
for the set of tested configurations. In the majority of cases, it's
preferable to let the linker figure things out for us.

The reverted commit attempted to fix a build issue by adding an
invisible Kconfig option. This is wrong in several ways:

It invents a new Kconfig variable when CONFIG_HASH already
exists for the same purpose.
Second, hash-checksum.c makes use of the hash_progressive_lookup_algo()
symbol, which is only provided with CONFIG_HASH, but this dependency
was not expressed in the reverted patch.

It feels like Kconfig is turning into a listing of all available
source files, and a buffet to 'select' which ones to compile. The
purpose of this revert is to enable the next change to make use of
CONFIG_HASH instead of adding to Kconfig.

This reverts commit 87316da05f2fd49d3709275e64ef0c5980366ade.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Acked-by: Masahisa Kojima <masahisa.kojima@linaro.org>

# 1621d3c4 10-May-2021 Bin Meng <bmeng.cn@gmail.com>

lib: kconfig: Limit BINMAN_FDT for OF_SEPARATE or OF_EMBED

Generally speaking BINMAN_FDT makes sense for OF_SEPARATE or OF_EMBED.
For the other OF_CONTROL methods, it's quite possible binman node is
not available as binman is invoked during the build phase instead of
runtime. Let's only turn it on for OF_SEPARATE or OF_EMBED by default.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 87316da0 13-May-2021 Masahisa Kojima <masahisa.kojima@linaro.org>

lib: introduce HASH_CALCULATE option

Build error occurs when CONFIG_EFI_SECURE_BOOT or
CONFIG_EFI_CAPSULE_AUTHENTICATE is enabled,
because hash-checksum.c is not compiled.

Since hash_calculate() implemented in hash-checksum.c can be
commonly used aside from FIT image signature verification,
this commit itroduces HASH_CALCULATE option to decide
if hash-checksum.c shall be compiled.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# e2ae483c 13-May-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

hash: Kconfig option for SHA512 hardware acceleration

Commit a479f103dc1c ("hash: Allow for SHA512 hardware implementations")
defined function definitions for hardware accelerated SHA384 and SHA512.
If CONFIG_SHA_HW_ACCEL=y, these functions are used.

We already have boards using CONFIG_SHA_HW_ACCEL=y but none implements the
new functions hw_sha384() and hw_sha512().

For implementing the EFI TCG2 protocol we need SHA384 and SHA512. The
missing hardware acceleration functions lead to build errors on boards like
peach-pi_defconfig.

Introduce a new Kconfig symbol CONFIG_SHA512_HW_ACCEL to control if the
functions hw_sha384() and hw_sha512() shall be used to implement the SHA384
and SHA512 algorithms.

Fixes: a479f103dc1c ("hash: Allow for SHA512 hardware implementations")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

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

# 6d66502b 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: Add 2 config to define the max number of regions

Add 2 configs CONFIG_LMB_MEMORY_REGIONS and CONFIG_LMB_RESERVED_REGIONS
to change independently the max number of the regions in lmb
library.

When CONFIG_LMB_USE_MAX_REGIONS=y, move the lmb property arrays to
struct lmb and manage the array size with the element 'max' of struct
lmb_region; their are still allocated in stack.

When CONFIG_LMB_USE_MAX_REGIONS=n, keep the current location in
struct lmb_region to allow compiler optimization.

Increase CONFIG_LMB_RESERVED_REGIONS is useful to avoid lmb errors in
bootm when the number of reserved regions (not adjacent) is reached:
+ 1 region for relocated U-Boot
+ 1 region for initrd
+ 1 region for relocated linux device tree
+ reserved memory regions present in Linux device tree.

The current limit of 8 regions is reached with only 5 reserved regions
in DT.

see Linux kernel commit bf23c51f1f49 ("memblock: Move memblock arrays
to static storage in memblock.c and make their size a variable")

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# 4fa0150d 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: move MAX_LMB_REGIONS value in Kconfig

Move MAX_LMB_REGIONS value in Kconfig, the max number of the regions
in lmb library.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# 77b8cfef 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: move CONFIG_LMB in Kconfig

Migrate CONFIG_LMB in Kconfig.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# a479f103 16-Feb-2021 Joel Stanley <joel@jms.id.au>

hash: Allow for SHA512 hardware implementations

Similar to support for SHA1 and SHA256, allow the use of hardware hashing
engine by enabling the algorithm and setting CONFIG_SHA_HW_ACCEL /
CONFIG_SHA_PROG_HW_ACCEL.

Signed-off-by: Joel Stanley <joel@jms.id.au>

# f2c1442e 14-Mar-2021 Simon Glass <sjg@chromium.org>

bloblist: Make BLOBLIST_TABLES depend on BLOBLIST

Add an extra condition here since we cannot put x86 tables in a bloblist
when bloblists are not supported.

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

# e0103158 25-Feb-2021 Bin Meng <bmeng.cn@gmail.com>

lib: kconfig: Mention CONFIG_ADDR_MAP limitation in the help

Mention that CONFIG_ADDR_MAP only works in the post-relocation phase.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>

# 56e7257c 03-Feb-2021 Bin Meng <bmeng.cn@gmail.com>

lib: Fix BINMAN_FDT dependency

lib/binman.c references the following 3 ofnode APIs:
ofnode_first_subnode(), ofnode_path() and ofnode_read_bool().

These APIs get built only when DM is on. Fix the dependency then.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 59e4e391 18-Jan-2021 Tom Rini <trini@konsulko.com>

Merge https://gitlab.denx.de/u-boot/custodians/u-boot-riscv

- Update qemu-riscv.rst build instructions.
- Add support for SPI on Kendryte K210.
- Add Microchip PolarFire SoC Icicle Kit support.
- Add support for an early timer.
- Select TIMER_EARLY to avoid infinite recursion for Trace.


# a80f8513 17-Jan-2021 Pragnesh Patel <pragnesh.patel@sifive.com>

trace: select TIMER_EARLY to avoid infinite recursion

When tracing functions is enabled this adds calls to
__cyg_profile_func_enter() and __cyg_profile_func_exit() to the traced
functions.

__cyg_profile_func_enter() and __cyg_profile_func_exit() invoke
timer_get_us() to record the entry and exit time.

initr_dm() will make gd->dm_root = NULL and gd->timer = NULL, so
timer_get_us() -> get_ticks() -> dm_timer_init() will lead to an
indefinite recursion.

So select TIMER_EARLY when tracing got enabled.

Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Rick Chen <rick@andestech.com>

# 6205bbb1 04-Jan-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lib: cosmetic update of CONFIG_LIB_ELF description

Change 2 typo error in CONFIG_LIB_ELF description:
- Supoort => Support
- fir => for

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c589132a 02-Dec-2020 Aswath Govindraju <a-govindraju@ti.com>

fdt: Use phandle to distinguish DT nodes with same name

While assigning the sequence number to subsystem instances by reading the
aliases property, only DT nodes names are compared and not the complete
path. This causes a problem when there are two DT nodes with same name but
have different paths.

In arch/arm/dts/k3-am65-main.dtsi there are two USB controllers with the
same device tree node name but different path. When aliases are defined for
these USB controllers then fdtdec_get_alias_seq() fails to pick the correct
instance for a given index.

fdt_path_offset() function is slow and this would effect the U-Boot
startup. To avert the time penalty on all boards, apply this extra check
only when required by using a config option.

Fix it by comparing the phandles of DT nodes after the node names match,
under a config option.

Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Fix whitespace error in Kconfig:
Signed-off-by: Simon Glass <sjg@chromium.org>

# 28cef9ca 19-Nov-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

fs: fat: create correct short names

The current function set_name() used to create short names has the
following deficiencies resolved by this patch:

* Long names (e.g. FOO.TXT) are stored even if a short name is enough.
* Short names with spaces are created, e.g. "A ~1.TXT".
* Short names with illegal characters are created, e.g. "FOO++BAR".
* Debug output does not not consider that the short file name has no
concluding '\0'.

The solution for the following bug is split of into a separate patch:

* Short file names must be unique.

This patch only provides the loop over possible short file names.

Fixes: c30a15e590c ("FAT: Add FAT write feature")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# e4f8e543 05-Nov-2020 Simon Glass <sjg@chromium.org>

smbios: Drop the unused Kconfig options

Now that we can use devicetree to specify this information, drop the old
CONFIG options.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 44c74bdd 05-Nov-2020 Simon Glass <sjg@chromium.org>

sysinfo: Provide a default driver to set SMBIOS values

Some boards want to specify the manufacturer or product name but do not
need to have their own sysinfo driver.

Add a default driver which provides a way to specify this SMBIOS
information in the devicetree, without needing any board-specific
functionality.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d2cb7a22 04-Nov-2020 Simon Glass <sjg@chromium.org>

x86: Allow putting some tables in the bloblist

At present all tables are placed starting at address f0000 in memory, and
can be up to 64KB in size. If the tables are very large, this may not
provide enough space.

Also if the tables point to other tables (such as console log or a ramoops
area) then we must allocate other memory anyway.

The bloblist is a nice place to put these tables since it is contiguous,
which makes it easy to reserve this memory for linux using the 820 tables.

Add an option to put some of the tables in the bloblist. For SMBIOS and
ACPI, create suitable pointers from the f0000 region to the new location
of the tables.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
[bmeng: squashed in http://patchwork.ozlabs.org/project/uboot/patch/
20201105062407.1.I8091ad931cbbb5e3b6f6ababdf3f8d5db0d17bb9@changeid/]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# 415eab06 03-Nov-2020 Christian Gmeiner <christian.gmeiner@gmail.com>

smbios: add parsing API

Add a very simple API to be able to access SMBIOS strings
like vendor, model and bios version.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 72eda507 27-Oct-2020 Sean Anderson <seanga2@gmail.com>

lib: Add getopt

Some commands can get very unweildy if they have too many positional
arguments. Adding options makes them easier to read, remember, and
understand.

This implementation of getopt has been taken from barebox, which has had
option support for quite a while. I have made a few modifications to their
version, such as the removal of opterr in favor of a separate getopt_silent
function. In addition, I have moved all global variables into struct
getopt_context.

The getopt from barebox also re-orders the arguments passed to it so that
non-options are placed last. This allows users to specify options anywhere.
For example, `ls -l foo/ -R` would be re-ordered to `ls -l -R foo/` as
getopt parsed the options. However, this feature conflicts with the const
argv in cmd_tbl->cmd. This was originally added in 54841ab50c ("Make sure
that argv[] argument pointers are not modified."). The reason stated in
that commit is that hush requires argv to stay unmodified. Has this
situation changed? Barebox also uses hush, and does not have this problem.
Perhaps we could use their fix?

I have assigned maintenance of getopt to Simon Glass, as it is currently
only used by the log command. I would also be fine maintaining it.

Signed-off-by: Sean Anderson <seanga2@gmail.com>

# 26637e2e 12-Sep-2020 Simon Glass <sjg@chromium.org>

lib: Allow hexdump to be used in SPL

It is sometimes useful to output hex dumps in SPL. Add a config option to
allow this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# e87dfb05 05-Aug-2020 Andrii Anisov <andrii_anisov@epam.com>

lib: sscanf: add sscanf implementation

Port sscanf implementation from mini-os and introduce new
Kconfig option to enable it: CONFIG_SSCANF. Disable by default.

Signed-off-by: Andrii Anisov <andrii_anisov@epam.com>
Signed-off-by: Anastasiia Lukianenko <anastasiia_lukianenko@epam.com>
Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>

# 81014f73 30-Jul-2020 Joao Marcos Costa <joaomarcos.costa@bootlin.com>

include/u-boot, lib/zlib: add sources for zlib decompression

Add zlib (v1.2.11) uncompr() function to U-Boot. SquashFS depends on
this function to decompress data from a raw disk image. The actual
support for zlib into SquashFS sources will be added in a follow-up
commit.

Signed-off-by: Joao Marcos Costa <joaomarcos.costa@bootlin.com>

# 69be8fd1 03-Jun-2020 Marek Szyprowski <m.szyprowski@samsung.com>

powerpc: move ADDR_MAP to Kconfig

Move ADDR_MAP related config options from include/configs/*.h to the
proper place in lib/Kconfig. This has been done using
./tools/moveconfig.py and manual inspection of the generated changes.
This is a preparation to use ADDR_MAP helper on ARM 32bit Raspberry Pi4
board for mapping the PCIe XHCI MMIO, which is above the 4GiB identity
mapping limit.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# d16b38f4 15-Apr-2020 Reuben Dowle <reubendowle0@gmail.com>

Add support for SHA384 and SHA512

The current recommendation for best security practice from the US government
is to use SHA384 for TOP SECRET [1].

This patch adds support for SHA384 and SHA512 in the hash command, and also
allows FIT images to be hashed with these algorithms, and signed with
sha384,rsaXXXX and sha512,rsaXXXX

The SHA implementation is adapted from the linux kernel implementation.

[1] Commercial National Security Algorithm Suite
http://www.iad.gov/iad/programs/iad-initiatives/cnsa-suite.cfm

Signed-off-by: Reuben Dowle <reuben.dowle@4rf.com>

# 43e442a5 26-May-2020 Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

kconfig: fix some typos

Signed-off-by: Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

# eff5a547 22-May-2020 Michael Walle <michael@walle.cc>

cmd: zip: automatically pull in gzip()

Move the CONFIG_GZIP_COMPRESSED from a config.h macro to a Kconfig menu
item. It is not selectable by a user because there is no reason to do
so. Instead it will be automatically selected by the stuff which uses
gzip(), like the zip command.

Remove it from the config_whitelist.txt. Also remove
CONFIG_GZIP_COMPRESS_DEF_SZ as this was never used on any board. The
default seems to be sane, otherwise it should be added as a Kconfig
option.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8239be61 06-May-2020 Simon Glass <sjg@chromium.org>

lib: Allow MD5 to be enabled in SPL

At present the MD5 option cannot be enabled by board configs since it has
no Kconfig name. It is generally enabled, so long as FIT support is
present. But not all boards use FIT, particularly in SPL

Fix this and add an option for SPL as well. This allows board code to call
md5() even if FIT support is not enabled.

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

# 04cb3994 21-Apr-2020 Weijie Gao <weijie.gao@mediatek.com>

lib: enable lzma decompression support for SPL build

This patch enables LZMA decompression support for SPL build

Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>

# 2a2119e1 05-Mar-2020 Atish Patra <atishp@atishpatra.org>

lib: kconfig: Add option to set BZIP2 compression method

There is no way to select BZIP2 compression method.
Add it under library/compression config where all other
compression related configs are present.

Signed-off-by: Atish Patra <atish.patra@wdc.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 805b3cac 12-Feb-2020 Keerthy <j-keerthy@ti.com>

lib: elf: Move the generic elf loading/validating functions to lib

Move the generic elf loading/validating functions to lib/
so that they can be re-used and accessed by code existing
outside cmd.

While at it remove the duplicate static version of load_elf_image_phdr
under arch/arm/mach-imx/imx_bootaux.c.

Signed-off-by: Keerthy <j-keerthy@ti.com>
Suggested-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>

# 1611235b 19-Jan-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: Kconfig dependencies for pseudo-random library

drivers/rng/sandbox_rng.c requires rand() to be defined but configuration
option CONFIG_CONFIG_LIB_RAND selected in drivers/rng/Kconfig does not
exist.

test/lib/test_aes.c requires rand() to be defined.

Fix the selection criteria for choice "Pseudo-random library support type".

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 3c10dc95 06-Dec-2019 Simon Glass <sjg@chromium.org>

binman: Add a library to access binman entries

SPL and TPL can access information about binman entries using link-time
symbols but this is not available in U-Boot proper. Of course it could be
made available, but the intention is to just read the device tree.

Add support for this, so that U-Boot can locate entries.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# b4adf627 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: crypto: add x509 parser

Imported from linux kernel v5.3:
x509.asn1 without changes
x509_akid.asn1 without changes
x509_parser.h without changes
x509_cert_parser.c with changes marked as __UBOOT__
x509_public_key.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# a9b45e6e 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add oid registry utility

Imported from linux kernel v5.3:
build_OID_registry without changes
oid_registry.h without changes
oid_registry.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# ab8a0e06 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add asn1 decoder

Imported from linux kernel v5.3:
lib/asn1_decoder.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 2b12196d 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

cmd: add asn1_compiler

Imported from linux kernel v5.3:
asn1.h without changes
asn1_ber_bytecode.h without changes
asn1_decoder.h without changes
asn1_compiler.c without changes

This host command will be used to create a ASN1 parser, for example,
for pkcs7 messages or x509 certificates. More specifically, it will
generate *byte code* which will be interpreted by asn1 decoder library.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 05429b6c 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

rtc: move date.c from drivers/rtc/ to lib/

In the next commit, rtc_mktime(), for compatibility with linux, will be
implemented using rtc_mktime(), which is no longer drivers/rtc specific.
So move this file under lib/.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 37ef1774 10-Nov-2019 Thomas Hebb <tommyhebb@gmail.com>

Kconfig: disambiguate config names for tiny printf

27084c03d36a ("spl: Allow tiny printf() to be controlled in SPL and
TPL") split this option in two for TPL and SPL, but didn't change the
Kconfig names, making them hard to set quickly.

Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>

# 0d76afc0 27-Oct-2019 Simon Glass <sjg@chromium.org>

fdt: Add Kconfig options to control code size

For better or worse libfdt recent grew a lot of code that checks the
validity of the device tree in great detail. When using unsigned or
unverified data this makes things safer, but it does add to code size.

Add some controls to select the trade-off between safety and code size.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 27084c03 25-Sep-2019 Simon Glass <sjg@chromium.org>

spl: Allow tiny printf() to be controlled in SPL and TPL

At present there is only one control for this and it is used for both SPL
and TPL. But SPL might have a lot more space than TPL so the extra cost of
a full printf() might be acceptable.

Split the option into two, providing separate SPL and TPL controls. The
TPL setting defaults to the same as SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2a51e16b 07-Jun-2019 Tom Rini <trini@konsulko.com>

configs: Make USE_TINY_PRINTF depend on SPL||TPL and be default

The USE_TINY_PRINTF symbol only changes things within SPL and TPL
builds, so make it depend on that support. Next, make it default as
within these cases we should rarely have need of more advanced print
formats outside of the debug context.

To do this, in a few cases we need to correct our Kconfig dependencies
as we had cases of non-SPL targets select'ing this symbol. Finally, in
the case of a few boards we really do need the full printf
functionality.

Signed-off-by: Tom Rini <trini@konsulko.com>

# da0fb5fd 02-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: make call depth limit customizable

Up to now we had hard coded values for the call depth up to which trace
records are created: 200 for early tracing, 15 thereafter. UEFI
applications reach a call depth of 80 or above.

Provide customizing settings for the call trace depth limit and the early
call trace depth limit. Use the old values as defaults.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8509f22a 29-Apr-2019 Marek Behún <kabel@kernel.org>

lib: add Zstandard decompression support

Add the zstd library from Linux kernel (only decompression support).
There are minimal changes to build with U-Boot, otherwise the files are
identical to Linux commit dc35da16 from March 2018, the files had not
been touched since in kernel. Also SPDX lincese tags were added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 83a486b6 29-Apr-2019 Marek Behún <kabel@kernel.org>

lib: Add xxhash support

This adds the xxhash support from Linux. Files are almost identical to
those added to Linux in commit 5d240522 ("lib: Add xxhash module") (they
haven't been touched since in Linux). The only difference is to add some
includes to be compatible with U-Boot. Also SPDX lincese tags were
added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 5132361a 29-Apr-2019 Heiko Schocher <hs@denx.de>

lib: Kconfig: fix help text for GZIP

commit 95f4bbd581cf ("lib: fdt: Allow LZO and GZIP DT compression in U-Boot")

introduced Kconfig option for gzip in U-Boot, but help text
says gzip for SPL, which is wrong. Fix this.

Signed-off-by: Heiko Schocher <hs@denx.de>
Acked-by: Marek Vasut <marex@denx.de>

# 1c6eb075 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE_BUFFER_SIZE et al to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE_BUFFER_SIZE
CONFIG_TRACE_EARLY_SIZE
CONFIG_TRACE_EARLY
CONFIG_TRACE_EARLY_ADDR

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

# a24a78d7 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE

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

# 54969b40 21-Mar-2019 Thierry Reding <treding@nvidia.com>

fdtdec: Add Kconfig symbol for tests

Runtime tests are provided as a test_fdtdec command implementation. Add
a Kconfig symbol that allows this command to be built so that the tests
can be used.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 95f4bbd5 08-Mar-2019 Marek Vasut <marex@denx.de>

lib: fdt: Allow LZO and GZIP DT compression in U-Boot

Add required Kconfig symbols, Makefile bits and macro fixes in a
few places to support LZO and DT compression in U-Boot. This can
save a lot of space with multi-DTB fitImages.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>

# 6e705114 13-Jan-2019 Chris Packham <judge.packham@gmail.com>

lib: Kconfig: spelling fixes

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 048c6e89 06-Nov-2018 Simon Glass <sjg@chromium.org>

spl: lz4: Allow use of lz4 compression in SPL

In some cases U-Boot is compressed and it is useful to be able to
decompress it in SPL. Add a Kconfig and Makefile change to allow this.
Note that this does not actually implement decompression.

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

# 2895c4b7 15-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

kconfig: Introduce HAVE_ARCH_IOMAP

Introduce a new Kconfig option for architecture codes to control
whether it provides io{read,write}{8,16,32} I/O accessor functions.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5592a633 01-Oct-2018 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt in TPL

In some cases (e.g. sandbox with verified boot) it is useful to support
libfdt in TPL. Update the Kconfig to handle this.

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

# 6307896c 01-Oct-2018 Simon Glass <sjg@chromium.org>

tpm: Add support for SPL and TPL

At present the tpm can only be used in U-Boot proper. Updated it to work
in SPL and TPL also.

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

# ab948cd2 19-Jul-2018 Masahiro Yamada <masahiroy@kernel.org>

fdt_support: make FDT_FIXUP_PARTITIONS depend on CMD_MTDPARTS

fdt_fixup_mtdparts() calls mtdparts_init() and device_find(),
which are defined in cmd/mtdparts.c

The combination of FDT_FIXUP_PARTITIONS=y and CMD_MTDPARTS=n
emits the following link error:

common/fdt_support.c:903: undefined reference to `mtdparts_init'
common/fdt_support.c:914: undefined reference to `device_find'

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 3330584d 03-Jun-2018 Igor Opaniuk <igor.opaniuk@gmail.com>

avb2.0: integrate avb 2.0 into the build system

Integrate libavb into the build system. Introduce CONFIG_LIBAVB
build option.

Signed-off-by: Igor Opaniuk <igor.opaniuk@linaro.org>

# f8c987f8 05-Jun-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

lib: Add hexdump

Often during debugging session it's very interesting to see
what data we were dealing with. For example what we write or read
to/from memory or peripherals.

This change introduces functions that allow to dump binary
data with one simple function invocation like:
------------------->8----------------
print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, buf, len);
------------------->8----------------

which gives us the following:
------------------->8----------------
00000000: f2 b7 c9 88 62 61 75 64 72 61 74 65 3d 31 31 35 ....baudrate=115
00000010: 32 30 30 00 62 6f 6f 74 61 72 67 73 3d 63 6f 6e 200.bootargs=con
00000020: 73 6f 6c 65 3d 74 74 79 53 33 2c 31 31 35 32 30 sole=ttyS3,11520
00000030: 30 6e 38 00 62 6f 6f 74 64 65 6c 61 79 3d 33 00 0n8.bootdelay=3.
00000040: 62 6f 6f 74 66 69 6c 65 3d 75 49 6d 61 67 65 00 bootfile=uImage.
00000050: 66 64 74 63 6f 6e 74 72 6f 6c 61 64 64 72 3d 39 fdtcontroladdr=9
00000060: 66 66 62 31 62 61 30 00 6c 6f 61 64 61 64 64 72 ffb1ba0.loadaddr
00000070: 3d 30 78 38 32 30 30 30 30 30 30 00 73 74 64 65 =0x82000000.stde
00000080: 72 72 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 rr=serial0@e0022
00000090: 30 30 30 00 73 74 64 69 6e 3d 73 65 72 69 61 6c 000.stdin=serial
000000a0: 30 40 65 30 30 32 32 30 30 30 00 73 74 64 6f 75 0@e0022000.stdou
000000b0: 74 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 30 t=serial0@e00220
000000c0: 30 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00..............
...
------------------->8----------------

Source of hexdump.c was copied from Linux kernel v4.7-rc2.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Mario Six <mario.six@gdsys.cc>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Stefan Roese <sr@denx.de>

# c232d14d 29-May-2018 Alex Kiernan <alex.kiernan@gmail.com>

mmc: Separate "mmc swrite" from fastboot

Introduce CONFIG_IMAGE_SPARSE and CONFIG_CMD_MMC_SWRITE so the "mmc
swrite" command is separated from the fastboot code.

Move image-sparse from common to lib so it's clear it's library code.

Rename CONFIG_FASTBOOT_FLASH_FILLBUF_SIZE to CONFIG_IMAGE_SPARSE_FILLBUF_SIZE
and migrate it to Kconfig.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Acked-by: Jassi Brar <jaswinder.singh@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6417572e 08-May-2018 Tom Rini <trini@konsulko.com>

lib/Kconfig: Mark OF_LIBFDT_OVERLAY as depending on OF_LIBFDT

The overlay code is only useful when OF_LIBFDT is set, so mark it as
depending on that first.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 58a46f88 25-Apr-2018 Praneeth Bajjuri <praneeth@ti.com>

configs: TI: Enable FIT Library overlay support

Enable the FDT library overlay support for all TI SOC family.

Without this option, when Loading fdt from FIT image, the
following warning is seen.

"config with overlays but CONFIG_OF_LIBFDT_OVERLAY not set".

Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
Suggested-by: Andrew F.Davis <afd@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>

# 14ad44ab 18-Apr-2018 Alex Kiernan <alex.kiernan@gmail.com>

spl: Split sprintf, strto* from SPL serial in Kconfig

When SPL serial is disabled, callers who need sprintf or strtoul fail
because their inclusion is guarded by CONFIG_SPL_SERIAL_SUPPORT/
CONFIG_TPL_SERIAL_SUPPORT.

Split printf, sprintf and strto into their own entries and then select
all of them if SERIAL_SUPPORT is enabled to match the current behaviour.

Include panic.o unconditionally as it can be called from anywhere which
uses BUG_ON().

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>

# e294ba06 04-Apr-2018 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-sunxi

Signed-off-by: Tom Rini <trini@konsulko.com>


# d14db11d 03-Apr-2018 Andre Przywara <andre.przywara@arm.com>

sunxi: revert disabling of features

In January some commits were introduced to mitigate the U-Boot image
size issues we encountered on sunxi builds.
Now with the MMC environment removed we can bring them back, as we
practically don't have a size limit anymore.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 32ce6179 13-Mar-2018 Bryan O'Donoghue <bryan.odonoghue@linaro.org>

optee: Add lib entries for sharing OPTEE code across ports

This patch adds code to lib to enable sharing of useful OPTEE code between
board-ports and architectures. The code on lib/optee/optee.c comes from the
TI omap2 port. Eventually the OMAP2 code will be patched to include the
shared code. The intention here is to add more useful OPTEE specific code
as more functionality gets added.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Cc: Harinarayan Bhatta <harinarayan@ti.com>
Cc: Andrew F. Davis <afd@ti.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Kever Yang <kever.yang@rock-chips.com>
Cc: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Cc: Peng Fan <peng.fan@nxp.com>
Tested-by: Peng Fan <peng.fan@nxp.com>

# 36c1877c 06-Feb-2018 Faiz Abbas <faiz_abbas@ti.com>

lib: Kconfig: Move DYNAMIC_CRC_TABLE to Kconfig

Add CONFIG prefix to DYNAMIC_CRC_TABLE and implement it in
Kconfig.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>

# a451bc27 05-Feb-2018 Adam Ford <aford173@gmail.com>

Convert LIB_UUID to Kconfig

config_fallback.h has some logic that checks a variety of options
and selects LIB_UUID if it hasn't already been selected. This
will all LIB_UUID in Kconfig and select this option for the list
of options to allow us to remove the logic from fallbacks

Signed-off-by: Adam Ford <aford173@gmail.com>

# a5a37567 06-Feb-2018 Adam Ford <aford173@gmail.com>

Convert CONFIG LIB_HW_RAND to Kconfig

config_fallbacks.h had some logic to automatically select
LIB_RAND if RANDOM_UUID or CMD_UUID were set if LIB_HW_RAND wasn't
already selected. By migrating LIB_HW_RAND to Kconfig, we can
remove this check from config_fallbacks.h and put it into Kconfig

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
[trini: Turn into a choice, add NET_RANDOM_ETHADDR]
Signed-off-by: Tom Rini <trini@konsulko.com>

# acd4d334 16-Jan-2018 Maxime Ripard <maxime.ripard@free-electrons.com>

net: regex: Disable by default on sunXi

The sunXi arm64 build has overflown, leading to the main U-boot binary
overwriting the environment when flashing the new image, or even worse,
overwriting itself when we're calling saveenv.

Disable this option that is not critical until we can adress the issue
properly.

Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 7e3caa81 03-Dec-2017 Masahiro Yamada <masahiroy@kernel.org>

Move CONFIG_PANIC_HANG to Kconfig

Freescale (NXP) boards have lots of defconfig files per board.
I used "imply PANIC_HANG" for them.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# da5337a6 08-Nov-2017 Nandor Han <nandor.han@ge.com>

rtc: add support for s35392a

Add support for S35392A RTC. The driver supports both U-Boot driver
models.

Signed-off-by: Nandor Han <nandor.han@ge.com>
Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
Cc: Heiko Schocher <hs@denx.de>

# f52bdf4b 14-Sep-2017 Jean-Jacques Hiblot <jjhiblot@ti.com>

lib: allow building lzo for the SPL

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 85d8bf57 03-Sep-2017 Marek Behún <kabel@kernel.org>

lib: Add CRC32-C

This is needed for BTRFS.

Signed-off-by: Marek Behun <marek.behun@nic.cz>

create mode 100644 lib/crc32c.c

# 7264f292 15-Aug-2017 York Sun <york.sun@nxp.com>

spl: fit: Eanble GZIP support for image decompression

Add Kconfig option SPL_GZIP and SPL_ZLIB to enable gunzip support for
SPL boot, eg. falcon boot compressed kernel image.

Signed-off-by: York Sun <york.sun@nxp.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6ef2f901 11-Aug-2017 Adam Ford <aford173@gmail.com>

Convert CONFIG_BCH to Kconfig

This converts the following to Kconfig:
CONFIG_BCH

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1a7ba1d 18-Aug-2017 Anatolij Gustschin <agust@denx.de>

Fix 'notes' typos

s/notes/nodes

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 96b9082c 03-Aug-2017 Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

rockchip: rk3188: rock: adjust for SPL/TPL split

With the changes to split SPL/TPL for the RK3368, I apparently missed
some needed adjustments to the RK3188 Kconfig and rock_defconfig.

This fixes build-issues for the rock board after applying the RK3368
enablement (and SPL/TPL) set that resulted from TPL_SERIAL_SUPPORT,
TPL_ROCKCHIP_BACK_TO_BROM and TPL_TINY_MEMSET being separate symbols
now.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d56b4b19 22-Jul-2017 Tom Rini <trini@konsulko.com>

configs: Migrate RBTREE, LZO, CMD_MTDPARTS, CMD_UBI and CMD_UBIFS

The above CONFIG options are in Kconfig, and now have correct depends and
inter-dependencies. Migrate these to configs/ from include/configs/. In the
case of CMD_UBIFS also change it to be a default y if CMD_UBI.

Signed-off-by: Tom Rini <trini@konsulko.com>

# aed998aa 17-May-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_LZMA to Kconfig

This converts the following to Kconfig:
CONFIG_LZMA

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

# b1a873df 26-Apr-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_CMD_AES et al to Kconfig

This converts the following to Kconfig:
CONFIG_CMD_AES
CONFIG_AES

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Add select AES to CMD_AES]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 173aafbf 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

cmd: Expose a Kconfig option to enable UBIFS commands

Create a new Kconfig entry to allow CMD_UBIFS selection from Kconfig and
add an hidden LZO option that can be selected by CMD_UBIFS.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>

# aa049152 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

mtd: ubi: Select RBTREE option from MTD_UBI Kconfig entry

Expose the RBTREE feature through Kconfig and select this option from the
MTD_UBI option.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>
[Rebased on master]
Signed-off-by: Jagan Teki <jagan@openedev.com>

# ab4458bd 02-Apr-2017 Simon Glass <sjg@chromium.org>

string: Provide a slimmed-down memset()

Most of the time the optimised memset() is what we want. For extreme
situations such as TPL it may be too large. For example on the 'rock'
board, using a simple loop saves a useful 48 bytes. With gcc 4.9 and
the rodata bug, this patch is enough to reduce the TPL image below the
limit.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>

# bea79d7d 14-Mar-2017 Andre Przywara <andre.przywara@arm.com>

Kconfig: introduce md5sum command selection

So far CONFIG_MD5SUM would need to be set by a board's include file.
Since the command is really generic, move it over to Kconfig to allow
it to be defined by either a board's defconfig, menuconfig or some
config snippet merged via mergeconfig.sh.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e663b350 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

smbios: Expose in efi_loader as table

We can pass SMBIOS easily as EFI configuration table to an EFI payload. This
patch adds enablement for that case.

While at it, we also enable SMBIOS generation for ARM systems, since they support
EFI_LOADER.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4b6dddc2 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

x86: Move smbios generation into arch independent directory

We will need the SMBIOS generation function on ARM as well going forward,
so let's move it into a non arch specific location.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# ebf7fff2 05-Oct-2016 Heiko Schocher <hs@denx.de>

spl: move FDT_FIXUP_PARTITIONS to Kconfig

Move FDT_FIXUP_PARTITIONS to Kconfig and cleanup existing
uses.

Signed-off-by: Heiko Schocher <hs@denx.de>

# ddf67f71 05-Jul-2016 Maxime Ripard <maxime.ripard@free-electrons.com>

libfdt: Add overlay application function

The device tree overlays are a good way to deal with user-modifyable
boards or boards with some kind of an expansion mechanism where we can
easily plug new board in (like the BBB, the Raspberry Pi or the CHIP).

Add a new function to merge overlays with a base device tree.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>

# 91b86e21 26-May-2016 Marek Vasut <marex@denx.de>

lib: Enable private libgcc by default

This patch decouples U-Boot binary from the toolchain on systems where
private libgcc is available. Instead of pulling in functions provided
by the libgcc from the toolchain, U-Boot will use it's own set of libgcc
functions. These functions are usually imported from Linux kernel, which
also uses it's own libgcc functions instead of the ones provided by the
toolchain.

This patch solves a rather common problem. The toolchain can usually
generate code for many variants of target architecture and often even
different endianness. The libgcc on the other hand is usually compiled
for one particular configuration and the functions provided by it may
or may not be suited for use in U-Boot. This can manifest in two ways,
either the U-Boot fails to compile altogether and linker will complain
or, in the much worse case, the resulting U-Boot will build, but will
misbehave in very subtle and hard to debug ways.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 67976306 30-Mar-2016 Masahiro Yamada <masahiroy@kernel.org>

cosmetic: Fix typos "privide"

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# ed980b8c 03-Mar-2016 Alexander Graf <agraf@csgraf.de>

efi_loader: hook up in build environment

Now that we have all the bits and pieces ready for EFI payload loading
support, hook them up in Makefiles and KConfigs so that we can build.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
[trini: Enable only when we of OF_LIBFDT, disable on kwb and colibri_pxa270]
Signed-off-by: Tom Rini <trini@konsulko.com>

# aa34fbc0 22-Feb-2016 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt to be used in SPL

Add an option to enable libfdt in SPL. This can be useful when decoding
FIT files in SPL.

We need to make sure this option is not enabled in SPL by this change.
Also this option needs to be enabled in host builds. Si add a new
IMAGE_USE_LIBFDT #define which can be used in files that are built on the
host but must also build for U-Boot and SPL.

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

# 69e173eb 22-Feb-2016 Simon Glass <sjg@chromium.org>

Move CONFIG_OF_LIBFDT to Kconfig

Move this option to Kconfig and tidy up existing boards.

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

# a187559e 05-Feb-2016 Bin Meng <bmeng.cn@gmail.com>

Use correct spelling of "U-Boot"

Correct spelling of "U-Boot" shall be used in all written text
(documentation, comments in source files etc.).

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Minkyu Kang <mk7.kang@samsung.com>

# 947c626d 14-Jan-2016 Tom Rini <trini@konsulko.com>

vsprintf.c: Always enable CONFIG_SYS_VSNPRINTF

Enabling this function always removes some class of string saftey issues.
The size change here in general is about 400 bytes and this seems a reasonable
trade-off.

Cc: Peng Fan <peng.fan@nxp.com>
Cc: Peter Robinson <pbrobinson@gmail.com>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Adrian Alonso <aalonso@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 7d9cde10 22-Nov-2015 Stefan Roese <sr@denx.de>

lib/tiny-printf.c: Add tiny printf function for space limited environments

This patch adds a small printf() version that supports all basic formats.
Its intented to be used in U-Boot SPL versions on platforms with very
limited internal RAM sizes.

To enable it, just define CONFIG_USE_TINY_PRINTF in your defconfig. This
will result in the SPL using this tiny function and the main U-Boot
still using the full-blown printf() function.

This code was copied from:
http://www.sparetimelabs.com/printfrevisited
With mostly only coding style related changes so that its checkpatch
clean.

The size reduction is about 2.5KiB. Here a comparison for the db-mv784mp-gp
(Marvell AXP) SPL:

Without this patch:
58963 18536 1928 79427 13643 ./spl/u-boot-spl

With this patch:
56542 18536 1956 77034 12cea ./spl/u-boot-spl

Note:
To make it possible to compile tiny-printf.c instead of vsprintf.c when
CONFIG_USE_TINY_PRINTF is defined, the functions printf() and vprintf() are
moved from common/console.c into vsprintf.c in this patch.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>

# 2419cd16 03-Oct-2015 Simon Glass <sjg@chromium.org>

dm: tpm: Drop CONFIG_DM_TPM

Now that all TPM drivers use driver model, we can drop the special driver
model CONFIG option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>

# 027b728d 06-Oct-2015 Julius Werner <jwerner@chromium.org>

Add support for LZ4 decompression algorithm

This patch adds support for LZ4-compressed FIT image contents. This
algorithm has a slightly worse compression ration than LZO while being
nearly twice as fast to decompress. When loading images from a fast
storage medium this usually results in a boot time win.

Sandbox-tested only since I don't have a U-Boot development system set
up right now. The code was imported unchanged from coreboot where it's
proven to work, though. I'm mostly interested in getting this recognized
by mkImage for use in a downstream project.

Signed-off-by: Julius Werner <jwerner@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# a7d660bc 22-Aug-2015 Simon Glass <sjg@chromium.org>

tpm: Add Kconfig options for TPMs

Add new Kconfig options for TPMs in preparation for moving boards to use
Kconfig for TPM configuration.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 867a6ac8 31-Jul-2015 Simon Glass <sjg@chromium.org>

efi: Add start-up library code

When running as an EFI application, U-Boot must request memory from EFI,
and provide access to the boot services U-Boot needs.

Add library code to perform these tasks. This includes efi_main() which is
the entry point from EFI. U-Boot is built as a shared library.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d1389403 23-Jun-2015 Simon Glass <sjg@chromium.org>

Add a dhrystone benchmark command

Drystone provides a convenient sanity check that the CPU is running at full
speed. Add this as a command which can be enabled as needed.

Note: I investigated using Coremark for this but there was a license
agreement and I could not work out if it was GPL-compatible.

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

# f7848d90 22-Jun-2015 Joe Hershberger <joe.hershberger@ni.com>

Allow CONFIG_REGEX to be disabled when CONFIG_NET

Instead of selecting REGEX when NET is enabled, make it the default, but
allow boards that are tiny to disable it and lose functionality on all
but the first Ethernet adapter.

cm-bf548, bf538f-ezkit, and bf533-stamp need this. None appear to have
more than one Ethernet interface.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# 3850dbe8 11-Jun-2015 Masahiro Yamada <masahiroy@kernel.org>

blackfin: fix undefined reference to srand and rand

Commit 9ba9e85f3f1c (net: Fix NET_RANDOM_ETHADDR dependencies)
accidentally dropped CONFIG_LIB_RAND defines for 14 Blackfin boards.

Prior to that commit, those boards defined CONFIG_LIB_RAND, but not
CONFIG_NET_RANDOM_ETHADDR. So, commit 9ba9e85f3f1c should not have
touched them, but in fact it ripped CONFIG_LIB_RAND off from all the
header files, which caused undefined reference to srand and rand.
CONFIG_LIB_RAND=y must be revived for such boards.

BTW, this commit indeed makes it better, but even with this fix,
three boards (bf533-stamp, bf538f-ezkit, cm-bf548) still can not
build due to region 'ram' overflowed error. This was cause by
commit 6eed3786c68c (net: Move the CMD_NET config to defconfigs)
because CMD_NET selects NET, and NET selects REGEX. Eventually,
some boards were newly enabled with CONFIG_REGEX, increasing the
memory footprint. A patch is expected to fix the build error.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 9ba9e85f 25-May-2015 Michal Simek <michal.simek@amd.com>

net: Fix NET_RANDOM_ETHADDR dependencies

NET_RANDOM_ETHADDR depends on lib/rand.c. This patch adds dependency to
Kconfig to ensure that library is also compiled.

Remove the definitions from Blackfin boards' include/configs.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 6501ff62 20-Apr-2015 Przemyslaw Marczak <p.marczak@samsung.com>

lib: Kconfig: add entry for errno_str() function

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1a60650c 21-Apr-2015 Joe Hershberger <joe.hershberger@ni.com>

kconfig: Move REGEX to Kconfig

Having this as a Kconfig allows it to be a dependent feature.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8156345d 06-Mar-2015 Simon Glass <sjg@chromium.org>

sandbox: Move CONFIG_SYS_VSNPRINTF to Kconfig

Move this over to Kconfig and tidy up.

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

# 94e3c8c4 19-Feb-2015 gaurav rana <gaurav.rana@freescale.com>

crypto/fsl - Add progressive hashing support using hardware acceleration.

Currently only normal hashing is supported using hardware acceleration.
Added support for progressive hashing using hardware.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
Signed-off-by: Gaurav Rana <gaurav.rana@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>

# d9f23c7f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

lib/rsa: Add Kconfig for devices supporting RSA Modular Exponentiation

Kconfig option added for devices which support RSA Verification.
1. RSA_SOFTWARE_EXP
Enables driver for supporting RSA Modular Exponentiation in Software
2. RSA_FREESCALE_EXP
Enables driver for supporting RSA Modular Exponentiation using Freescale specific
driver

The above drivers use RSA uclass

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
(Removed duplicate line in Kconfig comment)

Change-Id: I7663c4d5350e2bfc3dfa2696f70ef777d6ccc6f6

# c4beb22f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

FIT: Modify option FIT_SIGNATURE in Kconfig

For FIT signature based approach to work, RSA library needs to be selected.
The FIT_SIGNATURE option in Kconfig is modified to automatically select RSA.
Selecting RSA compiles the RSA library required for image verification.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 45ccec8f 23-Oct-2014 Masahiro Yamada <masahiroy@kernel.org>

kconfig: move CONFIG_USE_PRIVATE_LIBGCC to Kconfig

The private libgcc is supported only on ARM, MIPS, PowerPC, SH, x86.
Those architectures should "select" HAVE_PRIVATE_LIBGCC and
CONFIG_USE_PRIVATE_LIBGCC should depend on it.

Currently, this option is enabled on Tegra boards and x86 architecture.
Move the definition from header files to Kconfig.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Tested-by: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: Tom Warren <twarren@nvidia.com>

# 8c688bc4 23-Oct-2014 Masahiro Yamada <masahiroy@kernel.org>

kconfig: move CONFIG_SYS_HZ to lib/Kconfig

CONFIG_SYS_HZ is always defined as 1000 in config_fallbacks.h
(but some boards still have redundant definitions).

This commit moves the definition and the document in README to
Kconfig. Since lib/Kconfig can assure that CONFIG_SYS_HZ is 1000,
the sanity check in lib/time.c should be removed.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Reviewed-by: Marek Vasut <marex@denx.de>

# b0928da6 16-Sep-2014 Masahiro Yamada <masahiroy@kernel.org>

kconfig: move CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED to Kconfig

If this option is enabled, the objects under lib/ directory
are compiled with speed optimization, not size optimization.
(Currently, only used by some Blackfin boards.)

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# ed36323f 16-Sep-2014 Masahiro Yamada <masahiroy@kernel.org>

kconfig: add blank Kconfig files

This would be useful to start moving various config options.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# dfe00b34 13-Jul-2023 Manorit Chawdhry <m-chawdhry@ti.com>

lib: Kconfig: k3: Enable SHA512 for fit signature

We are using our custMpk for signing that is a 4096 bit key, 4096 bit
rsa key requires a SHA512 hashing algorithm to be enabled as per the
source. Even though it is not mandated but this is how it works and is
tested.

Enables SHA512 if fit signature is enabled on K3 platforms.

Signed-off-by: Manorit Chawdhry <m-chawdhry@ti.com>

# 0992a90d 04-May-2023 Simon Glass <sjg@chromium.org>

acpi: Create a new Kconfig for ACPI

We have several Kconfig options for ACPI, but all relate to specific
functions, such as generating tables and AML code.

Add a new option which controls including basic ACPI library code,
including the lib/acpi directory. This will allow us to add functions
which are available even if table generation is not supported.

Adjust the command to avoid a build error when ACPIGEN is not enabled.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 94c8da21 22-Mar-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: Fix LMB_MEMORY_REGIONS flag usage

Remove test on CONFIG_LMB_MEMORY_REGIONS introduced by commit
7c1860fce4e3 ("lmb: Fix lmb property's defination under struct lmb").

This code in lmb_init() is strange, because if CONFIG_LMB_USE_MAX_REGIONS
and CONFIG_LMB_MEMORY_REGIONS are not defined, the implicit #else is empty
and the required initialization is not done:
lmb->memory.max = ?
lmb->reserved.max = ?

But this setting is not possible:
- CONFIG_LMB_USE_MAX_REGIONS not defined
- CONFIG_LMB_MEMORY_REGIONS not defined
because CONFIG_LMB_MEMORY_REGIONS and CONFIG_LMB_RESERVED_REGIONS are
defined as soon as the CONFIG_LMB_USE_MAX_REGIONS is not defined.

This patch removes this impossible case #elif and I add some
explanation in lmb.h to explain why in the struct lmb {} the lmb
property is defined if CONFIG_LMB_MEMORY_REGIONS is NOT defined.

This patch also removes CONFIG_LMB_XXX dependency on CONFIG_LMB as these
defines are used in API file lmb.h and not only in library file.

Fixes: 5e2548c1d6e03 ("lmb: Fix LMB_MEMORY_REGIONS flag usage")
Reported-by: Mark Millard <marklmi@yahoo.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Acked-by: Michal Simek <michal.simek@amd.com>

# c61df340 18-Mar-2023 Marek Vasut <marek.vasut+renesas@mailbox.org>

lib: Fix SYS_TIMER_COUNTS_DOWN description in Kconfig

The SYS_TIMER_COUNTS_DOWN description contains a typo,
s@rathe@&r@ , fix it.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>

# 3b510807 22-Feb-2023 Simon Glass <sjg@chromium.org>

lib: Add an SPL config for LIB_UUID

This is selected by PARTITION_UUIDS which has a separate option for SPL.
Add an SPL option for LIB_UUID also, so that we can keep them consistent.

Also add one for PARTITION_TYPE_GUID to avoid a build error in part_efi.c
which wants to call a uuid function in SPL.

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

# 5a6bc166 22-Feb-2023 Simon Glass <sjg@chromium.org>

lib: Add VPL options for SHA1 and SHA256

Add these options so these algorithms can be used in VPL.

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

# ae625d92 22-Feb-2023 Simon Glass <sjg@chromium.org>

lib: Add a Kconfig for SPL_BZIP2

This is implicitly used in the source and seems useful, so add it.

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

# c33425c6 15-Jan-2023 Simon Glass <sjg@chromium.org>

trace: Reduce the default for TRACE_EARLY_CALL_DEPTH_LIMIT

This is a silly value at present, since U-Boot's call depth never reaches
200. Fix it.

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

# 2dc16a2c 19-Jan-2023 Sjoerd Simons <sjoerd@collabora.com>

Bump LMB_MAX_REGIONS default to 16

Since commit 06d514d77c37 ("lmb: consider EFI memory map") the EFI regions
are also pushed into the lmb if EFI_LOADER is enabled (which is by
default on most system). Which can cause the number of entries to go
over the maximum as it's default is only 8.

Specifically i ran into this case on an TI am62 which has an fdt with
4 reserved regions (in practice 3 lmb entries due to adjecent ranges).

As this is likely to impact more devices bump the default max
regions to 16 so there is a bit more slack.

Fixes: 06d514d77c ("lmb: consider EFI memory map")
Link: https://bugzilla.opensuse.org/show_bug.cgi?id=1207562
Reviewed-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Signed-off-by: Sjoerd Simons <sjoerd@collabora.com>
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
[trini: collect tags from the other equivalent patch]

# 948d3999 08-Feb-2023 Tom Rini <trini@konsulko.com>

Revert "lmb: Default to not-LMB_USE_MAX_REGIONS"

As explained by Philippe Schenker, I was misinterpreting what happened
in the case where we do not set LMB_USE_MAX_REGIONS and so had
re-introduced the problem I was attempting to more widely resolve.

This reverts commit 007ae5d108a37564905ea1588cb279f3a522cc3d.

Reported-by: Philippe Schenker <philippe.schenker@toradex.com>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 007ae5d1 25-Jan-2023 Tom Rini <trini@konsulko.com>

lmb: Default to not-LMB_USE_MAX_REGIONS

The LMB code allows for picking a hard limit on the number of regions it
can know of, or to dynamically allocate these regions. The reason for
this choice is to allow for the compiler to perform a size optimization
in the common case. This optimization however, is very small, ranging
from 196 bytes to 15 bytes saved, or in some cases, being larger. Now
that we also have more regions covered by LMB (in order to protect
various parts of our self at run time), the default of 8 is also much
easier to hit and leads to non-obvious error messages (which imply that
an area is protected, not that we're out of areas to add to the list).

Switch to the dynamic use as the default.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 53c47c59 19-Jan-2023 Tom Rini <trini@konsulko.com>

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


# 4b9b25d9 12-Jan-2023 Brandon Maier <brandon.maier@collins.com>

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

[1] https://github.com/torvalds/linux/commit/e0c1b49f5b674cca7b10549c53b3791d0bbc90a8
[2] https://github.com/facebook/zstd/blob/f302ad8811643c428c4e3498e28f53a0578020d3/lib/libzstd.mk#L31

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>

# ebc1d50a 21-Dec-2022 Simon Glass <sjg@chromium.org>

Revert "fdtdec: drop needlessly convoluted CONFIG_PHANDLE_CHECK_SEQ"

The fdt_path_offset() function is slow since it must scan the tree.
This substantial overhead now applies to all boards.

The original code may not be ideal but it is fit for purpose and is only
needed on a few boards.

Reverting this reduces time to set up driver model by about 30ms.

Before revert:

Accumulated time:
47,170 dm_r
53,237 dm_spl
572,986 dm_f

Accumulated time:
44,598 dm_r
50,347 dm_spl
549,133 dm_f

This reverts commit 26f981f295d00351b6f0c69b5317b254b2361cc0.

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

# 12619d4e 21-Dec-2022 Simon Glass <sjg@chromium.org>

trace: Don't require TIMER_EARLY

Some platforms cannot honour this and don't need trace before relocation.
Use 'imply' instead, so boards can disable this.

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

# 0c16fca9 07-Jan-2023 Simon Glass <sjg@chromium.org>

tpm: Add a proper Kconfig option for crc8 in SPL

The current approach is a bit of a hack and only works for the tpm
subsystem. Add a Kconfig so that crc8 can be enabled in SPL for other
purposes.

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

# 14f43797 19-Dec-2022 Tom Rini <trini@konsulko.com>

Merge tag 'v2023.01-rc4' into next

Prepare v2023.01-rc4

Signed-off-by: Tom Rini <trini@konsulko.com>


# ae3527f0 07-Dec-2022 Kautuk Consul <kconsul@ventanamicro.com>

arch/riscv: add semihosting support for RISC-V

We add RISC-V semihosting based serial console for JTAG based early
debugging.

The RISC-V semihosting specification is available at:
https://github.com/riscv/riscv-semihosting-spec/blob/main/riscv-semihosting-spec.adoc

Signed-off-by: Anup Patel <apatel@ventanamicro.com>
Signed-off-by: Kautuk Consul <kconsul@ventanamicro.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>

# 1c03ab9f 07-Dec-2022 Kautuk Consul <kconsul@ventanamicro.com>

lib: Add common semihosting library

We factor out the arch-independent parts of the ARM semihosting
implementation as a common library so that it can be shared
with RISC-V.

Signed-off-by: Kautuk Consul <kconsul@ventanamicro.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>

# 3b8dfc42 16-Nov-2022 Tom Rini <trini@konsulko.com>

Convert CONFIG_SYS_TIMER_COUNTS_DOWN to Kconfig

This converts the following to Kconfig:
CONFIG_SYS_TIMER_COUNTS_DOWN

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 86794052 21-Oct-2022 Sughosh Ganu <sughosh.ganu@linaro.org>

FWU: Add support for the FWU Multi Bank Update feature

The FWU Multi Bank Update feature supports updating firmware images
to one of multiple sets(also called banks) of images. The firmware
images are clubbed together in banks, with the system booting images
from the active bank. Information on the images such as which bank
they belong to is stored as part of the metadata structure, which is
stored on the same storage media as the firmware images on a dedicated
partition.

At the time of update, the metadata is read to identify the bank to
which the images need to be flashed(update bank). On a successful
update, the metadata is modified to set the updated bank as active
bank to subsequently boot from.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

# 40ed7be4 02-Aug-2022 Tom Rini <trini@konsulko.com>

Convert CONFIG_SYS_FDT_PAD to Kconfig

This converts the following to Kconfig:
CONFIG_SYS_FDT_PAD

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e67ffb5a 22-Jul-2022 Sughosh Ganu <sughosh.ganu@linaro.org>

tpm: rng: Add driver model interface for TPM RNG device

The TPM device has a builtin random number generator(RNG)
functionality. Expose the RNG functions of the TPM device to the
driver model so that they can be used by the EFI_RNG_PROTOCOL if the
protocol is installed.

Also change the function arguments and return type of the random
number functions to comply with the driver model api.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

# b340199f 10-Jun-2022 Tom Rini <trini@konsulko.com>

spl: Ensure all SPL symbols in Kconfig have some SPL dependency

Tighten up symbol dependencies in a number of places. Ensure that a SPL
specific option has at least a direct dependency on SPL. In places
where it's clear that we depend on something more specific, use that
dependency instead. This means in a very small number of places we can
drop redundant dependencies.

Reported-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 13ce351b 08-Jun-2022 Tom Rini <trini@konsulko.com>

vpl: Ensure all VPL symbols in Kconfig have some VPL dependency

Tighten up symbol dependencies in a number of places. Ensure that a VPL
specific option has at least a direct dependency on VPL. In places
where it's clear that we depend on something more specific, use that
dependency instead.

Reported-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 8bea4bf7 08-Jun-2022 Tom Rini <trini@konsulko.com>

tpl: Ensure all TPL symbols in Kconfig have some TPL dependency

Tighten up symbol dependencies in a number of places. Ensure that a TPL
specific option has at least a direct dependency on TPL. In places
where it's clear that we depend on something more specific, use that
dependency instead.

Reported-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 26f981f2 19-May-2022 Rasmus Villemoes <rasmus.villemoes@prevas.dk>

fdtdec: drop needlessly convoluted CONFIG_PHANDLE_CHECK_SEQ

Asking if the alias we found actually points at the device tree node
we passed in (in the guise of its offset from blob) can be done simply
by asking if the fdt_path_offset() of the alias' path is identical to
offset.

In fact, the current method suffers from the possibility of false
negatives: dtc does not necessarily emit a phandle property for a node
just because it is referenced in /aliases; it only emits a phandle
property for a node if it is referenced in <angle brackets>
somewhere. So if both the node we passed in and the alias node we're
considering don't have phandles, fdt_get_phandle() returns 0 for both.

Since the proper check is so simple, there's no reason to hide that
behind a config option (and if one really wanted that, it should be
called something else because there's no need to involve phandle in
the check).

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Acked-by: Aswath Govindraju <a-govindraju@ti.com>

# d30924f1 01-May-2022 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: fix selection of CONFIG_CHARSET

lib/charset.c is not optional for
EFI_APP || EFI_LOADER || UFS || UT_UNICODE.
These must select CONFIG_CHARSET.

Fixes: 726cd9836db0 ("efi: Make unicode printf available to the app")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>

# 747093dd 30-Apr-2022 Simon Glass <sjg@chromium.org>

vpl: Add Kconfig options for VPL

Add VPL versions of commonly used Kconfig options.

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

# 11232139 06-Apr-2022 Tom Rini <trini@konsulko.com>

nds32: Remove the architecture

As removal of nds32 has been ack'd for the Linux kernel, remove support
here as well.

Cc: Rick Chen <rick@andestech.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Rick Chen <rick@andestech.com>

# fd210fee 28-Mar-2022 Philippe Reynes <philippe.reynes@softathome.com>

lib: allow to build asn1 decoder and oid registry in SPL

This commit adds the options:
- SPL_ASN1_DECODER
- SPL_OID_REGISTRY

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>

# 7d44a985 28-Mar-2022 Philippe Reynes <philippe.reynes@softathome.com>

lib: Kconfig: enhance the help of OID_REGISTRY

Enhance the help for the config OID_REGISTRY.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>

# a0e71d96 28-Mar-2022 Philippe Reynes <philippe.reynes@softathome.com>

lib: Kconfig: enhance help for ASN1

Enhance the help for configs ASN1_COMPILER
and ASN1_decoder.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>

# 761a1786 27-Jan-2022 Tom Rini <trini@konsulko.com>

Merge tag 'dm-pull-26jan22' of https://source.denx.de/u-boot/custodians/u-boot-dm

acpi refactoring to allow non-x86 use
binman support for bintools (binary tools)
minor tools improvements in preparation for FDT signing
various minor fixes and improvements


# 334a9b9d 25-Nov-2021 Loic Poulain <loic.poulain@linaro.org>

lib/circbuf: Make circbuf selectable symbol

It is currenly only used from usbtty driver but make it properly
selectable via Kconfig symbol, for future usage.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>

# e1722fcb 01-Dec-2021 Simon Glass <sjg@chromium.org>

x86: Allow any arch to generate ACPI tables

These have sadly found their way to ARM now. Allow any arch to support
generating ACPI tables.

Disable this for the tools build.

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

# 7c3fd5c2 26-Dec-2021 Qu Wenruo <wqu@suse.com>

lib: add BLAKE2 hash support

The code is cross-ported from BLAKE2 reference implementation
(https://github.com/BLAKE2/BLAKE2).

With minimal change to remove unused macros/features.

Currently there is only one user inside U-boot (btrfs), and since it
only utilize BLAKE2B, all other favors are all removed.

Signed-off-by: Qu Wenruo <wqu@suse.com>
[trini: Rename ROUND to R to avoid clash with <linux/bitops.h>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 97f2a749 04-Jan-2022 Eugen Hristev <eugen.hristev@collabora.com>

lib: Kconfig: fix PHANDLE_CHECK_SEQ position outside of menu

CONFIG_PHANDLE_CHECK_SEQ is outside of the menu 'Library routines'
thus it's invisible in menuconfig and cannot be selected.
Fix this by moving the 'endmenu' after the PHANDLE_CHECK_SEQ definition

Fixes: c589132a1d ("fdt: Use phandle to distinguish DT nodes with same name")
Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
Reviewed-by: Aswath Govindraju <a-govindraju@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 726cd983 29-Dec-2021 Simon Glass <sjg@chromium.org>

efi: Make unicode printf available to the app

This is needed to show unicode strings. Enable this code in the app.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>

# 6405ab7a 24-Nov-2021 Simon Glass <sjg@chromium.org>

Convert CONFIG_PHYSMEM to Kconfig

This converts the following to Kconfig:
CONFIG_PHYSMEM

Signed-off-by: Simon Glass <sjg@chromium.org>
Suggested-by: Sean Anderson <seanga2@gmail.com>

# ac7606af 14-Nov-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

lmb: fix typo 'commun'

%s/commun/common/

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

# e7d285b2 25-Sep-2021 Simon Glass <sjg@chromium.org>

image: Use the correct checks for CRC32

Add a host Kconfig for CRC32. With this we can use CONFIG_IS_ENABLED(CRC32)
directly in the host build, so drop the unnecessary indirection.

Add a few more conditions to SPL_CRC32 to avoid build failures as well as
TPL_CRC32. Also update hash.c to make crc32 optional and to actually take
notice of SPL_CRC32.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# 2c21256b 25-Sep-2021 Simon Glass <sjg@chromium.org>

hash: Use Kconfig to enable hashing in host tools and SPL

At present when building host tools, we force CONFIG_SHAxxx to be enabled
regardless of the board Kconfig setting. This is done in the image.h
header file.

For SPL we currently just assume the algorithm is desired if U-Boot proper
enables it.

Clean this up by adding new Kconfig options to enable hashing on the host,
relying on CONFIG_IS_ENABLED() to deal with the different builds.

Add new SPL Kconfigs for hardware-accelerated hashing, to maintain the
current settings.

This allows us to drop the image.h code and the I_WANT_MD5 hack.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# 603d15a5 25-Sep-2021 Simon Glass <sjg@chromium.org>

spl: cypto: Bring back SPL_ versions of SHA

Unfortunately these were removed by mistake. This means that adding hash
support to SPL brings in all software algorithms, with a substantial
increase in code size.

The origin of the problem was renaming them to SPL_FIT_xxx and then these
were removed altogether in a later commit.

Add them back. This aligns with CONFIG_MD5, for example, which has an SPL
variant.

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: f5bc9c25f31 ("image: Rename SPL_SHAxxx_SUPPORT to SPL_FIT_SHAxxx")
Fixes: eb5171ddec9 ("common: Remove unused CONFIG_FIT_SHAxxx selectors")
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# 6674edaa 16-Sep-2021 Tom Rini <trini@konsulko.com>

Merge tag 'v2021.10-rc4' into next

Prepare v2021.10-rc4

Signed-off-by: Tom Rini <trini@konsulko.com>

# gpg: Signature made Tue 14 Sep 2021 06:58:32 PM EDT
# gpg: using RSA key 1A3C7F70E08FAB1707809BBF147C39FF9634B72C
# gpg: Good signature from "Thomas Rini <trini@konsulko.com>" [ultimate]

# Conflicts:
# board/Arcturus/ucp1020/spl.c
# cmd/mvebu/Kconfig
# common/Kconfig.boot
# common/image-fit.c
# configs/UCP1020_defconfig
# configs/sifive_unmatched_defconfig
# drivers/pci/Kconfig
# include/configs/UCP1020.h
# include/configs/sifive-unmatched.h
# lib/Makefile
# scripts/config_whitelist.txt


# 5145bc73 01-Sep-2021 Oleksandr Suvorov <oleksandr.suvorov@foundries.io>

lib: fix typos in Kconfig

There are trivial typos in the Kconfig file. Fixed them.
Also, fixed grammar in the descriptions with typos.

Fixes: d56b4b1974 ("configs: Migrate RBTREE, LZO, CMD_MTDPARTS, CMD_UBI and CMD_UBIFS")
Fixes: 7264f2928b ("spl: fit: Eanble GZIP support for image decompression")
Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# e60e4499 02-Sep-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

lib: Drop SHA512_ALGO in lieu of SHA512

SHA512_ALGO was used as a "either SHA512 or SHA384", although the
implementations of these two algorithms share a majority of code.

From a Kconfig interface perspective, it makes sense to present two
distinct options. This requires #ifdefing out the SHA512
implementation from sha512.c. The latter doesn't make any sense.

It's reasonable to say in Kconfig that SHA384 depends on SHA512, and
seems to be the more polite way to handle the selection.

Thus, automatically select SHA512 when SHA384 is enabled.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# b4c2c151 27-Aug-2021 Michal Simek <michal.simek@amd.com>

Kconfig: Remove all default n/no options

default n/no doesn't need to be specified. It is default option anyway.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
[trini: Rework FSP_USE_UPD portion]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 928a8be7 29-Jul-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

lib: ecdsa: Implement UCLASS_ECDSA verification on target

Implement the crypto_algo .verify() function for ecdsa256. Because
it backends on UCLASS_ECDSA, this change is focused on parsing the
keys from devicetree and passing this information to the specific
UCLASS driver.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# fa3f1f1d 24-Jul-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: disable CONFIG_SPL_HEXDUMP by default

CONFIG_HEXDUMP is needed to display UEFI variables using 'printenv -e'.

Enabling CONFIG_SPL_HEXDUMP only makes sense for debugging purposes.
Hence CONFIG_SPL_HEXDUMP should not be enabled by default.

The following boards currently have CONFIG_SPL_HEXDUMP=y. This includes
boards that don't use SPL at all.

axm_defconfig
imx8mm-cl-iot-gate_defconfig
imx8mm_venice_defconfig
imxrt1020-evk_defconfig
imxrt1050-evk_defconfig
kontron_sl28_defconfig
kp_imx53_defconfig
lx2160ardb_tfa_stmm_defconfig
mt7622_rfb_defconfig
octeon_ebb7304_defconfig
octeon_nic23_defconfig
qemu_arm64_defconfig
qemu_arm_defconfig
qemu-riscv32_defconfig
qemu-riscv32_smode_defconfig
qemu-riscv64_defconfig
qemu-riscv64_smode_defconfig
qemu-x86_64_defconfig
qemu-x86_defconfig
sandbox64_defconfig
sandbox_defconfig
stm32mp15_basic_defconfig
stm32mp15_trusted_defconfig
synquacer_developerbox_defconfig
taurus_defconfig
xilinx_versal_virt_defconfig

The patch only keeps it enabled on

sandbox_spl_defconfig

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 1a46cb6c 02-Jul-2021 Simon Glass <sjg@chromium.org>

lib: Create a new Kconfig option for charset conversion

Rather than looking at two KConfig options in the Makefile, create a new
Kconfig option for compiling lib/charset.c

Enable it for UFS also, which needs this support.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 26dd9936 08-Jul-2021 Steffen Jaeckel <jaeckel-floss@eyet-services.de>

lib: add crypt subsystem

Add the basic functionality required to support the standard crypt
format.
The files crypt-sha256.c and crypt-sha512.c originate from libxcrypt and
their formatting is therefor retained.
The integration is done via a crypt_compare() function in crypt.c.

```
libxcrypt $ git describe --long --always --all
tags/v4.4.17-0-g6b110bc
```

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 7d0f3fbb 11-Jun-2021 Tero Kristo <t-kristo@ti.com>

lib: rational: copy the rational fraction lib routines from Linux

Copy the best rational approximation calculation routines from Linux.
Typical usecase for these routines is to calculate the M/N divider
values for PLLs to reach a specific clock rate.

This is based on linux kernel commit:
"lib/math/rational.c: fix possible incorrect result from rational
fractions helper"
(sha1: 323dd2c3ed0641f49e89b4e420f9eef5d3d5a881)

Signed-off-by: Tero Kristo <t-kristo@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Tero Kristo <kristo@kernel.org>

# ec0512b1 24-May-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

Revert "lib: introduce HASH_CALCULATE option"

When we think of Kconfig, we usually think of features that we like
to enable or not. Ideally, we wouldn't use Kconfig to fix a build
issue, although sometimes it might make sense. With Kconfig it's hard
to guarantee that the fix is universal. We can only say that it works
for the set of tested configurations. In the majority of cases, it's
preferable to let the linker figure things out for us.

The reverted commit attempted to fix a build issue by adding an
invisible Kconfig option. This is wrong in several ways:

It invents a new Kconfig variable when CONFIG_HASH already
exists for the same purpose.
Second, hash-checksum.c makes use of the hash_progressive_lookup_algo()
symbol, which is only provided with CONFIG_HASH, but this dependency
was not expressed in the reverted patch.

It feels like Kconfig is turning into a listing of all available
source files, and a buffet to 'select' which ones to compile. The
purpose of this revert is to enable the next change to make use of
CONFIG_HASH instead of adding to Kconfig.

This reverts commit 87316da05f2fd49d3709275e64ef0c5980366ade.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Acked-by: Masahisa Kojima <masahisa.kojima@linaro.org>

# 1621d3c4 10-May-2021 Bin Meng <bmeng.cn@gmail.com>

lib: kconfig: Limit BINMAN_FDT for OF_SEPARATE or OF_EMBED

Generally speaking BINMAN_FDT makes sense for OF_SEPARATE or OF_EMBED.
For the other OF_CONTROL methods, it's quite possible binman node is
not available as binman is invoked during the build phase instead of
runtime. Let's only turn it on for OF_SEPARATE or OF_EMBED by default.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 87316da0 13-May-2021 Masahisa Kojima <masahisa.kojima@linaro.org>

lib: introduce HASH_CALCULATE option

Build error occurs when CONFIG_EFI_SECURE_BOOT or
CONFIG_EFI_CAPSULE_AUTHENTICATE is enabled,
because hash-checksum.c is not compiled.

Since hash_calculate() implemented in hash-checksum.c can be
commonly used aside from FIT image signature verification,
this commit itroduces HASH_CALCULATE option to decide
if hash-checksum.c shall be compiled.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# e2ae483c 13-May-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

hash: Kconfig option for SHA512 hardware acceleration

Commit a479f103dc1c ("hash: Allow for SHA512 hardware implementations")
defined function definitions for hardware accelerated SHA384 and SHA512.
If CONFIG_SHA_HW_ACCEL=y, these functions are used.

We already have boards using CONFIG_SHA_HW_ACCEL=y but none implements the
new functions hw_sha384() and hw_sha512().

For implementing the EFI TCG2 protocol we need SHA384 and SHA512. The
missing hardware acceleration functions lead to build errors on boards like
peach-pi_defconfig.

Introduce a new Kconfig symbol CONFIG_SHA512_HW_ACCEL to control if the
functions hw_sha384() and hw_sha512() shall be used to implement the SHA384
and SHA512 algorithms.

Fixes: a479f103dc1c ("hash: Allow for SHA512 hardware implementations")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

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

# 6d66502b 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: Add 2 config to define the max number of regions

Add 2 configs CONFIG_LMB_MEMORY_REGIONS and CONFIG_LMB_RESERVED_REGIONS
to change independently the max number of the regions in lmb
library.

When CONFIG_LMB_USE_MAX_REGIONS=y, move the lmb property arrays to
struct lmb and manage the array size with the element 'max' of struct
lmb_region; their are still allocated in stack.

When CONFIG_LMB_USE_MAX_REGIONS=n, keep the current location in
struct lmb_region to allow compiler optimization.

Increase CONFIG_LMB_RESERVED_REGIONS is useful to avoid lmb errors in
bootm when the number of reserved regions (not adjacent) is reached:
+ 1 region for relocated U-Boot
+ 1 region for initrd
+ 1 region for relocated linux device tree
+ reserved memory regions present in Linux device tree.

The current limit of 8 regions is reached with only 5 reserved regions
in DT.

see Linux kernel commit bf23c51f1f49 ("memblock: Move memblock arrays
to static storage in memblock.c and make their size a variable")

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# 4fa0150d 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: move MAX_LMB_REGIONS value in Kconfig

Move MAX_LMB_REGIONS value in Kconfig, the max number of the regions
in lmb library.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# 77b8cfef 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: move CONFIG_LMB in Kconfig

Migrate CONFIG_LMB in Kconfig.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# a479f103 16-Feb-2021 Joel Stanley <joel@jms.id.au>

hash: Allow for SHA512 hardware implementations

Similar to support for SHA1 and SHA256, allow the use of hardware hashing
engine by enabling the algorithm and setting CONFIG_SHA_HW_ACCEL /
CONFIG_SHA_PROG_HW_ACCEL.

Signed-off-by: Joel Stanley <joel@jms.id.au>

# f2c1442e 14-Mar-2021 Simon Glass <sjg@chromium.org>

bloblist: Make BLOBLIST_TABLES depend on BLOBLIST

Add an extra condition here since we cannot put x86 tables in a bloblist
when bloblists are not supported.

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

# e0103158 25-Feb-2021 Bin Meng <bmeng.cn@gmail.com>

lib: kconfig: Mention CONFIG_ADDR_MAP limitation in the help

Mention that CONFIG_ADDR_MAP only works in the post-relocation phase.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>

# 56e7257c 03-Feb-2021 Bin Meng <bmeng.cn@gmail.com>

lib: Fix BINMAN_FDT dependency

lib/binman.c references the following 3 ofnode APIs:
ofnode_first_subnode(), ofnode_path() and ofnode_read_bool().

These APIs get built only when DM is on. Fix the dependency then.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 59e4e391 18-Jan-2021 Tom Rini <trini@konsulko.com>

Merge https://gitlab.denx.de/u-boot/custodians/u-boot-riscv

- Update qemu-riscv.rst build instructions.
- Add support for SPI on Kendryte K210.
- Add Microchip PolarFire SoC Icicle Kit support.
- Add support for an early timer.
- Select TIMER_EARLY to avoid infinite recursion for Trace.


# a80f8513 17-Jan-2021 Pragnesh Patel <pragnesh.patel@sifive.com>

trace: select TIMER_EARLY to avoid infinite recursion

When tracing functions is enabled this adds calls to
__cyg_profile_func_enter() and __cyg_profile_func_exit() to the traced
functions.

__cyg_profile_func_enter() and __cyg_profile_func_exit() invoke
timer_get_us() to record the entry and exit time.

initr_dm() will make gd->dm_root = NULL and gd->timer = NULL, so
timer_get_us() -> get_ticks() -> dm_timer_init() will lead to an
indefinite recursion.

So select TIMER_EARLY when tracing got enabled.

Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Rick Chen <rick@andestech.com>

# 6205bbb1 04-Jan-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lib: cosmetic update of CONFIG_LIB_ELF description

Change 2 typo error in CONFIG_LIB_ELF description:
- Supoort => Support
- fir => for

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c589132a 02-Dec-2020 Aswath Govindraju <a-govindraju@ti.com>

fdt: Use phandle to distinguish DT nodes with same name

While assigning the sequence number to subsystem instances by reading the
aliases property, only DT nodes names are compared and not the complete
path. This causes a problem when there are two DT nodes with same name but
have different paths.

In arch/arm/dts/k3-am65-main.dtsi there are two USB controllers with the
same device tree node name but different path. When aliases are defined for
these USB controllers then fdtdec_get_alias_seq() fails to pick the correct
instance for a given index.

fdt_path_offset() function is slow and this would effect the U-Boot
startup. To avert the time penalty on all boards, apply this extra check
only when required by using a config option.

Fix it by comparing the phandles of DT nodes after the node names match,
under a config option.

Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Fix whitespace error in Kconfig:
Signed-off-by: Simon Glass <sjg@chromium.org>

# 28cef9ca 19-Nov-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

fs: fat: create correct short names

The current function set_name() used to create short names has the
following deficiencies resolved by this patch:

* Long names (e.g. FOO.TXT) are stored even if a short name is enough.
* Short names with spaces are created, e.g. "A ~1.TXT".
* Short names with illegal characters are created, e.g. "FOO++BAR".
* Debug output does not not consider that the short file name has no
concluding '\0'.

The solution for the following bug is split of into a separate patch:

* Short file names must be unique.

This patch only provides the loop over possible short file names.

Fixes: c30a15e590c ("FAT: Add FAT write feature")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# e4f8e543 05-Nov-2020 Simon Glass <sjg@chromium.org>

smbios: Drop the unused Kconfig options

Now that we can use devicetree to specify this information, drop the old
CONFIG options.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 44c74bdd 05-Nov-2020 Simon Glass <sjg@chromium.org>

sysinfo: Provide a default driver to set SMBIOS values

Some boards want to specify the manufacturer or product name but do not
need to have their own sysinfo driver.

Add a default driver which provides a way to specify this SMBIOS
information in the devicetree, without needing any board-specific
functionality.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d2cb7a22 04-Nov-2020 Simon Glass <sjg@chromium.org>

x86: Allow putting some tables in the bloblist

At present all tables are placed starting at address f0000 in memory, and
can be up to 64KB in size. If the tables are very large, this may not
provide enough space.

Also if the tables point to other tables (such as console log or a ramoops
area) then we must allocate other memory anyway.

The bloblist is a nice place to put these tables since it is contiguous,
which makes it easy to reserve this memory for linux using the 820 tables.

Add an option to put some of the tables in the bloblist. For SMBIOS and
ACPI, create suitable pointers from the f0000 region to the new location
of the tables.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
[bmeng: squashed in http://patchwork.ozlabs.org/project/uboot/patch/
20201105062407.1.I8091ad931cbbb5e3b6f6ababdf3f8d5db0d17bb9@changeid/]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# 415eab06 03-Nov-2020 Christian Gmeiner <christian.gmeiner@gmail.com>

smbios: add parsing API

Add a very simple API to be able to access SMBIOS strings
like vendor, model and bios version.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 72eda507 27-Oct-2020 Sean Anderson <seanga2@gmail.com>

lib: Add getopt

Some commands can get very unweildy if they have too many positional
arguments. Adding options makes them easier to read, remember, and
understand.

This implementation of getopt has been taken from barebox, which has had
option support for quite a while. I have made a few modifications to their
version, such as the removal of opterr in favor of a separate getopt_silent
function. In addition, I have moved all global variables into struct
getopt_context.

The getopt from barebox also re-orders the arguments passed to it so that
non-options are placed last. This allows users to specify options anywhere.
For example, `ls -l foo/ -R` would be re-ordered to `ls -l -R foo/` as
getopt parsed the options. However, this feature conflicts with the const
argv in cmd_tbl->cmd. This was originally added in 54841ab50c ("Make sure
that argv[] argument pointers are not modified."). The reason stated in
that commit is that hush requires argv to stay unmodified. Has this
situation changed? Barebox also uses hush, and does not have this problem.
Perhaps we could use their fix?

I have assigned maintenance of getopt to Simon Glass, as it is currently
only used by the log command. I would also be fine maintaining it.

Signed-off-by: Sean Anderson <seanga2@gmail.com>

# 26637e2e 12-Sep-2020 Simon Glass <sjg@chromium.org>

lib: Allow hexdump to be used in SPL

It is sometimes useful to output hex dumps in SPL. Add a config option to
allow this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# e87dfb05 05-Aug-2020 Andrii Anisov <andrii_anisov@epam.com>

lib: sscanf: add sscanf implementation

Port sscanf implementation from mini-os and introduce new
Kconfig option to enable it: CONFIG_SSCANF. Disable by default.

Signed-off-by: Andrii Anisov <andrii_anisov@epam.com>
Signed-off-by: Anastasiia Lukianenko <anastasiia_lukianenko@epam.com>
Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>

# 81014f73 30-Jul-2020 Joao Marcos Costa <joaomarcos.costa@bootlin.com>

include/u-boot, lib/zlib: add sources for zlib decompression

Add zlib (v1.2.11) uncompr() function to U-Boot. SquashFS depends on
this function to decompress data from a raw disk image. The actual
support for zlib into SquashFS sources will be added in a follow-up
commit.

Signed-off-by: Joao Marcos Costa <joaomarcos.costa@bootlin.com>

# 69be8fd1 03-Jun-2020 Marek Szyprowski <m.szyprowski@samsung.com>

powerpc: move ADDR_MAP to Kconfig

Move ADDR_MAP related config options from include/configs/*.h to the
proper place in lib/Kconfig. This has been done using
./tools/moveconfig.py and manual inspection of the generated changes.
This is a preparation to use ADDR_MAP helper on ARM 32bit Raspberry Pi4
board for mapping the PCIe XHCI MMIO, which is above the 4GiB identity
mapping limit.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# d16b38f4 15-Apr-2020 Reuben Dowle <reubendowle0@gmail.com>

Add support for SHA384 and SHA512

The current recommendation for best security practice from the US government
is to use SHA384 for TOP SECRET [1].

This patch adds support for SHA384 and SHA512 in the hash command, and also
allows FIT images to be hashed with these algorithms, and signed with
sha384,rsaXXXX and sha512,rsaXXXX

The SHA implementation is adapted from the linux kernel implementation.

[1] Commercial National Security Algorithm Suite
http://www.iad.gov/iad/programs/iad-initiatives/cnsa-suite.cfm

Signed-off-by: Reuben Dowle <reuben.dowle@4rf.com>

# 43e442a5 26-May-2020 Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

kconfig: fix some typos

Signed-off-by: Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

# eff5a547 22-May-2020 Michael Walle <michael@walle.cc>

cmd: zip: automatically pull in gzip()

Move the CONFIG_GZIP_COMPRESSED from a config.h macro to a Kconfig menu
item. It is not selectable by a user because there is no reason to do
so. Instead it will be automatically selected by the stuff which uses
gzip(), like the zip command.

Remove it from the config_whitelist.txt. Also remove
CONFIG_GZIP_COMPRESS_DEF_SZ as this was never used on any board. The
default seems to be sane, otherwise it should be added as a Kconfig
option.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8239be61 06-May-2020 Simon Glass <sjg@chromium.org>

lib: Allow MD5 to be enabled in SPL

At present the MD5 option cannot be enabled by board configs since it has
no Kconfig name. It is generally enabled, so long as FIT support is
present. But not all boards use FIT, particularly in SPL

Fix this and add an option for SPL as well. This allows board code to call
md5() even if FIT support is not enabled.

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

# 04cb3994 21-Apr-2020 Weijie Gao <weijie.gao@mediatek.com>

lib: enable lzma decompression support for SPL build

This patch enables LZMA decompression support for SPL build

Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>

# 2a2119e1 05-Mar-2020 Atish Patra <atishp@atishpatra.org>

lib: kconfig: Add option to set BZIP2 compression method

There is no way to select BZIP2 compression method.
Add it under library/compression config where all other
compression related configs are present.

Signed-off-by: Atish Patra <atish.patra@wdc.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 805b3cac 12-Feb-2020 Keerthy <j-keerthy@ti.com>

lib: elf: Move the generic elf loading/validating functions to lib

Move the generic elf loading/validating functions to lib/
so that they can be re-used and accessed by code existing
outside cmd.

While at it remove the duplicate static version of load_elf_image_phdr
under arch/arm/mach-imx/imx_bootaux.c.

Signed-off-by: Keerthy <j-keerthy@ti.com>
Suggested-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>

# 1611235b 19-Jan-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: Kconfig dependencies for pseudo-random library

drivers/rng/sandbox_rng.c requires rand() to be defined but configuration
option CONFIG_CONFIG_LIB_RAND selected in drivers/rng/Kconfig does not
exist.

test/lib/test_aes.c requires rand() to be defined.

Fix the selection criteria for choice "Pseudo-random library support type".

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 3c10dc95 06-Dec-2019 Simon Glass <sjg@chromium.org>

binman: Add a library to access binman entries

SPL and TPL can access information about binman entries using link-time
symbols but this is not available in U-Boot proper. Of course it could be
made available, but the intention is to just read the device tree.

Add support for this, so that U-Boot can locate entries.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# b4adf627 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: crypto: add x509 parser

Imported from linux kernel v5.3:
x509.asn1 without changes
x509_akid.asn1 without changes
x509_parser.h without changes
x509_cert_parser.c with changes marked as __UBOOT__
x509_public_key.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# a9b45e6e 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add oid registry utility

Imported from linux kernel v5.3:
build_OID_registry without changes
oid_registry.h without changes
oid_registry.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# ab8a0e06 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add asn1 decoder

Imported from linux kernel v5.3:
lib/asn1_decoder.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 2b12196d 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

cmd: add asn1_compiler

Imported from linux kernel v5.3:
asn1.h without changes
asn1_ber_bytecode.h without changes
asn1_decoder.h without changes
asn1_compiler.c without changes

This host command will be used to create a ASN1 parser, for example,
for pkcs7 messages or x509 certificates. More specifically, it will
generate *byte code* which will be interpreted by asn1 decoder library.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 05429b6c 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

rtc: move date.c from drivers/rtc/ to lib/

In the next commit, rtc_mktime(), for compatibility with linux, will be
implemented using rtc_mktime(), which is no longer drivers/rtc specific.
So move this file under lib/.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 37ef1774 10-Nov-2019 Thomas Hebb <tommyhebb@gmail.com>

Kconfig: disambiguate config names for tiny printf

27084c03d36a ("spl: Allow tiny printf() to be controlled in SPL and
TPL") split this option in two for TPL and SPL, but didn't change the
Kconfig names, making them hard to set quickly.

Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>

# 0d76afc0 27-Oct-2019 Simon Glass <sjg@chromium.org>

fdt: Add Kconfig options to control code size

For better or worse libfdt recent grew a lot of code that checks the
validity of the device tree in great detail. When using unsigned or
unverified data this makes things safer, but it does add to code size.

Add some controls to select the trade-off between safety and code size.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 27084c03 25-Sep-2019 Simon Glass <sjg@chromium.org>

spl: Allow tiny printf() to be controlled in SPL and TPL

At present there is only one control for this and it is used for both SPL
and TPL. But SPL might have a lot more space than TPL so the extra cost of
a full printf() might be acceptable.

Split the option into two, providing separate SPL and TPL controls. The
TPL setting defaults to the same as SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2a51e16b 07-Jun-2019 Tom Rini <trini@konsulko.com>

configs: Make USE_TINY_PRINTF depend on SPL||TPL and be default

The USE_TINY_PRINTF symbol only changes things within SPL and TPL
builds, so make it depend on that support. Next, make it default as
within these cases we should rarely have need of more advanced print
formats outside of the debug context.

To do this, in a few cases we need to correct our Kconfig dependencies
as we had cases of non-SPL targets select'ing this symbol. Finally, in
the case of a few boards we really do need the full printf
functionality.

Signed-off-by: Tom Rini <trini@konsulko.com>

# da0fb5fd 02-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: make call depth limit customizable

Up to now we had hard coded values for the call depth up to which trace
records are created: 200 for early tracing, 15 thereafter. UEFI
applications reach a call depth of 80 or above.

Provide customizing settings for the call trace depth limit and the early
call trace depth limit. Use the old values as defaults.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8509f22a 29-Apr-2019 Marek Behún <kabel@kernel.org>

lib: add Zstandard decompression support

Add the zstd library from Linux kernel (only decompression support).
There are minimal changes to build with U-Boot, otherwise the files are
identical to Linux commit dc35da16 from March 2018, the files had not
been touched since in kernel. Also SPDX lincese tags were added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 83a486b6 29-Apr-2019 Marek Behún <kabel@kernel.org>

lib: Add xxhash support

This adds the xxhash support from Linux. Files are almost identical to
those added to Linux in commit 5d240522 ("lib: Add xxhash module") (they
haven't been touched since in Linux). The only difference is to add some
includes to be compatible with U-Boot. Also SPDX lincese tags were
added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 5132361a 29-Apr-2019 Heiko Schocher <hs@denx.de>

lib: Kconfig: fix help text for GZIP

commit 95f4bbd581cf ("lib: fdt: Allow LZO and GZIP DT compression in U-Boot")

introduced Kconfig option for gzip in U-Boot, but help text
says gzip for SPL, which is wrong. Fix this.

Signed-off-by: Heiko Schocher <hs@denx.de>
Acked-by: Marek Vasut <marex@denx.de>

# 1c6eb075 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE_BUFFER_SIZE et al to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE_BUFFER_SIZE
CONFIG_TRACE_EARLY_SIZE
CONFIG_TRACE_EARLY
CONFIG_TRACE_EARLY_ADDR

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

# a24a78d7 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE

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

# 54969b40 21-Mar-2019 Thierry Reding <treding@nvidia.com>

fdtdec: Add Kconfig symbol for tests

Runtime tests are provided as a test_fdtdec command implementation. Add
a Kconfig symbol that allows this command to be built so that the tests
can be used.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 95f4bbd5 08-Mar-2019 Marek Vasut <marex@denx.de>

lib: fdt: Allow LZO and GZIP DT compression in U-Boot

Add required Kconfig symbols, Makefile bits and macro fixes in a
few places to support LZO and DT compression in U-Boot. This can
save a lot of space with multi-DTB fitImages.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>

# 6e705114 13-Jan-2019 Chris Packham <judge.packham@gmail.com>

lib: Kconfig: spelling fixes

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 048c6e89 06-Nov-2018 Simon Glass <sjg@chromium.org>

spl: lz4: Allow use of lz4 compression in SPL

In some cases U-Boot is compressed and it is useful to be able to
decompress it in SPL. Add a Kconfig and Makefile change to allow this.
Note that this does not actually implement decompression.

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

# 2895c4b7 15-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

kconfig: Introduce HAVE_ARCH_IOMAP

Introduce a new Kconfig option for architecture codes to control
whether it provides io{read,write}{8,16,32} I/O accessor functions.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5592a633 01-Oct-2018 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt in TPL

In some cases (e.g. sandbox with verified boot) it is useful to support
libfdt in TPL. Update the Kconfig to handle this.

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

# 6307896c 01-Oct-2018 Simon Glass <sjg@chromium.org>

tpm: Add support for SPL and TPL

At present the tpm can only be used in U-Boot proper. Updated it to work
in SPL and TPL also.

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

# ab948cd2 19-Jul-2018 Masahiro Yamada <masahiroy@kernel.org>

fdt_support: make FDT_FIXUP_PARTITIONS depend on CMD_MTDPARTS

fdt_fixup_mtdparts() calls mtdparts_init() and device_find(),
which are defined in cmd/mtdparts.c

The combination of FDT_FIXUP_PARTITIONS=y and CMD_MTDPARTS=n
emits the following link error:

common/fdt_support.c:903: undefined reference to `mtdparts_init'
common/fdt_support.c:914: undefined reference to `device_find'

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 3330584d 03-Jun-2018 Igor Opaniuk <igor.opaniuk@gmail.com>

avb2.0: integrate avb 2.0 into the build system

Integrate libavb into the build system. Introduce CONFIG_LIBAVB
build option.

Signed-off-by: Igor Opaniuk <igor.opaniuk@linaro.org>

# f8c987f8 05-Jun-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

lib: Add hexdump

Often during debugging session it's very interesting to see
what data we were dealing with. For example what we write or read
to/from memory or peripherals.

This change introduces functions that allow to dump binary
data with one simple function invocation like:
------------------->8----------------
print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, buf, len);
------------------->8----------------

which gives us the following:
------------------->8----------------
00000000: f2 b7 c9 88 62 61 75 64 72 61 74 65 3d 31 31 35 ....baudrate=115
00000010: 32 30 30 00 62 6f 6f 74 61 72 67 73 3d 63 6f 6e 200.bootargs=con
00000020: 73 6f 6c 65 3d 74 74 79 53 33 2c 31 31 35 32 30 sole=ttyS3,11520
00000030: 30 6e 38 00 62 6f 6f 74 64 65 6c 61 79 3d 33 00 0n8.bootdelay=3.
00000040: 62 6f 6f 74 66 69 6c 65 3d 75 49 6d 61 67 65 00 bootfile=uImage.
00000050: 66 64 74 63 6f 6e 74 72 6f 6c 61 64 64 72 3d 39 fdtcontroladdr=9
00000060: 66 66 62 31 62 61 30 00 6c 6f 61 64 61 64 64 72 ffb1ba0.loadaddr
00000070: 3d 30 78 38 32 30 30 30 30 30 30 00 73 74 64 65 =0x82000000.stde
00000080: 72 72 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 rr=serial0@e0022
00000090: 30 30 30 00 73 74 64 69 6e 3d 73 65 72 69 61 6c 000.stdin=serial
000000a0: 30 40 65 30 30 32 32 30 30 30 00 73 74 64 6f 75 0@e0022000.stdou
000000b0: 74 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 30 t=serial0@e00220
000000c0: 30 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00..............
...
------------------->8----------------

Source of hexdump.c was copied from Linux kernel v4.7-rc2.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Mario Six <mario.six@gdsys.cc>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Stefan Roese <sr@denx.de>

# c232d14d 29-May-2018 Alex Kiernan <alex.kiernan@gmail.com>

mmc: Separate "mmc swrite" from fastboot

Introduce CONFIG_IMAGE_SPARSE and CONFIG_CMD_MMC_SWRITE so the "mmc
swrite" command is separated from the fastboot code.

Move image-sparse from common to lib so it's clear it's library code.

Rename CONFIG_FASTBOOT_FLASH_FILLBUF_SIZE to CONFIG_IMAGE_SPARSE_FILLBUF_SIZE
and migrate it to Kconfig.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Acked-by: Jassi Brar <jaswinder.singh@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6417572e 08-May-2018 Tom Rini <trini@konsulko.com>

lib/Kconfig: Mark OF_LIBFDT_OVERLAY as depending on OF_LIBFDT

The overlay code is only useful when OF_LIBFDT is set, so mark it as
depending on that first.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 58a46f88 25-Apr-2018 Praneeth Bajjuri <praneeth@ti.com>

configs: TI: Enable FIT Library overlay support

Enable the FDT library overlay support for all TI SOC family.

Without this option, when Loading fdt from FIT image, the
following warning is seen.

"config with overlays but CONFIG_OF_LIBFDT_OVERLAY not set".

Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
Suggested-by: Andrew F.Davis <afd@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>

# 14ad44ab 18-Apr-2018 Alex Kiernan <alex.kiernan@gmail.com>

spl: Split sprintf, strto* from SPL serial in Kconfig

When SPL serial is disabled, callers who need sprintf or strtoul fail
because their inclusion is guarded by CONFIG_SPL_SERIAL_SUPPORT/
CONFIG_TPL_SERIAL_SUPPORT.

Split printf, sprintf and strto into their own entries and then select
all of them if SERIAL_SUPPORT is enabled to match the current behaviour.

Include panic.o unconditionally as it can be called from anywhere which
uses BUG_ON().

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>

# e294ba06 04-Apr-2018 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-sunxi

Signed-off-by: Tom Rini <trini@konsulko.com>


# d14db11d 03-Apr-2018 Andre Przywara <andre.przywara@arm.com>

sunxi: revert disabling of features

In January some commits were introduced to mitigate the U-Boot image
size issues we encountered on sunxi builds.
Now with the MMC environment removed we can bring them back, as we
practically don't have a size limit anymore.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 32ce6179 13-Mar-2018 Bryan O'Donoghue <bryan.odonoghue@linaro.org>

optee: Add lib entries for sharing OPTEE code across ports

This patch adds code to lib to enable sharing of useful OPTEE code between
board-ports and architectures. The code on lib/optee/optee.c comes from the
TI omap2 port. Eventually the OMAP2 code will be patched to include the
shared code. The intention here is to add more useful OPTEE specific code
as more functionality gets added.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Cc: Harinarayan Bhatta <harinarayan@ti.com>
Cc: Andrew F. Davis <afd@ti.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Kever Yang <kever.yang@rock-chips.com>
Cc: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Cc: Peng Fan <peng.fan@nxp.com>
Tested-by: Peng Fan <peng.fan@nxp.com>

# 36c1877c 06-Feb-2018 Faiz Abbas <faiz_abbas@ti.com>

lib: Kconfig: Move DYNAMIC_CRC_TABLE to Kconfig

Add CONFIG prefix to DYNAMIC_CRC_TABLE and implement it in
Kconfig.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>

# a451bc27 05-Feb-2018 Adam Ford <aford173@gmail.com>

Convert LIB_UUID to Kconfig

config_fallback.h has some logic that checks a variety of options
and selects LIB_UUID if it hasn't already been selected. This
will all LIB_UUID in Kconfig and select this option for the list
of options to allow us to remove the logic from fallbacks

Signed-off-by: Adam Ford <aford173@gmail.com>

# a5a37567 06-Feb-2018 Adam Ford <aford173@gmail.com>

Convert CONFIG LIB_HW_RAND to Kconfig

config_fallbacks.h had some logic to automatically select
LIB_RAND if RANDOM_UUID or CMD_UUID were set if LIB_HW_RAND wasn't
already selected. By migrating LIB_HW_RAND to Kconfig, we can
remove this check from config_fallbacks.h and put it into Kconfig

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
[trini: Turn into a choice, add NET_RANDOM_ETHADDR]
Signed-off-by: Tom Rini <trini@konsulko.com>

# acd4d334 16-Jan-2018 Maxime Ripard <maxime.ripard@free-electrons.com>

net: regex: Disable by default on sunXi

The sunXi arm64 build has overflown, leading to the main U-boot binary
overwriting the environment when flashing the new image, or even worse,
overwriting itself when we're calling saveenv.

Disable this option that is not critical until we can adress the issue
properly.

Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 7e3caa81 03-Dec-2017 Masahiro Yamada <masahiroy@kernel.org>

Move CONFIG_PANIC_HANG to Kconfig

Freescale (NXP) boards have lots of defconfig files per board.
I used "imply PANIC_HANG" for them.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# da5337a6 08-Nov-2017 Nandor Han <nandor.han@ge.com>

rtc: add support for s35392a

Add support for S35392A RTC. The driver supports both U-Boot driver
models.

Signed-off-by: Nandor Han <nandor.han@ge.com>
Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
Cc: Heiko Schocher <hs@denx.de>

# f52bdf4b 14-Sep-2017 Jean-Jacques Hiblot <jjhiblot@ti.com>

lib: allow building lzo for the SPL

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 85d8bf57 03-Sep-2017 Marek Behún <kabel@kernel.org>

lib: Add CRC32-C

This is needed for BTRFS.

Signed-off-by: Marek Behun <marek.behun@nic.cz>

create mode 100644 lib/crc32c.c

# 7264f292 15-Aug-2017 York Sun <york.sun@nxp.com>

spl: fit: Eanble GZIP support for image decompression

Add Kconfig option SPL_GZIP and SPL_ZLIB to enable gunzip support for
SPL boot, eg. falcon boot compressed kernel image.

Signed-off-by: York Sun <york.sun@nxp.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6ef2f901 11-Aug-2017 Adam Ford <aford173@gmail.com>

Convert CONFIG_BCH to Kconfig

This converts the following to Kconfig:
CONFIG_BCH

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1a7ba1d 18-Aug-2017 Anatolij Gustschin <agust@denx.de>

Fix 'notes' typos

s/notes/nodes

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 96b9082c 03-Aug-2017 Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

rockchip: rk3188: rock: adjust for SPL/TPL split

With the changes to split SPL/TPL for the RK3368, I apparently missed
some needed adjustments to the RK3188 Kconfig and rock_defconfig.

This fixes build-issues for the rock board after applying the RK3368
enablement (and SPL/TPL) set that resulted from TPL_SERIAL_SUPPORT,
TPL_ROCKCHIP_BACK_TO_BROM and TPL_TINY_MEMSET being separate symbols
now.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d56b4b19 22-Jul-2017 Tom Rini <trini@konsulko.com>

configs: Migrate RBTREE, LZO, CMD_MTDPARTS, CMD_UBI and CMD_UBIFS

The above CONFIG options are in Kconfig, and now have correct depends and
inter-dependencies. Migrate these to configs/ from include/configs/. In the
case of CMD_UBIFS also change it to be a default y if CMD_UBI.

Signed-off-by: Tom Rini <trini@konsulko.com>

# aed998aa 17-May-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_LZMA to Kconfig

This converts the following to Kconfig:
CONFIG_LZMA

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

# b1a873df 26-Apr-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_CMD_AES et al to Kconfig

This converts the following to Kconfig:
CONFIG_CMD_AES
CONFIG_AES

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Add select AES to CMD_AES]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 173aafbf 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

cmd: Expose a Kconfig option to enable UBIFS commands

Create a new Kconfig entry to allow CMD_UBIFS selection from Kconfig and
add an hidden LZO option that can be selected by CMD_UBIFS.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>

# aa049152 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

mtd: ubi: Select RBTREE option from MTD_UBI Kconfig entry

Expose the RBTREE feature through Kconfig and select this option from the
MTD_UBI option.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>
[Rebased on master]
Signed-off-by: Jagan Teki <jagan@openedev.com>

# ab4458bd 02-Apr-2017 Simon Glass <sjg@chromium.org>

string: Provide a slimmed-down memset()

Most of the time the optimised memset() is what we want. For extreme
situations such as TPL it may be too large. For example on the 'rock'
board, using a simple loop saves a useful 48 bytes. With gcc 4.9 and
the rodata bug, this patch is enough to reduce the TPL image below the
limit.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>

# bea79d7d 14-Mar-2017 Andre Przywara <andre.przywara@arm.com>

Kconfig: introduce md5sum command selection

So far CONFIG_MD5SUM would need to be set by a board's include file.
Since the command is really generic, move it over to Kconfig to allow
it to be defined by either a board's defconfig, menuconfig or some
config snippet merged via mergeconfig.sh.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e663b350 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

smbios: Expose in efi_loader as table

We can pass SMBIOS easily as EFI configuration table to an EFI payload. This
patch adds enablement for that case.

While at it, we also enable SMBIOS generation for ARM systems, since they support
EFI_LOADER.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4b6dddc2 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

x86: Move smbios generation into arch independent directory

We will need the SMBIOS generation function on ARM as well going forward,
so let's move it into a non arch specific location.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# ebf7fff2 05-Oct-2016 Heiko Schocher <hs@denx.de>

spl: move FDT_FIXUP_PARTITIONS to Kconfig

Move FDT_FIXUP_PARTITIONS to Kconfig and cleanup existing
uses.

Signed-off-by: Heiko Schocher <hs@denx.de>

# ddf67f71 05-Jul-2016 Maxime Ripard <maxime.ripard@free-electrons.com>

libfdt: Add overlay application function

The device tree overlays are a good way to deal with user-modifyable
boards or boards with some kind of an expansion mechanism where we can
easily plug new board in (like the BBB, the Raspberry Pi or the CHIP).

Add a new function to merge overlays with a base device tree.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>

# 91b86e21 26-May-2016 Marek Vasut <marex@denx.de>

lib: Enable private libgcc by default

This patch decouples U-Boot binary from the toolchain on systems where
private libgcc is available. Instead of pulling in functions provided
by the libgcc from the toolchain, U-Boot will use it's own set of libgcc
functions. These functions are usually imported from Linux kernel, which
also uses it's own libgcc functions instead of the ones provided by the
toolchain.

This patch solves a rather common problem. The toolchain can usually
generate code for many variants of target architecture and often even
different endianness. The libgcc on the other hand is usually compiled
for one particular configuration and the functions provided by it may
or may not be suited for use in U-Boot. This can manifest in two ways,
either the U-Boot fails to compile altogether and linker will complain
or, in the much worse case, the resulting U-Boot will build, but will
misbehave in very subtle and hard to debug ways.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 67976306 30-Mar-2016 Masahiro Yamada <masahiroy@kernel.org>

cosmetic: Fix typos "privide"

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# ed980b8c 03-Mar-2016 Alexander Graf <agraf@csgraf.de>

efi_loader: hook up in build environment

Now that we have all the bits and pieces ready for EFI payload loading
support, hook them up in Makefiles and KConfigs so that we can build.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
[trini: Enable only when we of OF_LIBFDT, disable on kwb and colibri_pxa270]
Signed-off-by: Tom Rini <trini@konsulko.com>

# aa34fbc0 22-Feb-2016 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt to be used in SPL

Add an option to enable libfdt in SPL. This can be useful when decoding
FIT files in SPL.

We need to make sure this option is not enabled in SPL by this change.
Also this option needs to be enabled in host builds. Si add a new
IMAGE_USE_LIBFDT #define which can be used in files that are built on the
host but must also build for U-Boot and SPL.

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

# 69e173eb 22-Feb-2016 Simon Glass <sjg@chromium.org>

Move CONFIG_OF_LIBFDT to Kconfig

Move this option to Kconfig and tidy up existing boards.

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

# a187559e 05-Feb-2016 Bin Meng <bmeng.cn@gmail.com>

Use correct spelling of "U-Boot"

Correct spelling of "U-Boot" shall be used in all written text
(documentation, comments in source files etc.).

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Minkyu Kang <mk7.kang@samsung.com>

# 947c626d 14-Jan-2016 Tom Rini <trini@konsulko.com>

vsprintf.c: Always enable CONFIG_SYS_VSNPRINTF

Enabling this function always removes some class of string saftey issues.
The size change here in general is about 400 bytes and this seems a reasonable
trade-off.

Cc: Peng Fan <peng.fan@nxp.com>
Cc: Peter Robinson <pbrobinson@gmail.com>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Adrian Alonso <aalonso@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 7d9cde10 22-Nov-2015 Stefan Roese <sr@denx.de>

lib/tiny-printf.c: Add tiny printf function for space limited environments

This patch adds a small printf() version that supports all basic formats.
Its intented to be used in U-Boot SPL versions on platforms with very
limited internal RAM sizes.

To enable it, just define CONFIG_USE_TINY_PRINTF in your defconfig. This
will result in the SPL using this tiny function and the main U-Boot
still using the full-blown printf() function.

This code was copied from:
http://www.sparetimelabs.com/printfrevisited
With mostly only coding style related changes so that its checkpatch
clean.

The size reduction is about 2.5KiB. Here a comparison for the db-mv784mp-gp
(Marvell AXP) SPL:

Without this patch:
58963 18536 1928 79427 13643 ./spl/u-boot-spl

With this patch:
56542 18536 1956 77034 12cea ./spl/u-boot-spl

Note:
To make it possible to compile tiny-printf.c instead of vsprintf.c when
CONFIG_USE_TINY_PRINTF is defined, the functions printf() and vprintf() are
moved from common/console.c into vsprintf.c in this patch.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>

# 2419cd16 03-Oct-2015 Simon Glass <sjg@chromium.org>

dm: tpm: Drop CONFIG_DM_TPM

Now that all TPM drivers use driver model, we can drop the special driver
model CONFIG option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>

# 027b728d 06-Oct-2015 Julius Werner <jwerner@chromium.org>

Add support for LZ4 decompression algorithm

This patch adds support for LZ4-compressed FIT image contents. This
algorithm has a slightly worse compression ration than LZO while being
nearly twice as fast to decompress. When loading images from a fast
storage medium this usually results in a boot time win.

Sandbox-tested only since I don't have a U-Boot development system set
up right now. The code was imported unchanged from coreboot where it's
proven to work, though. I'm mostly interested in getting this recognized
by mkImage for use in a downstream project.

Signed-off-by: Julius Werner <jwerner@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# a7d660bc 22-Aug-2015 Simon Glass <sjg@chromium.org>

tpm: Add Kconfig options for TPMs

Add new Kconfig options for TPMs in preparation for moving boards to use
Kconfig for TPM configuration.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 867a6ac8 31-Jul-2015 Simon Glass <sjg@chromium.org>

efi: Add start-up library code

When running as an EFI application, U-Boot must request memory from EFI,
and provide access to the boot services U-Boot needs.

Add library code to perform these tasks. This includes efi_main() which is
the entry point from EFI. U-Boot is built as a shared library.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d1389403 23-Jun-2015 Simon Glass <sjg@chromium.org>

Add a dhrystone benchmark command

Drystone provides a convenient sanity check that the CPU is running at full
speed. Add this as a command which can be enabled as needed.

Note: I investigated using Coremark for this but there was a license
agreement and I could not work out if it was GPL-compatible.

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

# f7848d90 22-Jun-2015 Joe Hershberger <joe.hershberger@ni.com>

Allow CONFIG_REGEX to be disabled when CONFIG_NET

Instead of selecting REGEX when NET is enabled, make it the default, but
allow boards that are tiny to disable it and lose functionality on all
but the first Ethernet adapter.

cm-bf548, bf538f-ezkit, and bf533-stamp need this. None appear to have
more than one Ethernet interface.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# 3850dbe8 11-Jun-2015 Masahiro Yamada <masahiroy@kernel.org>

blackfin: fix undefined reference to srand and rand

Commit 9ba9e85f3f1c (net: Fix NET_RANDOM_ETHADDR dependencies)
accidentally dropped CONFIG_LIB_RAND defines for 14 Blackfin boards.

Prior to that commit, those boards defined CONFIG_LIB_RAND, but not
CONFIG_NET_RANDOM_ETHADDR. So, commit 9ba9e85f3f1c should not have
touched them, but in fact it ripped CONFIG_LIB_RAND off from all the
header files, which caused undefined reference to srand and rand.
CONFIG_LIB_RAND=y must be revived for such boards.

BTW, this commit indeed makes it better, but even with this fix,
three boards (bf533-stamp, bf538f-ezkit, cm-bf548) still can not
build due to region 'ram' overflowed error. This was cause by
commit 6eed3786c68c (net: Move the CMD_NET config to defconfigs)
because CMD_NET selects NET, and NET selects REGEX. Eventually,
some boards were newly enabled with CONFIG_REGEX, increasing the
memory footprint. A patch is expected to fix the build error.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 9ba9e85f 25-May-2015 Michal Simek <michal.simek@amd.com>

net: Fix NET_RANDOM_ETHADDR dependencies

NET_RANDOM_ETHADDR depends on lib/rand.c. This patch adds dependency to
Kconfig to ensure that library is also compiled.

Remove the definitions from Blackfin boards' include/configs.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 6501ff62 20-Apr-2015 Przemyslaw Marczak <p.marczak@samsung.com>

lib: Kconfig: add entry for errno_str() function

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1a60650c 21-Apr-2015 Joe Hershberger <joe.hershberger@ni.com>

kconfig: Move REGEX to Kconfig

Having this as a Kconfig allows it to be a dependent feature.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8156345d 06-Mar-2015 Simon Glass <sjg@chromium.org>

sandbox: Move CONFIG_SYS_VSNPRINTF to Kconfig

Move this over to Kconfig and tidy up.

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

# 94e3c8c4 19-Feb-2015 gaurav rana <gaurav.rana@freescale.com>

crypto/fsl - Add progressive hashing support using hardware acceleration.

Currently only normal hashing is supported using hardware acceleration.
Added support for progressive hashing using hardware.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
Signed-off-by: Gaurav Rana <gaurav.rana@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>

# d9f23c7f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

lib/rsa: Add Kconfig for devices supporting RSA Modular Exponentiation

Kconfig option added for devices which support RSA Verification.
1. RSA_SOFTWARE_EXP
Enables driver for supporting RSA Modular Exponentiation in Software
2. RSA_FREESCALE_EXP
Enables driver for supporting RSA Modular Exponentiation using Freescale specific
driver

The above drivers use RSA uclass

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
(Removed duplicate line in Kconfig comment)

Change-Id: I7663c4d5350e2bfc3dfa2696f70ef777d6ccc6f6

# c4beb22f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

FIT: Modify option FIT_SIGNATURE in Kconfig

For FIT signature based approach to work, RSA library needs to be selected.
The FIT_SIGNATURE option in Kconfig is modified to automatically select RSA.
Selecting RSA compiles the RSA library required for image verification.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 45ccec8f 23-Oct-2014 Masahiro Yamada <masahiroy@kernel.org>

kconfig: move CONFIG_USE_PRIVATE_LIBGCC to Kconfig

The private libgcc is supported only on ARM, MIPS, PowerPC, SH, x86.
Those architectures should "select" HAVE_PRIVATE_LIBGCC and
CONFIG_USE_PRIVATE_LIBGCC should depend on it.

Currently, this option is enabled on Tegra boards and x86 architecture.
Move the definition from header files to Kconfig.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Tested-by: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: Tom Warren <twarren@nvidia.com>

# 8c688bc4 23-Oct-2014 Masahiro Yamada <masahiroy@kernel.org>

kconfig: move CONFIG_SYS_HZ to lib/Kconfig

CONFIG_SYS_HZ is always defined as 1000 in config_fallbacks.h
(but some boards still have redundant definitions).

This commit moves the definition and the document in README to
Kconfig. Since lib/Kconfig can assure that CONFIG_SYS_HZ is 1000,
the sanity check in lib/time.c should be removed.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Reviewed-by: Marek Vasut <marex@denx.de>

# b0928da6 16-Sep-2014 Masahiro Yamada <masahiroy@kernel.org>

kconfig: move CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED to Kconfig

If this option is enabled, the objects under lib/ directory
are compiled with speed optimization, not size optimization.
(Currently, only used by some Blackfin boards.)

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# ed36323f 16-Sep-2014 Masahiro Yamada <masahiroy@kernel.org>

kconfig: add blank Kconfig files

This would be useful to start moving various config options.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# 0992a90d 04-May-2023 Simon Glass <sjg@chromium.org>

acpi: Create a new Kconfig for ACPI

We have several Kconfig options for ACPI, but all relate to specific
functions, such as generating tables and AML code.

Add a new option which controls including basic ACPI library code,
including the lib/acpi directory. This will allow us to add functions
which are available even if table generation is not supported.

Adjust the command to avoid a build error when ACPIGEN is not enabled.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 94c8da21 22-Mar-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: Fix LMB_MEMORY_REGIONS flag usage

Remove test on CONFIG_LMB_MEMORY_REGIONS introduced by commit
7c1860fce4e3 ("lmb: Fix lmb property's defination under struct lmb").

This code in lmb_init() is strange, because if CONFIG_LMB_USE_MAX_REGIONS
and CONFIG_LMB_MEMORY_REGIONS are not defined, the implicit #else is empty
and the required initialization is not done:
lmb->memory.max = ?
lmb->reserved.max = ?

But this setting is not possible:
- CONFIG_LMB_USE_MAX_REGIONS not defined
- CONFIG_LMB_MEMORY_REGIONS not defined
because CONFIG_LMB_MEMORY_REGIONS and CONFIG_LMB_RESERVED_REGIONS are
defined as soon as the CONFIG_LMB_USE_MAX_REGIONS is not defined.

This patch removes this impossible case #elif and I add some
explanation in lmb.h to explain why in the struct lmb {} the lmb
property is defined if CONFIG_LMB_MEMORY_REGIONS is NOT defined.

This patch also removes CONFIG_LMB_XXX dependency on CONFIG_LMB as these
defines are used in API file lmb.h and not only in library file.

Fixes: 5e2548c1d6e03 ("lmb: Fix LMB_MEMORY_REGIONS flag usage")
Reported-by: Mark Millard <marklmi@yahoo.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Acked-by: Michal Simek <michal.simek@amd.com>

# c61df340 18-Mar-2023 Marek Vasut <marek.vasut+renesas@mailbox.org>

lib: Fix SYS_TIMER_COUNTS_DOWN description in Kconfig

The SYS_TIMER_COUNTS_DOWN description contains a typo,
s@rathe@&r@ , fix it.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>

# 3b510807 22-Feb-2023 Simon Glass <sjg@chromium.org>

lib: Add an SPL config for LIB_UUID

This is selected by PARTITION_UUIDS which has a separate option for SPL.
Add an SPL option for LIB_UUID also, so that we can keep them consistent.

Also add one for PARTITION_TYPE_GUID to avoid a build error in part_efi.c
which wants to call a uuid function in SPL.

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

# 5a6bc166 22-Feb-2023 Simon Glass <sjg@chromium.org>

lib: Add VPL options for SHA1 and SHA256

Add these options so these algorithms can be used in VPL.

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

# ae625d92 22-Feb-2023 Simon Glass <sjg@chromium.org>

lib: Add a Kconfig for SPL_BZIP2

This is implicitly used in the source and seems useful, so add it.

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

# c33425c6 15-Jan-2023 Simon Glass <sjg@chromium.org>

trace: Reduce the default for TRACE_EARLY_CALL_DEPTH_LIMIT

This is a silly value at present, since U-Boot's call depth never reaches
200. Fix it.

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

# 2dc16a2c 19-Jan-2023 Sjoerd Simons <sjoerd@collabora.com>

Bump LMB_MAX_REGIONS default to 16

Since commit 06d514d77c37 ("lmb: consider EFI memory map") the EFI regions
are also pushed into the lmb if EFI_LOADER is enabled (which is by
default on most system). Which can cause the number of entries to go
over the maximum as it's default is only 8.

Specifically i ran into this case on an TI am62 which has an fdt with
4 reserved regions (in practice 3 lmb entries due to adjecent ranges).

As this is likely to impact more devices bump the default max
regions to 16 so there is a bit more slack.

Fixes: 06d514d77c ("lmb: consider EFI memory map")
Link: https://bugzilla.opensuse.org/show_bug.cgi?id=1207562
Reviewed-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Signed-off-by: Sjoerd Simons <sjoerd@collabora.com>
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
[trini: collect tags from the other equivalent patch]

# 948d3999 08-Feb-2023 Tom Rini <trini@konsulko.com>

Revert "lmb: Default to not-LMB_USE_MAX_REGIONS"

As explained by Philippe Schenker, I was misinterpreting what happened
in the case where we do not set LMB_USE_MAX_REGIONS and so had
re-introduced the problem I was attempting to more widely resolve.

This reverts commit 007ae5d108a37564905ea1588cb279f3a522cc3d.

Reported-by: Philippe Schenker <philippe.schenker@toradex.com>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 007ae5d1 25-Jan-2023 Tom Rini <trini@konsulko.com>

lmb: Default to not-LMB_USE_MAX_REGIONS

The LMB code allows for picking a hard limit on the number of regions it
can know of, or to dynamically allocate these regions. The reason for
this choice is to allow for the compiler to perform a size optimization
in the common case. This optimization however, is very small, ranging
from 196 bytes to 15 bytes saved, or in some cases, being larger. Now
that we also have more regions covered by LMB (in order to protect
various parts of our self at run time), the default of 8 is also much
easier to hit and leads to non-obvious error messages (which imply that
an area is protected, not that we're out of areas to add to the list).

Switch to the dynamic use as the default.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 53c47c59 19-Jan-2023 Tom Rini <trini@konsulko.com>

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


# 4b9b25d9 12-Jan-2023 Brandon Maier <brandon.maier@collins.com>

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

[1] https://github.com/torvalds/linux/commit/e0c1b49f5b674cca7b10549c53b3791d0bbc90a8
[2] https://github.com/facebook/zstd/blob/f302ad8811643c428c4e3498e28f53a0578020d3/lib/libzstd.mk#L31

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>

# ebc1d50a 21-Dec-2022 Simon Glass <sjg@chromium.org>

Revert "fdtdec: drop needlessly convoluted CONFIG_PHANDLE_CHECK_SEQ"

The fdt_path_offset() function is slow since it must scan the tree.
This substantial overhead now applies to all boards.

The original code may not be ideal but it is fit for purpose and is only
needed on a few boards.

Reverting this reduces time to set up driver model by about 30ms.

Before revert:

Accumulated time:
47,170 dm_r
53,237 dm_spl
572,986 dm_f

Accumulated time:
44,598 dm_r
50,347 dm_spl
549,133 dm_f

This reverts commit 26f981f295d00351b6f0c69b5317b254b2361cc0.

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

# 12619d4e 21-Dec-2022 Simon Glass <sjg@chromium.org>

trace: Don't require TIMER_EARLY

Some platforms cannot honour this and don't need trace before relocation.
Use 'imply' instead, so boards can disable this.

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

# 0c16fca9 07-Jan-2023 Simon Glass <sjg@chromium.org>

tpm: Add a proper Kconfig option for crc8 in SPL

The current approach is a bit of a hack and only works for the tpm
subsystem. Add a Kconfig so that crc8 can be enabled in SPL for other
purposes.

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

# 14f43797 19-Dec-2022 Tom Rini <trini@konsulko.com>

Merge tag 'v2023.01-rc4' into next

Prepare v2023.01-rc4

Signed-off-by: Tom Rini <trini@konsulko.com>


# ae3527f0 07-Dec-2022 Kautuk Consul <kconsul@ventanamicro.com>

arch/riscv: add semihosting support for RISC-V

We add RISC-V semihosting based serial console for JTAG based early
debugging.

The RISC-V semihosting specification is available at:
https://github.com/riscv/riscv-semihosting-spec/blob/main/riscv-semihosting-spec.adoc

Signed-off-by: Anup Patel <apatel@ventanamicro.com>
Signed-off-by: Kautuk Consul <kconsul@ventanamicro.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>

# 1c03ab9f 07-Dec-2022 Kautuk Consul <kconsul@ventanamicro.com>

lib: Add common semihosting library

We factor out the arch-independent parts of the ARM semihosting
implementation as a common library so that it can be shared
with RISC-V.

Signed-off-by: Kautuk Consul <kconsul@ventanamicro.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>

# 3b8dfc42 16-Nov-2022 Tom Rini <trini@konsulko.com>

Convert CONFIG_SYS_TIMER_COUNTS_DOWN to Kconfig

This converts the following to Kconfig:
CONFIG_SYS_TIMER_COUNTS_DOWN

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 86794052 21-Oct-2022 Sughosh Ganu <sughosh.ganu@linaro.org>

FWU: Add support for the FWU Multi Bank Update feature

The FWU Multi Bank Update feature supports updating firmware images
to one of multiple sets(also called banks) of images. The firmware
images are clubbed together in banks, with the system booting images
from the active bank. Information on the images such as which bank
they belong to is stored as part of the metadata structure, which is
stored on the same storage media as the firmware images on a dedicated
partition.

At the time of update, the metadata is read to identify the bank to
which the images need to be flashed(update bank). On a successful
update, the metadata is modified to set the updated bank as active
bank to subsequently boot from.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

# 40ed7be4 02-Aug-2022 Tom Rini <trini@konsulko.com>

Convert CONFIG_SYS_FDT_PAD to Kconfig

This converts the following to Kconfig:
CONFIG_SYS_FDT_PAD

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e67ffb5a 22-Jul-2022 Sughosh Ganu <sughosh.ganu@linaro.org>

tpm: rng: Add driver model interface for TPM RNG device

The TPM device has a builtin random number generator(RNG)
functionality. Expose the RNG functions of the TPM device to the
driver model so that they can be used by the EFI_RNG_PROTOCOL if the
protocol is installed.

Also change the function arguments and return type of the random
number functions to comply with the driver model api.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

# b340199f 10-Jun-2022 Tom Rini <trini@konsulko.com>

spl: Ensure all SPL symbols in Kconfig have some SPL dependency

Tighten up symbol dependencies in a number of places. Ensure that a SPL
specific option has at least a direct dependency on SPL. In places
where it's clear that we depend on something more specific, use that
dependency instead. This means in a very small number of places we can
drop redundant dependencies.

Reported-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 13ce351b 08-Jun-2022 Tom Rini <trini@konsulko.com>

vpl: Ensure all VPL symbols in Kconfig have some VPL dependency

Tighten up symbol dependencies in a number of places. Ensure that a VPL
specific option has at least a direct dependency on VPL. In places
where it's clear that we depend on something more specific, use that
dependency instead.

Reported-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 8bea4bf7 08-Jun-2022 Tom Rini <trini@konsulko.com>

tpl: Ensure all TPL symbols in Kconfig have some TPL dependency

Tighten up symbol dependencies in a number of places. Ensure that a TPL
specific option has at least a direct dependency on TPL. In places
where it's clear that we depend on something more specific, use that
dependency instead.

Reported-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 26f981f2 19-May-2022 Rasmus Villemoes <rasmus.villemoes@prevas.dk>

fdtdec: drop needlessly convoluted CONFIG_PHANDLE_CHECK_SEQ

Asking if the alias we found actually points at the device tree node
we passed in (in the guise of its offset from blob) can be done simply
by asking if the fdt_path_offset() of the alias' path is identical to
offset.

In fact, the current method suffers from the possibility of false
negatives: dtc does not necessarily emit a phandle property for a node
just because it is referenced in /aliases; it only emits a phandle
property for a node if it is referenced in <angle brackets>
somewhere. So if both the node we passed in and the alias node we're
considering don't have phandles, fdt_get_phandle() returns 0 for both.

Since the proper check is so simple, there's no reason to hide that
behind a config option (and if one really wanted that, it should be
called something else because there's no need to involve phandle in
the check).

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Acked-by: Aswath Govindraju <a-govindraju@ti.com>

# d30924f1 01-May-2022 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: fix selection of CONFIG_CHARSET

lib/charset.c is not optional for
EFI_APP || EFI_LOADER || UFS || UT_UNICODE.
These must select CONFIG_CHARSET.

Fixes: 726cd9836db0 ("efi: Make unicode printf available to the app")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>

# 747093dd 30-Apr-2022 Simon Glass <sjg@chromium.org>

vpl: Add Kconfig options for VPL

Add VPL versions of commonly used Kconfig options.

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

# 11232139 06-Apr-2022 Tom Rini <trini@konsulko.com>

nds32: Remove the architecture

As removal of nds32 has been ack'd for the Linux kernel, remove support
here as well.

Cc: Rick Chen <rick@andestech.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Rick Chen <rick@andestech.com>

# fd210fee 28-Mar-2022 Philippe Reynes <philippe.reynes@softathome.com>

lib: allow to build asn1 decoder and oid registry in SPL

This commit adds the options:
- SPL_ASN1_DECODER
- SPL_OID_REGISTRY

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>

# 7d44a985 28-Mar-2022 Philippe Reynes <philippe.reynes@softathome.com>

lib: Kconfig: enhance the help of OID_REGISTRY

Enhance the help for the config OID_REGISTRY.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>

# a0e71d96 28-Mar-2022 Philippe Reynes <philippe.reynes@softathome.com>

lib: Kconfig: enhance help for ASN1

Enhance the help for configs ASN1_COMPILER
and ASN1_decoder.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>

# 761a1786 27-Jan-2022 Tom Rini <trini@konsulko.com>

Merge tag 'dm-pull-26jan22' of https://source.denx.de/u-boot/custodians/u-boot-dm

acpi refactoring to allow non-x86 use
binman support for bintools (binary tools)
minor tools improvements in preparation for FDT signing
various minor fixes and improvements


# 334a9b9d 25-Nov-2021 Loic Poulain <loic.poulain@linaro.org>

lib/circbuf: Make circbuf selectable symbol

It is currenly only used from usbtty driver but make it properly
selectable via Kconfig symbol, for future usage.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>

# e1722fcb 01-Dec-2021 Simon Glass <sjg@chromium.org>

x86: Allow any arch to generate ACPI tables

These have sadly found their way to ARM now. Allow any arch to support
generating ACPI tables.

Disable this for the tools build.

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

# 7c3fd5c2 26-Dec-2021 Qu Wenruo <wqu@suse.com>

lib: add BLAKE2 hash support

The code is cross-ported from BLAKE2 reference implementation
(https://github.com/BLAKE2/BLAKE2).

With minimal change to remove unused macros/features.

Currently there is only one user inside U-boot (btrfs), and since it
only utilize BLAKE2B, all other favors are all removed.

Signed-off-by: Qu Wenruo <wqu@suse.com>
[trini: Rename ROUND to R to avoid clash with <linux/bitops.h>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 97f2a749 04-Jan-2022 Eugen Hristev <eugen.hristev@collabora.com>

lib: Kconfig: fix PHANDLE_CHECK_SEQ position outside of menu

CONFIG_PHANDLE_CHECK_SEQ is outside of the menu 'Library routines'
thus it's invisible in menuconfig and cannot be selected.
Fix this by moving the 'endmenu' after the PHANDLE_CHECK_SEQ definition

Fixes: c589132a1d ("fdt: Use phandle to distinguish DT nodes with same name")
Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
Reviewed-by: Aswath Govindraju <a-govindraju@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 726cd983 29-Dec-2021 Simon Glass <sjg@chromium.org>

efi: Make unicode printf available to the app

This is needed to show unicode strings. Enable this code in the app.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>

# 6405ab7a 24-Nov-2021 Simon Glass <sjg@chromium.org>

Convert CONFIG_PHYSMEM to Kconfig

This converts the following to Kconfig:
CONFIG_PHYSMEM

Signed-off-by: Simon Glass <sjg@chromium.org>
Suggested-by: Sean Anderson <seanga2@gmail.com>

# ac7606af 14-Nov-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

lmb: fix typo 'commun'

%s/commun/common/

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

# e7d285b2 25-Sep-2021 Simon Glass <sjg@chromium.org>

image: Use the correct checks for CRC32

Add a host Kconfig for CRC32. With this we can use CONFIG_IS_ENABLED(CRC32)
directly in the host build, so drop the unnecessary indirection.

Add a few more conditions to SPL_CRC32 to avoid build failures as well as
TPL_CRC32. Also update hash.c to make crc32 optional and to actually take
notice of SPL_CRC32.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# 2c21256b 25-Sep-2021 Simon Glass <sjg@chromium.org>

hash: Use Kconfig to enable hashing in host tools and SPL

At present when building host tools, we force CONFIG_SHAxxx to be enabled
regardless of the board Kconfig setting. This is done in the image.h
header file.

For SPL we currently just assume the algorithm is desired if U-Boot proper
enables it.

Clean this up by adding new Kconfig options to enable hashing on the host,
relying on CONFIG_IS_ENABLED() to deal with the different builds.

Add new SPL Kconfigs for hardware-accelerated hashing, to maintain the
current settings.

This allows us to drop the image.h code and the I_WANT_MD5 hack.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# 603d15a5 25-Sep-2021 Simon Glass <sjg@chromium.org>

spl: cypto: Bring back SPL_ versions of SHA

Unfortunately these were removed by mistake. This means that adding hash
support to SPL brings in all software algorithms, with a substantial
increase in code size.

The origin of the problem was renaming them to SPL_FIT_xxx and then these
were removed altogether in a later commit.

Add them back. This aligns with CONFIG_MD5, for example, which has an SPL
variant.

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: f5bc9c25f31 ("image: Rename SPL_SHAxxx_SUPPORT to SPL_FIT_SHAxxx")
Fixes: eb5171ddec9 ("common: Remove unused CONFIG_FIT_SHAxxx selectors")
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# 6674edaa 16-Sep-2021 Tom Rini <trini@konsulko.com>

Merge tag 'v2021.10-rc4' into next

Prepare v2021.10-rc4

Signed-off-by: Tom Rini <trini@konsulko.com>

# gpg: Signature made Tue 14 Sep 2021 06:58:32 PM EDT
# gpg: using RSA key 1A3C7F70E08FAB1707809BBF147C39FF9634B72C
# gpg: Good signature from "Thomas Rini <trini@konsulko.com>" [ultimate]

# Conflicts:
# board/Arcturus/ucp1020/spl.c
# cmd/mvebu/Kconfig
# common/Kconfig.boot
# common/image-fit.c
# configs/UCP1020_defconfig
# configs/sifive_unmatched_defconfig
# drivers/pci/Kconfig
# include/configs/UCP1020.h
# include/configs/sifive-unmatched.h
# lib/Makefile
# scripts/config_whitelist.txt


# 5145bc73 01-Sep-2021 Oleksandr Suvorov <oleksandr.suvorov@foundries.io>

lib: fix typos in Kconfig

There are trivial typos in the Kconfig file. Fixed them.
Also, fixed grammar in the descriptions with typos.

Fixes: d56b4b1974 ("configs: Migrate RBTREE, LZO, CMD_MTDPARTS, CMD_UBI and CMD_UBIFS")
Fixes: 7264f2928b ("spl: fit: Eanble GZIP support for image decompression")
Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# e60e4499 02-Sep-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

lib: Drop SHA512_ALGO in lieu of SHA512

SHA512_ALGO was used as a "either SHA512 or SHA384", although the
implementations of these two algorithms share a majority of code.

From a Kconfig interface perspective, it makes sense to present two
distinct options. This requires #ifdefing out the SHA512
implementation from sha512.c. The latter doesn't make any sense.

It's reasonable to say in Kconfig that SHA384 depends on SHA512, and
seems to be the more polite way to handle the selection.

Thus, automatically select SHA512 when SHA384 is enabled.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# b4c2c151 27-Aug-2021 Michal Simek <michal.simek@amd.com>

Kconfig: Remove all default n/no options

default n/no doesn't need to be specified. It is default option anyway.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
[trini: Rework FSP_USE_UPD portion]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 928a8be7 29-Jul-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

lib: ecdsa: Implement UCLASS_ECDSA verification on target

Implement the crypto_algo .verify() function for ecdsa256. Because
it backends on UCLASS_ECDSA, this change is focused on parsing the
keys from devicetree and passing this information to the specific
UCLASS driver.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# fa3f1f1d 24-Jul-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: disable CONFIG_SPL_HEXDUMP by default

CONFIG_HEXDUMP is needed to display UEFI variables using 'printenv -e'.

Enabling CONFIG_SPL_HEXDUMP only makes sense for debugging purposes.
Hence CONFIG_SPL_HEXDUMP should not be enabled by default.

The following boards currently have CONFIG_SPL_HEXDUMP=y. This includes
boards that don't use SPL at all.

axm_defconfig
imx8mm-cl-iot-gate_defconfig
imx8mm_venice_defconfig
imxrt1020-evk_defconfig
imxrt1050-evk_defconfig
kontron_sl28_defconfig
kp_imx53_defconfig
lx2160ardb_tfa_stmm_defconfig
mt7622_rfb_defconfig
octeon_ebb7304_defconfig
octeon_nic23_defconfig
qemu_arm64_defconfig
qemu_arm_defconfig
qemu-riscv32_defconfig
qemu-riscv32_smode_defconfig
qemu-riscv64_defconfig
qemu-riscv64_smode_defconfig
qemu-x86_64_defconfig
qemu-x86_defconfig
sandbox64_defconfig
sandbox_defconfig
stm32mp15_basic_defconfig
stm32mp15_trusted_defconfig
synquacer_developerbox_defconfig
taurus_defconfig
xilinx_versal_virt_defconfig

The patch only keeps it enabled on

sandbox_spl_defconfig

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 1a46cb6c 02-Jul-2021 Simon Glass <sjg@chromium.org>

lib: Create a new Kconfig option for charset conversion

Rather than looking at two KConfig options in the Makefile, create a new
Kconfig option for compiling lib/charset.c

Enable it for UFS also, which needs this support.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 26dd9936 08-Jul-2021 Steffen Jaeckel <jaeckel-floss@eyet-services.de>

lib: add crypt subsystem

Add the basic functionality required to support the standard crypt
format.
The files crypt-sha256.c and crypt-sha512.c originate from libxcrypt and
their formatting is therefor retained.
The integration is done via a crypt_compare() function in crypt.c.

```
libxcrypt $ git describe --long --always --all
tags/v4.4.17-0-g6b110bc
```

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 7d0f3fbb 11-Jun-2021 Tero Kristo <t-kristo@ti.com>

lib: rational: copy the rational fraction lib routines from Linux

Copy the best rational approximation calculation routines from Linux.
Typical usecase for these routines is to calculate the M/N divider
values for PLLs to reach a specific clock rate.

This is based on linux kernel commit:
"lib/math/rational.c: fix possible incorrect result from rational
fractions helper"
(sha1: 323dd2c3ed0641f49e89b4e420f9eef5d3d5a881)

Signed-off-by: Tero Kristo <t-kristo@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Tero Kristo <kristo@kernel.org>

# ec0512b1 24-May-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

Revert "lib: introduce HASH_CALCULATE option"

When we think of Kconfig, we usually think of features that we like
to enable or not. Ideally, we wouldn't use Kconfig to fix a build
issue, although sometimes it might make sense. With Kconfig it's hard
to guarantee that the fix is universal. We can only say that it works
for the set of tested configurations. In the majority of cases, it's
preferable to let the linker figure things out for us.

The reverted commit attempted to fix a build issue by adding an
invisible Kconfig option. This is wrong in several ways:

It invents a new Kconfig variable when CONFIG_HASH already
exists for the same purpose.
Second, hash-checksum.c makes use of the hash_progressive_lookup_algo()
symbol, which is only provided with CONFIG_HASH, but this dependency
was not expressed in the reverted patch.

It feels like Kconfig is turning into a listing of all available
source files, and a buffet to 'select' which ones to compile. The
purpose of this revert is to enable the next change to make use of
CONFIG_HASH instead of adding to Kconfig.

This reverts commit 87316da05f2fd49d3709275e64ef0c5980366ade.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Acked-by: Masahisa Kojima <masahisa.kojima@linaro.org>

# 1621d3c4 10-May-2021 Bin Meng <bmeng.cn@gmail.com>

lib: kconfig: Limit BINMAN_FDT for OF_SEPARATE or OF_EMBED

Generally speaking BINMAN_FDT makes sense for OF_SEPARATE or OF_EMBED.
For the other OF_CONTROL methods, it's quite possible binman node is
not available as binman is invoked during the build phase instead of
runtime. Let's only turn it on for OF_SEPARATE or OF_EMBED by default.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 87316da0 13-May-2021 Masahisa Kojima <masahisa.kojima@linaro.org>

lib: introduce HASH_CALCULATE option

Build error occurs when CONFIG_EFI_SECURE_BOOT or
CONFIG_EFI_CAPSULE_AUTHENTICATE is enabled,
because hash-checksum.c is not compiled.

Since hash_calculate() implemented in hash-checksum.c can be
commonly used aside from FIT image signature verification,
this commit itroduces HASH_CALCULATE option to decide
if hash-checksum.c shall be compiled.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# e2ae483c 13-May-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

hash: Kconfig option for SHA512 hardware acceleration

Commit a479f103dc1c ("hash: Allow for SHA512 hardware implementations")
defined function definitions for hardware accelerated SHA384 and SHA512.
If CONFIG_SHA_HW_ACCEL=y, these functions are used.

We already have boards using CONFIG_SHA_HW_ACCEL=y but none implements the
new functions hw_sha384() and hw_sha512().

For implementing the EFI TCG2 protocol we need SHA384 and SHA512. The
missing hardware acceleration functions lead to build errors on boards like
peach-pi_defconfig.

Introduce a new Kconfig symbol CONFIG_SHA512_HW_ACCEL to control if the
functions hw_sha384() and hw_sha512() shall be used to implement the SHA384
and SHA512 algorithms.

Fixes: a479f103dc1c ("hash: Allow for SHA512 hardware implementations")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

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

# 6d66502b 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: Add 2 config to define the max number of regions

Add 2 configs CONFIG_LMB_MEMORY_REGIONS and CONFIG_LMB_RESERVED_REGIONS
to change independently the max number of the regions in lmb
library.

When CONFIG_LMB_USE_MAX_REGIONS=y, move the lmb property arrays to
struct lmb and manage the array size with the element 'max' of struct
lmb_region; their are still allocated in stack.

When CONFIG_LMB_USE_MAX_REGIONS=n, keep the current location in
struct lmb_region to allow compiler optimization.

Increase CONFIG_LMB_RESERVED_REGIONS is useful to avoid lmb errors in
bootm when the number of reserved regions (not adjacent) is reached:
+ 1 region for relocated U-Boot
+ 1 region for initrd
+ 1 region for relocated linux device tree
+ reserved memory regions present in Linux device tree.

The current limit of 8 regions is reached with only 5 reserved regions
in DT.

see Linux kernel commit bf23c51f1f49 ("memblock: Move memblock arrays
to static storage in memblock.c and make their size a variable")

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# 4fa0150d 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: move MAX_LMB_REGIONS value in Kconfig

Move MAX_LMB_REGIONS value in Kconfig, the max number of the regions
in lmb library.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# 77b8cfef 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: move CONFIG_LMB in Kconfig

Migrate CONFIG_LMB in Kconfig.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# a479f103 16-Feb-2021 Joel Stanley <joel@jms.id.au>

hash: Allow for SHA512 hardware implementations

Similar to support for SHA1 and SHA256, allow the use of hardware hashing
engine by enabling the algorithm and setting CONFIG_SHA_HW_ACCEL /
CONFIG_SHA_PROG_HW_ACCEL.

Signed-off-by: Joel Stanley <joel@jms.id.au>

# f2c1442e 14-Mar-2021 Simon Glass <sjg@chromium.org>

bloblist: Make BLOBLIST_TABLES depend on BLOBLIST

Add an extra condition here since we cannot put x86 tables in a bloblist
when bloblists are not supported.

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

# e0103158 25-Feb-2021 Bin Meng <bmeng.cn@gmail.com>

lib: kconfig: Mention CONFIG_ADDR_MAP limitation in the help

Mention that CONFIG_ADDR_MAP only works in the post-relocation phase.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>

# 56e7257c 03-Feb-2021 Bin Meng <bmeng.cn@gmail.com>

lib: Fix BINMAN_FDT dependency

lib/binman.c references the following 3 ofnode APIs:
ofnode_first_subnode(), ofnode_path() and ofnode_read_bool().

These APIs get built only when DM is on. Fix the dependency then.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 59e4e391 18-Jan-2021 Tom Rini <trini@konsulko.com>

Merge https://gitlab.denx.de/u-boot/custodians/u-boot-riscv

- Update qemu-riscv.rst build instructions.
- Add support for SPI on Kendryte K210.
- Add Microchip PolarFire SoC Icicle Kit support.
- Add support for an early timer.
- Select TIMER_EARLY to avoid infinite recursion for Trace.


# a80f8513 17-Jan-2021 Pragnesh Patel <pragnesh.patel@sifive.com>

trace: select TIMER_EARLY to avoid infinite recursion

When tracing functions is enabled this adds calls to
__cyg_profile_func_enter() and __cyg_profile_func_exit() to the traced
functions.

__cyg_profile_func_enter() and __cyg_profile_func_exit() invoke
timer_get_us() to record the entry and exit time.

initr_dm() will make gd->dm_root = NULL and gd->timer = NULL, so
timer_get_us() -> get_ticks() -> dm_timer_init() will lead to an
indefinite recursion.

So select TIMER_EARLY when tracing got enabled.

Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Rick Chen <rick@andestech.com>

# 6205bbb1 04-Jan-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lib: cosmetic update of CONFIG_LIB_ELF description

Change 2 typo error in CONFIG_LIB_ELF description:
- Supoort => Support
- fir => for

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c589132a 02-Dec-2020 Aswath Govindraju <a-govindraju@ti.com>

fdt: Use phandle to distinguish DT nodes with same name

While assigning the sequence number to subsystem instances by reading the
aliases property, only DT nodes names are compared and not the complete
path. This causes a problem when there are two DT nodes with same name but
have different paths.

In arch/arm/dts/k3-am65-main.dtsi there are two USB controllers with the
same device tree node name but different path. When aliases are defined for
these USB controllers then fdtdec_get_alias_seq() fails to pick the correct
instance for a given index.

fdt_path_offset() function is slow and this would effect the U-Boot
startup. To avert the time penalty on all boards, apply this extra check
only when required by using a config option.

Fix it by comparing the phandles of DT nodes after the node names match,
under a config option.

Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Fix whitespace error in Kconfig:
Signed-off-by: Simon Glass <sjg@chromium.org>

# 28cef9ca 19-Nov-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

fs: fat: create correct short names

The current function set_name() used to create short names has the
following deficiencies resolved by this patch:

* Long names (e.g. FOO.TXT) are stored even if a short name is enough.
* Short names with spaces are created, e.g. "A ~1.TXT".
* Short names with illegal characters are created, e.g. "FOO++BAR".
* Debug output does not not consider that the short file name has no
concluding '\0'.

The solution for the following bug is split of into a separate patch:

* Short file names must be unique.

This patch only provides the loop over possible short file names.

Fixes: c30a15e590c ("FAT: Add FAT write feature")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# e4f8e543 05-Nov-2020 Simon Glass <sjg@chromium.org>

smbios: Drop the unused Kconfig options

Now that we can use devicetree to specify this information, drop the old
CONFIG options.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 44c74bdd 05-Nov-2020 Simon Glass <sjg@chromium.org>

sysinfo: Provide a default driver to set SMBIOS values

Some boards want to specify the manufacturer or product name but do not
need to have their own sysinfo driver.

Add a default driver which provides a way to specify this SMBIOS
information in the devicetree, without needing any board-specific
functionality.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d2cb7a22 04-Nov-2020 Simon Glass <sjg@chromium.org>

x86: Allow putting some tables in the bloblist

At present all tables are placed starting at address f0000 in memory, and
can be up to 64KB in size. If the tables are very large, this may not
provide enough space.

Also if the tables point to other tables (such as console log or a ramoops
area) then we must allocate other memory anyway.

The bloblist is a nice place to put these tables since it is contiguous,
which makes it easy to reserve this memory for linux using the 820 tables.

Add an option to put some of the tables in the bloblist. For SMBIOS and
ACPI, create suitable pointers from the f0000 region to the new location
of the tables.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
[bmeng: squashed in http://patchwork.ozlabs.org/project/uboot/patch/
20201105062407.1.I8091ad931cbbb5e3b6f6ababdf3f8d5db0d17bb9@changeid/]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# 415eab06 03-Nov-2020 Christian Gmeiner <christian.gmeiner@gmail.com>

smbios: add parsing API

Add a very simple API to be able to access SMBIOS strings
like vendor, model and bios version.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 72eda507 27-Oct-2020 Sean Anderson <seanga2@gmail.com>

lib: Add getopt

Some commands can get very unweildy if they have too many positional
arguments. Adding options makes them easier to read, remember, and
understand.

This implementation of getopt has been taken from barebox, which has had
option support for quite a while. I have made a few modifications to their
version, such as the removal of opterr in favor of a separate getopt_silent
function. In addition, I have moved all global variables into struct
getopt_context.

The getopt from barebox also re-orders the arguments passed to it so that
non-options are placed last. This allows users to specify options anywhere.
For example, `ls -l foo/ -R` would be re-ordered to `ls -l -R foo/` as
getopt parsed the options. However, this feature conflicts with the const
argv in cmd_tbl->cmd. This was originally added in 54841ab50c ("Make sure
that argv[] argument pointers are not modified."). The reason stated in
that commit is that hush requires argv to stay unmodified. Has this
situation changed? Barebox also uses hush, and does not have this problem.
Perhaps we could use their fix?

I have assigned maintenance of getopt to Simon Glass, as it is currently
only used by the log command. I would also be fine maintaining it.

Signed-off-by: Sean Anderson <seanga2@gmail.com>

# 26637e2e 12-Sep-2020 Simon Glass <sjg@chromium.org>

lib: Allow hexdump to be used in SPL

It is sometimes useful to output hex dumps in SPL. Add a config option to
allow this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# e87dfb05 05-Aug-2020 Andrii Anisov <andrii_anisov@epam.com>

lib: sscanf: add sscanf implementation

Port sscanf implementation from mini-os and introduce new
Kconfig option to enable it: CONFIG_SSCANF. Disable by default.

Signed-off-by: Andrii Anisov <andrii_anisov@epam.com>
Signed-off-by: Anastasiia Lukianenko <anastasiia_lukianenko@epam.com>
Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>

# 81014f73 30-Jul-2020 Joao Marcos Costa <joaomarcos.costa@bootlin.com>

include/u-boot, lib/zlib: add sources for zlib decompression

Add zlib (v1.2.11) uncompr() function to U-Boot. SquashFS depends on
this function to decompress data from a raw disk image. The actual
support for zlib into SquashFS sources will be added in a follow-up
commit.

Signed-off-by: Joao Marcos Costa <joaomarcos.costa@bootlin.com>

# 69be8fd1 03-Jun-2020 Marek Szyprowski <m.szyprowski@samsung.com>

powerpc: move ADDR_MAP to Kconfig

Move ADDR_MAP related config options from include/configs/*.h to the
proper place in lib/Kconfig. This has been done using
./tools/moveconfig.py and manual inspection of the generated changes.
This is a preparation to use ADDR_MAP helper on ARM 32bit Raspberry Pi4
board for mapping the PCIe XHCI MMIO, which is above the 4GiB identity
mapping limit.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# d16b38f4 15-Apr-2020 Reuben Dowle <reubendowle0@gmail.com>

Add support for SHA384 and SHA512

The current recommendation for best security practice from the US government
is to use SHA384 for TOP SECRET [1].

This patch adds support for SHA384 and SHA512 in the hash command, and also
allows FIT images to be hashed with these algorithms, and signed with
sha384,rsaXXXX and sha512,rsaXXXX

The SHA implementation is adapted from the linux kernel implementation.

[1] Commercial National Security Algorithm Suite
http://www.iad.gov/iad/programs/iad-initiatives/cnsa-suite.cfm

Signed-off-by: Reuben Dowle <reuben.dowle@4rf.com>

# 43e442a5 26-May-2020 Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

kconfig: fix some typos

Signed-off-by: Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

# eff5a547 22-May-2020 Michael Walle <michael@walle.cc>

cmd: zip: automatically pull in gzip()

Move the CONFIG_GZIP_COMPRESSED from a config.h macro to a Kconfig menu
item. It is not selectable by a user because there is no reason to do
so. Instead it will be automatically selected by the stuff which uses
gzip(), like the zip command.

Remove it from the config_whitelist.txt. Also remove
CONFIG_GZIP_COMPRESS_DEF_SZ as this was never used on any board. The
default seems to be sane, otherwise it should be added as a Kconfig
option.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8239be61 06-May-2020 Simon Glass <sjg@chromium.org>

lib: Allow MD5 to be enabled in SPL

At present the MD5 option cannot be enabled by board configs since it has
no Kconfig name. It is generally enabled, so long as FIT support is
present. But not all boards use FIT, particularly in SPL

Fix this and add an option for SPL as well. This allows board code to call
md5() even if FIT support is not enabled.

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

# 04cb3994 21-Apr-2020 Weijie Gao <weijie.gao@mediatek.com>

lib: enable lzma decompression support for SPL build

This patch enables LZMA decompression support for SPL build

Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>

# 2a2119e1 05-Mar-2020 Atish Patra <atishp@atishpatra.org>

lib: kconfig: Add option to set BZIP2 compression method

There is no way to select BZIP2 compression method.
Add it under library/compression config where all other
compression related configs are present.

Signed-off-by: Atish Patra <atish.patra@wdc.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 805b3cac 12-Feb-2020 Keerthy <j-keerthy@ti.com>

lib: elf: Move the generic elf loading/validating functions to lib

Move the generic elf loading/validating functions to lib/
so that they can be re-used and accessed by code existing
outside cmd.

While at it remove the duplicate static version of load_elf_image_phdr
under arch/arm/mach-imx/imx_bootaux.c.

Signed-off-by: Keerthy <j-keerthy@ti.com>
Suggested-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>

# 1611235b 19-Jan-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: Kconfig dependencies for pseudo-random library

drivers/rng/sandbox_rng.c requires rand() to be defined but configuration
option CONFIG_CONFIG_LIB_RAND selected in drivers/rng/Kconfig does not
exist.

test/lib/test_aes.c requires rand() to be defined.

Fix the selection criteria for choice "Pseudo-random library support type".

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 3c10dc95 06-Dec-2019 Simon Glass <sjg@chromium.org>

binman: Add a library to access binman entries

SPL and TPL can access information about binman entries using link-time
symbols but this is not available in U-Boot proper. Of course it could be
made available, but the intention is to just read the device tree.

Add support for this, so that U-Boot can locate entries.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# b4adf627 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: crypto: add x509 parser

Imported from linux kernel v5.3:
x509.asn1 without changes
x509_akid.asn1 without changes
x509_parser.h without changes
x509_cert_parser.c with changes marked as __UBOOT__
x509_public_key.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# a9b45e6e 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add oid registry utility

Imported from linux kernel v5.3:
build_OID_registry without changes
oid_registry.h without changes
oid_registry.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# ab8a0e06 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add asn1 decoder

Imported from linux kernel v5.3:
lib/asn1_decoder.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 2b12196d 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

cmd: add asn1_compiler

Imported from linux kernel v5.3:
asn1.h without changes
asn1_ber_bytecode.h without changes
asn1_decoder.h without changes
asn1_compiler.c without changes

This host command will be used to create a ASN1 parser, for example,
for pkcs7 messages or x509 certificates. More specifically, it will
generate *byte code* which will be interpreted by asn1 decoder library.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 05429b6c 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

rtc: move date.c from drivers/rtc/ to lib/

In the next commit, rtc_mktime(), for compatibility with linux, will be
implemented using rtc_mktime(), which is no longer drivers/rtc specific.
So move this file under lib/.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 37ef1774 10-Nov-2019 Thomas Hebb <tommyhebb@gmail.com>

Kconfig: disambiguate config names for tiny printf

27084c03d36a ("spl: Allow tiny printf() to be controlled in SPL and
TPL") split this option in two for TPL and SPL, but didn't change the
Kconfig names, making them hard to set quickly.

Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>

# 0d76afc0 27-Oct-2019 Simon Glass <sjg@chromium.org>

fdt: Add Kconfig options to control code size

For better or worse libfdt recent grew a lot of code that checks the
validity of the device tree in great detail. When using unsigned or
unverified data this makes things safer, but it does add to code size.

Add some controls to select the trade-off between safety and code size.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 27084c03 25-Sep-2019 Simon Glass <sjg@chromium.org>

spl: Allow tiny printf() to be controlled in SPL and TPL

At present there is only one control for this and it is used for both SPL
and TPL. But SPL might have a lot more space than TPL so the extra cost of
a full printf() might be acceptable.

Split the option into two, providing separate SPL and TPL controls. The
TPL setting defaults to the same as SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2a51e16b 07-Jun-2019 Tom Rini <trini@konsulko.com>

configs: Make USE_TINY_PRINTF depend on SPL||TPL and be default

The USE_TINY_PRINTF symbol only changes things within SPL and TPL
builds, so make it depend on that support. Next, make it default as
within these cases we should rarely have need of more advanced print
formats outside of the debug context.

To do this, in a few cases we need to correct our Kconfig dependencies
as we had cases of non-SPL targets select'ing this symbol. Finally, in
the case of a few boards we really do need the full printf
functionality.

Signed-off-by: Tom Rini <trini@konsulko.com>

# da0fb5fd 02-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: make call depth limit customizable

Up to now we had hard coded values for the call depth up to which trace
records are created: 200 for early tracing, 15 thereafter. UEFI
applications reach a call depth of 80 or above.

Provide customizing settings for the call trace depth limit and the early
call trace depth limit. Use the old values as defaults.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8509f22a 29-Apr-2019 Marek Behún <kabel@kernel.org>

lib: add Zstandard decompression support

Add the zstd library from Linux kernel (only decompression support).
There are minimal changes to build with U-Boot, otherwise the files are
identical to Linux commit dc35da16 from March 2018, the files had not
been touched since in kernel. Also SPDX lincese tags were added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 83a486b6 29-Apr-2019 Marek Behún <kabel@kernel.org>

lib: Add xxhash support

This adds the xxhash support from Linux. Files are almost identical to
those added to Linux in commit 5d240522 ("lib: Add xxhash module") (they
haven't been touched since in Linux). The only difference is to add some
includes to be compatible with U-Boot. Also SPDX lincese tags were
added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 5132361a 29-Apr-2019 Heiko Schocher <hs@denx.de>

lib: Kconfig: fix help text for GZIP

commit 95f4bbd581cf ("lib: fdt: Allow LZO and GZIP DT compression in U-Boot")

introduced Kconfig option for gzip in U-Boot, but help text
says gzip for SPL, which is wrong. Fix this.

Signed-off-by: Heiko Schocher <hs@denx.de>
Acked-by: Marek Vasut <marex@denx.de>

# 1c6eb075 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE_BUFFER_SIZE et al to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE_BUFFER_SIZE
CONFIG_TRACE_EARLY_SIZE
CONFIG_TRACE_EARLY
CONFIG_TRACE_EARLY_ADDR

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

# a24a78d7 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE

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

# 54969b40 21-Mar-2019 Thierry Reding <treding@nvidia.com>

fdtdec: Add Kconfig symbol for tests

Runtime tests are provided as a test_fdtdec command implementation. Add
a Kconfig symbol that allows this command to be built so that the tests
can be used.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 95f4bbd5 08-Mar-2019 Marek Vasut <marex@denx.de>

lib: fdt: Allow LZO and GZIP DT compression in U-Boot

Add required Kconfig symbols, Makefile bits and macro fixes in a
few places to support LZO and DT compression in U-Boot. This can
save a lot of space with multi-DTB fitImages.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>

# 6e705114 13-Jan-2019 Chris Packham <judge.packham@gmail.com>

lib: Kconfig: spelling fixes

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 048c6e89 06-Nov-2018 Simon Glass <sjg@chromium.org>

spl: lz4: Allow use of lz4 compression in SPL

In some cases U-Boot is compressed and it is useful to be able to
decompress it in SPL. Add a Kconfig and Makefile change to allow this.
Note that this does not actually implement decompression.

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

# 2895c4b7 15-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

kconfig: Introduce HAVE_ARCH_IOMAP

Introduce a new Kconfig option for architecture codes to control
whether it provides io{read,write}{8,16,32} I/O accessor functions.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5592a633 01-Oct-2018 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt in TPL

In some cases (e.g. sandbox with verified boot) it is useful to support
libfdt in TPL. Update the Kconfig to handle this.

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

# 6307896c 01-Oct-2018 Simon Glass <sjg@chromium.org>

tpm: Add support for SPL and TPL

At present the tpm can only be used in U-Boot proper. Updated it to work
in SPL and TPL also.

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

# ab948cd2 19-Jul-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

fdt_support: make FDT_FIXUP_PARTITIONS depend on CMD_MTDPARTS

fdt_fixup_mtdparts() calls mtdparts_init() and device_find(),
which are defined in cmd/mtdparts.c

The combination of FDT_FIXUP_PARTITIONS=y and CMD_MTDPARTS=n
emits the following link error:

common/fdt_support.c:903: undefined reference to `mtdparts_init'
common/fdt_support.c:914: undefined reference to `device_find'

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 3330584d 03-Jun-2018 Igor Opaniuk <igor.opaniuk@gmail.com>

avb2.0: integrate avb 2.0 into the build system

Integrate libavb into the build system. Introduce CONFIG_LIBAVB
build option.

Signed-off-by: Igor Opaniuk <igor.opaniuk@linaro.org>

# f8c987f8 05-Jun-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

lib: Add hexdump

Often during debugging session it's very interesting to see
what data we were dealing with. For example what we write or read
to/from memory or peripherals.

This change introduces functions that allow to dump binary
data with one simple function invocation like:
------------------->8----------------
print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, buf, len);
------------------->8----------------

which gives us the following:
------------------->8----------------
00000000: f2 b7 c9 88 62 61 75 64 72 61 74 65 3d 31 31 35 ....baudrate=115
00000010: 32 30 30 00 62 6f 6f 74 61 72 67 73 3d 63 6f 6e 200.bootargs=con
00000020: 73 6f 6c 65 3d 74 74 79 53 33 2c 31 31 35 32 30 sole=ttyS3,11520
00000030: 30 6e 38 00 62 6f 6f 74 64 65 6c 61 79 3d 33 00 0n8.bootdelay=3.
00000040: 62 6f 6f 74 66 69 6c 65 3d 75 49 6d 61 67 65 00 bootfile=uImage.
00000050: 66 64 74 63 6f 6e 74 72 6f 6c 61 64 64 72 3d 39 fdtcontroladdr=9
00000060: 66 66 62 31 62 61 30 00 6c 6f 61 64 61 64 64 72 ffb1ba0.loadaddr
00000070: 3d 30 78 38 32 30 30 30 30 30 30 00 73 74 64 65 =0x82000000.stde
00000080: 72 72 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 rr=serial0@e0022
00000090: 30 30 30 00 73 74 64 69 6e 3d 73 65 72 69 61 6c 000.stdin=serial
000000a0: 30 40 65 30 30 32 32 30 30 30 00 73 74 64 6f 75 0@e0022000.stdou
000000b0: 74 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 30 t=serial0@e00220
000000c0: 30 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00..............
...
------------------->8----------------

Source of hexdump.c was copied from Linux kernel v4.7-rc2.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Mario Six <mario.six@gdsys.cc>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Stefan Roese <sr@denx.de>

# c232d14d 29-May-2018 Alex Kiernan <alex.kiernan@gmail.com>

mmc: Separate "mmc swrite" from fastboot

Introduce CONFIG_IMAGE_SPARSE and CONFIG_CMD_MMC_SWRITE so the "mmc
swrite" command is separated from the fastboot code.

Move image-sparse from common to lib so it's clear it's library code.

Rename CONFIG_FASTBOOT_FLASH_FILLBUF_SIZE to CONFIG_IMAGE_SPARSE_FILLBUF_SIZE
and migrate it to Kconfig.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Acked-by: Jassi Brar <jaswinder.singh@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6417572e 08-May-2018 Tom Rini <trini@konsulko.com>

lib/Kconfig: Mark OF_LIBFDT_OVERLAY as depending on OF_LIBFDT

The overlay code is only useful when OF_LIBFDT is set, so mark it as
depending on that first.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 58a46f88 25-Apr-2018 Praneeth Bajjuri <praneeth@ti.com>

configs: TI: Enable FIT Library overlay support

Enable the FDT library overlay support for all TI SOC family.

Without this option, when Loading fdt from FIT image, the
following warning is seen.

"config with overlays but CONFIG_OF_LIBFDT_OVERLAY not set".

Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
Suggested-by: Andrew F.Davis <afd@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>

# 14ad44ab 18-Apr-2018 Alex Kiernan <alex.kiernan@gmail.com>

spl: Split sprintf, strto* from SPL serial in Kconfig

When SPL serial is disabled, callers who need sprintf or strtoul fail
because their inclusion is guarded by CONFIG_SPL_SERIAL_SUPPORT/
CONFIG_TPL_SERIAL_SUPPORT.

Split printf, sprintf and strto into their own entries and then select
all of them if SERIAL_SUPPORT is enabled to match the current behaviour.

Include panic.o unconditionally as it can be called from anywhere which
uses BUG_ON().

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>

# e294ba06 04-Apr-2018 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-sunxi

Signed-off-by: Tom Rini <trini@konsulko.com>


# d14db11d 03-Apr-2018 Andre Przywara <andre.przywara@arm.com>

sunxi: revert disabling of features

In January some commits were introduced to mitigate the U-Boot image
size issues we encountered on sunxi builds.
Now with the MMC environment removed we can bring them back, as we
practically don't have a size limit anymore.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 32ce6179 13-Mar-2018 Bryan O'Donoghue <bryan.odonoghue@linaro.org>

optee: Add lib entries for sharing OPTEE code across ports

This patch adds code to lib to enable sharing of useful OPTEE code between
board-ports and architectures. The code on lib/optee/optee.c comes from the
TI omap2 port. Eventually the OMAP2 code will be patched to include the
shared code. The intention here is to add more useful OPTEE specific code
as more functionality gets added.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Cc: Harinarayan Bhatta <harinarayan@ti.com>
Cc: Andrew F. Davis <afd@ti.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Kever Yang <kever.yang@rock-chips.com>
Cc: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Cc: Peng Fan <peng.fan@nxp.com>
Tested-by: Peng Fan <peng.fan@nxp.com>

# 36c1877c 06-Feb-2018 Faiz Abbas <faiz_abbas@ti.com>

lib: Kconfig: Move DYNAMIC_CRC_TABLE to Kconfig

Add CONFIG prefix to DYNAMIC_CRC_TABLE and implement it in
Kconfig.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>

# a451bc27 05-Feb-2018 Adam Ford <aford173@gmail.com>

Convert LIB_UUID to Kconfig

config_fallback.h has some logic that checks a variety of options
and selects LIB_UUID if it hasn't already been selected. This
will all LIB_UUID in Kconfig and select this option for the list
of options to allow us to remove the logic from fallbacks

Signed-off-by: Adam Ford <aford173@gmail.com>

# a5a37567 06-Feb-2018 Adam Ford <aford173@gmail.com>

Convert CONFIG LIB_HW_RAND to Kconfig

config_fallbacks.h had some logic to automatically select
LIB_RAND if RANDOM_UUID or CMD_UUID were set if LIB_HW_RAND wasn't
already selected. By migrating LIB_HW_RAND to Kconfig, we can
remove this check from config_fallbacks.h and put it into Kconfig

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
[trini: Turn into a choice, add NET_RANDOM_ETHADDR]
Signed-off-by: Tom Rini <trini@konsulko.com>

# acd4d334 16-Jan-2018 Maxime Ripard <maxime.ripard@free-electrons.com>

net: regex: Disable by default on sunXi

The sunXi arm64 build has overflown, leading to the main U-boot binary
overwriting the environment when flashing the new image, or even worse,
overwriting itself when we're calling saveenv.

Disable this option that is not critical until we can adress the issue
properly.

Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 7e3caa81 03-Dec-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

Move CONFIG_PANIC_HANG to Kconfig

Freescale (NXP) boards have lots of defconfig files per board.
I used "imply PANIC_HANG" for them.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# da5337a6 08-Nov-2017 Nandor Han <nandor.han@ge.com>

rtc: add support for s35392a

Add support for S35392A RTC. The driver supports both U-Boot driver
models.

Signed-off-by: Nandor Han <nandor.han@ge.com>
Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
Cc: Heiko Schocher <hs@denx.de>

# f52bdf4b 14-Sep-2017 Jean-Jacques Hiblot <jjhiblot@ti.com>

lib: allow building lzo for the SPL

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 85d8bf57 03-Sep-2017 Marek Behún <kabel@kernel.org>

lib: Add CRC32-C

This is needed for BTRFS.

Signed-off-by: Marek Behun <marek.behun@nic.cz>

create mode 100644 lib/crc32c.c

# 7264f292 15-Aug-2017 York Sun <york.sun@nxp.com>

spl: fit: Eanble GZIP support for image decompression

Add Kconfig option SPL_GZIP and SPL_ZLIB to enable gunzip support for
SPL boot, eg. falcon boot compressed kernel image.

Signed-off-by: York Sun <york.sun@nxp.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6ef2f901 11-Aug-2017 Adam Ford <aford173@gmail.com>

Convert CONFIG_BCH to Kconfig

This converts the following to Kconfig:
CONFIG_BCH

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1a7ba1d 18-Aug-2017 Anatolij Gustschin <agust@denx.de>

Fix 'notes' typos

s/notes/nodes

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 96b9082c 03-Aug-2017 Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

rockchip: rk3188: rock: adjust for SPL/TPL split

With the changes to split SPL/TPL for the RK3368, I apparently missed
some needed adjustments to the RK3188 Kconfig and rock_defconfig.

This fixes build-issues for the rock board after applying the RK3368
enablement (and SPL/TPL) set that resulted from TPL_SERIAL_SUPPORT,
TPL_ROCKCHIP_BACK_TO_BROM and TPL_TINY_MEMSET being separate symbols
now.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d56b4b19 22-Jul-2017 Tom Rini <trini@konsulko.com>

configs: Migrate RBTREE, LZO, CMD_MTDPARTS, CMD_UBI and CMD_UBIFS

The above CONFIG options are in Kconfig, and now have correct depends and
inter-dependencies. Migrate these to configs/ from include/configs/. In the
case of CMD_UBIFS also change it to be a default y if CMD_UBI.

Signed-off-by: Tom Rini <trini@konsulko.com>

# aed998aa 17-May-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_LZMA to Kconfig

This converts the following to Kconfig:
CONFIG_LZMA

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

# b1a873df 26-Apr-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_CMD_AES et al to Kconfig

This converts the following to Kconfig:
CONFIG_CMD_AES
CONFIG_AES

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Add select AES to CMD_AES]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 173aafbf 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

cmd: Expose a Kconfig option to enable UBIFS commands

Create a new Kconfig entry to allow CMD_UBIFS selection from Kconfig and
add an hidden LZO option that can be selected by CMD_UBIFS.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>

# aa049152 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

mtd: ubi: Select RBTREE option from MTD_UBI Kconfig entry

Expose the RBTREE feature through Kconfig and select this option from the
MTD_UBI option.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>
[Rebased on master]
Signed-off-by: Jagan Teki <jagan@openedev.com>

# ab4458bd 02-Apr-2017 Simon Glass <sjg@chromium.org>

string: Provide a slimmed-down memset()

Most of the time the optimised memset() is what we want. For extreme
situations such as TPL it may be too large. For example on the 'rock'
board, using a simple loop saves a useful 48 bytes. With gcc 4.9 and
the rodata bug, this patch is enough to reduce the TPL image below the
limit.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>

# bea79d7d 14-Mar-2017 Andre Przywara <andre.przywara@arm.com>

Kconfig: introduce md5sum command selection

So far CONFIG_MD5SUM would need to be set by a board's include file.
Since the command is really generic, move it over to Kconfig to allow
it to be defined by either a board's defconfig, menuconfig or some
config snippet merged via mergeconfig.sh.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e663b350 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

smbios: Expose in efi_loader as table

We can pass SMBIOS easily as EFI configuration table to an EFI payload. This
patch adds enablement for that case.

While at it, we also enable SMBIOS generation for ARM systems, since they support
EFI_LOADER.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4b6dddc2 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

x86: Move smbios generation into arch independent directory

We will need the SMBIOS generation function on ARM as well going forward,
so let's move it into a non arch specific location.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# ebf7fff2 05-Oct-2016 Heiko Schocher <hs@denx.de>

spl: move FDT_FIXUP_PARTITIONS to Kconfig

Move FDT_FIXUP_PARTITIONS to Kconfig and cleanup existing
uses.

Signed-off-by: Heiko Schocher <hs@denx.de>

# ddf67f71 05-Jul-2016 Maxime Ripard <maxime.ripard@free-electrons.com>

libfdt: Add overlay application function

The device tree overlays are a good way to deal with user-modifyable
boards or boards with some kind of an expansion mechanism where we can
easily plug new board in (like the BBB, the Raspberry Pi or the CHIP).

Add a new function to merge overlays with a base device tree.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>

# 91b86e21 26-May-2016 Marek Vasut <marex@denx.de>

lib: Enable private libgcc by default

This patch decouples U-Boot binary from the toolchain on systems where
private libgcc is available. Instead of pulling in functions provided
by the libgcc from the toolchain, U-Boot will use it's own set of libgcc
functions. These functions are usually imported from Linux kernel, which
also uses it's own libgcc functions instead of the ones provided by the
toolchain.

This patch solves a rather common problem. The toolchain can usually
generate code for many variants of target architecture and often even
different endianness. The libgcc on the other hand is usually compiled
for one particular configuration and the functions provided by it may
or may not be suited for use in U-Boot. This can manifest in two ways,
either the U-Boot fails to compile altogether and linker will complain
or, in the much worse case, the resulting U-Boot will build, but will
misbehave in very subtle and hard to debug ways.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 67976306 30-Mar-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

cosmetic: Fix typos "privide"

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# ed980b8c 03-Mar-2016 Alexander Graf <agraf@csgraf.de>

efi_loader: hook up in build environment

Now that we have all the bits and pieces ready for EFI payload loading
support, hook them up in Makefiles and KConfigs so that we can build.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
[trini: Enable only when we of OF_LIBFDT, disable on kwb and colibri_pxa270]
Signed-off-by: Tom Rini <trini@konsulko.com>

# aa34fbc0 22-Feb-2016 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt to be used in SPL

Add an option to enable libfdt in SPL. This can be useful when decoding
FIT files in SPL.

We need to make sure this option is not enabled in SPL by this change.
Also this option needs to be enabled in host builds. Si add a new
IMAGE_USE_LIBFDT #define which can be used in files that are built on the
host but must also build for U-Boot and SPL.

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

# 69e173eb 22-Feb-2016 Simon Glass <sjg@chromium.org>

Move CONFIG_OF_LIBFDT to Kconfig

Move this option to Kconfig and tidy up existing boards.

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

# a187559e 05-Feb-2016 Bin Meng <bmeng.cn@gmail.com>

Use correct spelling of "U-Boot"

Correct spelling of "U-Boot" shall be used in all written text
(documentation, comments in source files etc.).

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Minkyu Kang <mk7.kang@samsung.com>

# 947c626d 14-Jan-2016 Tom Rini <trini@konsulko.com>

vsprintf.c: Always enable CONFIG_SYS_VSNPRINTF

Enabling this function always removes some class of string saftey issues.
The size change here in general is about 400 bytes and this seems a reasonable
trade-off.

Cc: Peng Fan <peng.fan@nxp.com>
Cc: Peter Robinson <pbrobinson@gmail.com>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Adrian Alonso <aalonso@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 7d9cde10 22-Nov-2015 Stefan Roese <sr@denx.de>

lib/tiny-printf.c: Add tiny printf function for space limited environments

This patch adds a small printf() version that supports all basic formats.
Its intented to be used in U-Boot SPL versions on platforms with very
limited internal RAM sizes.

To enable it, just define CONFIG_USE_TINY_PRINTF in your defconfig. This
will result in the SPL using this tiny function and the main U-Boot
still using the full-blown printf() function.

This code was copied from:
http://www.sparetimelabs.com/printfrevisited
With mostly only coding style related changes so that its checkpatch
clean.

The size reduction is about 2.5KiB. Here a comparison for the db-mv784mp-gp
(Marvell AXP) SPL:

Without this patch:
58963 18536 1928 79427 13643 ./spl/u-boot-spl

With this patch:
56542 18536 1956 77034 12cea ./spl/u-boot-spl

Note:
To make it possible to compile tiny-printf.c instead of vsprintf.c when
CONFIG_USE_TINY_PRINTF is defined, the functions printf() and vprintf() are
moved from common/console.c into vsprintf.c in this patch.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>

# 2419cd16 03-Oct-2015 Simon Glass <sjg@chromium.org>

dm: tpm: Drop CONFIG_DM_TPM

Now that all TPM drivers use driver model, we can drop the special driver
model CONFIG option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>

# 027b728d 06-Oct-2015 Julius Werner <jwerner@chromium.org>

Add support for LZ4 decompression algorithm

This patch adds support for LZ4-compressed FIT image contents. This
algorithm has a slightly worse compression ration than LZO while being
nearly twice as fast to decompress. When loading images from a fast
storage medium this usually results in a boot time win.

Sandbox-tested only since I don't have a U-Boot development system set
up right now. The code was imported unchanged from coreboot where it's
proven to work, though. I'm mostly interested in getting this recognized
by mkImage for use in a downstream project.

Signed-off-by: Julius Werner <jwerner@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# a7d660bc 22-Aug-2015 Simon Glass <sjg@chromium.org>

tpm: Add Kconfig options for TPMs

Add new Kconfig options for TPMs in preparation for moving boards to use
Kconfig for TPM configuration.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 867a6ac8 31-Jul-2015 Simon Glass <sjg@chromium.org>

efi: Add start-up library code

When running as an EFI application, U-Boot must request memory from EFI,
and provide access to the boot services U-Boot needs.

Add library code to perform these tasks. This includes efi_main() which is
the entry point from EFI. U-Boot is built as a shared library.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d1389403 23-Jun-2015 Simon Glass <sjg@chromium.org>

Add a dhrystone benchmark command

Drystone provides a convenient sanity check that the CPU is running at full
speed. Add this as a command which can be enabled as needed.

Note: I investigated using Coremark for this but there was a license
agreement and I could not work out if it was GPL-compatible.

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

# f7848d90 22-Jun-2015 Joe Hershberger <joe.hershberger@ni.com>

Allow CONFIG_REGEX to be disabled when CONFIG_NET

Instead of selecting REGEX when NET is enabled, make it the default, but
allow boards that are tiny to disable it and lose functionality on all
but the first Ethernet adapter.

cm-bf548, bf538f-ezkit, and bf533-stamp need this. None appear to have
more than one Ethernet interface.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# 3850dbe8 11-Jun-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

blackfin: fix undefined reference to srand and rand

Commit 9ba9e85f3f1c (net: Fix NET_RANDOM_ETHADDR dependencies)
accidentally dropped CONFIG_LIB_RAND defines for 14 Blackfin boards.

Prior to that commit, those boards defined CONFIG_LIB_RAND, but not
CONFIG_NET_RANDOM_ETHADDR. So, commit 9ba9e85f3f1c should not have
touched them, but in fact it ripped CONFIG_LIB_RAND off from all the
header files, which caused undefined reference to srand and rand.
CONFIG_LIB_RAND=y must be revived for such boards.

BTW, this commit indeed makes it better, but even with this fix,
three boards (bf533-stamp, bf538f-ezkit, cm-bf548) still can not
build due to region 'ram' overflowed error. This was cause by
commit 6eed3786c68c (net: Move the CMD_NET config to defconfigs)
because CMD_NET selects NET, and NET selects REGEX. Eventually,
some boards were newly enabled with CONFIG_REGEX, increasing the
memory footprint. A patch is expected to fix the build error.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 9ba9e85f 25-May-2015 Michal Simek <michal.simek@amd.com>

net: Fix NET_RANDOM_ETHADDR dependencies

NET_RANDOM_ETHADDR depends on lib/rand.c. This patch adds dependency to
Kconfig to ensure that library is also compiled.

Remove the definitions from Blackfin boards' include/configs.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 6501ff62 20-Apr-2015 Przemyslaw Marczak <p.marczak@samsung.com>

lib: Kconfig: add entry for errno_str() function

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1a60650c 21-Apr-2015 Joe Hershberger <joe.hershberger@ni.com>

kconfig: Move REGEX to Kconfig

Having this as a Kconfig allows it to be a dependent feature.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8156345d 06-Mar-2015 Simon Glass <sjg@chromium.org>

sandbox: Move CONFIG_SYS_VSNPRINTF to Kconfig

Move this over to Kconfig and tidy up.

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

# 94e3c8c4 19-Feb-2015 gaurav rana <gaurav.rana@freescale.com>

crypto/fsl - Add progressive hashing support using hardware acceleration.

Currently only normal hashing is supported using hardware acceleration.
Added support for progressive hashing using hardware.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
Signed-off-by: Gaurav Rana <gaurav.rana@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>

# d9f23c7f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

lib/rsa: Add Kconfig for devices supporting RSA Modular Exponentiation

Kconfig option added for devices which support RSA Verification.
1. RSA_SOFTWARE_EXP
Enables driver for supporting RSA Modular Exponentiation in Software
2. RSA_FREESCALE_EXP
Enables driver for supporting RSA Modular Exponentiation using Freescale specific
driver

The above drivers use RSA uclass

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
(Removed duplicate line in Kconfig comment)

Change-Id: I7663c4d5350e2bfc3dfa2696f70ef777d6ccc6f6

# c4beb22f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

FIT: Modify option FIT_SIGNATURE in Kconfig

For FIT signature based approach to work, RSA library needs to be selected.
The FIT_SIGNATURE option in Kconfig is modified to automatically select RSA.
Selecting RSA compiles the RSA library required for image verification.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 45ccec8f 23-Oct-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

kconfig: move CONFIG_USE_PRIVATE_LIBGCC to Kconfig

The private libgcc is supported only on ARM, MIPS, PowerPC, SH, x86.
Those architectures should "select" HAVE_PRIVATE_LIBGCC and
CONFIG_USE_PRIVATE_LIBGCC should depend on it.

Currently, this option is enabled on Tegra boards and x86 architecture.
Move the definition from header files to Kconfig.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Tested-by: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: Tom Warren <twarren@nvidia.com>

# 8c688bc4 23-Oct-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

kconfig: move CONFIG_SYS_HZ to lib/Kconfig

CONFIG_SYS_HZ is always defined as 1000 in config_fallbacks.h
(but some boards still have redundant definitions).

This commit moves the definition and the document in README to
Kconfig. Since lib/Kconfig can assure that CONFIG_SYS_HZ is 1000,
the sanity check in lib/time.c should be removed.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Reviewed-by: Marek Vasut <marex@denx.de>

# b0928da6 16-Sep-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

kconfig: move CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED to Kconfig

If this option is enabled, the objects under lib/ directory
are compiled with speed optimization, not size optimization.
(Currently, only used by some Blackfin boards.)

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# ed36323f 16-Sep-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

kconfig: add blank Kconfig files

This would be useful to start moving various config options.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# 94c8da21 22-Mar-2023 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: Fix LMB_MEMORY_REGIONS flag usage

Remove test on CONFIG_LMB_MEMORY_REGIONS introduced by commit
7c1860fce4e3 ("lmb: Fix lmb property's defination under struct lmb").

This code in lmb_init() is strange, because if CONFIG_LMB_USE_MAX_REGIONS
and CONFIG_LMB_MEMORY_REGIONS are not defined, the implicit #else is empty
and the required initialization is not done:
lmb->memory.max = ?
lmb->reserved.max = ?

But this setting is not possible:
- CONFIG_LMB_USE_MAX_REGIONS not defined
- CONFIG_LMB_MEMORY_REGIONS not defined
because CONFIG_LMB_MEMORY_REGIONS and CONFIG_LMB_RESERVED_REGIONS are
defined as soon as the CONFIG_LMB_USE_MAX_REGIONS is not defined.

This patch removes this impossible case #elif and I add some
explanation in lmb.h to explain why in the struct lmb {} the lmb
property is defined if CONFIG_LMB_MEMORY_REGIONS is NOT defined.

This patch also removes CONFIG_LMB_XXX dependency on CONFIG_LMB as these
defines are used in API file lmb.h and not only in library file.

Fixes: 5e2548c1d6e03 ("lmb: Fix LMB_MEMORY_REGIONS flag usage")
Reported-by: Mark Millard <marklmi@yahoo.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Acked-by: Michal Simek <michal.simek@amd.com>

# c61df340 18-Mar-2023 Marek Vasut <marek.vasut+renesas@mailbox.org>

lib: Fix SYS_TIMER_COUNTS_DOWN description in Kconfig

The SYS_TIMER_COUNTS_DOWN description contains a typo,
s@rathe@&r@ , fix it.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>

# 3b510807 22-Feb-2023 Simon Glass <sjg@chromium.org>

lib: Add an SPL config for LIB_UUID

This is selected by PARTITION_UUIDS which has a separate option for SPL.
Add an SPL option for LIB_UUID also, so that we can keep them consistent.

Also add one for PARTITION_TYPE_GUID to avoid a build error in part_efi.c
which wants to call a uuid function in SPL.

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

# 5a6bc166 22-Feb-2023 Simon Glass <sjg@chromium.org>

lib: Add VPL options for SHA1 and SHA256

Add these options so these algorithms can be used in VPL.

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

# ae625d92 22-Feb-2023 Simon Glass <sjg@chromium.org>

lib: Add a Kconfig for SPL_BZIP2

This is implicitly used in the source and seems useful, so add it.

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

# c33425c6 15-Jan-2023 Simon Glass <sjg@chromium.org>

trace: Reduce the default for TRACE_EARLY_CALL_DEPTH_LIMIT

This is a silly value at present, since U-Boot's call depth never reaches
200. Fix it.

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

# 2dc16a2c 19-Jan-2023 Sjoerd Simons <sjoerd@collabora.com>

Bump LMB_MAX_REGIONS default to 16

Since commit 06d514d77c37 ("lmb: consider EFI memory map") the EFI regions
are also pushed into the lmb if EFI_LOADER is enabled (which is by
default on most system). Which can cause the number of entries to go
over the maximum as it's default is only 8.

Specifically i ran into this case on an TI am62 which has an fdt with
4 reserved regions (in practice 3 lmb entries due to adjecent ranges).

As this is likely to impact more devices bump the default max
regions to 16 so there is a bit more slack.

Fixes: 06d514d77c ("lmb: consider EFI memory map")
Link: https://bugzilla.opensuse.org/show_bug.cgi?id=1207562
Reviewed-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Signed-off-by: Sjoerd Simons <sjoerd@collabora.com>
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
[trini: collect tags from the other equivalent patch]

# 948d3999 08-Feb-2023 Tom Rini <trini@konsulko.com>

Revert "lmb: Default to not-LMB_USE_MAX_REGIONS"

As explained by Philippe Schenker, I was misinterpreting what happened
in the case where we do not set LMB_USE_MAX_REGIONS and so had
re-introduced the problem I was attempting to more widely resolve.

This reverts commit 007ae5d108a37564905ea1588cb279f3a522cc3d.

Reported-by: Philippe Schenker <philippe.schenker@toradex.com>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 007ae5d1 25-Jan-2023 Tom Rini <trini@konsulko.com>

lmb: Default to not-LMB_USE_MAX_REGIONS

The LMB code allows for picking a hard limit on the number of regions it
can know of, or to dynamically allocate these regions. The reason for
this choice is to allow for the compiler to perform a size optimization
in the common case. This optimization however, is very small, ranging
from 196 bytes to 15 bytes saved, or in some cases, being larger. Now
that we also have more regions covered by LMB (in order to protect
various parts of our self at run time), the default of 8 is also much
easier to hit and leads to non-obvious error messages (which imply that
an area is protected, not that we're out of areas to add to the list).

Switch to the dynamic use as the default.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 53c47c59 19-Jan-2023 Tom Rini <trini@konsulko.com>

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


# 4b9b25d9 12-Jan-2023 Brandon Maier <brandon.maier@collins.com>

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

[1] https://github.com/torvalds/linux/commit/e0c1b49f5b674cca7b10549c53b3791d0bbc90a8
[2] https://github.com/facebook/zstd/blob/f302ad8811643c428c4e3498e28f53a0578020d3/lib/libzstd.mk#L31

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>

# ebc1d50a 21-Dec-2022 Simon Glass <sjg@chromium.org>

Revert "fdtdec: drop needlessly convoluted CONFIG_PHANDLE_CHECK_SEQ"

The fdt_path_offset() function is slow since it must scan the tree.
This substantial overhead now applies to all boards.

The original code may not be ideal but it is fit for purpose and is only
needed on a few boards.

Reverting this reduces time to set up driver model by about 30ms.

Before revert:

Accumulated time:
47,170 dm_r
53,237 dm_spl
572,986 dm_f

Accumulated time:
44,598 dm_r
50,347 dm_spl
549,133 dm_f

This reverts commit 26f981f295d00351b6f0c69b5317b254b2361cc0.

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

# 12619d4e 21-Dec-2022 Simon Glass <sjg@chromium.org>

trace: Don't require TIMER_EARLY

Some platforms cannot honour this and don't need trace before relocation.
Use 'imply' instead, so boards can disable this.

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

# 0c16fca9 07-Jan-2023 Simon Glass <sjg@chromium.org>

tpm: Add a proper Kconfig option for crc8 in SPL

The current approach is a bit of a hack and only works for the tpm
subsystem. Add a Kconfig so that crc8 can be enabled in SPL for other
purposes.

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

# 14f43797 19-Dec-2022 Tom Rini <trini@konsulko.com>

Merge tag 'v2023.01-rc4' into next

Prepare v2023.01-rc4

Signed-off-by: Tom Rini <trini@konsulko.com>


# ae3527f0 07-Dec-2022 Kautuk Consul <kconsul@ventanamicro.com>

arch/riscv: add semihosting support for RISC-V

We add RISC-V semihosting based serial console for JTAG based early
debugging.

The RISC-V semihosting specification is available at:
https://github.com/riscv/riscv-semihosting-spec/blob/main/riscv-semihosting-spec.adoc

Signed-off-by: Anup Patel <apatel@ventanamicro.com>
Signed-off-by: Kautuk Consul <kconsul@ventanamicro.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>

# 1c03ab9f 07-Dec-2022 Kautuk Consul <kconsul@ventanamicro.com>

lib: Add common semihosting library

We factor out the arch-independent parts of the ARM semihosting
implementation as a common library so that it can be shared
with RISC-V.

Signed-off-by: Kautuk Consul <kconsul@ventanamicro.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>

# 3b8dfc42 16-Nov-2022 Tom Rini <trini@konsulko.com>

Convert CONFIG_SYS_TIMER_COUNTS_DOWN to Kconfig

This converts the following to Kconfig:
CONFIG_SYS_TIMER_COUNTS_DOWN

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 86794052 21-Oct-2022 Sughosh Ganu <sughosh.ganu@linaro.org>

FWU: Add support for the FWU Multi Bank Update feature

The FWU Multi Bank Update feature supports updating firmware images
to one of multiple sets(also called banks) of images. The firmware
images are clubbed together in banks, with the system booting images
from the active bank. Information on the images such as which bank
they belong to is stored as part of the metadata structure, which is
stored on the same storage media as the firmware images on a dedicated
partition.

At the time of update, the metadata is read to identify the bank to
which the images need to be flashed(update bank). On a successful
update, the metadata is modified to set the updated bank as active
bank to subsequently boot from.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

# 40ed7be4 02-Aug-2022 Tom Rini <trini@konsulko.com>

Convert CONFIG_SYS_FDT_PAD to Kconfig

This converts the following to Kconfig:
CONFIG_SYS_FDT_PAD

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e67ffb5a 22-Jul-2022 Sughosh Ganu <sughosh.ganu@linaro.org>

tpm: rng: Add driver model interface for TPM RNG device

The TPM device has a builtin random number generator(RNG)
functionality. Expose the RNG functions of the TPM device to the
driver model so that they can be used by the EFI_RNG_PROTOCOL if the
protocol is installed.

Also change the function arguments and return type of the random
number functions to comply with the driver model api.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

# b340199f 10-Jun-2022 Tom Rini <trini@konsulko.com>

spl: Ensure all SPL symbols in Kconfig have some SPL dependency

Tighten up symbol dependencies in a number of places. Ensure that a SPL
specific option has at least a direct dependency on SPL. In places
where it's clear that we depend on something more specific, use that
dependency instead. This means in a very small number of places we can
drop redundant dependencies.

Reported-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 13ce351b 08-Jun-2022 Tom Rini <trini@konsulko.com>

vpl: Ensure all VPL symbols in Kconfig have some VPL dependency

Tighten up symbol dependencies in a number of places. Ensure that a VPL
specific option has at least a direct dependency on VPL. In places
where it's clear that we depend on something more specific, use that
dependency instead.

Reported-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 8bea4bf7 08-Jun-2022 Tom Rini <trini@konsulko.com>

tpl: Ensure all TPL symbols in Kconfig have some TPL dependency

Tighten up symbol dependencies in a number of places. Ensure that a TPL
specific option has at least a direct dependency on TPL. In places
where it's clear that we depend on something more specific, use that
dependency instead.

Reported-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 26f981f2 19-May-2022 Rasmus Villemoes <rasmus.villemoes@prevas.dk>

fdtdec: drop needlessly convoluted CONFIG_PHANDLE_CHECK_SEQ

Asking if the alias we found actually points at the device tree node
we passed in (in the guise of its offset from blob) can be done simply
by asking if the fdt_path_offset() of the alias' path is identical to
offset.

In fact, the current method suffers from the possibility of false
negatives: dtc does not necessarily emit a phandle property for a node
just because it is referenced in /aliases; it only emits a phandle
property for a node if it is referenced in <angle brackets>
somewhere. So if both the node we passed in and the alias node we're
considering don't have phandles, fdt_get_phandle() returns 0 for both.

Since the proper check is so simple, there's no reason to hide that
behind a config option (and if one really wanted that, it should be
called something else because there's no need to involve phandle in
the check).

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Acked-by: Aswath Govindraju <a-govindraju@ti.com>

# d30924f1 01-May-2022 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: fix selection of CONFIG_CHARSET

lib/charset.c is not optional for
EFI_APP || EFI_LOADER || UFS || UT_UNICODE.
These must select CONFIG_CHARSET.

Fixes: 726cd9836db0 ("efi: Make unicode printf available to the app")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>

# 747093dd 30-Apr-2022 Simon Glass <sjg@chromium.org>

vpl: Add Kconfig options for VPL

Add VPL versions of commonly used Kconfig options.

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

# 11232139 06-Apr-2022 Tom Rini <trini@konsulko.com>

nds32: Remove the architecture

As removal of nds32 has been ack'd for the Linux kernel, remove support
here as well.

Cc: Rick Chen <rick@andestech.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Rick Chen <rick@andestech.com>

# fd210fee 28-Mar-2022 Philippe Reynes <philippe.reynes@softathome.com>

lib: allow to build asn1 decoder and oid registry in SPL

This commit adds the options:
- SPL_ASN1_DECODER
- SPL_OID_REGISTRY

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>

# 7d44a985 28-Mar-2022 Philippe Reynes <philippe.reynes@softathome.com>

lib: Kconfig: enhance the help of OID_REGISTRY

Enhance the help for the config OID_REGISTRY.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>

# a0e71d96 28-Mar-2022 Philippe Reynes <philippe.reynes@softathome.com>

lib: Kconfig: enhance help for ASN1

Enhance the help for configs ASN1_COMPILER
and ASN1_decoder.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>

# 761a1786 27-Jan-2022 Tom Rini <trini@konsulko.com>

Merge tag 'dm-pull-26jan22' of https://source.denx.de/u-boot/custodians/u-boot-dm

acpi refactoring to allow non-x86 use
binman support for bintools (binary tools)
minor tools improvements in preparation for FDT signing
various minor fixes and improvements


# 334a9b9d 25-Nov-2021 Loic Poulain <loic.poulain@linaro.org>

lib/circbuf: Make circbuf selectable symbol

It is currenly only used from usbtty driver but make it properly
selectable via Kconfig symbol, for future usage.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>

# e1722fcb 01-Dec-2021 Simon Glass <sjg@chromium.org>

x86: Allow any arch to generate ACPI tables

These have sadly found their way to ARM now. Allow any arch to support
generating ACPI tables.

Disable this for the tools build.

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

# 7c3fd5c2 26-Dec-2021 Qu Wenruo <wqu@suse.com>

lib: add BLAKE2 hash support

The code is cross-ported from BLAKE2 reference implementation
(https://github.com/BLAKE2/BLAKE2).

With minimal change to remove unused macros/features.

Currently there is only one user inside U-boot (btrfs), and since it
only utilize BLAKE2B, all other favors are all removed.

Signed-off-by: Qu Wenruo <wqu@suse.com>
[trini: Rename ROUND to R to avoid clash with <linux/bitops.h>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 97f2a749 04-Jan-2022 Eugen Hristev <eugen.hristev@collabora.com>

lib: Kconfig: fix PHANDLE_CHECK_SEQ position outside of menu

CONFIG_PHANDLE_CHECK_SEQ is outside of the menu 'Library routines'
thus it's invisible in menuconfig and cannot be selected.
Fix this by moving the 'endmenu' after the PHANDLE_CHECK_SEQ definition

Fixes: c589132a1d ("fdt: Use phandle to distinguish DT nodes with same name")
Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
Reviewed-by: Aswath Govindraju <a-govindraju@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 726cd983 29-Dec-2021 Simon Glass <sjg@chromium.org>

efi: Make unicode printf available to the app

This is needed to show unicode strings. Enable this code in the app.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>

# 6405ab7a 24-Nov-2021 Simon Glass <sjg@chromium.org>

Convert CONFIG_PHYSMEM to Kconfig

This converts the following to Kconfig:
CONFIG_PHYSMEM

Signed-off-by: Simon Glass <sjg@chromium.org>
Suggested-by: Sean Anderson <seanga2@gmail.com>

# ac7606af 14-Nov-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

lmb: fix typo 'commun'

%s/commun/common/

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

# e7d285b2 25-Sep-2021 Simon Glass <sjg@chromium.org>

image: Use the correct checks for CRC32

Add a host Kconfig for CRC32. With this we can use CONFIG_IS_ENABLED(CRC32)
directly in the host build, so drop the unnecessary indirection.

Add a few more conditions to SPL_CRC32 to avoid build failures as well as
TPL_CRC32. Also update hash.c to make crc32 optional and to actually take
notice of SPL_CRC32.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# 2c21256b 25-Sep-2021 Simon Glass <sjg@chromium.org>

hash: Use Kconfig to enable hashing in host tools and SPL

At present when building host tools, we force CONFIG_SHAxxx to be enabled
regardless of the board Kconfig setting. This is done in the image.h
header file.

For SPL we currently just assume the algorithm is desired if U-Boot proper
enables it.

Clean this up by adding new Kconfig options to enable hashing on the host,
relying on CONFIG_IS_ENABLED() to deal with the different builds.

Add new SPL Kconfigs for hardware-accelerated hashing, to maintain the
current settings.

This allows us to drop the image.h code and the I_WANT_MD5 hack.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# 603d15a5 25-Sep-2021 Simon Glass <sjg@chromium.org>

spl: cypto: Bring back SPL_ versions of SHA

Unfortunately these were removed by mistake. This means that adding hash
support to SPL brings in all software algorithms, with a substantial
increase in code size.

The origin of the problem was renaming them to SPL_FIT_xxx and then these
were removed altogether in a later commit.

Add them back. This aligns with CONFIG_MD5, for example, which has an SPL
variant.

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: f5bc9c25f31 ("image: Rename SPL_SHAxxx_SUPPORT to SPL_FIT_SHAxxx")
Fixes: eb5171ddec9 ("common: Remove unused CONFIG_FIT_SHAxxx selectors")
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# 6674edaa 16-Sep-2021 Tom Rini <trini@konsulko.com>

Merge tag 'v2021.10-rc4' into next

Prepare v2021.10-rc4

Signed-off-by: Tom Rini <trini@konsulko.com>

# gpg: Signature made Tue 14 Sep 2021 06:58:32 PM EDT
# gpg: using RSA key 1A3C7F70E08FAB1707809BBF147C39FF9634B72C
# gpg: Good signature from "Thomas Rini <trini@konsulko.com>" [ultimate]

# Conflicts:
# board/Arcturus/ucp1020/spl.c
# cmd/mvebu/Kconfig
# common/Kconfig.boot
# common/image-fit.c
# configs/UCP1020_defconfig
# configs/sifive_unmatched_defconfig
# drivers/pci/Kconfig
# include/configs/UCP1020.h
# include/configs/sifive-unmatched.h
# lib/Makefile
# scripts/config_whitelist.txt


# 5145bc73 01-Sep-2021 Oleksandr Suvorov <oleksandr.suvorov@foundries.io>

lib: fix typos in Kconfig

There are trivial typos in the Kconfig file. Fixed them.
Also, fixed grammar in the descriptions with typos.

Fixes: d56b4b1974 ("configs: Migrate RBTREE, LZO, CMD_MTDPARTS, CMD_UBI and CMD_UBIFS")
Fixes: 7264f2928b ("spl: fit: Eanble GZIP support for image decompression")
Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# e60e4499 02-Sep-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

lib: Drop SHA512_ALGO in lieu of SHA512

SHA512_ALGO was used as a "either SHA512 or SHA384", although the
implementations of these two algorithms share a majority of code.

From a Kconfig interface perspective, it makes sense to present two
distinct options. This requires #ifdefing out the SHA512
implementation from sha512.c. The latter doesn't make any sense.

It's reasonable to say in Kconfig that SHA384 depends on SHA512, and
seems to be the more polite way to handle the selection.

Thus, automatically select SHA512 when SHA384 is enabled.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# b4c2c151 27-Aug-2021 Michal Simek <michal.simek@amd.com>

Kconfig: Remove all default n/no options

default n/no doesn't need to be specified. It is default option anyway.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
[trini: Rework FSP_USE_UPD portion]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 928a8be7 29-Jul-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

lib: ecdsa: Implement UCLASS_ECDSA verification on target

Implement the crypto_algo .verify() function for ecdsa256. Because
it backends on UCLASS_ECDSA, this change is focused on parsing the
keys from devicetree and passing this information to the specific
UCLASS driver.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# fa3f1f1d 24-Jul-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: disable CONFIG_SPL_HEXDUMP by default

CONFIG_HEXDUMP is needed to display UEFI variables using 'printenv -e'.

Enabling CONFIG_SPL_HEXDUMP only makes sense for debugging purposes.
Hence CONFIG_SPL_HEXDUMP should not be enabled by default.

The following boards currently have CONFIG_SPL_HEXDUMP=y. This includes
boards that don't use SPL at all.

axm_defconfig
imx8mm-cl-iot-gate_defconfig
imx8mm_venice_defconfig
imxrt1020-evk_defconfig
imxrt1050-evk_defconfig
kontron_sl28_defconfig
kp_imx53_defconfig
lx2160ardb_tfa_stmm_defconfig
mt7622_rfb_defconfig
octeon_ebb7304_defconfig
octeon_nic23_defconfig
qemu_arm64_defconfig
qemu_arm_defconfig
qemu-riscv32_defconfig
qemu-riscv32_smode_defconfig
qemu-riscv64_defconfig
qemu-riscv64_smode_defconfig
qemu-x86_64_defconfig
qemu-x86_defconfig
sandbox64_defconfig
sandbox_defconfig
stm32mp15_basic_defconfig
stm32mp15_trusted_defconfig
synquacer_developerbox_defconfig
taurus_defconfig
xilinx_versal_virt_defconfig

The patch only keeps it enabled on

sandbox_spl_defconfig

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 1a46cb6c 02-Jul-2021 Simon Glass <sjg@chromium.org>

lib: Create a new Kconfig option for charset conversion

Rather than looking at two KConfig options in the Makefile, create a new
Kconfig option for compiling lib/charset.c

Enable it for UFS also, which needs this support.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 26dd9936 08-Jul-2021 Steffen Jaeckel <jaeckel-floss@eyet-services.de>

lib: add crypt subsystem

Add the basic functionality required to support the standard crypt
format.
The files crypt-sha256.c and crypt-sha512.c originate from libxcrypt and
their formatting is therefor retained.
The integration is done via a crypt_compare() function in crypt.c.

```
libxcrypt $ git describe --long --always --all
tags/v4.4.17-0-g6b110bc
```

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 7d0f3fbb 11-Jun-2021 Tero Kristo <t-kristo@ti.com>

lib: rational: copy the rational fraction lib routines from Linux

Copy the best rational approximation calculation routines from Linux.
Typical usecase for these routines is to calculate the M/N divider
values for PLLs to reach a specific clock rate.

This is based on linux kernel commit:
"lib/math/rational.c: fix possible incorrect result from rational
fractions helper"
(sha1: 323dd2c3ed0641f49e89b4e420f9eef5d3d5a881)

Signed-off-by: Tero Kristo <t-kristo@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Tero Kristo <kristo@kernel.org>

# ec0512b1 24-May-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

Revert "lib: introduce HASH_CALCULATE option"

When we think of Kconfig, we usually think of features that we like
to enable or not. Ideally, we wouldn't use Kconfig to fix a build
issue, although sometimes it might make sense. With Kconfig it's hard
to guarantee that the fix is universal. We can only say that it works
for the set of tested configurations. In the majority of cases, it's
preferable to let the linker figure things out for us.

The reverted commit attempted to fix a build issue by adding an
invisible Kconfig option. This is wrong in several ways:

It invents a new Kconfig variable when CONFIG_HASH already
exists for the same purpose.
Second, hash-checksum.c makes use of the hash_progressive_lookup_algo()
symbol, which is only provided with CONFIG_HASH, but this dependency
was not expressed in the reverted patch.

It feels like Kconfig is turning into a listing of all available
source files, and a buffet to 'select' which ones to compile. The
purpose of this revert is to enable the next change to make use of
CONFIG_HASH instead of adding to Kconfig.

This reverts commit 87316da05f2fd49d3709275e64ef0c5980366ade.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Acked-by: Masahisa Kojima <masahisa.kojima@linaro.org>

# 1621d3c4 10-May-2021 Bin Meng <bmeng.cn@gmail.com>

lib: kconfig: Limit BINMAN_FDT for OF_SEPARATE or OF_EMBED

Generally speaking BINMAN_FDT makes sense for OF_SEPARATE or OF_EMBED.
For the other OF_CONTROL methods, it's quite possible binman node is
not available as binman is invoked during the build phase instead of
runtime. Let's only turn it on for OF_SEPARATE or OF_EMBED by default.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 87316da0 13-May-2021 Masahisa Kojima <masahisa.kojima@linaro.org>

lib: introduce HASH_CALCULATE option

Build error occurs when CONFIG_EFI_SECURE_BOOT or
CONFIG_EFI_CAPSULE_AUTHENTICATE is enabled,
because hash-checksum.c is not compiled.

Since hash_calculate() implemented in hash-checksum.c can be
commonly used aside from FIT image signature verification,
this commit itroduces HASH_CALCULATE option to decide
if hash-checksum.c shall be compiled.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# e2ae483c 13-May-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

hash: Kconfig option for SHA512 hardware acceleration

Commit a479f103dc1c ("hash: Allow for SHA512 hardware implementations")
defined function definitions for hardware accelerated SHA384 and SHA512.
If CONFIG_SHA_HW_ACCEL=y, these functions are used.

We already have boards using CONFIG_SHA_HW_ACCEL=y but none implements the
new functions hw_sha384() and hw_sha512().

For implementing the EFI TCG2 protocol we need SHA384 and SHA512. The
missing hardware acceleration functions lead to build errors on boards like
peach-pi_defconfig.

Introduce a new Kconfig symbol CONFIG_SHA512_HW_ACCEL to control if the
functions hw_sha384() and hw_sha512() shall be used to implement the SHA384
and SHA512 algorithms.

Fixes: a479f103dc1c ("hash: Allow for SHA512 hardware implementations")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

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

# 6d66502b 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: Add 2 config to define the max number of regions

Add 2 configs CONFIG_LMB_MEMORY_REGIONS and CONFIG_LMB_RESERVED_REGIONS
to change independently the max number of the regions in lmb
library.

When CONFIG_LMB_USE_MAX_REGIONS=y, move the lmb property arrays to
struct lmb and manage the array size with the element 'max' of struct
lmb_region; their are still allocated in stack.

When CONFIG_LMB_USE_MAX_REGIONS=n, keep the current location in
struct lmb_region to allow compiler optimization.

Increase CONFIG_LMB_RESERVED_REGIONS is useful to avoid lmb errors in
bootm when the number of reserved regions (not adjacent) is reached:
+ 1 region for relocated U-Boot
+ 1 region for initrd
+ 1 region for relocated linux device tree
+ reserved memory regions present in Linux device tree.

The current limit of 8 regions is reached with only 5 reserved regions
in DT.

see Linux kernel commit bf23c51f1f49 ("memblock: Move memblock arrays
to static storage in memblock.c and make their size a variable")

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# 4fa0150d 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: move MAX_LMB_REGIONS value in Kconfig

Move MAX_LMB_REGIONS value in Kconfig, the max number of the regions
in lmb library.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# 77b8cfef 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: move CONFIG_LMB in Kconfig

Migrate CONFIG_LMB in Kconfig.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# a479f103 16-Feb-2021 Joel Stanley <joel@jms.id.au>

hash: Allow for SHA512 hardware implementations

Similar to support for SHA1 and SHA256, allow the use of hardware hashing
engine by enabling the algorithm and setting CONFIG_SHA_HW_ACCEL /
CONFIG_SHA_PROG_HW_ACCEL.

Signed-off-by: Joel Stanley <joel@jms.id.au>

# f2c1442e 14-Mar-2021 Simon Glass <sjg@chromium.org>

bloblist: Make BLOBLIST_TABLES depend on BLOBLIST

Add an extra condition here since we cannot put x86 tables in a bloblist
when bloblists are not supported.

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

# e0103158 25-Feb-2021 Bin Meng <bmeng.cn@gmail.com>

lib: kconfig: Mention CONFIG_ADDR_MAP limitation in the help

Mention that CONFIG_ADDR_MAP only works in the post-relocation phase.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>

# 56e7257c 03-Feb-2021 Bin Meng <bmeng.cn@gmail.com>

lib: Fix BINMAN_FDT dependency

lib/binman.c references the following 3 ofnode APIs:
ofnode_first_subnode(), ofnode_path() and ofnode_read_bool().

These APIs get built only when DM is on. Fix the dependency then.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 59e4e391 18-Jan-2021 Tom Rini <trini@konsulko.com>

Merge https://gitlab.denx.de/u-boot/custodians/u-boot-riscv

- Update qemu-riscv.rst build instructions.
- Add support for SPI on Kendryte K210.
- Add Microchip PolarFire SoC Icicle Kit support.
- Add support for an early timer.
- Select TIMER_EARLY to avoid infinite recursion for Trace.


# a80f8513 17-Jan-2021 Pragnesh Patel <pragnesh.patel@sifive.com>

trace: select TIMER_EARLY to avoid infinite recursion

When tracing functions is enabled this adds calls to
__cyg_profile_func_enter() and __cyg_profile_func_exit() to the traced
functions.

__cyg_profile_func_enter() and __cyg_profile_func_exit() invoke
timer_get_us() to record the entry and exit time.

initr_dm() will make gd->dm_root = NULL and gd->timer = NULL, so
timer_get_us() -> get_ticks() -> dm_timer_init() will lead to an
indefinite recursion.

So select TIMER_EARLY when tracing got enabled.

Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Rick Chen <rick@andestech.com>

# 6205bbb1 04-Jan-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lib: cosmetic update of CONFIG_LIB_ELF description

Change 2 typo error in CONFIG_LIB_ELF description:
- Supoort => Support
- fir => for

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c589132a 02-Dec-2020 Aswath Govindraju <a-govindraju@ti.com>

fdt: Use phandle to distinguish DT nodes with same name

While assigning the sequence number to subsystem instances by reading the
aliases property, only DT nodes names are compared and not the complete
path. This causes a problem when there are two DT nodes with same name but
have different paths.

In arch/arm/dts/k3-am65-main.dtsi there are two USB controllers with the
same device tree node name but different path. When aliases are defined for
these USB controllers then fdtdec_get_alias_seq() fails to pick the correct
instance for a given index.

fdt_path_offset() function is slow and this would effect the U-Boot
startup. To avert the time penalty on all boards, apply this extra check
only when required by using a config option.

Fix it by comparing the phandles of DT nodes after the node names match,
under a config option.

Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Fix whitespace error in Kconfig:
Signed-off-by: Simon Glass <sjg@chromium.org>

# 28cef9ca 19-Nov-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

fs: fat: create correct short names

The current function set_name() used to create short names has the
following deficiencies resolved by this patch:

* Long names (e.g. FOO.TXT) are stored even if a short name is enough.
* Short names with spaces are created, e.g. "A ~1.TXT".
* Short names with illegal characters are created, e.g. "FOO++BAR".
* Debug output does not not consider that the short file name has no
concluding '\0'.

The solution for the following bug is split of into a separate patch:

* Short file names must be unique.

This patch only provides the loop over possible short file names.

Fixes: c30a15e590c ("FAT: Add FAT write feature")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# e4f8e543 05-Nov-2020 Simon Glass <sjg@chromium.org>

smbios: Drop the unused Kconfig options

Now that we can use devicetree to specify this information, drop the old
CONFIG options.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 44c74bdd 05-Nov-2020 Simon Glass <sjg@chromium.org>

sysinfo: Provide a default driver to set SMBIOS values

Some boards want to specify the manufacturer or product name but do not
need to have their own sysinfo driver.

Add a default driver which provides a way to specify this SMBIOS
information in the devicetree, without needing any board-specific
functionality.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d2cb7a22 04-Nov-2020 Simon Glass <sjg@chromium.org>

x86: Allow putting some tables in the bloblist

At present all tables are placed starting at address f0000 in memory, and
can be up to 64KB in size. If the tables are very large, this may not
provide enough space.

Also if the tables point to other tables (such as console log or a ramoops
area) then we must allocate other memory anyway.

The bloblist is a nice place to put these tables since it is contiguous,
which makes it easy to reserve this memory for linux using the 820 tables.

Add an option to put some of the tables in the bloblist. For SMBIOS and
ACPI, create suitable pointers from the f0000 region to the new location
of the tables.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
[bmeng: squashed in http://patchwork.ozlabs.org/project/uboot/patch/
20201105062407.1.I8091ad931cbbb5e3b6f6ababdf3f8d5db0d17bb9@changeid/]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# 415eab06 03-Nov-2020 Christian Gmeiner <christian.gmeiner@gmail.com>

smbios: add parsing API

Add a very simple API to be able to access SMBIOS strings
like vendor, model and bios version.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 72eda507 27-Oct-2020 Sean Anderson <seanga2@gmail.com>

lib: Add getopt

Some commands can get very unweildy if they have too many positional
arguments. Adding options makes them easier to read, remember, and
understand.

This implementation of getopt has been taken from barebox, which has had
option support for quite a while. I have made a few modifications to their
version, such as the removal of opterr in favor of a separate getopt_silent
function. In addition, I have moved all global variables into struct
getopt_context.

The getopt from barebox also re-orders the arguments passed to it so that
non-options are placed last. This allows users to specify options anywhere.
For example, `ls -l foo/ -R` would be re-ordered to `ls -l -R foo/` as
getopt parsed the options. However, this feature conflicts with the const
argv in cmd_tbl->cmd. This was originally added in 54841ab50c ("Make sure
that argv[] argument pointers are not modified."). The reason stated in
that commit is that hush requires argv to stay unmodified. Has this
situation changed? Barebox also uses hush, and does not have this problem.
Perhaps we could use their fix?

I have assigned maintenance of getopt to Simon Glass, as it is currently
only used by the log command. I would also be fine maintaining it.

Signed-off-by: Sean Anderson <seanga2@gmail.com>

# 26637e2e 12-Sep-2020 Simon Glass <sjg@chromium.org>

lib: Allow hexdump to be used in SPL

It is sometimes useful to output hex dumps in SPL. Add a config option to
allow this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# e87dfb05 05-Aug-2020 Andrii Anisov <andrii_anisov@epam.com>

lib: sscanf: add sscanf implementation

Port sscanf implementation from mini-os and introduce new
Kconfig option to enable it: CONFIG_SSCANF. Disable by default.

Signed-off-by: Andrii Anisov <andrii_anisov@epam.com>
Signed-off-by: Anastasiia Lukianenko <anastasiia_lukianenko@epam.com>
Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>

# 81014f73 30-Jul-2020 Joao Marcos Costa <joaomarcos.costa@bootlin.com>

include/u-boot, lib/zlib: add sources for zlib decompression

Add zlib (v1.2.11) uncompr() function to U-Boot. SquashFS depends on
this function to decompress data from a raw disk image. The actual
support for zlib into SquashFS sources will be added in a follow-up
commit.

Signed-off-by: Joao Marcos Costa <joaomarcos.costa@bootlin.com>

# 69be8fd1 03-Jun-2020 Marek Szyprowski <m.szyprowski@samsung.com>

powerpc: move ADDR_MAP to Kconfig

Move ADDR_MAP related config options from include/configs/*.h to the
proper place in lib/Kconfig. This has been done using
./tools/moveconfig.py and manual inspection of the generated changes.
This is a preparation to use ADDR_MAP helper on ARM 32bit Raspberry Pi4
board for mapping the PCIe XHCI MMIO, which is above the 4GiB identity
mapping limit.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# d16b38f4 15-Apr-2020 Reuben Dowle <reubendowle0@gmail.com>

Add support for SHA384 and SHA512

The current recommendation for best security practice from the US government
is to use SHA384 for TOP SECRET [1].

This patch adds support for SHA384 and SHA512 in the hash command, and also
allows FIT images to be hashed with these algorithms, and signed with
sha384,rsaXXXX and sha512,rsaXXXX

The SHA implementation is adapted from the linux kernel implementation.

[1] Commercial National Security Algorithm Suite
http://www.iad.gov/iad/programs/iad-initiatives/cnsa-suite.cfm

Signed-off-by: Reuben Dowle <reuben.dowle@4rf.com>

# 43e442a5 26-May-2020 Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

kconfig: fix some typos

Signed-off-by: Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

# eff5a547 22-May-2020 Michael Walle <michael@walle.cc>

cmd: zip: automatically pull in gzip()

Move the CONFIG_GZIP_COMPRESSED from a config.h macro to a Kconfig menu
item. It is not selectable by a user because there is no reason to do
so. Instead it will be automatically selected by the stuff which uses
gzip(), like the zip command.

Remove it from the config_whitelist.txt. Also remove
CONFIG_GZIP_COMPRESS_DEF_SZ as this was never used on any board. The
default seems to be sane, otherwise it should be added as a Kconfig
option.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8239be61 06-May-2020 Simon Glass <sjg@chromium.org>

lib: Allow MD5 to be enabled in SPL

At present the MD5 option cannot be enabled by board configs since it has
no Kconfig name. It is generally enabled, so long as FIT support is
present. But not all boards use FIT, particularly in SPL

Fix this and add an option for SPL as well. This allows board code to call
md5() even if FIT support is not enabled.

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

# 04cb3994 21-Apr-2020 Weijie Gao <weijie.gao@mediatek.com>

lib: enable lzma decompression support for SPL build

This patch enables LZMA decompression support for SPL build

Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>

# 2a2119e1 05-Mar-2020 Atish Patra <atishp@atishpatra.org>

lib: kconfig: Add option to set BZIP2 compression method

There is no way to select BZIP2 compression method.
Add it under library/compression config where all other
compression related configs are present.

Signed-off-by: Atish Patra <atish.patra@wdc.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 805b3cac 12-Feb-2020 Keerthy <j-keerthy@ti.com>

lib: elf: Move the generic elf loading/validating functions to lib

Move the generic elf loading/validating functions to lib/
so that they can be re-used and accessed by code existing
outside cmd.

While at it remove the duplicate static version of load_elf_image_phdr
under arch/arm/mach-imx/imx_bootaux.c.

Signed-off-by: Keerthy <j-keerthy@ti.com>
Suggested-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>

# 1611235b 19-Jan-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: Kconfig dependencies for pseudo-random library

drivers/rng/sandbox_rng.c requires rand() to be defined but configuration
option CONFIG_CONFIG_LIB_RAND selected in drivers/rng/Kconfig does not
exist.

test/lib/test_aes.c requires rand() to be defined.

Fix the selection criteria for choice "Pseudo-random library support type".

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 3c10dc95 06-Dec-2019 Simon Glass <sjg@chromium.org>

binman: Add a library to access binman entries

SPL and TPL can access information about binman entries using link-time
symbols but this is not available in U-Boot proper. Of course it could be
made available, but the intention is to just read the device tree.

Add support for this, so that U-Boot can locate entries.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# b4adf627 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: crypto: add x509 parser

Imported from linux kernel v5.3:
x509.asn1 without changes
x509_akid.asn1 without changes
x509_parser.h without changes
x509_cert_parser.c with changes marked as __UBOOT__
x509_public_key.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# a9b45e6e 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add oid registry utility

Imported from linux kernel v5.3:
build_OID_registry without changes
oid_registry.h without changes
oid_registry.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# ab8a0e06 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add asn1 decoder

Imported from linux kernel v5.3:
lib/asn1_decoder.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 2b12196d 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

cmd: add asn1_compiler

Imported from linux kernel v5.3:
asn1.h without changes
asn1_ber_bytecode.h without changes
asn1_decoder.h without changes
asn1_compiler.c without changes

This host command will be used to create a ASN1 parser, for example,
for pkcs7 messages or x509 certificates. More specifically, it will
generate *byte code* which will be interpreted by asn1 decoder library.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 05429b6c 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

rtc: move date.c from drivers/rtc/ to lib/

In the next commit, rtc_mktime(), for compatibility with linux, will be
implemented using rtc_mktime(), which is no longer drivers/rtc specific.
So move this file under lib/.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 37ef1774 10-Nov-2019 Thomas Hebb <tommyhebb@gmail.com>

Kconfig: disambiguate config names for tiny printf

27084c03d36a ("spl: Allow tiny printf() to be controlled in SPL and
TPL") split this option in two for TPL and SPL, but didn't change the
Kconfig names, making them hard to set quickly.

Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>

# 0d76afc0 27-Oct-2019 Simon Glass <sjg@chromium.org>

fdt: Add Kconfig options to control code size

For better or worse libfdt recent grew a lot of code that checks the
validity of the device tree in great detail. When using unsigned or
unverified data this makes things safer, but it does add to code size.

Add some controls to select the trade-off between safety and code size.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 27084c03 25-Sep-2019 Simon Glass <sjg@chromium.org>

spl: Allow tiny printf() to be controlled in SPL and TPL

At present there is only one control for this and it is used for both SPL
and TPL. But SPL might have a lot more space than TPL so the extra cost of
a full printf() might be acceptable.

Split the option into two, providing separate SPL and TPL controls. The
TPL setting defaults to the same as SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2a51e16b 07-Jun-2019 Tom Rini <trini@konsulko.com>

configs: Make USE_TINY_PRINTF depend on SPL||TPL and be default

The USE_TINY_PRINTF symbol only changes things within SPL and TPL
builds, so make it depend on that support. Next, make it default as
within these cases we should rarely have need of more advanced print
formats outside of the debug context.

To do this, in a few cases we need to correct our Kconfig dependencies
as we had cases of non-SPL targets select'ing this symbol. Finally, in
the case of a few boards we really do need the full printf
functionality.

Signed-off-by: Tom Rini <trini@konsulko.com>

# da0fb5fd 02-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: make call depth limit customizable

Up to now we had hard coded values for the call depth up to which trace
records are created: 200 for early tracing, 15 thereafter. UEFI
applications reach a call depth of 80 or above.

Provide customizing settings for the call trace depth limit and the early
call trace depth limit. Use the old values as defaults.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8509f22a 29-Apr-2019 Marek Behún <kabel@kernel.org>

lib: add Zstandard decompression support

Add the zstd library from Linux kernel (only decompression support).
There are minimal changes to build with U-Boot, otherwise the files are
identical to Linux commit dc35da16 from March 2018, the files had not
been touched since in kernel. Also SPDX lincese tags were added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 83a486b6 29-Apr-2019 Marek Behún <kabel@kernel.org>

lib: Add xxhash support

This adds the xxhash support from Linux. Files are almost identical to
those added to Linux in commit 5d240522 ("lib: Add xxhash module") (they
haven't been touched since in Linux). The only difference is to add some
includes to be compatible with U-Boot. Also SPDX lincese tags were
added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 5132361a 29-Apr-2019 Heiko Schocher <hs@denx.de>

lib: Kconfig: fix help text for GZIP

commit 95f4bbd581cf ("lib: fdt: Allow LZO and GZIP DT compression in U-Boot")

introduced Kconfig option for gzip in U-Boot, but help text
says gzip for SPL, which is wrong. Fix this.

Signed-off-by: Heiko Schocher <hs@denx.de>
Acked-by: Marek Vasut <marex@denx.de>

# 1c6eb075 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE_BUFFER_SIZE et al to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE_BUFFER_SIZE
CONFIG_TRACE_EARLY_SIZE
CONFIG_TRACE_EARLY
CONFIG_TRACE_EARLY_ADDR

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

# a24a78d7 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE

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

# 54969b40 21-Mar-2019 Thierry Reding <treding@nvidia.com>

fdtdec: Add Kconfig symbol for tests

Runtime tests are provided as a test_fdtdec command implementation. Add
a Kconfig symbol that allows this command to be built so that the tests
can be used.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 95f4bbd5 08-Mar-2019 Marek Vasut <marex@denx.de>

lib: fdt: Allow LZO and GZIP DT compression in U-Boot

Add required Kconfig symbols, Makefile bits and macro fixes in a
few places to support LZO and DT compression in U-Boot. This can
save a lot of space with multi-DTB fitImages.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>

# 6e705114 13-Jan-2019 Chris Packham <judge.packham@gmail.com>

lib: Kconfig: spelling fixes

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 048c6e89 06-Nov-2018 Simon Glass <sjg@chromium.org>

spl: lz4: Allow use of lz4 compression in SPL

In some cases U-Boot is compressed and it is useful to be able to
decompress it in SPL. Add a Kconfig and Makefile change to allow this.
Note that this does not actually implement decompression.

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

# 2895c4b7 15-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

kconfig: Introduce HAVE_ARCH_IOMAP

Introduce a new Kconfig option for architecture codes to control
whether it provides io{read,write}{8,16,32} I/O accessor functions.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5592a633 01-Oct-2018 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt in TPL

In some cases (e.g. sandbox with verified boot) it is useful to support
libfdt in TPL. Update the Kconfig to handle this.

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

# 6307896c 01-Oct-2018 Simon Glass <sjg@chromium.org>

tpm: Add support for SPL and TPL

At present the tpm can only be used in U-Boot proper. Updated it to work
in SPL and TPL also.

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

# ab948cd2 19-Jul-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

fdt_support: make FDT_FIXUP_PARTITIONS depend on CMD_MTDPARTS

fdt_fixup_mtdparts() calls mtdparts_init() and device_find(),
which are defined in cmd/mtdparts.c

The combination of FDT_FIXUP_PARTITIONS=y and CMD_MTDPARTS=n
emits the following link error:

common/fdt_support.c:903: undefined reference to `mtdparts_init'
common/fdt_support.c:914: undefined reference to `device_find'

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 3330584d 03-Jun-2018 Igor Opaniuk <igor.opaniuk@gmail.com>

avb2.0: integrate avb 2.0 into the build system

Integrate libavb into the build system. Introduce CONFIG_LIBAVB
build option.

Signed-off-by: Igor Opaniuk <igor.opaniuk@linaro.org>

# f8c987f8 05-Jun-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

lib: Add hexdump

Often during debugging session it's very interesting to see
what data we were dealing with. For example what we write or read
to/from memory or peripherals.

This change introduces functions that allow to dump binary
data with one simple function invocation like:
------------------->8----------------
print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, buf, len);
------------------->8----------------

which gives us the following:
------------------->8----------------
00000000: f2 b7 c9 88 62 61 75 64 72 61 74 65 3d 31 31 35 ....baudrate=115
00000010: 32 30 30 00 62 6f 6f 74 61 72 67 73 3d 63 6f 6e 200.bootargs=con
00000020: 73 6f 6c 65 3d 74 74 79 53 33 2c 31 31 35 32 30 sole=ttyS3,11520
00000030: 30 6e 38 00 62 6f 6f 74 64 65 6c 61 79 3d 33 00 0n8.bootdelay=3.
00000040: 62 6f 6f 74 66 69 6c 65 3d 75 49 6d 61 67 65 00 bootfile=uImage.
00000050: 66 64 74 63 6f 6e 74 72 6f 6c 61 64 64 72 3d 39 fdtcontroladdr=9
00000060: 66 66 62 31 62 61 30 00 6c 6f 61 64 61 64 64 72 ffb1ba0.loadaddr
00000070: 3d 30 78 38 32 30 30 30 30 30 30 00 73 74 64 65 =0x82000000.stde
00000080: 72 72 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 rr=serial0@e0022
00000090: 30 30 30 00 73 74 64 69 6e 3d 73 65 72 69 61 6c 000.stdin=serial
000000a0: 30 40 65 30 30 32 32 30 30 30 00 73 74 64 6f 75 0@e0022000.stdou
000000b0: 74 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 30 t=serial0@e00220
000000c0: 30 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00..............
...
------------------->8----------------

Source of hexdump.c was copied from Linux kernel v4.7-rc2.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Mario Six <mario.six@gdsys.cc>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Stefan Roese <sr@denx.de>

# c232d14d 29-May-2018 Alex Kiernan <alex.kiernan@gmail.com>

mmc: Separate "mmc swrite" from fastboot

Introduce CONFIG_IMAGE_SPARSE and CONFIG_CMD_MMC_SWRITE so the "mmc
swrite" command is separated from the fastboot code.

Move image-sparse from common to lib so it's clear it's library code.

Rename CONFIG_FASTBOOT_FLASH_FILLBUF_SIZE to CONFIG_IMAGE_SPARSE_FILLBUF_SIZE
and migrate it to Kconfig.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Acked-by: Jassi Brar <jaswinder.singh@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6417572e 08-May-2018 Tom Rini <trini@konsulko.com>

lib/Kconfig: Mark OF_LIBFDT_OVERLAY as depending on OF_LIBFDT

The overlay code is only useful when OF_LIBFDT is set, so mark it as
depending on that first.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 58a46f88 25-Apr-2018 Praneeth Bajjuri <praneeth@ti.com>

configs: TI: Enable FIT Library overlay support

Enable the FDT library overlay support for all TI SOC family.

Without this option, when Loading fdt from FIT image, the
following warning is seen.

"config with overlays but CONFIG_OF_LIBFDT_OVERLAY not set".

Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
Suggested-by: Andrew F.Davis <afd@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>

# 14ad44ab 18-Apr-2018 Alex Kiernan <alex.kiernan@gmail.com>

spl: Split sprintf, strto* from SPL serial in Kconfig

When SPL serial is disabled, callers who need sprintf or strtoul fail
because their inclusion is guarded by CONFIG_SPL_SERIAL_SUPPORT/
CONFIG_TPL_SERIAL_SUPPORT.

Split printf, sprintf and strto into their own entries and then select
all of them if SERIAL_SUPPORT is enabled to match the current behaviour.

Include panic.o unconditionally as it can be called from anywhere which
uses BUG_ON().

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>

# e294ba06 04-Apr-2018 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-sunxi

Signed-off-by: Tom Rini <trini@konsulko.com>


# d14db11d 03-Apr-2018 Andre Przywara <andre.przywara@arm.com>

sunxi: revert disabling of features

In January some commits were introduced to mitigate the U-Boot image
size issues we encountered on sunxi builds.
Now with the MMC environment removed we can bring them back, as we
practically don't have a size limit anymore.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 32ce6179 13-Mar-2018 Bryan O'Donoghue <bryan.odonoghue@linaro.org>

optee: Add lib entries for sharing OPTEE code across ports

This patch adds code to lib to enable sharing of useful OPTEE code between
board-ports and architectures. The code on lib/optee/optee.c comes from the
TI omap2 port. Eventually the OMAP2 code will be patched to include the
shared code. The intention here is to add more useful OPTEE specific code
as more functionality gets added.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Cc: Harinarayan Bhatta <harinarayan@ti.com>
Cc: Andrew F. Davis <afd@ti.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Kever Yang <kever.yang@rock-chips.com>
Cc: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Cc: Peng Fan <peng.fan@nxp.com>
Tested-by: Peng Fan <peng.fan@nxp.com>

# 36c1877c 06-Feb-2018 Faiz Abbas <faiz_abbas@ti.com>

lib: Kconfig: Move DYNAMIC_CRC_TABLE to Kconfig

Add CONFIG prefix to DYNAMIC_CRC_TABLE and implement it in
Kconfig.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>

# a451bc27 05-Feb-2018 Adam Ford <aford173@gmail.com>

Convert LIB_UUID to Kconfig

config_fallback.h has some logic that checks a variety of options
and selects LIB_UUID if it hasn't already been selected. This
will all LIB_UUID in Kconfig and select this option for the list
of options to allow us to remove the logic from fallbacks

Signed-off-by: Adam Ford <aford173@gmail.com>

# a5a37567 06-Feb-2018 Adam Ford <aford173@gmail.com>

Convert CONFIG LIB_HW_RAND to Kconfig

config_fallbacks.h had some logic to automatically select
LIB_RAND if RANDOM_UUID or CMD_UUID were set if LIB_HW_RAND wasn't
already selected. By migrating LIB_HW_RAND to Kconfig, we can
remove this check from config_fallbacks.h and put it into Kconfig

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
[trini: Turn into a choice, add NET_RANDOM_ETHADDR]
Signed-off-by: Tom Rini <trini@konsulko.com>

# acd4d334 16-Jan-2018 Maxime Ripard <maxime.ripard@free-electrons.com>

net: regex: Disable by default on sunXi

The sunXi arm64 build has overflown, leading to the main U-boot binary
overwriting the environment when flashing the new image, or even worse,
overwriting itself when we're calling saveenv.

Disable this option that is not critical until we can adress the issue
properly.

Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 7e3caa81 03-Dec-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

Move CONFIG_PANIC_HANG to Kconfig

Freescale (NXP) boards have lots of defconfig files per board.
I used "imply PANIC_HANG" for them.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# da5337a6 08-Nov-2017 Nandor Han <nandor.han@ge.com>

rtc: add support for s35392a

Add support for S35392A RTC. The driver supports both U-Boot driver
models.

Signed-off-by: Nandor Han <nandor.han@ge.com>
Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
Cc: Heiko Schocher <hs@denx.de>

# f52bdf4b 14-Sep-2017 Jean-Jacques Hiblot <jjhiblot@ti.com>

lib: allow building lzo for the SPL

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 85d8bf57 03-Sep-2017 Marek Behún <kabel@kernel.org>

lib: Add CRC32-C

This is needed for BTRFS.

Signed-off-by: Marek Behun <marek.behun@nic.cz>

create mode 100644 lib/crc32c.c

# 7264f292 15-Aug-2017 York Sun <york.sun@nxp.com>

spl: fit: Eanble GZIP support for image decompression

Add Kconfig option SPL_GZIP and SPL_ZLIB to enable gunzip support for
SPL boot, eg. falcon boot compressed kernel image.

Signed-off-by: York Sun <york.sun@nxp.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6ef2f901 11-Aug-2017 Adam Ford <aford173@gmail.com>

Convert CONFIG_BCH to Kconfig

This converts the following to Kconfig:
CONFIG_BCH

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1a7ba1d 18-Aug-2017 Anatolij Gustschin <agust@denx.de>

Fix 'notes' typos

s/notes/nodes

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 96b9082c 03-Aug-2017 Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

rockchip: rk3188: rock: adjust for SPL/TPL split

With the changes to split SPL/TPL for the RK3368, I apparently missed
some needed adjustments to the RK3188 Kconfig and rock_defconfig.

This fixes build-issues for the rock board after applying the RK3368
enablement (and SPL/TPL) set that resulted from TPL_SERIAL_SUPPORT,
TPL_ROCKCHIP_BACK_TO_BROM and TPL_TINY_MEMSET being separate symbols
now.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d56b4b19 22-Jul-2017 Tom Rini <trini@konsulko.com>

configs: Migrate RBTREE, LZO, CMD_MTDPARTS, CMD_UBI and CMD_UBIFS

The above CONFIG options are in Kconfig, and now have correct depends and
inter-dependencies. Migrate these to configs/ from include/configs/. In the
case of CMD_UBIFS also change it to be a default y if CMD_UBI.

Signed-off-by: Tom Rini <trini@konsulko.com>

# aed998aa 17-May-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_LZMA to Kconfig

This converts the following to Kconfig:
CONFIG_LZMA

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

# b1a873df 26-Apr-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_CMD_AES et al to Kconfig

This converts the following to Kconfig:
CONFIG_CMD_AES
CONFIG_AES

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Add select AES to CMD_AES]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 173aafbf 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

cmd: Expose a Kconfig option to enable UBIFS commands

Create a new Kconfig entry to allow CMD_UBIFS selection from Kconfig and
add an hidden LZO option that can be selected by CMD_UBIFS.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>

# aa049152 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

mtd: ubi: Select RBTREE option from MTD_UBI Kconfig entry

Expose the RBTREE feature through Kconfig and select this option from the
MTD_UBI option.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>
[Rebased on master]
Signed-off-by: Jagan Teki <jagan@openedev.com>

# ab4458bd 02-Apr-2017 Simon Glass <sjg@chromium.org>

string: Provide a slimmed-down memset()

Most of the time the optimised memset() is what we want. For extreme
situations such as TPL it may be too large. For example on the 'rock'
board, using a simple loop saves a useful 48 bytes. With gcc 4.9 and
the rodata bug, this patch is enough to reduce the TPL image below the
limit.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>

# bea79d7d 14-Mar-2017 Andre Przywara <andre.przywara@arm.com>

Kconfig: introduce md5sum command selection

So far CONFIG_MD5SUM would need to be set by a board's include file.
Since the command is really generic, move it over to Kconfig to allow
it to be defined by either a board's defconfig, menuconfig or some
config snippet merged via mergeconfig.sh.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e663b350 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

smbios: Expose in efi_loader as table

We can pass SMBIOS easily as EFI configuration table to an EFI payload. This
patch adds enablement for that case.

While at it, we also enable SMBIOS generation for ARM systems, since they support
EFI_LOADER.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4b6dddc2 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

x86: Move smbios generation into arch independent directory

We will need the SMBIOS generation function on ARM as well going forward,
so let's move it into a non arch specific location.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# ebf7fff2 05-Oct-2016 Heiko Schocher <hs@denx.de>

spl: move FDT_FIXUP_PARTITIONS to Kconfig

Move FDT_FIXUP_PARTITIONS to Kconfig and cleanup existing
uses.

Signed-off-by: Heiko Schocher <hs@denx.de>

# ddf67f71 05-Jul-2016 Maxime Ripard <maxime.ripard@free-electrons.com>

libfdt: Add overlay application function

The device tree overlays are a good way to deal with user-modifyable
boards or boards with some kind of an expansion mechanism where we can
easily plug new board in (like the BBB, the Raspberry Pi or the CHIP).

Add a new function to merge overlays with a base device tree.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>

# 91b86e21 26-May-2016 Marek Vasut <marex@denx.de>

lib: Enable private libgcc by default

This patch decouples U-Boot binary from the toolchain on systems where
private libgcc is available. Instead of pulling in functions provided
by the libgcc from the toolchain, U-Boot will use it's own set of libgcc
functions. These functions are usually imported from Linux kernel, which
also uses it's own libgcc functions instead of the ones provided by the
toolchain.

This patch solves a rather common problem. The toolchain can usually
generate code for many variants of target architecture and often even
different endianness. The libgcc on the other hand is usually compiled
for one particular configuration and the functions provided by it may
or may not be suited for use in U-Boot. This can manifest in two ways,
either the U-Boot fails to compile altogether and linker will complain
or, in the much worse case, the resulting U-Boot will build, but will
misbehave in very subtle and hard to debug ways.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 67976306 30-Mar-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

cosmetic: Fix typos "privide"

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# ed980b8c 03-Mar-2016 Alexander Graf <agraf@csgraf.de>

efi_loader: hook up in build environment

Now that we have all the bits and pieces ready for EFI payload loading
support, hook them up in Makefiles and KConfigs so that we can build.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
[trini: Enable only when we of OF_LIBFDT, disable on kwb and colibri_pxa270]
Signed-off-by: Tom Rini <trini@konsulko.com>

# aa34fbc0 22-Feb-2016 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt to be used in SPL

Add an option to enable libfdt in SPL. This can be useful when decoding
FIT files in SPL.

We need to make sure this option is not enabled in SPL by this change.
Also this option needs to be enabled in host builds. Si add a new
IMAGE_USE_LIBFDT #define which can be used in files that are built on the
host but must also build for U-Boot and SPL.

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

# 69e173eb 22-Feb-2016 Simon Glass <sjg@chromium.org>

Move CONFIG_OF_LIBFDT to Kconfig

Move this option to Kconfig and tidy up existing boards.

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

# a187559e 05-Feb-2016 Bin Meng <bmeng.cn@gmail.com>

Use correct spelling of "U-Boot"

Correct spelling of "U-Boot" shall be used in all written text
(documentation, comments in source files etc.).

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Minkyu Kang <mk7.kang@samsung.com>

# 947c626d 14-Jan-2016 Tom Rini <trini@konsulko.com>

vsprintf.c: Always enable CONFIG_SYS_VSNPRINTF

Enabling this function always removes some class of string saftey issues.
The size change here in general is about 400 bytes and this seems a reasonable
trade-off.

Cc: Peng Fan <peng.fan@nxp.com>
Cc: Peter Robinson <pbrobinson@gmail.com>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Adrian Alonso <aalonso@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 7d9cde10 22-Nov-2015 Stefan Roese <sr@denx.de>

lib/tiny-printf.c: Add tiny printf function for space limited environments

This patch adds a small printf() version that supports all basic formats.
Its intented to be used in U-Boot SPL versions on platforms with very
limited internal RAM sizes.

To enable it, just define CONFIG_USE_TINY_PRINTF in your defconfig. This
will result in the SPL using this tiny function and the main U-Boot
still using the full-blown printf() function.

This code was copied from:
http://www.sparetimelabs.com/printfrevisited
With mostly only coding style related changes so that its checkpatch
clean.

The size reduction is about 2.5KiB. Here a comparison for the db-mv784mp-gp
(Marvell AXP) SPL:

Without this patch:
58963 18536 1928 79427 13643 ./spl/u-boot-spl

With this patch:
56542 18536 1956 77034 12cea ./spl/u-boot-spl

Note:
To make it possible to compile tiny-printf.c instead of vsprintf.c when
CONFIG_USE_TINY_PRINTF is defined, the functions printf() and vprintf() are
moved from common/console.c into vsprintf.c in this patch.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>

# 2419cd16 03-Oct-2015 Simon Glass <sjg@chromium.org>

dm: tpm: Drop CONFIG_DM_TPM

Now that all TPM drivers use driver model, we can drop the special driver
model CONFIG option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>

# 027b728d 06-Oct-2015 Julius Werner <jwerner@chromium.org>

Add support for LZ4 decompression algorithm

This patch adds support for LZ4-compressed FIT image contents. This
algorithm has a slightly worse compression ration than LZO while being
nearly twice as fast to decompress. When loading images from a fast
storage medium this usually results in a boot time win.

Sandbox-tested only since I don't have a U-Boot development system set
up right now. The code was imported unchanged from coreboot where it's
proven to work, though. I'm mostly interested in getting this recognized
by mkImage for use in a downstream project.

Signed-off-by: Julius Werner <jwerner@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# a7d660bc 22-Aug-2015 Simon Glass <sjg@chromium.org>

tpm: Add Kconfig options for TPMs

Add new Kconfig options for TPMs in preparation for moving boards to use
Kconfig for TPM configuration.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 867a6ac8 31-Jul-2015 Simon Glass <sjg@chromium.org>

efi: Add start-up library code

When running as an EFI application, U-Boot must request memory from EFI,
and provide access to the boot services U-Boot needs.

Add library code to perform these tasks. This includes efi_main() which is
the entry point from EFI. U-Boot is built as a shared library.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d1389403 23-Jun-2015 Simon Glass <sjg@chromium.org>

Add a dhrystone benchmark command

Drystone provides a convenient sanity check that the CPU is running at full
speed. Add this as a command which can be enabled as needed.

Note: I investigated using Coremark for this but there was a license
agreement and I could not work out if it was GPL-compatible.

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

# f7848d90 22-Jun-2015 Joe Hershberger <joe.hershberger@ni.com>

Allow CONFIG_REGEX to be disabled when CONFIG_NET

Instead of selecting REGEX when NET is enabled, make it the default, but
allow boards that are tiny to disable it and lose functionality on all
but the first Ethernet adapter.

cm-bf548, bf538f-ezkit, and bf533-stamp need this. None appear to have
more than one Ethernet interface.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# 3850dbe8 11-Jun-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

blackfin: fix undefined reference to srand and rand

Commit 9ba9e85f3f1c (net: Fix NET_RANDOM_ETHADDR dependencies)
accidentally dropped CONFIG_LIB_RAND defines for 14 Blackfin boards.

Prior to that commit, those boards defined CONFIG_LIB_RAND, but not
CONFIG_NET_RANDOM_ETHADDR. So, commit 9ba9e85f3f1c should not have
touched them, but in fact it ripped CONFIG_LIB_RAND off from all the
header files, which caused undefined reference to srand and rand.
CONFIG_LIB_RAND=y must be revived for such boards.

BTW, this commit indeed makes it better, but even with this fix,
three boards (bf533-stamp, bf538f-ezkit, cm-bf548) still can not
build due to region 'ram' overflowed error. This was cause by
commit 6eed3786c68c (net: Move the CMD_NET config to defconfigs)
because CMD_NET selects NET, and NET selects REGEX. Eventually,
some boards were newly enabled with CONFIG_REGEX, increasing the
memory footprint. A patch is expected to fix the build error.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 9ba9e85f 25-May-2015 Michal Simek <michal.simek@amd.com>

net: Fix NET_RANDOM_ETHADDR dependencies

NET_RANDOM_ETHADDR depends on lib/rand.c. This patch adds dependency to
Kconfig to ensure that library is also compiled.

Remove the definitions from Blackfin boards' include/configs.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 6501ff62 20-Apr-2015 Przemyslaw Marczak <p.marczak@samsung.com>

lib: Kconfig: add entry for errno_str() function

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1a60650c 21-Apr-2015 Joe Hershberger <joe.hershberger@ni.com>

kconfig: Move REGEX to Kconfig

Having this as a Kconfig allows it to be a dependent feature.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8156345d 06-Mar-2015 Simon Glass <sjg@chromium.org>

sandbox: Move CONFIG_SYS_VSNPRINTF to Kconfig

Move this over to Kconfig and tidy up.

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

# 94e3c8c4 19-Feb-2015 gaurav rana <gaurav.rana@freescale.com>

crypto/fsl - Add progressive hashing support using hardware acceleration.

Currently only normal hashing is supported using hardware acceleration.
Added support for progressive hashing using hardware.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
Signed-off-by: Gaurav Rana <gaurav.rana@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>

# d9f23c7f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

lib/rsa: Add Kconfig for devices supporting RSA Modular Exponentiation

Kconfig option added for devices which support RSA Verification.
1. RSA_SOFTWARE_EXP
Enables driver for supporting RSA Modular Exponentiation in Software
2. RSA_FREESCALE_EXP
Enables driver for supporting RSA Modular Exponentiation using Freescale specific
driver

The above drivers use RSA uclass

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
(Removed duplicate line in Kconfig comment)

Change-Id: I7663c4d5350e2bfc3dfa2696f70ef777d6ccc6f6

# c4beb22f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

FIT: Modify option FIT_SIGNATURE in Kconfig

For FIT signature based approach to work, RSA library needs to be selected.
The FIT_SIGNATURE option in Kconfig is modified to automatically select RSA.
Selecting RSA compiles the RSA library required for image verification.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 45ccec8f 23-Oct-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

kconfig: move CONFIG_USE_PRIVATE_LIBGCC to Kconfig

The private libgcc is supported only on ARM, MIPS, PowerPC, SH, x86.
Those architectures should "select" HAVE_PRIVATE_LIBGCC and
CONFIG_USE_PRIVATE_LIBGCC should depend on it.

Currently, this option is enabled on Tegra boards and x86 architecture.
Move the definition from header files to Kconfig.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Tested-by: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: Tom Warren <twarren@nvidia.com>

# 8c688bc4 23-Oct-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

kconfig: move CONFIG_SYS_HZ to lib/Kconfig

CONFIG_SYS_HZ is always defined as 1000 in config_fallbacks.h
(but some boards still have redundant definitions).

This commit moves the definition and the document in README to
Kconfig. Since lib/Kconfig can assure that CONFIG_SYS_HZ is 1000,
the sanity check in lib/time.c should be removed.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Reviewed-by: Marek Vasut <marex@denx.de>

# b0928da6 16-Sep-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

kconfig: move CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED to Kconfig

If this option is enabled, the objects under lib/ directory
are compiled with speed optimization, not size optimization.
(Currently, only used by some Blackfin boards.)

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# ed36323f 16-Sep-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

kconfig: add blank Kconfig files

This would be useful to start moving various config options.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# c33425c6 15-Jan-2023 Simon Glass <sjg@chromium.org>

trace: Reduce the default for TRACE_EARLY_CALL_DEPTH_LIMIT

This is a silly value at present, since U-Boot's call depth never reaches
200. Fix it.

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

# 2dc16a2c 19-Jan-2023 Sjoerd Simons <sjoerd@collabora.com>

Bump LMB_MAX_REGIONS default to 16

Since commit 06d514d77c37 ("lmb: consider EFI memory map") the EFI regions
are also pushed into the lmb if EFI_LOADER is enabled (which is by
default on most system). Which can cause the number of entries to go
over the maximum as it's default is only 8.

Specifically i ran into this case on an TI am62 which has an fdt with
4 reserved regions (in practice 3 lmb entries due to adjecent ranges).

As this is likely to impact more devices bump the default max
regions to 16 so there is a bit more slack.

Fixes: 06d514d77c ("lmb: consider EFI memory map")
Link: https://bugzilla.opensuse.org/show_bug.cgi?id=1207562
Reviewed-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Signed-off-by: Sjoerd Simons <sjoerd@collabora.com>
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
[trini: collect tags from the other equivalent patch]

# 948d3999 08-Feb-2023 Tom Rini <trini@konsulko.com>

Revert "lmb: Default to not-LMB_USE_MAX_REGIONS"

As explained by Philippe Schenker, I was misinterpreting what happened
in the case where we do not set LMB_USE_MAX_REGIONS and so had
re-introduced the problem I was attempting to more widely resolve.

This reverts commit 007ae5d108a37564905ea1588cb279f3a522cc3d.

Reported-by: Philippe Schenker <philippe.schenker@toradex.com>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 007ae5d1 25-Jan-2023 Tom Rini <trini@konsulko.com>

lmb: Default to not-LMB_USE_MAX_REGIONS

The LMB code allows for picking a hard limit on the number of regions it
can know of, or to dynamically allocate these regions. The reason for
this choice is to allow for the compiler to perform a size optimization
in the common case. This optimization however, is very small, ranging
from 196 bytes to 15 bytes saved, or in some cases, being larger. Now
that we also have more regions covered by LMB (in order to protect
various parts of our self at run time), the default of 8 is also much
easier to hit and leads to non-obvious error messages (which imply that
an area is protected, not that we're out of areas to add to the list).

Switch to the dynamic use as the default.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 53c47c59 19-Jan-2023 Tom Rini <trini@konsulko.com>

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


# 4b9b25d9 12-Jan-2023 Brandon Maier <brandon.maier@collins.com>

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

[1] https://github.com/torvalds/linux/commit/e0c1b49f5b674cca7b10549c53b3791d0bbc90a8
[2] https://github.com/facebook/zstd/blob/f302ad8811643c428c4e3498e28f53a0578020d3/lib/libzstd.mk#L31

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>

# ebc1d50a 21-Dec-2022 Simon Glass <sjg@chromium.org>

Revert "fdtdec: drop needlessly convoluted CONFIG_PHANDLE_CHECK_SEQ"

The fdt_path_offset() function is slow since it must scan the tree.
This substantial overhead now applies to all boards.

The original code may not be ideal but it is fit for purpose and is only
needed on a few boards.

Reverting this reduces time to set up driver model by about 30ms.

Before revert:

Accumulated time:
47,170 dm_r
53,237 dm_spl
572,986 dm_f

Accumulated time:
44,598 dm_r
50,347 dm_spl
549,133 dm_f

This reverts commit 26f981f295d00351b6f0c69b5317b254b2361cc0.

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

# 12619d4e 21-Dec-2022 Simon Glass <sjg@chromium.org>

trace: Don't require TIMER_EARLY

Some platforms cannot honour this and don't need trace before relocation.
Use 'imply' instead, so boards can disable this.

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

# 0c16fca9 07-Jan-2023 Simon Glass <sjg@chromium.org>

tpm: Add a proper Kconfig option for crc8 in SPL

The current approach is a bit of a hack and only works for the tpm
subsystem. Add a Kconfig so that crc8 can be enabled in SPL for other
purposes.

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

# 14f43797 19-Dec-2022 Tom Rini <trini@konsulko.com>

Merge tag 'v2023.01-rc4' into next

Prepare v2023.01-rc4

Signed-off-by: Tom Rini <trini@konsulko.com>


# ae3527f0 07-Dec-2022 Kautuk Consul <kconsul@ventanamicro.com>

arch/riscv: add semihosting support for RISC-V

We add RISC-V semihosting based serial console for JTAG based early
debugging.

The RISC-V semihosting specification is available at:
https://github.com/riscv/riscv-semihosting-spec/blob/main/riscv-semihosting-spec.adoc

Signed-off-by: Anup Patel <apatel@ventanamicro.com>
Signed-off-by: Kautuk Consul <kconsul@ventanamicro.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>

# 1c03ab9f 07-Dec-2022 Kautuk Consul <kconsul@ventanamicro.com>

lib: Add common semihosting library

We factor out the arch-independent parts of the ARM semihosting
implementation as a common library so that it can be shared
with RISC-V.

Signed-off-by: Kautuk Consul <kconsul@ventanamicro.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>

# 3b8dfc42 16-Nov-2022 Tom Rini <trini@konsulko.com>

Convert CONFIG_SYS_TIMER_COUNTS_DOWN to Kconfig

This converts the following to Kconfig:
CONFIG_SYS_TIMER_COUNTS_DOWN

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 86794052 21-Oct-2022 Sughosh Ganu <sughosh.ganu@linaro.org>

FWU: Add support for the FWU Multi Bank Update feature

The FWU Multi Bank Update feature supports updating firmware images
to one of multiple sets(also called banks) of images. The firmware
images are clubbed together in banks, with the system booting images
from the active bank. Information on the images such as which bank
they belong to is stored as part of the metadata structure, which is
stored on the same storage media as the firmware images on a dedicated
partition.

At the time of update, the metadata is read to identify the bank to
which the images need to be flashed(update bank). On a successful
update, the metadata is modified to set the updated bank as active
bank to subsequently boot from.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

# 40ed7be4 02-Aug-2022 Tom Rini <trini@konsulko.com>

Convert CONFIG_SYS_FDT_PAD to Kconfig

This converts the following to Kconfig:
CONFIG_SYS_FDT_PAD

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e67ffb5a 22-Jul-2022 Sughosh Ganu <sughosh.ganu@linaro.org>

tpm: rng: Add driver model interface for TPM RNG device

The TPM device has a builtin random number generator(RNG)
functionality. Expose the RNG functions of the TPM device to the
driver model so that they can be used by the EFI_RNG_PROTOCOL if the
protocol is installed.

Also change the function arguments and return type of the random
number functions to comply with the driver model api.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

# b340199f 10-Jun-2022 Tom Rini <trini@konsulko.com>

spl: Ensure all SPL symbols in Kconfig have some SPL dependency

Tighten up symbol dependencies in a number of places. Ensure that a SPL
specific option has at least a direct dependency on SPL. In places
where it's clear that we depend on something more specific, use that
dependency instead. This means in a very small number of places we can
drop redundant dependencies.

Reported-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 13ce351b 08-Jun-2022 Tom Rini <trini@konsulko.com>

vpl: Ensure all VPL symbols in Kconfig have some VPL dependency

Tighten up symbol dependencies in a number of places. Ensure that a VPL
specific option has at least a direct dependency on VPL. In places
where it's clear that we depend on something more specific, use that
dependency instead.

Reported-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 8bea4bf7 08-Jun-2022 Tom Rini <trini@konsulko.com>

tpl: Ensure all TPL symbols in Kconfig have some TPL dependency

Tighten up symbol dependencies in a number of places. Ensure that a TPL
specific option has at least a direct dependency on TPL. In places
where it's clear that we depend on something more specific, use that
dependency instead.

Reported-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 26f981f2 19-May-2022 Rasmus Villemoes <rasmus.villemoes@prevas.dk>

fdtdec: drop needlessly convoluted CONFIG_PHANDLE_CHECK_SEQ

Asking if the alias we found actually points at the device tree node
we passed in (in the guise of its offset from blob) can be done simply
by asking if the fdt_path_offset() of the alias' path is identical to
offset.

In fact, the current method suffers from the possibility of false
negatives: dtc does not necessarily emit a phandle property for a node
just because it is referenced in /aliases; it only emits a phandle
property for a node if it is referenced in <angle brackets>
somewhere. So if both the node we passed in and the alias node we're
considering don't have phandles, fdt_get_phandle() returns 0 for both.

Since the proper check is so simple, there's no reason to hide that
behind a config option (and if one really wanted that, it should be
called something else because there's no need to involve phandle in
the check).

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Acked-by: Aswath Govindraju <a-govindraju@ti.com>

# d30924f1 01-May-2022 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: fix selection of CONFIG_CHARSET

lib/charset.c is not optional for
EFI_APP || EFI_LOADER || UFS || UT_UNICODE.
These must select CONFIG_CHARSET.

Fixes: 726cd9836db0 ("efi: Make unicode printf available to the app")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>

# 747093dd 30-Apr-2022 Simon Glass <sjg@chromium.org>

vpl: Add Kconfig options for VPL

Add VPL versions of commonly used Kconfig options.

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

# 11232139 06-Apr-2022 Tom Rini <trini@konsulko.com>

nds32: Remove the architecture

As removal of nds32 has been ack'd for the Linux kernel, remove support
here as well.

Cc: Rick Chen <rick@andestech.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Rick Chen <rick@andestech.com>

# fd210fee 28-Mar-2022 Philippe Reynes <philippe.reynes@softathome.com>

lib: allow to build asn1 decoder and oid registry in SPL

This commit adds the options:
- SPL_ASN1_DECODER
- SPL_OID_REGISTRY

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>

# 7d44a985 28-Mar-2022 Philippe Reynes <philippe.reynes@softathome.com>

lib: Kconfig: enhance the help of OID_REGISTRY

Enhance the help for the config OID_REGISTRY.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>

# a0e71d96 28-Mar-2022 Philippe Reynes <philippe.reynes@softathome.com>

lib: Kconfig: enhance help for ASN1

Enhance the help for configs ASN1_COMPILER
and ASN1_decoder.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>

# 761a1786 27-Jan-2022 Tom Rini <trini@konsulko.com>

Merge tag 'dm-pull-26jan22' of https://source.denx.de/u-boot/custodians/u-boot-dm

acpi refactoring to allow non-x86 use
binman support for bintools (binary tools)
minor tools improvements in preparation for FDT signing
various minor fixes and improvements


# 334a9b9d 25-Nov-2021 Loic Poulain <loic.poulain@linaro.org>

lib/circbuf: Make circbuf selectable symbol

It is currenly only used from usbtty driver but make it properly
selectable via Kconfig symbol, for future usage.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>

# e1722fcb 01-Dec-2021 Simon Glass <sjg@chromium.org>

x86: Allow any arch to generate ACPI tables

These have sadly found their way to ARM now. Allow any arch to support
generating ACPI tables.

Disable this for the tools build.

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

# 7c3fd5c2 26-Dec-2021 Qu Wenruo <wqu@suse.com>

lib: add BLAKE2 hash support

The code is cross-ported from BLAKE2 reference implementation
(https://github.com/BLAKE2/BLAKE2).

With minimal change to remove unused macros/features.

Currently there is only one user inside U-boot (btrfs), and since it
only utilize BLAKE2B, all other favors are all removed.

Signed-off-by: Qu Wenruo <wqu@suse.com>
[trini: Rename ROUND to R to avoid clash with <linux/bitops.h>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 97f2a749 04-Jan-2022 Eugen Hristev <eugen.hristev@collabora.com>

lib: Kconfig: fix PHANDLE_CHECK_SEQ position outside of menu

CONFIG_PHANDLE_CHECK_SEQ is outside of the menu 'Library routines'
thus it's invisible in menuconfig and cannot be selected.
Fix this by moving the 'endmenu' after the PHANDLE_CHECK_SEQ definition

Fixes: c589132a1d ("fdt: Use phandle to distinguish DT nodes with same name")
Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
Reviewed-by: Aswath Govindraju <a-govindraju@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 726cd983 29-Dec-2021 Simon Glass <sjg@chromium.org>

efi: Make unicode printf available to the app

This is needed to show unicode strings. Enable this code in the app.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>

# 6405ab7a 24-Nov-2021 Simon Glass <sjg@chromium.org>

Convert CONFIG_PHYSMEM to Kconfig

This converts the following to Kconfig:
CONFIG_PHYSMEM

Signed-off-by: Simon Glass <sjg@chromium.org>
Suggested-by: Sean Anderson <seanga2@gmail.com>

# ac7606af 14-Nov-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

lmb: fix typo 'commun'

%s/commun/common/

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

# e7d285b2 25-Sep-2021 Simon Glass <sjg@chromium.org>

image: Use the correct checks for CRC32

Add a host Kconfig for CRC32. With this we can use CONFIG_IS_ENABLED(CRC32)
directly in the host build, so drop the unnecessary indirection.

Add a few more conditions to SPL_CRC32 to avoid build failures as well as
TPL_CRC32. Also update hash.c to make crc32 optional and to actually take
notice of SPL_CRC32.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# 2c21256b 25-Sep-2021 Simon Glass <sjg@chromium.org>

hash: Use Kconfig to enable hashing in host tools and SPL

At present when building host tools, we force CONFIG_SHAxxx to be enabled
regardless of the board Kconfig setting. This is done in the image.h
header file.

For SPL we currently just assume the algorithm is desired if U-Boot proper
enables it.

Clean this up by adding new Kconfig options to enable hashing on the host,
relying on CONFIG_IS_ENABLED() to deal with the different builds.

Add new SPL Kconfigs for hardware-accelerated hashing, to maintain the
current settings.

This allows us to drop the image.h code and the I_WANT_MD5 hack.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# 603d15a5 25-Sep-2021 Simon Glass <sjg@chromium.org>

spl: cypto: Bring back SPL_ versions of SHA

Unfortunately these were removed by mistake. This means that adding hash
support to SPL brings in all software algorithms, with a substantial
increase in code size.

The origin of the problem was renaming them to SPL_FIT_xxx and then these
were removed altogether in a later commit.

Add them back. This aligns with CONFIG_MD5, for example, which has an SPL
variant.

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: f5bc9c25f31 ("image: Rename SPL_SHAxxx_SUPPORT to SPL_FIT_SHAxxx")
Fixes: eb5171ddec9 ("common: Remove unused CONFIG_FIT_SHAxxx selectors")
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# 6674edaa 16-Sep-2021 Tom Rini <trini@konsulko.com>

Merge tag 'v2021.10-rc4' into next

Prepare v2021.10-rc4

Signed-off-by: Tom Rini <trini@konsulko.com>

# gpg: Signature made Tue 14 Sep 2021 06:58:32 PM EDT
# gpg: using RSA key 1A3C7F70E08FAB1707809BBF147C39FF9634B72C
# gpg: Good signature from "Thomas Rini <trini@konsulko.com>" [ultimate]

# Conflicts:
# board/Arcturus/ucp1020/spl.c
# cmd/mvebu/Kconfig
# common/Kconfig.boot
# common/image-fit.c
# configs/UCP1020_defconfig
# configs/sifive_unmatched_defconfig
# drivers/pci/Kconfig
# include/configs/UCP1020.h
# include/configs/sifive-unmatched.h
# lib/Makefile
# scripts/config_whitelist.txt


# 5145bc73 01-Sep-2021 Oleksandr Suvorov <oleksandr.suvorov@foundries.io>

lib: fix typos in Kconfig

There are trivial typos in the Kconfig file. Fixed them.
Also, fixed grammar in the descriptions with typos.

Fixes: d56b4b1974 ("configs: Migrate RBTREE, LZO, CMD_MTDPARTS, CMD_UBI and CMD_UBIFS")
Fixes: 7264f2928b ("spl: fit: Eanble GZIP support for image decompression")
Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# e60e4499 02-Sep-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

lib: Drop SHA512_ALGO in lieu of SHA512

SHA512_ALGO was used as a "either SHA512 or SHA384", although the
implementations of these two algorithms share a majority of code.

From a Kconfig interface perspective, it makes sense to present two
distinct options. This requires #ifdefing out the SHA512
implementation from sha512.c. The latter doesn't make any sense.

It's reasonable to say in Kconfig that SHA384 depends on SHA512, and
seems to be the more polite way to handle the selection.

Thus, automatically select SHA512 when SHA384 is enabled.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# b4c2c151 27-Aug-2021 Michal Simek <michal.simek@amd.com>

Kconfig: Remove all default n/no options

default n/no doesn't need to be specified. It is default option anyway.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
[trini: Rework FSP_USE_UPD portion]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 928a8be7 29-Jul-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

lib: ecdsa: Implement UCLASS_ECDSA verification on target

Implement the crypto_algo .verify() function for ecdsa256. Because
it backends on UCLASS_ECDSA, this change is focused on parsing the
keys from devicetree and passing this information to the specific
UCLASS driver.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# fa3f1f1d 24-Jul-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: disable CONFIG_SPL_HEXDUMP by default

CONFIG_HEXDUMP is needed to display UEFI variables using 'printenv -e'.

Enabling CONFIG_SPL_HEXDUMP only makes sense for debugging purposes.
Hence CONFIG_SPL_HEXDUMP should not be enabled by default.

The following boards currently have CONFIG_SPL_HEXDUMP=y. This includes
boards that don't use SPL at all.

axm_defconfig
imx8mm-cl-iot-gate_defconfig
imx8mm_venice_defconfig
imxrt1020-evk_defconfig
imxrt1050-evk_defconfig
kontron_sl28_defconfig
kp_imx53_defconfig
lx2160ardb_tfa_stmm_defconfig
mt7622_rfb_defconfig
octeon_ebb7304_defconfig
octeon_nic23_defconfig
qemu_arm64_defconfig
qemu_arm_defconfig
qemu-riscv32_defconfig
qemu-riscv32_smode_defconfig
qemu-riscv64_defconfig
qemu-riscv64_smode_defconfig
qemu-x86_64_defconfig
qemu-x86_defconfig
sandbox64_defconfig
sandbox_defconfig
stm32mp15_basic_defconfig
stm32mp15_trusted_defconfig
synquacer_developerbox_defconfig
taurus_defconfig
xilinx_versal_virt_defconfig

The patch only keeps it enabled on

sandbox_spl_defconfig

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 1a46cb6c 02-Jul-2021 Simon Glass <sjg@chromium.org>

lib: Create a new Kconfig option for charset conversion

Rather than looking at two KConfig options in the Makefile, create a new
Kconfig option for compiling lib/charset.c

Enable it for UFS also, which needs this support.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 26dd9936 08-Jul-2021 Steffen Jaeckel <jaeckel-floss@eyet-services.de>

lib: add crypt subsystem

Add the basic functionality required to support the standard crypt
format.
The files crypt-sha256.c and crypt-sha512.c originate from libxcrypt and
their formatting is therefor retained.
The integration is done via a crypt_compare() function in crypt.c.

```
libxcrypt $ git describe --long --always --all
tags/v4.4.17-0-g6b110bc
```

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 7d0f3fbb 11-Jun-2021 Tero Kristo <t-kristo@ti.com>

lib: rational: copy the rational fraction lib routines from Linux

Copy the best rational approximation calculation routines from Linux.
Typical usecase for these routines is to calculate the M/N divider
values for PLLs to reach a specific clock rate.

This is based on linux kernel commit:
"lib/math/rational.c: fix possible incorrect result from rational
fractions helper"
(sha1: 323dd2c3ed0641f49e89b4e420f9eef5d3d5a881)

Signed-off-by: Tero Kristo <t-kristo@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Tero Kristo <kristo@kernel.org>

# ec0512b1 24-May-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

Revert "lib: introduce HASH_CALCULATE option"

When we think of Kconfig, we usually think of features that we like
to enable or not. Ideally, we wouldn't use Kconfig to fix a build
issue, although sometimes it might make sense. With Kconfig it's hard
to guarantee that the fix is universal. We can only say that it works
for the set of tested configurations. In the majority of cases, it's
preferable to let the linker figure things out for us.

The reverted commit attempted to fix a build issue by adding an
invisible Kconfig option. This is wrong in several ways:

It invents a new Kconfig variable when CONFIG_HASH already
exists for the same purpose.
Second, hash-checksum.c makes use of the hash_progressive_lookup_algo()
symbol, which is only provided with CONFIG_HASH, but this dependency
was not expressed in the reverted patch.

It feels like Kconfig is turning into a listing of all available
source files, and a buffet to 'select' which ones to compile. The
purpose of this revert is to enable the next change to make use of
CONFIG_HASH instead of adding to Kconfig.

This reverts commit 87316da05f2fd49d3709275e64ef0c5980366ade.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Acked-by: Masahisa Kojima <masahisa.kojima@linaro.org>

# 1621d3c4 10-May-2021 Bin Meng <bmeng.cn@gmail.com>

lib: kconfig: Limit BINMAN_FDT for OF_SEPARATE or OF_EMBED

Generally speaking BINMAN_FDT makes sense for OF_SEPARATE or OF_EMBED.
For the other OF_CONTROL methods, it's quite possible binman node is
not available as binman is invoked during the build phase instead of
runtime. Let's only turn it on for OF_SEPARATE or OF_EMBED by default.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 87316da0 13-May-2021 Masahisa Kojima <masahisa.kojima@linaro.org>

lib: introduce HASH_CALCULATE option

Build error occurs when CONFIG_EFI_SECURE_BOOT or
CONFIG_EFI_CAPSULE_AUTHENTICATE is enabled,
because hash-checksum.c is not compiled.

Since hash_calculate() implemented in hash-checksum.c can be
commonly used aside from FIT image signature verification,
this commit itroduces HASH_CALCULATE option to decide
if hash-checksum.c shall be compiled.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# e2ae483c 13-May-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

hash: Kconfig option for SHA512 hardware acceleration

Commit a479f103dc1c ("hash: Allow for SHA512 hardware implementations")
defined function definitions for hardware accelerated SHA384 and SHA512.
If CONFIG_SHA_HW_ACCEL=y, these functions are used.

We already have boards using CONFIG_SHA_HW_ACCEL=y but none implements the
new functions hw_sha384() and hw_sha512().

For implementing the EFI TCG2 protocol we need SHA384 and SHA512. The
missing hardware acceleration functions lead to build errors on boards like
peach-pi_defconfig.

Introduce a new Kconfig symbol CONFIG_SHA512_HW_ACCEL to control if the
functions hw_sha384() and hw_sha512() shall be used to implement the SHA384
and SHA512 algorithms.

Fixes: a479f103dc1c ("hash: Allow for SHA512 hardware implementations")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

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

# 6d66502b 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: Add 2 config to define the max number of regions

Add 2 configs CONFIG_LMB_MEMORY_REGIONS and CONFIG_LMB_RESERVED_REGIONS
to change independently the max number of the regions in lmb
library.

When CONFIG_LMB_USE_MAX_REGIONS=y, move the lmb property arrays to
struct lmb and manage the array size with the element 'max' of struct
lmb_region; their are still allocated in stack.

When CONFIG_LMB_USE_MAX_REGIONS=n, keep the current location in
struct lmb_region to allow compiler optimization.

Increase CONFIG_LMB_RESERVED_REGIONS is useful to avoid lmb errors in
bootm when the number of reserved regions (not adjacent) is reached:
+ 1 region for relocated U-Boot
+ 1 region for initrd
+ 1 region for relocated linux device tree
+ reserved memory regions present in Linux device tree.

The current limit of 8 regions is reached with only 5 reserved regions
in DT.

see Linux kernel commit bf23c51f1f49 ("memblock: Move memblock arrays
to static storage in memblock.c and make their size a variable")

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# 4fa0150d 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: move MAX_LMB_REGIONS value in Kconfig

Move MAX_LMB_REGIONS value in Kconfig, the max number of the regions
in lmb library.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# 77b8cfef 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: move CONFIG_LMB in Kconfig

Migrate CONFIG_LMB in Kconfig.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# a479f103 16-Feb-2021 Joel Stanley <joel@jms.id.au>

hash: Allow for SHA512 hardware implementations

Similar to support for SHA1 and SHA256, allow the use of hardware hashing
engine by enabling the algorithm and setting CONFIG_SHA_HW_ACCEL /
CONFIG_SHA_PROG_HW_ACCEL.

Signed-off-by: Joel Stanley <joel@jms.id.au>

# f2c1442e 14-Mar-2021 Simon Glass <sjg@chromium.org>

bloblist: Make BLOBLIST_TABLES depend on BLOBLIST

Add an extra condition here since we cannot put x86 tables in a bloblist
when bloblists are not supported.

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

# e0103158 25-Feb-2021 Bin Meng <bmeng.cn@gmail.com>

lib: kconfig: Mention CONFIG_ADDR_MAP limitation in the help

Mention that CONFIG_ADDR_MAP only works in the post-relocation phase.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>

# 56e7257c 03-Feb-2021 Bin Meng <bmeng.cn@gmail.com>

lib: Fix BINMAN_FDT dependency

lib/binman.c references the following 3 ofnode APIs:
ofnode_first_subnode(), ofnode_path() and ofnode_read_bool().

These APIs get built only when DM is on. Fix the dependency then.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 59e4e391 18-Jan-2021 Tom Rini <trini@konsulko.com>

Merge https://gitlab.denx.de/u-boot/custodians/u-boot-riscv

- Update qemu-riscv.rst build instructions.
- Add support for SPI on Kendryte K210.
- Add Microchip PolarFire SoC Icicle Kit support.
- Add support for an early timer.
- Select TIMER_EARLY to avoid infinite recursion for Trace.


# a80f8513 17-Jan-2021 Pragnesh Patel <pragnesh.patel@sifive.com>

trace: select TIMER_EARLY to avoid infinite recursion

When tracing functions is enabled this adds calls to
__cyg_profile_func_enter() and __cyg_profile_func_exit() to the traced
functions.

__cyg_profile_func_enter() and __cyg_profile_func_exit() invoke
timer_get_us() to record the entry and exit time.

initr_dm() will make gd->dm_root = NULL and gd->timer = NULL, so
timer_get_us() -> get_ticks() -> dm_timer_init() will lead to an
indefinite recursion.

So select TIMER_EARLY when tracing got enabled.

Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Rick Chen <rick@andestech.com>

# 6205bbb1 04-Jan-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lib: cosmetic update of CONFIG_LIB_ELF description

Change 2 typo error in CONFIG_LIB_ELF description:
- Supoort => Support
- fir => for

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c589132a 02-Dec-2020 Aswath Govindraju <a-govindraju@ti.com>

fdt: Use phandle to distinguish DT nodes with same name

While assigning the sequence number to subsystem instances by reading the
aliases property, only DT nodes names are compared and not the complete
path. This causes a problem when there are two DT nodes with same name but
have different paths.

In arch/arm/dts/k3-am65-main.dtsi there are two USB controllers with the
same device tree node name but different path. When aliases are defined for
these USB controllers then fdtdec_get_alias_seq() fails to pick the correct
instance for a given index.

fdt_path_offset() function is slow and this would effect the U-Boot
startup. To avert the time penalty on all boards, apply this extra check
only when required by using a config option.

Fix it by comparing the phandles of DT nodes after the node names match,
under a config option.

Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Fix whitespace error in Kconfig:
Signed-off-by: Simon Glass <sjg@chromium.org>

# 28cef9ca 19-Nov-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

fs: fat: create correct short names

The current function set_name() used to create short names has the
following deficiencies resolved by this patch:

* Long names (e.g. FOO.TXT) are stored even if a short name is enough.
* Short names with spaces are created, e.g. "A ~1.TXT".
* Short names with illegal characters are created, e.g. "FOO++BAR".
* Debug output does not not consider that the short file name has no
concluding '\0'.

The solution for the following bug is split of into a separate patch:

* Short file names must be unique.

This patch only provides the loop over possible short file names.

Fixes: c30a15e590c ("FAT: Add FAT write feature")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# e4f8e543 05-Nov-2020 Simon Glass <sjg@chromium.org>

smbios: Drop the unused Kconfig options

Now that we can use devicetree to specify this information, drop the old
CONFIG options.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 44c74bdd 05-Nov-2020 Simon Glass <sjg@chromium.org>

sysinfo: Provide a default driver to set SMBIOS values

Some boards want to specify the manufacturer or product name but do not
need to have their own sysinfo driver.

Add a default driver which provides a way to specify this SMBIOS
information in the devicetree, without needing any board-specific
functionality.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d2cb7a22 04-Nov-2020 Simon Glass <sjg@chromium.org>

x86: Allow putting some tables in the bloblist

At present all tables are placed starting at address f0000 in memory, and
can be up to 64KB in size. If the tables are very large, this may not
provide enough space.

Also if the tables point to other tables (such as console log or a ramoops
area) then we must allocate other memory anyway.

The bloblist is a nice place to put these tables since it is contiguous,
which makes it easy to reserve this memory for linux using the 820 tables.

Add an option to put some of the tables in the bloblist. For SMBIOS and
ACPI, create suitable pointers from the f0000 region to the new location
of the tables.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
[bmeng: squashed in http://patchwork.ozlabs.org/project/uboot/patch/
20201105062407.1.I8091ad931cbbb5e3b6f6ababdf3f8d5db0d17bb9@changeid/]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# 415eab06 03-Nov-2020 Christian Gmeiner <christian.gmeiner@gmail.com>

smbios: add parsing API

Add a very simple API to be able to access SMBIOS strings
like vendor, model and bios version.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 72eda507 27-Oct-2020 Sean Anderson <seanga2@gmail.com>

lib: Add getopt

Some commands can get very unweildy if they have too many positional
arguments. Adding options makes them easier to read, remember, and
understand.

This implementation of getopt has been taken from barebox, which has had
option support for quite a while. I have made a few modifications to their
version, such as the removal of opterr in favor of a separate getopt_silent
function. In addition, I have moved all global variables into struct
getopt_context.

The getopt from barebox also re-orders the arguments passed to it so that
non-options are placed last. This allows users to specify options anywhere.
For example, `ls -l foo/ -R` would be re-ordered to `ls -l -R foo/` as
getopt parsed the options. However, this feature conflicts with the const
argv in cmd_tbl->cmd. This was originally added in 54841ab50c ("Make sure
that argv[] argument pointers are not modified."). The reason stated in
that commit is that hush requires argv to stay unmodified. Has this
situation changed? Barebox also uses hush, and does not have this problem.
Perhaps we could use their fix?

I have assigned maintenance of getopt to Simon Glass, as it is currently
only used by the log command. I would also be fine maintaining it.

Signed-off-by: Sean Anderson <seanga2@gmail.com>

# 26637e2e 12-Sep-2020 Simon Glass <sjg@chromium.org>

lib: Allow hexdump to be used in SPL

It is sometimes useful to output hex dumps in SPL. Add a config option to
allow this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# e87dfb05 05-Aug-2020 Andrii Anisov <andrii_anisov@epam.com>

lib: sscanf: add sscanf implementation

Port sscanf implementation from mini-os and introduce new
Kconfig option to enable it: CONFIG_SSCANF. Disable by default.

Signed-off-by: Andrii Anisov <andrii_anisov@epam.com>
Signed-off-by: Anastasiia Lukianenko <anastasiia_lukianenko@epam.com>
Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>

# 81014f73 30-Jul-2020 Joao Marcos Costa <joaomarcos.costa@bootlin.com>

include/u-boot, lib/zlib: add sources for zlib decompression

Add zlib (v1.2.11) uncompr() function to U-Boot. SquashFS depends on
this function to decompress data from a raw disk image. The actual
support for zlib into SquashFS sources will be added in a follow-up
commit.

Signed-off-by: Joao Marcos Costa <joaomarcos.costa@bootlin.com>

# 69be8fd1 03-Jun-2020 Marek Szyprowski <m.szyprowski@samsung.com>

powerpc: move ADDR_MAP to Kconfig

Move ADDR_MAP related config options from include/configs/*.h to the
proper place in lib/Kconfig. This has been done using
./tools/moveconfig.py and manual inspection of the generated changes.
This is a preparation to use ADDR_MAP helper on ARM 32bit Raspberry Pi4
board for mapping the PCIe XHCI MMIO, which is above the 4GiB identity
mapping limit.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# d16b38f4 15-Apr-2020 Reuben Dowle <reubendowle0@gmail.com>

Add support for SHA384 and SHA512

The current recommendation for best security practice from the US government
is to use SHA384 for TOP SECRET [1].

This patch adds support for SHA384 and SHA512 in the hash command, and also
allows FIT images to be hashed with these algorithms, and signed with
sha384,rsaXXXX and sha512,rsaXXXX

The SHA implementation is adapted from the linux kernel implementation.

[1] Commercial National Security Algorithm Suite
http://www.iad.gov/iad/programs/iad-initiatives/cnsa-suite.cfm

Signed-off-by: Reuben Dowle <reuben.dowle@4rf.com>

# 43e442a5 26-May-2020 Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

kconfig: fix some typos

Signed-off-by: Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

# eff5a547 22-May-2020 Michael Walle <michael@walle.cc>

cmd: zip: automatically pull in gzip()

Move the CONFIG_GZIP_COMPRESSED from a config.h macro to a Kconfig menu
item. It is not selectable by a user because there is no reason to do
so. Instead it will be automatically selected by the stuff which uses
gzip(), like the zip command.

Remove it from the config_whitelist.txt. Also remove
CONFIG_GZIP_COMPRESS_DEF_SZ as this was never used on any board. The
default seems to be sane, otherwise it should be added as a Kconfig
option.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8239be61 06-May-2020 Simon Glass <sjg@chromium.org>

lib: Allow MD5 to be enabled in SPL

At present the MD5 option cannot be enabled by board configs since it has
no Kconfig name. It is generally enabled, so long as FIT support is
present. But not all boards use FIT, particularly in SPL

Fix this and add an option for SPL as well. This allows board code to call
md5() even if FIT support is not enabled.

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

# 04cb3994 21-Apr-2020 Weijie Gao <weijie.gao@mediatek.com>

lib: enable lzma decompression support for SPL build

This patch enables LZMA decompression support for SPL build

Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>

# 2a2119e1 05-Mar-2020 Atish Patra <atishp@atishpatra.org>

lib: kconfig: Add option to set BZIP2 compression method

There is no way to select BZIP2 compression method.
Add it under library/compression config where all other
compression related configs are present.

Signed-off-by: Atish Patra <atish.patra@wdc.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 805b3cac 12-Feb-2020 Keerthy <j-keerthy@ti.com>

lib: elf: Move the generic elf loading/validating functions to lib

Move the generic elf loading/validating functions to lib/
so that they can be re-used and accessed by code existing
outside cmd.

While at it remove the duplicate static version of load_elf_image_phdr
under arch/arm/mach-imx/imx_bootaux.c.

Signed-off-by: Keerthy <j-keerthy@ti.com>
Suggested-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>

# 1611235b 19-Jan-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: Kconfig dependencies for pseudo-random library

drivers/rng/sandbox_rng.c requires rand() to be defined but configuration
option CONFIG_CONFIG_LIB_RAND selected in drivers/rng/Kconfig does not
exist.

test/lib/test_aes.c requires rand() to be defined.

Fix the selection criteria for choice "Pseudo-random library support type".

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 3c10dc95 06-Dec-2019 Simon Glass <sjg@chromium.org>

binman: Add a library to access binman entries

SPL and TPL can access information about binman entries using link-time
symbols but this is not available in U-Boot proper. Of course it could be
made available, but the intention is to just read the device tree.

Add support for this, so that U-Boot can locate entries.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# b4adf627 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: crypto: add x509 parser

Imported from linux kernel v5.3:
x509.asn1 without changes
x509_akid.asn1 without changes
x509_parser.h without changes
x509_cert_parser.c with changes marked as __UBOOT__
x509_public_key.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# a9b45e6e 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add oid registry utility

Imported from linux kernel v5.3:
build_OID_registry without changes
oid_registry.h without changes
oid_registry.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# ab8a0e06 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add asn1 decoder

Imported from linux kernel v5.3:
lib/asn1_decoder.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 2b12196d 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

cmd: add asn1_compiler

Imported from linux kernel v5.3:
asn1.h without changes
asn1_ber_bytecode.h without changes
asn1_decoder.h without changes
asn1_compiler.c without changes

This host command will be used to create a ASN1 parser, for example,
for pkcs7 messages or x509 certificates. More specifically, it will
generate *byte code* which will be interpreted by asn1 decoder library.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 05429b6c 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

rtc: move date.c from drivers/rtc/ to lib/

In the next commit, rtc_mktime(), for compatibility with linux, will be
implemented using rtc_mktime(), which is no longer drivers/rtc specific.
So move this file under lib/.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 37ef1774 10-Nov-2019 Thomas Hebb <tommyhebb@gmail.com>

Kconfig: disambiguate config names for tiny printf

27084c03d36a ("spl: Allow tiny printf() to be controlled in SPL and
TPL") split this option in two for TPL and SPL, but didn't change the
Kconfig names, making them hard to set quickly.

Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>

# 0d76afc0 27-Oct-2019 Simon Glass <sjg@chromium.org>

fdt: Add Kconfig options to control code size

For better or worse libfdt recent grew a lot of code that checks the
validity of the device tree in great detail. When using unsigned or
unverified data this makes things safer, but it does add to code size.

Add some controls to select the trade-off between safety and code size.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 27084c03 25-Sep-2019 Simon Glass <sjg@chromium.org>

spl: Allow tiny printf() to be controlled in SPL and TPL

At present there is only one control for this and it is used for both SPL
and TPL. But SPL might have a lot more space than TPL so the extra cost of
a full printf() might be acceptable.

Split the option into two, providing separate SPL and TPL controls. The
TPL setting defaults to the same as SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2a51e16b 07-Jun-2019 Tom Rini <trini@konsulko.com>

configs: Make USE_TINY_PRINTF depend on SPL||TPL and be default

The USE_TINY_PRINTF symbol only changes things within SPL and TPL
builds, so make it depend on that support. Next, make it default as
within these cases we should rarely have need of more advanced print
formats outside of the debug context.

To do this, in a few cases we need to correct our Kconfig dependencies
as we had cases of non-SPL targets select'ing this symbol. Finally, in
the case of a few boards we really do need the full printf
functionality.

Signed-off-by: Tom Rini <trini@konsulko.com>

# da0fb5fd 02-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: make call depth limit customizable

Up to now we had hard coded values for the call depth up to which trace
records are created: 200 for early tracing, 15 thereafter. UEFI
applications reach a call depth of 80 or above.

Provide customizing settings for the call trace depth limit and the early
call trace depth limit. Use the old values as defaults.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8509f22a 29-Apr-2019 Marek Behún <kabel@kernel.org>

lib: add Zstandard decompression support

Add the zstd library from Linux kernel (only decompression support).
There are minimal changes to build with U-Boot, otherwise the files are
identical to Linux commit dc35da16 from March 2018, the files had not
been touched since in kernel. Also SPDX lincese tags were added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 83a486b6 29-Apr-2019 Marek Behún <kabel@kernel.org>

lib: Add xxhash support

This adds the xxhash support from Linux. Files are almost identical to
those added to Linux in commit 5d240522 ("lib: Add xxhash module") (they
haven't been touched since in Linux). The only difference is to add some
includes to be compatible with U-Boot. Also SPDX lincese tags were
added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 5132361a 29-Apr-2019 Heiko Schocher <hs@denx.de>

lib: Kconfig: fix help text for GZIP

commit 95f4bbd581cf ("lib: fdt: Allow LZO and GZIP DT compression in U-Boot")

introduced Kconfig option for gzip in U-Boot, but help text
says gzip for SPL, which is wrong. Fix this.

Signed-off-by: Heiko Schocher <hs@denx.de>
Acked-by: Marek Vasut <marex@denx.de>

# 1c6eb075 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE_BUFFER_SIZE et al to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE_BUFFER_SIZE
CONFIG_TRACE_EARLY_SIZE
CONFIG_TRACE_EARLY
CONFIG_TRACE_EARLY_ADDR

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

# a24a78d7 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE

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

# 54969b40 21-Mar-2019 Thierry Reding <treding@nvidia.com>

fdtdec: Add Kconfig symbol for tests

Runtime tests are provided as a test_fdtdec command implementation. Add
a Kconfig symbol that allows this command to be built so that the tests
can be used.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 95f4bbd5 08-Mar-2019 Marek Vasut <marex@denx.de>

lib: fdt: Allow LZO and GZIP DT compression in U-Boot

Add required Kconfig symbols, Makefile bits and macro fixes in a
few places to support LZO and DT compression in U-Boot. This can
save a lot of space with multi-DTB fitImages.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>

# 6e705114 13-Jan-2019 Chris Packham <judge.packham@gmail.com>

lib: Kconfig: spelling fixes

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 048c6e89 06-Nov-2018 Simon Glass <sjg@chromium.org>

spl: lz4: Allow use of lz4 compression in SPL

In some cases U-Boot is compressed and it is useful to be able to
decompress it in SPL. Add a Kconfig and Makefile change to allow this.
Note that this does not actually implement decompression.

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

# 2895c4b7 15-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

kconfig: Introduce HAVE_ARCH_IOMAP

Introduce a new Kconfig option for architecture codes to control
whether it provides io{read,write}{8,16,32} I/O accessor functions.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5592a633 01-Oct-2018 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt in TPL

In some cases (e.g. sandbox with verified boot) it is useful to support
libfdt in TPL. Update the Kconfig to handle this.

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

# 6307896c 01-Oct-2018 Simon Glass <sjg@chromium.org>

tpm: Add support for SPL and TPL

At present the tpm can only be used in U-Boot proper. Updated it to work
in SPL and TPL also.

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

# ab948cd2 19-Jul-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

fdt_support: make FDT_FIXUP_PARTITIONS depend on CMD_MTDPARTS

fdt_fixup_mtdparts() calls mtdparts_init() and device_find(),
which are defined in cmd/mtdparts.c

The combination of FDT_FIXUP_PARTITIONS=y and CMD_MTDPARTS=n
emits the following link error:

common/fdt_support.c:903: undefined reference to `mtdparts_init'
common/fdt_support.c:914: undefined reference to `device_find'

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 3330584d 03-Jun-2018 Igor Opaniuk <igor.opaniuk@gmail.com>

avb2.0: integrate avb 2.0 into the build system

Integrate libavb into the build system. Introduce CONFIG_LIBAVB
build option.

Signed-off-by: Igor Opaniuk <igor.opaniuk@linaro.org>

# f8c987f8 05-Jun-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

lib: Add hexdump

Often during debugging session it's very interesting to see
what data we were dealing with. For example what we write or read
to/from memory or peripherals.

This change introduces functions that allow to dump binary
data with one simple function invocation like:
------------------->8----------------
print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, buf, len);
------------------->8----------------

which gives us the following:
------------------->8----------------
00000000: f2 b7 c9 88 62 61 75 64 72 61 74 65 3d 31 31 35 ....baudrate=115
00000010: 32 30 30 00 62 6f 6f 74 61 72 67 73 3d 63 6f 6e 200.bootargs=con
00000020: 73 6f 6c 65 3d 74 74 79 53 33 2c 31 31 35 32 30 sole=ttyS3,11520
00000030: 30 6e 38 00 62 6f 6f 74 64 65 6c 61 79 3d 33 00 0n8.bootdelay=3.
00000040: 62 6f 6f 74 66 69 6c 65 3d 75 49 6d 61 67 65 00 bootfile=uImage.
00000050: 66 64 74 63 6f 6e 74 72 6f 6c 61 64 64 72 3d 39 fdtcontroladdr=9
00000060: 66 66 62 31 62 61 30 00 6c 6f 61 64 61 64 64 72 ffb1ba0.loadaddr
00000070: 3d 30 78 38 32 30 30 30 30 30 30 00 73 74 64 65 =0x82000000.stde
00000080: 72 72 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 rr=serial0@e0022
00000090: 30 30 30 00 73 74 64 69 6e 3d 73 65 72 69 61 6c 000.stdin=serial
000000a0: 30 40 65 30 30 32 32 30 30 30 00 73 74 64 6f 75 0@e0022000.stdou
000000b0: 74 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 30 t=serial0@e00220
000000c0: 30 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00..............
...
------------------->8----------------

Source of hexdump.c was copied from Linux kernel v4.7-rc2.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Mario Six <mario.six@gdsys.cc>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Stefan Roese <sr@denx.de>

# c232d14d 29-May-2018 Alex Kiernan <alex.kiernan@gmail.com>

mmc: Separate "mmc swrite" from fastboot

Introduce CONFIG_IMAGE_SPARSE and CONFIG_CMD_MMC_SWRITE so the "mmc
swrite" command is separated from the fastboot code.

Move image-sparse from common to lib so it's clear it's library code.

Rename CONFIG_FASTBOOT_FLASH_FILLBUF_SIZE to CONFIG_IMAGE_SPARSE_FILLBUF_SIZE
and migrate it to Kconfig.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Acked-by: Jassi Brar <jaswinder.singh@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6417572e 08-May-2018 Tom Rini <trini@konsulko.com>

lib/Kconfig: Mark OF_LIBFDT_OVERLAY as depending on OF_LIBFDT

The overlay code is only useful when OF_LIBFDT is set, so mark it as
depending on that first.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 58a46f88 25-Apr-2018 Praneeth Bajjuri <praneeth@ti.com>

configs: TI: Enable FIT Library overlay support

Enable the FDT library overlay support for all TI SOC family.

Without this option, when Loading fdt from FIT image, the
following warning is seen.

"config with overlays but CONFIG_OF_LIBFDT_OVERLAY not set".

Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
Suggested-by: Andrew F.Davis <afd@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>

# 14ad44ab 18-Apr-2018 Alex Kiernan <alex.kiernan@gmail.com>

spl: Split sprintf, strto* from SPL serial in Kconfig

When SPL serial is disabled, callers who need sprintf or strtoul fail
because their inclusion is guarded by CONFIG_SPL_SERIAL_SUPPORT/
CONFIG_TPL_SERIAL_SUPPORT.

Split printf, sprintf and strto into their own entries and then select
all of them if SERIAL_SUPPORT is enabled to match the current behaviour.

Include panic.o unconditionally as it can be called from anywhere which
uses BUG_ON().

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>

# e294ba06 04-Apr-2018 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-sunxi

Signed-off-by: Tom Rini <trini@konsulko.com>


# d14db11d 03-Apr-2018 Andre Przywara <andre.przywara@arm.com>

sunxi: revert disabling of features

In January some commits were introduced to mitigate the U-Boot image
size issues we encountered on sunxi builds.
Now with the MMC environment removed we can bring them back, as we
practically don't have a size limit anymore.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 32ce6179 13-Mar-2018 Bryan O'Donoghue <bryan.odonoghue@linaro.org>

optee: Add lib entries for sharing OPTEE code across ports

This patch adds code to lib to enable sharing of useful OPTEE code between
board-ports and architectures. The code on lib/optee/optee.c comes from the
TI omap2 port. Eventually the OMAP2 code will be patched to include the
shared code. The intention here is to add more useful OPTEE specific code
as more functionality gets added.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Cc: Harinarayan Bhatta <harinarayan@ti.com>
Cc: Andrew F. Davis <afd@ti.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Kever Yang <kever.yang@rock-chips.com>
Cc: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Cc: Peng Fan <peng.fan@nxp.com>
Tested-by: Peng Fan <peng.fan@nxp.com>

# 36c1877c 06-Feb-2018 Faiz Abbas <faiz_abbas@ti.com>

lib: Kconfig: Move DYNAMIC_CRC_TABLE to Kconfig

Add CONFIG prefix to DYNAMIC_CRC_TABLE and implement it in
Kconfig.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>

# a451bc27 05-Feb-2018 Adam Ford <aford173@gmail.com>

Convert LIB_UUID to Kconfig

config_fallback.h has some logic that checks a variety of options
and selects LIB_UUID if it hasn't already been selected. This
will all LIB_UUID in Kconfig and select this option for the list
of options to allow us to remove the logic from fallbacks

Signed-off-by: Adam Ford <aford173@gmail.com>

# a5a37567 06-Feb-2018 Adam Ford <aford173@gmail.com>

Convert CONFIG LIB_HW_RAND to Kconfig

config_fallbacks.h had some logic to automatically select
LIB_RAND if RANDOM_UUID or CMD_UUID were set if LIB_HW_RAND wasn't
already selected. By migrating LIB_HW_RAND to Kconfig, we can
remove this check from config_fallbacks.h and put it into Kconfig

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
[trini: Turn into a choice, add NET_RANDOM_ETHADDR]
Signed-off-by: Tom Rini <trini@konsulko.com>

# acd4d334 16-Jan-2018 Maxime Ripard <maxime.ripard@free-electrons.com>

net: regex: Disable by default on sunXi

The sunXi arm64 build has overflown, leading to the main U-boot binary
overwriting the environment when flashing the new image, or even worse,
overwriting itself when we're calling saveenv.

Disable this option that is not critical until we can adress the issue
properly.

Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 7e3caa81 03-Dec-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

Move CONFIG_PANIC_HANG to Kconfig

Freescale (NXP) boards have lots of defconfig files per board.
I used "imply PANIC_HANG" for them.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# da5337a6 08-Nov-2017 Nandor Han <nandor.han@ge.com>

rtc: add support for s35392a

Add support for S35392A RTC. The driver supports both U-Boot driver
models.

Signed-off-by: Nandor Han <nandor.han@ge.com>
Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
Cc: Heiko Schocher <hs@denx.de>

# f52bdf4b 14-Sep-2017 Jean-Jacques Hiblot <jjhiblot@ti.com>

lib: allow building lzo for the SPL

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 85d8bf57 03-Sep-2017 Marek Behún <kabel@kernel.org>

lib: Add CRC32-C

This is needed for BTRFS.

Signed-off-by: Marek Behun <marek.behun@nic.cz>

create mode 100644 lib/crc32c.c

# 7264f292 15-Aug-2017 York Sun <york.sun@nxp.com>

spl: fit: Eanble GZIP support for image decompression

Add Kconfig option SPL_GZIP and SPL_ZLIB to enable gunzip support for
SPL boot, eg. falcon boot compressed kernel image.

Signed-off-by: York Sun <york.sun@nxp.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6ef2f901 11-Aug-2017 Adam Ford <aford173@gmail.com>

Convert CONFIG_BCH to Kconfig

This converts the following to Kconfig:
CONFIG_BCH

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1a7ba1d 18-Aug-2017 Anatolij Gustschin <agust@denx.de>

Fix 'notes' typos

s/notes/nodes

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 96b9082c 03-Aug-2017 Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

rockchip: rk3188: rock: adjust for SPL/TPL split

With the changes to split SPL/TPL for the RK3368, I apparently missed
some needed adjustments to the RK3188 Kconfig and rock_defconfig.

This fixes build-issues for the rock board after applying the RK3368
enablement (and SPL/TPL) set that resulted from TPL_SERIAL_SUPPORT,
TPL_ROCKCHIP_BACK_TO_BROM and TPL_TINY_MEMSET being separate symbols
now.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d56b4b19 22-Jul-2017 Tom Rini <trini@konsulko.com>

configs: Migrate RBTREE, LZO, CMD_MTDPARTS, CMD_UBI and CMD_UBIFS

The above CONFIG options are in Kconfig, and now have correct depends and
inter-dependencies. Migrate these to configs/ from include/configs/. In the
case of CMD_UBIFS also change it to be a default y if CMD_UBI.

Signed-off-by: Tom Rini <trini@konsulko.com>

# aed998aa 17-May-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_LZMA to Kconfig

This converts the following to Kconfig:
CONFIG_LZMA

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

# b1a873df 26-Apr-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_CMD_AES et al to Kconfig

This converts the following to Kconfig:
CONFIG_CMD_AES
CONFIG_AES

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Add select AES to CMD_AES]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 173aafbf 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

cmd: Expose a Kconfig option to enable UBIFS commands

Create a new Kconfig entry to allow CMD_UBIFS selection from Kconfig and
add an hidden LZO option that can be selected by CMD_UBIFS.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>

# aa049152 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

mtd: ubi: Select RBTREE option from MTD_UBI Kconfig entry

Expose the RBTREE feature through Kconfig and select this option from the
MTD_UBI option.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>
[Rebased on master]
Signed-off-by: Jagan Teki <jagan@openedev.com>

# ab4458bd 02-Apr-2017 Simon Glass <sjg@chromium.org>

string: Provide a slimmed-down memset()

Most of the time the optimised memset() is what we want. For extreme
situations such as TPL it may be too large. For example on the 'rock'
board, using a simple loop saves a useful 48 bytes. With gcc 4.9 and
the rodata bug, this patch is enough to reduce the TPL image below the
limit.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>

# bea79d7d 14-Mar-2017 Andre Przywara <andre.przywara@arm.com>

Kconfig: introduce md5sum command selection

So far CONFIG_MD5SUM would need to be set by a board's include file.
Since the command is really generic, move it over to Kconfig to allow
it to be defined by either a board's defconfig, menuconfig or some
config snippet merged via mergeconfig.sh.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e663b350 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

smbios: Expose in efi_loader as table

We can pass SMBIOS easily as EFI configuration table to an EFI payload. This
patch adds enablement for that case.

While at it, we also enable SMBIOS generation for ARM systems, since they support
EFI_LOADER.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4b6dddc2 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

x86: Move smbios generation into arch independent directory

We will need the SMBIOS generation function on ARM as well going forward,
so let's move it into a non arch specific location.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# ebf7fff2 05-Oct-2016 Heiko Schocher <hs@denx.de>

spl: move FDT_FIXUP_PARTITIONS to Kconfig

Move FDT_FIXUP_PARTITIONS to Kconfig and cleanup existing
uses.

Signed-off-by: Heiko Schocher <hs@denx.de>

# ddf67f71 05-Jul-2016 Maxime Ripard <maxime.ripard@free-electrons.com>

libfdt: Add overlay application function

The device tree overlays are a good way to deal with user-modifyable
boards or boards with some kind of an expansion mechanism where we can
easily plug new board in (like the BBB, the Raspberry Pi or the CHIP).

Add a new function to merge overlays with a base device tree.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>

# 91b86e21 26-May-2016 Marek Vasut <marex@denx.de>

lib: Enable private libgcc by default

This patch decouples U-Boot binary from the toolchain on systems where
private libgcc is available. Instead of pulling in functions provided
by the libgcc from the toolchain, U-Boot will use it's own set of libgcc
functions. These functions are usually imported from Linux kernel, which
also uses it's own libgcc functions instead of the ones provided by the
toolchain.

This patch solves a rather common problem. The toolchain can usually
generate code for many variants of target architecture and often even
different endianness. The libgcc on the other hand is usually compiled
for one particular configuration and the functions provided by it may
or may not be suited for use in U-Boot. This can manifest in two ways,
either the U-Boot fails to compile altogether and linker will complain
or, in the much worse case, the resulting U-Boot will build, but will
misbehave in very subtle and hard to debug ways.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 67976306 30-Mar-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

cosmetic: Fix typos "privide"

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# ed980b8c 03-Mar-2016 Alexander Graf <agraf@csgraf.de>

efi_loader: hook up in build environment

Now that we have all the bits and pieces ready for EFI payload loading
support, hook them up in Makefiles and KConfigs so that we can build.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
[trini: Enable only when we of OF_LIBFDT, disable on kwb and colibri_pxa270]
Signed-off-by: Tom Rini <trini@konsulko.com>

# aa34fbc0 22-Feb-2016 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt to be used in SPL

Add an option to enable libfdt in SPL. This can be useful when decoding
FIT files in SPL.

We need to make sure this option is not enabled in SPL by this change.
Also this option needs to be enabled in host builds. Si add a new
IMAGE_USE_LIBFDT #define which can be used in files that are built on the
host but must also build for U-Boot and SPL.

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

# 69e173eb 22-Feb-2016 Simon Glass <sjg@chromium.org>

Move CONFIG_OF_LIBFDT to Kconfig

Move this option to Kconfig and tidy up existing boards.

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

# a187559e 05-Feb-2016 Bin Meng <bmeng.cn@gmail.com>

Use correct spelling of "U-Boot"

Correct spelling of "U-Boot" shall be used in all written text
(documentation, comments in source files etc.).

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Minkyu Kang <mk7.kang@samsung.com>

# 947c626d 14-Jan-2016 Tom Rini <trini@konsulko.com>

vsprintf.c: Always enable CONFIG_SYS_VSNPRINTF

Enabling this function always removes some class of string saftey issues.
The size change here in general is about 400 bytes and this seems a reasonable
trade-off.

Cc: Peng Fan <peng.fan@nxp.com>
Cc: Peter Robinson <pbrobinson@gmail.com>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Adrian Alonso <aalonso@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 7d9cde10 22-Nov-2015 Stefan Roese <sr@denx.de>

lib/tiny-printf.c: Add tiny printf function for space limited environments

This patch adds a small printf() version that supports all basic formats.
Its intented to be used in U-Boot SPL versions on platforms with very
limited internal RAM sizes.

To enable it, just define CONFIG_USE_TINY_PRINTF in your defconfig. This
will result in the SPL using this tiny function and the main U-Boot
still using the full-blown printf() function.

This code was copied from:
http://www.sparetimelabs.com/printfrevisited
With mostly only coding style related changes so that its checkpatch
clean.

The size reduction is about 2.5KiB. Here a comparison for the db-mv784mp-gp
(Marvell AXP) SPL:

Without this patch:
58963 18536 1928 79427 13643 ./spl/u-boot-spl

With this patch:
56542 18536 1956 77034 12cea ./spl/u-boot-spl

Note:
To make it possible to compile tiny-printf.c instead of vsprintf.c when
CONFIG_USE_TINY_PRINTF is defined, the functions printf() and vprintf() are
moved from common/console.c into vsprintf.c in this patch.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>

# 2419cd16 03-Oct-2015 Simon Glass <sjg@chromium.org>

dm: tpm: Drop CONFIG_DM_TPM

Now that all TPM drivers use driver model, we can drop the special driver
model CONFIG option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>

# 027b728d 06-Oct-2015 Julius Werner <jwerner@chromium.org>

Add support for LZ4 decompression algorithm

This patch adds support for LZ4-compressed FIT image contents. This
algorithm has a slightly worse compression ration than LZO while being
nearly twice as fast to decompress. When loading images from a fast
storage medium this usually results in a boot time win.

Sandbox-tested only since I don't have a U-Boot development system set
up right now. The code was imported unchanged from coreboot where it's
proven to work, though. I'm mostly interested in getting this recognized
by mkImage for use in a downstream project.

Signed-off-by: Julius Werner <jwerner@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# a7d660bc 22-Aug-2015 Simon Glass <sjg@chromium.org>

tpm: Add Kconfig options for TPMs

Add new Kconfig options for TPMs in preparation for moving boards to use
Kconfig for TPM configuration.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 867a6ac8 31-Jul-2015 Simon Glass <sjg@chromium.org>

efi: Add start-up library code

When running as an EFI application, U-Boot must request memory from EFI,
and provide access to the boot services U-Boot needs.

Add library code to perform these tasks. This includes efi_main() which is
the entry point from EFI. U-Boot is built as a shared library.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d1389403 23-Jun-2015 Simon Glass <sjg@chromium.org>

Add a dhrystone benchmark command

Drystone provides a convenient sanity check that the CPU is running at full
speed. Add this as a command which can be enabled as needed.

Note: I investigated using Coremark for this but there was a license
agreement and I could not work out if it was GPL-compatible.

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

# f7848d90 22-Jun-2015 Joe Hershberger <joe.hershberger@ni.com>

Allow CONFIG_REGEX to be disabled when CONFIG_NET

Instead of selecting REGEX when NET is enabled, make it the default, but
allow boards that are tiny to disable it and lose functionality on all
but the first Ethernet adapter.

cm-bf548, bf538f-ezkit, and bf533-stamp need this. None appear to have
more than one Ethernet interface.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# 3850dbe8 11-Jun-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

blackfin: fix undefined reference to srand and rand

Commit 9ba9e85f3f1c (net: Fix NET_RANDOM_ETHADDR dependencies)
accidentally dropped CONFIG_LIB_RAND defines for 14 Blackfin boards.

Prior to that commit, those boards defined CONFIG_LIB_RAND, but not
CONFIG_NET_RANDOM_ETHADDR. So, commit 9ba9e85f3f1c should not have
touched them, but in fact it ripped CONFIG_LIB_RAND off from all the
header files, which caused undefined reference to srand and rand.
CONFIG_LIB_RAND=y must be revived for such boards.

BTW, this commit indeed makes it better, but even with this fix,
three boards (bf533-stamp, bf538f-ezkit, cm-bf548) still can not
build due to region 'ram' overflowed error. This was cause by
commit 6eed3786c68c (net: Move the CMD_NET config to defconfigs)
because CMD_NET selects NET, and NET selects REGEX. Eventually,
some boards were newly enabled with CONFIG_REGEX, increasing the
memory footprint. A patch is expected to fix the build error.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 9ba9e85f 25-May-2015 Michal Simek <michal.simek@amd.com>

net: Fix NET_RANDOM_ETHADDR dependencies

NET_RANDOM_ETHADDR depends on lib/rand.c. This patch adds dependency to
Kconfig to ensure that library is also compiled.

Remove the definitions from Blackfin boards' include/configs.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 6501ff62 20-Apr-2015 Przemyslaw Marczak <p.marczak@samsung.com>

lib: Kconfig: add entry for errno_str() function

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1a60650c 21-Apr-2015 Joe Hershberger <joe.hershberger@ni.com>

kconfig: Move REGEX to Kconfig

Having this as a Kconfig allows it to be a dependent feature.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8156345d 06-Mar-2015 Simon Glass <sjg@chromium.org>

sandbox: Move CONFIG_SYS_VSNPRINTF to Kconfig

Move this over to Kconfig and tidy up.

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

# 94e3c8c4 19-Feb-2015 gaurav rana <gaurav.rana@freescale.com>

crypto/fsl - Add progressive hashing support using hardware acceleration.

Currently only normal hashing is supported using hardware acceleration.
Added support for progressive hashing using hardware.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
Signed-off-by: Gaurav Rana <gaurav.rana@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>

# d9f23c7f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

lib/rsa: Add Kconfig for devices supporting RSA Modular Exponentiation

Kconfig option added for devices which support RSA Verification.
1. RSA_SOFTWARE_EXP
Enables driver for supporting RSA Modular Exponentiation in Software
2. RSA_FREESCALE_EXP
Enables driver for supporting RSA Modular Exponentiation using Freescale specific
driver

The above drivers use RSA uclass

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
(Removed duplicate line in Kconfig comment)

Change-Id: I7663c4d5350e2bfc3dfa2696f70ef777d6ccc6f6

# c4beb22f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

FIT: Modify option FIT_SIGNATURE in Kconfig

For FIT signature based approach to work, RSA library needs to be selected.
The FIT_SIGNATURE option in Kconfig is modified to automatically select RSA.
Selecting RSA compiles the RSA library required for image verification.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 45ccec8f 23-Oct-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

kconfig: move CONFIG_USE_PRIVATE_LIBGCC to Kconfig

The private libgcc is supported only on ARM, MIPS, PowerPC, SH, x86.
Those architectures should "select" HAVE_PRIVATE_LIBGCC and
CONFIG_USE_PRIVATE_LIBGCC should depend on it.

Currently, this option is enabled on Tegra boards and x86 architecture.
Move the definition from header files to Kconfig.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Tested-by: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: Tom Warren <twarren@nvidia.com>

# 8c688bc4 23-Oct-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

kconfig: move CONFIG_SYS_HZ to lib/Kconfig

CONFIG_SYS_HZ is always defined as 1000 in config_fallbacks.h
(but some boards still have redundant definitions).

This commit moves the definition and the document in README to
Kconfig. Since lib/Kconfig can assure that CONFIG_SYS_HZ is 1000,
the sanity check in lib/time.c should be removed.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Reviewed-by: Marek Vasut <marex@denx.de>

# b0928da6 16-Sep-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

kconfig: move CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED to Kconfig

If this option is enabled, the objects under lib/ directory
are compiled with speed optimization, not size optimization.
(Currently, only used by some Blackfin boards.)

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# ed36323f 16-Sep-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

kconfig: add blank Kconfig files

This would be useful to start moving various config options.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# 2dc16a2c 19-Jan-2023 Sjoerd Simons <sjoerd@collabora.com>

Bump LMB_MAX_REGIONS default to 16

Since commit 06d514d77c37 ("lmb: consider EFI memory map") the EFI regions
are also pushed into the lmb if EFI_LOADER is enabled (which is by
default on most system). Which can cause the number of entries to go
over the maximum as it's default is only 8.

Specifically i ran into this case on an TI am62 which has an fdt with
4 reserved regions (in practice 3 lmb entries due to adjecent ranges).

As this is likely to impact more devices bump the default max
regions to 16 so there is a bit more slack.

Fixes: 06d514d77c ("lmb: consider EFI memory map")
Link: https://bugzilla.opensuse.org/show_bug.cgi?id=1207562
Reviewed-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Signed-off-by: Sjoerd Simons <sjoerd@collabora.com>
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
[trini: collect tags from the other equivalent patch]

# 948d3999 08-Feb-2023 Tom Rini <trini@konsulko.com>

Revert "lmb: Default to not-LMB_USE_MAX_REGIONS"

As explained by Philippe Schenker, I was misinterpreting what happened
in the case where we do not set LMB_USE_MAX_REGIONS and so had
re-introduced the problem I was attempting to more widely resolve.

This reverts commit 007ae5d108a37564905ea1588cb279f3a522cc3d.

Reported-by: Philippe Schenker <philippe.schenker@toradex.com>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 007ae5d1 25-Jan-2023 Tom Rini <trini@konsulko.com>

lmb: Default to not-LMB_USE_MAX_REGIONS

The LMB code allows for picking a hard limit on the number of regions it
can know of, or to dynamically allocate these regions. The reason for
this choice is to allow for the compiler to perform a size optimization
in the common case. This optimization however, is very small, ranging
from 196 bytes to 15 bytes saved, or in some cases, being larger. Now
that we also have more regions covered by LMB (in order to protect
various parts of our self at run time), the default of 8 is also much
easier to hit and leads to non-obvious error messages (which imply that
an area is protected, not that we're out of areas to add to the list).

Switch to the dynamic use as the default.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 53c47c59 19-Jan-2023 Tom Rini <trini@konsulko.com>

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


# 4b9b25d9 12-Jan-2023 Brandon Maier <brandon.maier@collins.com>

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

[1] https://github.com/torvalds/linux/commit/e0c1b49f5b674cca7b10549c53b3791d0bbc90a8
[2] https://github.com/facebook/zstd/blob/f302ad8811643c428c4e3498e28f53a0578020d3/lib/libzstd.mk#L31

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>

# ebc1d50a 21-Dec-2022 Simon Glass <sjg@chromium.org>

Revert "fdtdec: drop needlessly convoluted CONFIG_PHANDLE_CHECK_SEQ"

The fdt_path_offset() function is slow since it must scan the tree.
This substantial overhead now applies to all boards.

The original code may not be ideal but it is fit for purpose and is only
needed on a few boards.

Reverting this reduces time to set up driver model by about 30ms.

Before revert:

Accumulated time:
47,170 dm_r
53,237 dm_spl
572,986 dm_f

Accumulated time:
44,598 dm_r
50,347 dm_spl
549,133 dm_f

This reverts commit 26f981f295d00351b6f0c69b5317b254b2361cc0.

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

# 12619d4e 21-Dec-2022 Simon Glass <sjg@chromium.org>

trace: Don't require TIMER_EARLY

Some platforms cannot honour this and don't need trace before relocation.
Use 'imply' instead, so boards can disable this.

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

# 0c16fca9 07-Jan-2023 Simon Glass <sjg@chromium.org>

tpm: Add a proper Kconfig option for crc8 in SPL

The current approach is a bit of a hack and only works for the tpm
subsystem. Add a Kconfig so that crc8 can be enabled in SPL for other
purposes.

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

# 14f43797 19-Dec-2022 Tom Rini <trini@konsulko.com>

Merge tag 'v2023.01-rc4' into next

Prepare v2023.01-rc4

Signed-off-by: Tom Rini <trini@konsulko.com>


# ae3527f0 07-Dec-2022 Kautuk Consul <kconsul@ventanamicro.com>

arch/riscv: add semihosting support for RISC-V

We add RISC-V semihosting based serial console for JTAG based early
debugging.

The RISC-V semihosting specification is available at:
https://github.com/riscv/riscv-semihosting-spec/blob/main/riscv-semihosting-spec.adoc

Signed-off-by: Anup Patel <apatel@ventanamicro.com>
Signed-off-by: Kautuk Consul <kconsul@ventanamicro.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>

# 1c03ab9f 07-Dec-2022 Kautuk Consul <kconsul@ventanamicro.com>

lib: Add common semihosting library

We factor out the arch-independent parts of the ARM semihosting
implementation as a common library so that it can be shared
with RISC-V.

Signed-off-by: Kautuk Consul <kconsul@ventanamicro.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>

# 3b8dfc42 16-Nov-2022 Tom Rini <trini@konsulko.com>

Convert CONFIG_SYS_TIMER_COUNTS_DOWN to Kconfig

This converts the following to Kconfig:
CONFIG_SYS_TIMER_COUNTS_DOWN

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 86794052 21-Oct-2022 Sughosh Ganu <sughosh.ganu@linaro.org>

FWU: Add support for the FWU Multi Bank Update feature

The FWU Multi Bank Update feature supports updating firmware images
to one of multiple sets(also called banks) of images. The firmware
images are clubbed together in banks, with the system booting images
from the active bank. Information on the images such as which bank
they belong to is stored as part of the metadata structure, which is
stored on the same storage media as the firmware images on a dedicated
partition.

At the time of update, the metadata is read to identify the bank to
which the images need to be flashed(update bank). On a successful
update, the metadata is modified to set the updated bank as active
bank to subsequently boot from.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

# 40ed7be4 02-Aug-2022 Tom Rini <trini@konsulko.com>

Convert CONFIG_SYS_FDT_PAD to Kconfig

This converts the following to Kconfig:
CONFIG_SYS_FDT_PAD

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e67ffb5a 22-Jul-2022 Sughosh Ganu <sughosh.ganu@linaro.org>

tpm: rng: Add driver model interface for TPM RNG device

The TPM device has a builtin random number generator(RNG)
functionality. Expose the RNG functions of the TPM device to the
driver model so that they can be used by the EFI_RNG_PROTOCOL if the
protocol is installed.

Also change the function arguments and return type of the random
number functions to comply with the driver model api.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

# b340199f 10-Jun-2022 Tom Rini <trini@konsulko.com>

spl: Ensure all SPL symbols in Kconfig have some SPL dependency

Tighten up symbol dependencies in a number of places. Ensure that a SPL
specific option has at least a direct dependency on SPL. In places
where it's clear that we depend on something more specific, use that
dependency instead. This means in a very small number of places we can
drop redundant dependencies.

Reported-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 13ce351b 08-Jun-2022 Tom Rini <trini@konsulko.com>

vpl: Ensure all VPL symbols in Kconfig have some VPL dependency

Tighten up symbol dependencies in a number of places. Ensure that a VPL
specific option has at least a direct dependency on VPL. In places
where it's clear that we depend on something more specific, use that
dependency instead.

Reported-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 8bea4bf7 08-Jun-2022 Tom Rini <trini@konsulko.com>

tpl: Ensure all TPL symbols in Kconfig have some TPL dependency

Tighten up symbol dependencies in a number of places. Ensure that a TPL
specific option has at least a direct dependency on TPL. In places
where it's clear that we depend on something more specific, use that
dependency instead.

Reported-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 26f981f2 19-May-2022 Rasmus Villemoes <rasmus.villemoes@prevas.dk>

fdtdec: drop needlessly convoluted CONFIG_PHANDLE_CHECK_SEQ

Asking if the alias we found actually points at the device tree node
we passed in (in the guise of its offset from blob) can be done simply
by asking if the fdt_path_offset() of the alias' path is identical to
offset.

In fact, the current method suffers from the possibility of false
negatives: dtc does not necessarily emit a phandle property for a node
just because it is referenced in /aliases; it only emits a phandle
property for a node if it is referenced in <angle brackets>
somewhere. So if both the node we passed in and the alias node we're
considering don't have phandles, fdt_get_phandle() returns 0 for both.

Since the proper check is so simple, there's no reason to hide that
behind a config option (and if one really wanted that, it should be
called something else because there's no need to involve phandle in
the check).

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Acked-by: Aswath Govindraju <a-govindraju@ti.com>

# d30924f1 01-May-2022 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: fix selection of CONFIG_CHARSET

lib/charset.c is not optional for
EFI_APP || EFI_LOADER || UFS || UT_UNICODE.
These must select CONFIG_CHARSET.

Fixes: 726cd9836db0 ("efi: Make unicode printf available to the app")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>

# 747093dd 30-Apr-2022 Simon Glass <sjg@chromium.org>

vpl: Add Kconfig options for VPL

Add VPL versions of commonly used Kconfig options.

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

# 11232139 06-Apr-2022 Tom Rini <trini@konsulko.com>

nds32: Remove the architecture

As removal of nds32 has been ack'd for the Linux kernel, remove support
here as well.

Cc: Rick Chen <rick@andestech.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Rick Chen <rick@andestech.com>

# fd210fee 28-Mar-2022 Philippe Reynes <philippe.reynes@softathome.com>

lib: allow to build asn1 decoder and oid registry in SPL

This commit adds the options:
- SPL_ASN1_DECODER
- SPL_OID_REGISTRY

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>

# 7d44a985 28-Mar-2022 Philippe Reynes <philippe.reynes@softathome.com>

lib: Kconfig: enhance the help of OID_REGISTRY

Enhance the help for the config OID_REGISTRY.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>

# a0e71d96 28-Mar-2022 Philippe Reynes <philippe.reynes@softathome.com>

lib: Kconfig: enhance help for ASN1

Enhance the help for configs ASN1_COMPILER
and ASN1_decoder.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>

# 761a1786 27-Jan-2022 Tom Rini <trini@konsulko.com>

Merge tag 'dm-pull-26jan22' of https://source.denx.de/u-boot/custodians/u-boot-dm

acpi refactoring to allow non-x86 use
binman support for bintools (binary tools)
minor tools improvements in preparation for FDT signing
various minor fixes and improvements


# 334a9b9d 25-Nov-2021 Loic Poulain <loic.poulain@linaro.org>

lib/circbuf: Make circbuf selectable symbol

It is currenly only used from usbtty driver but make it properly
selectable via Kconfig symbol, for future usage.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>

# e1722fcb 01-Dec-2021 Simon Glass <sjg@chromium.org>

x86: Allow any arch to generate ACPI tables

These have sadly found their way to ARM now. Allow any arch to support
generating ACPI tables.

Disable this for the tools build.

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

# 7c3fd5c2 26-Dec-2021 Qu Wenruo <wqu@suse.com>

lib: add BLAKE2 hash support

The code is cross-ported from BLAKE2 reference implementation
(https://github.com/BLAKE2/BLAKE2).

With minimal change to remove unused macros/features.

Currently there is only one user inside U-boot (btrfs), and since it
only utilize BLAKE2B, all other favors are all removed.

Signed-off-by: Qu Wenruo <wqu@suse.com>
[trini: Rename ROUND to R to avoid clash with <linux/bitops.h>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 97f2a749 04-Jan-2022 Eugen Hristev <eugen.hristev@collabora.com>

lib: Kconfig: fix PHANDLE_CHECK_SEQ position outside of menu

CONFIG_PHANDLE_CHECK_SEQ is outside of the menu 'Library routines'
thus it's invisible in menuconfig and cannot be selected.
Fix this by moving the 'endmenu' after the PHANDLE_CHECK_SEQ definition

Fixes: c589132a1d ("fdt: Use phandle to distinguish DT nodes with same name")
Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
Reviewed-by: Aswath Govindraju <a-govindraju@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 726cd983 29-Dec-2021 Simon Glass <sjg@chromium.org>

efi: Make unicode printf available to the app

This is needed to show unicode strings. Enable this code in the app.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>

# 6405ab7a 24-Nov-2021 Simon Glass <sjg@chromium.org>

Convert CONFIG_PHYSMEM to Kconfig

This converts the following to Kconfig:
CONFIG_PHYSMEM

Signed-off-by: Simon Glass <sjg@chromium.org>
Suggested-by: Sean Anderson <seanga2@gmail.com>

# ac7606af 14-Nov-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

lmb: fix typo 'commun'

%s/commun/common/

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

# e7d285b2 25-Sep-2021 Simon Glass <sjg@chromium.org>

image: Use the correct checks for CRC32

Add a host Kconfig for CRC32. With this we can use CONFIG_IS_ENABLED(CRC32)
directly in the host build, so drop the unnecessary indirection.

Add a few more conditions to SPL_CRC32 to avoid build failures as well as
TPL_CRC32. Also update hash.c to make crc32 optional and to actually take
notice of SPL_CRC32.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# 2c21256b 25-Sep-2021 Simon Glass <sjg@chromium.org>

hash: Use Kconfig to enable hashing in host tools and SPL

At present when building host tools, we force CONFIG_SHAxxx to be enabled
regardless of the board Kconfig setting. This is done in the image.h
header file.

For SPL we currently just assume the algorithm is desired if U-Boot proper
enables it.

Clean this up by adding new Kconfig options to enable hashing on the host,
relying on CONFIG_IS_ENABLED() to deal with the different builds.

Add new SPL Kconfigs for hardware-accelerated hashing, to maintain the
current settings.

This allows us to drop the image.h code and the I_WANT_MD5 hack.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# 603d15a5 25-Sep-2021 Simon Glass <sjg@chromium.org>

spl: cypto: Bring back SPL_ versions of SHA

Unfortunately these were removed by mistake. This means that adding hash
support to SPL brings in all software algorithms, with a substantial
increase in code size.

The origin of the problem was renaming them to SPL_FIT_xxx and then these
were removed altogether in a later commit.

Add them back. This aligns with CONFIG_MD5, for example, which has an SPL
variant.

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: f5bc9c25f31 ("image: Rename SPL_SHAxxx_SUPPORT to SPL_FIT_SHAxxx")
Fixes: eb5171ddec9 ("common: Remove unused CONFIG_FIT_SHAxxx selectors")
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# 6674edaa 16-Sep-2021 Tom Rini <trini@konsulko.com>

Merge tag 'v2021.10-rc4' into next

Prepare v2021.10-rc4

Signed-off-by: Tom Rini <trini@konsulko.com>

# gpg: Signature made Tue 14 Sep 2021 06:58:32 PM EDT
# gpg: using RSA key 1A3C7F70E08FAB1707809BBF147C39FF9634B72C
# gpg: Good signature from "Thomas Rini <trini@konsulko.com>" [ultimate]

# Conflicts:
# board/Arcturus/ucp1020/spl.c
# cmd/mvebu/Kconfig
# common/Kconfig.boot
# common/image-fit.c
# configs/UCP1020_defconfig
# configs/sifive_unmatched_defconfig
# drivers/pci/Kconfig
# include/configs/UCP1020.h
# include/configs/sifive-unmatched.h
# lib/Makefile
# scripts/config_whitelist.txt


# 5145bc73 01-Sep-2021 Oleksandr Suvorov <oleksandr.suvorov@foundries.io>

lib: fix typos in Kconfig

There are trivial typos in the Kconfig file. Fixed them.
Also, fixed grammar in the descriptions with typos.

Fixes: d56b4b1974 ("configs: Migrate RBTREE, LZO, CMD_MTDPARTS, CMD_UBI and CMD_UBIFS")
Fixes: 7264f2928b ("spl: fit: Eanble GZIP support for image decompression")
Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# e60e4499 02-Sep-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

lib: Drop SHA512_ALGO in lieu of SHA512

SHA512_ALGO was used as a "either SHA512 or SHA384", although the
implementations of these two algorithms share a majority of code.

From a Kconfig interface perspective, it makes sense to present two
distinct options. This requires #ifdefing out the SHA512
implementation from sha512.c. The latter doesn't make any sense.

It's reasonable to say in Kconfig that SHA384 depends on SHA512, and
seems to be the more polite way to handle the selection.

Thus, automatically select SHA512 when SHA384 is enabled.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# b4c2c151 27-Aug-2021 Michal Simek <michal.simek@amd.com>

Kconfig: Remove all default n/no options

default n/no doesn't need to be specified. It is default option anyway.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
[trini: Rework FSP_USE_UPD portion]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 928a8be7 29-Jul-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

lib: ecdsa: Implement UCLASS_ECDSA verification on target

Implement the crypto_algo .verify() function for ecdsa256. Because
it backends on UCLASS_ECDSA, this change is focused on parsing the
keys from devicetree and passing this information to the specific
UCLASS driver.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# fa3f1f1d 24-Jul-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: disable CONFIG_SPL_HEXDUMP by default

CONFIG_HEXDUMP is needed to display UEFI variables using 'printenv -e'.

Enabling CONFIG_SPL_HEXDUMP only makes sense for debugging purposes.
Hence CONFIG_SPL_HEXDUMP should not be enabled by default.

The following boards currently have CONFIG_SPL_HEXDUMP=y. This includes
boards that don't use SPL at all.

axm_defconfig
imx8mm-cl-iot-gate_defconfig
imx8mm_venice_defconfig
imxrt1020-evk_defconfig
imxrt1050-evk_defconfig
kontron_sl28_defconfig
kp_imx53_defconfig
lx2160ardb_tfa_stmm_defconfig
mt7622_rfb_defconfig
octeon_ebb7304_defconfig
octeon_nic23_defconfig
qemu_arm64_defconfig
qemu_arm_defconfig
qemu-riscv32_defconfig
qemu-riscv32_smode_defconfig
qemu-riscv64_defconfig
qemu-riscv64_smode_defconfig
qemu-x86_64_defconfig
qemu-x86_defconfig
sandbox64_defconfig
sandbox_defconfig
stm32mp15_basic_defconfig
stm32mp15_trusted_defconfig
synquacer_developerbox_defconfig
taurus_defconfig
xilinx_versal_virt_defconfig

The patch only keeps it enabled on

sandbox_spl_defconfig

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 1a46cb6c 02-Jul-2021 Simon Glass <sjg@chromium.org>

lib: Create a new Kconfig option for charset conversion

Rather than looking at two KConfig options in the Makefile, create a new
Kconfig option for compiling lib/charset.c

Enable it for UFS also, which needs this support.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 26dd9936 08-Jul-2021 Steffen Jaeckel <jaeckel-floss@eyet-services.de>

lib: add crypt subsystem

Add the basic functionality required to support the standard crypt
format.
The files crypt-sha256.c and crypt-sha512.c originate from libxcrypt and
their formatting is therefor retained.
The integration is done via a crypt_compare() function in crypt.c.

```
libxcrypt $ git describe --long --always --all
tags/v4.4.17-0-g6b110bc
```

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 7d0f3fbb 11-Jun-2021 Tero Kristo <t-kristo@ti.com>

lib: rational: copy the rational fraction lib routines from Linux

Copy the best rational approximation calculation routines from Linux.
Typical usecase for these routines is to calculate the M/N divider
values for PLLs to reach a specific clock rate.

This is based on linux kernel commit:
"lib/math/rational.c: fix possible incorrect result from rational
fractions helper"
(sha1: 323dd2c3ed0641f49e89b4e420f9eef5d3d5a881)

Signed-off-by: Tero Kristo <t-kristo@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Tero Kristo <kristo@kernel.org>

# ec0512b1 24-May-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

Revert "lib: introduce HASH_CALCULATE option"

When we think of Kconfig, we usually think of features that we like
to enable or not. Ideally, we wouldn't use Kconfig to fix a build
issue, although sometimes it might make sense. With Kconfig it's hard
to guarantee that the fix is universal. We can only say that it works
for the set of tested configurations. In the majority of cases, it's
preferable to let the linker figure things out for us.

The reverted commit attempted to fix a build issue by adding an
invisible Kconfig option. This is wrong in several ways:

It invents a new Kconfig variable when CONFIG_HASH already
exists for the same purpose.
Second, hash-checksum.c makes use of the hash_progressive_lookup_algo()
symbol, which is only provided with CONFIG_HASH, but this dependency
was not expressed in the reverted patch.

It feels like Kconfig is turning into a listing of all available
source files, and a buffet to 'select' which ones to compile. The
purpose of this revert is to enable the next change to make use of
CONFIG_HASH instead of adding to Kconfig.

This reverts commit 87316da05f2fd49d3709275e64ef0c5980366ade.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Acked-by: Masahisa Kojima <masahisa.kojima@linaro.org>

# 1621d3c4 10-May-2021 Bin Meng <bmeng.cn@gmail.com>

lib: kconfig: Limit BINMAN_FDT for OF_SEPARATE or OF_EMBED

Generally speaking BINMAN_FDT makes sense for OF_SEPARATE or OF_EMBED.
For the other OF_CONTROL methods, it's quite possible binman node is
not available as binman is invoked during the build phase instead of
runtime. Let's only turn it on for OF_SEPARATE or OF_EMBED by default.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 87316da0 13-May-2021 Masahisa Kojima <masahisa.kojima@linaro.org>

lib: introduce HASH_CALCULATE option

Build error occurs when CONFIG_EFI_SECURE_BOOT or
CONFIG_EFI_CAPSULE_AUTHENTICATE is enabled,
because hash-checksum.c is not compiled.

Since hash_calculate() implemented in hash-checksum.c can be
commonly used aside from FIT image signature verification,
this commit itroduces HASH_CALCULATE option to decide
if hash-checksum.c shall be compiled.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# e2ae483c 13-May-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

hash: Kconfig option for SHA512 hardware acceleration

Commit a479f103dc1c ("hash: Allow for SHA512 hardware implementations")
defined function definitions for hardware accelerated SHA384 and SHA512.
If CONFIG_SHA_HW_ACCEL=y, these functions are used.

We already have boards using CONFIG_SHA_HW_ACCEL=y but none implements the
new functions hw_sha384() and hw_sha512().

For implementing the EFI TCG2 protocol we need SHA384 and SHA512. The
missing hardware acceleration functions lead to build errors on boards like
peach-pi_defconfig.

Introduce a new Kconfig symbol CONFIG_SHA512_HW_ACCEL to control if the
functions hw_sha384() and hw_sha512() shall be used to implement the SHA384
and SHA512 algorithms.

Fixes: a479f103dc1c ("hash: Allow for SHA512 hardware implementations")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

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

# 6d66502b 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: Add 2 config to define the max number of regions

Add 2 configs CONFIG_LMB_MEMORY_REGIONS and CONFIG_LMB_RESERVED_REGIONS
to change independently the max number of the regions in lmb
library.

When CONFIG_LMB_USE_MAX_REGIONS=y, move the lmb property arrays to
struct lmb and manage the array size with the element 'max' of struct
lmb_region; their are still allocated in stack.

When CONFIG_LMB_USE_MAX_REGIONS=n, keep the current location in
struct lmb_region to allow compiler optimization.

Increase CONFIG_LMB_RESERVED_REGIONS is useful to avoid lmb errors in
bootm when the number of reserved regions (not adjacent) is reached:
+ 1 region for relocated U-Boot
+ 1 region for initrd
+ 1 region for relocated linux device tree
+ reserved memory regions present in Linux device tree.

The current limit of 8 regions is reached with only 5 reserved regions
in DT.

see Linux kernel commit bf23c51f1f49 ("memblock: Move memblock arrays
to static storage in memblock.c and make their size a variable")

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# 4fa0150d 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: move MAX_LMB_REGIONS value in Kconfig

Move MAX_LMB_REGIONS value in Kconfig, the max number of the regions
in lmb library.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# 77b8cfef 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: move CONFIG_LMB in Kconfig

Migrate CONFIG_LMB in Kconfig.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# a479f103 16-Feb-2021 Joel Stanley <joel@jms.id.au>

hash: Allow for SHA512 hardware implementations

Similar to support for SHA1 and SHA256, allow the use of hardware hashing
engine by enabling the algorithm and setting CONFIG_SHA_HW_ACCEL /
CONFIG_SHA_PROG_HW_ACCEL.

Signed-off-by: Joel Stanley <joel@jms.id.au>

# f2c1442e 14-Mar-2021 Simon Glass <sjg@chromium.org>

bloblist: Make BLOBLIST_TABLES depend on BLOBLIST

Add an extra condition here since we cannot put x86 tables in a bloblist
when bloblists are not supported.

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

# e0103158 25-Feb-2021 Bin Meng <bmeng.cn@gmail.com>

lib: kconfig: Mention CONFIG_ADDR_MAP limitation in the help

Mention that CONFIG_ADDR_MAP only works in the post-relocation phase.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>

# 56e7257c 03-Feb-2021 Bin Meng <bmeng.cn@gmail.com>

lib: Fix BINMAN_FDT dependency

lib/binman.c references the following 3 ofnode APIs:
ofnode_first_subnode(), ofnode_path() and ofnode_read_bool().

These APIs get built only when DM is on. Fix the dependency then.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 59e4e391 18-Jan-2021 Tom Rini <trini@konsulko.com>

Merge https://gitlab.denx.de/u-boot/custodians/u-boot-riscv

- Update qemu-riscv.rst build instructions.
- Add support for SPI on Kendryte K210.
- Add Microchip PolarFire SoC Icicle Kit support.
- Add support for an early timer.
- Select TIMER_EARLY to avoid infinite recursion for Trace.


# a80f8513 17-Jan-2021 Pragnesh Patel <pragnesh.patel@sifive.com>

trace: select TIMER_EARLY to avoid infinite recursion

When tracing functions is enabled this adds calls to
__cyg_profile_func_enter() and __cyg_profile_func_exit() to the traced
functions.

__cyg_profile_func_enter() and __cyg_profile_func_exit() invoke
timer_get_us() to record the entry and exit time.

initr_dm() will make gd->dm_root = NULL and gd->timer = NULL, so
timer_get_us() -> get_ticks() -> dm_timer_init() will lead to an
indefinite recursion.

So select TIMER_EARLY when tracing got enabled.

Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Rick Chen <rick@andestech.com>

# 6205bbb1 04-Jan-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lib: cosmetic update of CONFIG_LIB_ELF description

Change 2 typo error in CONFIG_LIB_ELF description:
- Supoort => Support
- fir => for

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c589132a 02-Dec-2020 Aswath Govindraju <a-govindraju@ti.com>

fdt: Use phandle to distinguish DT nodes with same name

While assigning the sequence number to subsystem instances by reading the
aliases property, only DT nodes names are compared and not the complete
path. This causes a problem when there are two DT nodes with same name but
have different paths.

In arch/arm/dts/k3-am65-main.dtsi there are two USB controllers with the
same device tree node name but different path. When aliases are defined for
these USB controllers then fdtdec_get_alias_seq() fails to pick the correct
instance for a given index.

fdt_path_offset() function is slow and this would effect the U-Boot
startup. To avert the time penalty on all boards, apply this extra check
only when required by using a config option.

Fix it by comparing the phandles of DT nodes after the node names match,
under a config option.

Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Fix whitespace error in Kconfig:
Signed-off-by: Simon Glass <sjg@chromium.org>

# 28cef9ca 19-Nov-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

fs: fat: create correct short names

The current function set_name() used to create short names has the
following deficiencies resolved by this patch:

* Long names (e.g. FOO.TXT) are stored even if a short name is enough.
* Short names with spaces are created, e.g. "A ~1.TXT".
* Short names with illegal characters are created, e.g. "FOO++BAR".
* Debug output does not not consider that the short file name has no
concluding '\0'.

The solution for the following bug is split of into a separate patch:

* Short file names must be unique.

This patch only provides the loop over possible short file names.

Fixes: c30a15e590c ("FAT: Add FAT write feature")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# e4f8e543 05-Nov-2020 Simon Glass <sjg@chromium.org>

smbios: Drop the unused Kconfig options

Now that we can use devicetree to specify this information, drop the old
CONFIG options.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 44c74bdd 05-Nov-2020 Simon Glass <sjg@chromium.org>

sysinfo: Provide a default driver to set SMBIOS values

Some boards want to specify the manufacturer or product name but do not
need to have their own sysinfo driver.

Add a default driver which provides a way to specify this SMBIOS
information in the devicetree, without needing any board-specific
functionality.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d2cb7a22 04-Nov-2020 Simon Glass <sjg@chromium.org>

x86: Allow putting some tables in the bloblist

At present all tables are placed starting at address f0000 in memory, and
can be up to 64KB in size. If the tables are very large, this may not
provide enough space.

Also if the tables point to other tables (such as console log or a ramoops
area) then we must allocate other memory anyway.

The bloblist is a nice place to put these tables since it is contiguous,
which makes it easy to reserve this memory for linux using the 820 tables.

Add an option to put some of the tables in the bloblist. For SMBIOS and
ACPI, create suitable pointers from the f0000 region to the new location
of the tables.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
[bmeng: squashed in http://patchwork.ozlabs.org/project/uboot/patch/
20201105062407.1.I8091ad931cbbb5e3b6f6ababdf3f8d5db0d17bb9@changeid/]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# 415eab06 03-Nov-2020 Christian Gmeiner <christian.gmeiner@gmail.com>

smbios: add parsing API

Add a very simple API to be able to access SMBIOS strings
like vendor, model and bios version.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 72eda507 27-Oct-2020 Sean Anderson <seanga2@gmail.com>

lib: Add getopt

Some commands can get very unweildy if they have too many positional
arguments. Adding options makes them easier to read, remember, and
understand.

This implementation of getopt has been taken from barebox, which has had
option support for quite a while. I have made a few modifications to their
version, such as the removal of opterr in favor of a separate getopt_silent
function. In addition, I have moved all global variables into struct
getopt_context.

The getopt from barebox also re-orders the arguments passed to it so that
non-options are placed last. This allows users to specify options anywhere.
For example, `ls -l foo/ -R` would be re-ordered to `ls -l -R foo/` as
getopt parsed the options. However, this feature conflicts with the const
argv in cmd_tbl->cmd. This was originally added in 54841ab50c ("Make sure
that argv[] argument pointers are not modified."). The reason stated in
that commit is that hush requires argv to stay unmodified. Has this
situation changed? Barebox also uses hush, and does not have this problem.
Perhaps we could use their fix?

I have assigned maintenance of getopt to Simon Glass, as it is currently
only used by the log command. I would also be fine maintaining it.

Signed-off-by: Sean Anderson <seanga2@gmail.com>

# 26637e2e 12-Sep-2020 Simon Glass <sjg@chromium.org>

lib: Allow hexdump to be used in SPL

It is sometimes useful to output hex dumps in SPL. Add a config option to
allow this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# e87dfb05 05-Aug-2020 Andrii Anisov <andrii_anisov@epam.com>

lib: sscanf: add sscanf implementation

Port sscanf implementation from mini-os and introduce new
Kconfig option to enable it: CONFIG_SSCANF. Disable by default.

Signed-off-by: Andrii Anisov <andrii_anisov@epam.com>
Signed-off-by: Anastasiia Lukianenko <anastasiia_lukianenko@epam.com>
Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>

# 81014f73 30-Jul-2020 Joao Marcos Costa <joaomarcos.costa@bootlin.com>

include/u-boot, lib/zlib: add sources for zlib decompression

Add zlib (v1.2.11) uncompr() function to U-Boot. SquashFS depends on
this function to decompress data from a raw disk image. The actual
support for zlib into SquashFS sources will be added in a follow-up
commit.

Signed-off-by: Joao Marcos Costa <joaomarcos.costa@bootlin.com>

# 69be8fd1 03-Jun-2020 Marek Szyprowski <m.szyprowski@samsung.com>

powerpc: move ADDR_MAP to Kconfig

Move ADDR_MAP related config options from include/configs/*.h to the
proper place in lib/Kconfig. This has been done using
./tools/moveconfig.py and manual inspection of the generated changes.
This is a preparation to use ADDR_MAP helper on ARM 32bit Raspberry Pi4
board for mapping the PCIe XHCI MMIO, which is above the 4GiB identity
mapping limit.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# d16b38f4 15-Apr-2020 Reuben Dowle <reubendowle0@gmail.com>

Add support for SHA384 and SHA512

The current recommendation for best security practice from the US government
is to use SHA384 for TOP SECRET [1].

This patch adds support for SHA384 and SHA512 in the hash command, and also
allows FIT images to be hashed with these algorithms, and signed with
sha384,rsaXXXX and sha512,rsaXXXX

The SHA implementation is adapted from the linux kernel implementation.

[1] Commercial National Security Algorithm Suite
http://www.iad.gov/iad/programs/iad-initiatives/cnsa-suite.cfm

Signed-off-by: Reuben Dowle <reuben.dowle@4rf.com>

# 43e442a5 26-May-2020 Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

kconfig: fix some typos

Signed-off-by: Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

# eff5a547 22-May-2020 Michael Walle <michael@walle.cc>

cmd: zip: automatically pull in gzip()

Move the CONFIG_GZIP_COMPRESSED from a config.h macro to a Kconfig menu
item. It is not selectable by a user because there is no reason to do
so. Instead it will be automatically selected by the stuff which uses
gzip(), like the zip command.

Remove it from the config_whitelist.txt. Also remove
CONFIG_GZIP_COMPRESS_DEF_SZ as this was never used on any board. The
default seems to be sane, otherwise it should be added as a Kconfig
option.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8239be61 06-May-2020 Simon Glass <sjg@chromium.org>

lib: Allow MD5 to be enabled in SPL

At present the MD5 option cannot be enabled by board configs since it has
no Kconfig name. It is generally enabled, so long as FIT support is
present. But not all boards use FIT, particularly in SPL

Fix this and add an option for SPL as well. This allows board code to call
md5() even if FIT support is not enabled.

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

# 04cb3994 21-Apr-2020 Weijie Gao <weijie.gao@mediatek.com>

lib: enable lzma decompression support for SPL build

This patch enables LZMA decompression support for SPL build

Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>

# 2a2119e1 05-Mar-2020 Atish Patra <atishp@atishpatra.org>

lib: kconfig: Add option to set BZIP2 compression method

There is no way to select BZIP2 compression method.
Add it under library/compression config where all other
compression related configs are present.

Signed-off-by: Atish Patra <atish.patra@wdc.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 805b3cac 12-Feb-2020 Keerthy <j-keerthy@ti.com>

lib: elf: Move the generic elf loading/validating functions to lib

Move the generic elf loading/validating functions to lib/
so that they can be re-used and accessed by code existing
outside cmd.

While at it remove the duplicate static version of load_elf_image_phdr
under arch/arm/mach-imx/imx_bootaux.c.

Signed-off-by: Keerthy <j-keerthy@ti.com>
Suggested-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>

# 1611235b 19-Jan-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: Kconfig dependencies for pseudo-random library

drivers/rng/sandbox_rng.c requires rand() to be defined but configuration
option CONFIG_CONFIG_LIB_RAND selected in drivers/rng/Kconfig does not
exist.

test/lib/test_aes.c requires rand() to be defined.

Fix the selection criteria for choice "Pseudo-random library support type".

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 3c10dc95 06-Dec-2019 Simon Glass <sjg@chromium.org>

binman: Add a library to access binman entries

SPL and TPL can access information about binman entries using link-time
symbols but this is not available in U-Boot proper. Of course it could be
made available, but the intention is to just read the device tree.

Add support for this, so that U-Boot can locate entries.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# b4adf627 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: crypto: add x509 parser

Imported from linux kernel v5.3:
x509.asn1 without changes
x509_akid.asn1 without changes
x509_parser.h without changes
x509_cert_parser.c with changes marked as __UBOOT__
x509_public_key.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# a9b45e6e 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add oid registry utility

Imported from linux kernel v5.3:
build_OID_registry without changes
oid_registry.h without changes
oid_registry.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# ab8a0e06 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add asn1 decoder

Imported from linux kernel v5.3:
lib/asn1_decoder.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 2b12196d 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

cmd: add asn1_compiler

Imported from linux kernel v5.3:
asn1.h without changes
asn1_ber_bytecode.h without changes
asn1_decoder.h without changes
asn1_compiler.c without changes

This host command will be used to create a ASN1 parser, for example,
for pkcs7 messages or x509 certificates. More specifically, it will
generate *byte code* which will be interpreted by asn1 decoder library.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 05429b6c 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

rtc: move date.c from drivers/rtc/ to lib/

In the next commit, rtc_mktime(), for compatibility with linux, will be
implemented using rtc_mktime(), which is no longer drivers/rtc specific.
So move this file under lib/.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 37ef1774 10-Nov-2019 Thomas Hebb <tommyhebb@gmail.com>

Kconfig: disambiguate config names for tiny printf

27084c03d36a ("spl: Allow tiny printf() to be controlled in SPL and
TPL") split this option in two for TPL and SPL, but didn't change the
Kconfig names, making them hard to set quickly.

Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>

# 0d76afc0 27-Oct-2019 Simon Glass <sjg@chromium.org>

fdt: Add Kconfig options to control code size

For better or worse libfdt recent grew a lot of code that checks the
validity of the device tree in great detail. When using unsigned or
unverified data this makes things safer, but it does add to code size.

Add some controls to select the trade-off between safety and code size.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 27084c03 25-Sep-2019 Simon Glass <sjg@chromium.org>

spl: Allow tiny printf() to be controlled in SPL and TPL

At present there is only one control for this and it is used for both SPL
and TPL. But SPL might have a lot more space than TPL so the extra cost of
a full printf() might be acceptable.

Split the option into two, providing separate SPL and TPL controls. The
TPL setting defaults to the same as SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2a51e16b 07-Jun-2019 Tom Rini <trini@konsulko.com>

configs: Make USE_TINY_PRINTF depend on SPL||TPL and be default

The USE_TINY_PRINTF symbol only changes things within SPL and TPL
builds, so make it depend on that support. Next, make it default as
within these cases we should rarely have need of more advanced print
formats outside of the debug context.

To do this, in a few cases we need to correct our Kconfig dependencies
as we had cases of non-SPL targets select'ing this symbol. Finally, in
the case of a few boards we really do need the full printf
functionality.

Signed-off-by: Tom Rini <trini@konsulko.com>

# da0fb5fd 02-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: make call depth limit customizable

Up to now we had hard coded values for the call depth up to which trace
records are created: 200 for early tracing, 15 thereafter. UEFI
applications reach a call depth of 80 or above.

Provide customizing settings for the call trace depth limit and the early
call trace depth limit. Use the old values as defaults.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8509f22a 29-Apr-2019 Marek Behún <kabel@kernel.org>

lib: add Zstandard decompression support

Add the zstd library from Linux kernel (only decompression support).
There are minimal changes to build with U-Boot, otherwise the files are
identical to Linux commit dc35da16 from March 2018, the files had not
been touched since in kernel. Also SPDX lincese tags were added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 83a486b6 29-Apr-2019 Marek Behún <kabel@kernel.org>

lib: Add xxhash support

This adds the xxhash support from Linux. Files are almost identical to
those added to Linux in commit 5d240522 ("lib: Add xxhash module") (they
haven't been touched since in Linux). The only difference is to add some
includes to be compatible with U-Boot. Also SPDX lincese tags were
added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 5132361a 29-Apr-2019 Heiko Schocher <hs@denx.de>

lib: Kconfig: fix help text for GZIP

commit 95f4bbd581cf ("lib: fdt: Allow LZO and GZIP DT compression in U-Boot")

introduced Kconfig option for gzip in U-Boot, but help text
says gzip for SPL, which is wrong. Fix this.

Signed-off-by: Heiko Schocher <hs@denx.de>
Acked-by: Marek Vasut <marex@denx.de>

# 1c6eb075 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE_BUFFER_SIZE et al to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE_BUFFER_SIZE
CONFIG_TRACE_EARLY_SIZE
CONFIG_TRACE_EARLY
CONFIG_TRACE_EARLY_ADDR

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

# a24a78d7 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE

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

# 54969b40 21-Mar-2019 Thierry Reding <treding@nvidia.com>

fdtdec: Add Kconfig symbol for tests

Runtime tests are provided as a test_fdtdec command implementation. Add
a Kconfig symbol that allows this command to be built so that the tests
can be used.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 95f4bbd5 08-Mar-2019 Marek Vasut <marex@denx.de>

lib: fdt: Allow LZO and GZIP DT compression in U-Boot

Add required Kconfig symbols, Makefile bits and macro fixes in a
few places to support LZO and DT compression in U-Boot. This can
save a lot of space with multi-DTB fitImages.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>

# 6e705114 13-Jan-2019 Chris Packham <judge.packham@gmail.com>

lib: Kconfig: spelling fixes

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 048c6e89 06-Nov-2018 Simon Glass <sjg@chromium.org>

spl: lz4: Allow use of lz4 compression in SPL

In some cases U-Boot is compressed and it is useful to be able to
decompress it in SPL. Add a Kconfig and Makefile change to allow this.
Note that this does not actually implement decompression.

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

# 2895c4b7 15-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

kconfig: Introduce HAVE_ARCH_IOMAP

Introduce a new Kconfig option for architecture codes to control
whether it provides io{read,write}{8,16,32} I/O accessor functions.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5592a633 01-Oct-2018 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt in TPL

In some cases (e.g. sandbox with verified boot) it is useful to support
libfdt in TPL. Update the Kconfig to handle this.

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

# 6307896c 01-Oct-2018 Simon Glass <sjg@chromium.org>

tpm: Add support for SPL and TPL

At present the tpm can only be used in U-Boot proper. Updated it to work
in SPL and TPL also.

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

# ab948cd2 19-Jul-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

fdt_support: make FDT_FIXUP_PARTITIONS depend on CMD_MTDPARTS

fdt_fixup_mtdparts() calls mtdparts_init() and device_find(),
which are defined in cmd/mtdparts.c

The combination of FDT_FIXUP_PARTITIONS=y and CMD_MTDPARTS=n
emits the following link error:

common/fdt_support.c:903: undefined reference to `mtdparts_init'
common/fdt_support.c:914: undefined reference to `device_find'

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 3330584d 03-Jun-2018 Igor Opaniuk <igor.opaniuk@gmail.com>

avb2.0: integrate avb 2.0 into the build system

Integrate libavb into the build system. Introduce CONFIG_LIBAVB
build option.

Signed-off-by: Igor Opaniuk <igor.opaniuk@linaro.org>

# f8c987f8 05-Jun-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

lib: Add hexdump

Often during debugging session it's very interesting to see
what data we were dealing with. For example what we write or read
to/from memory or peripherals.

This change introduces functions that allow to dump binary
data with one simple function invocation like:
------------------->8----------------
print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, buf, len);
------------------->8----------------

which gives us the following:
------------------->8----------------
00000000: f2 b7 c9 88 62 61 75 64 72 61 74 65 3d 31 31 35 ....baudrate=115
00000010: 32 30 30 00 62 6f 6f 74 61 72 67 73 3d 63 6f 6e 200.bootargs=con
00000020: 73 6f 6c 65 3d 74 74 79 53 33 2c 31 31 35 32 30 sole=ttyS3,11520
00000030: 30 6e 38 00 62 6f 6f 74 64 65 6c 61 79 3d 33 00 0n8.bootdelay=3.
00000040: 62 6f 6f 74 66 69 6c 65 3d 75 49 6d 61 67 65 00 bootfile=uImage.
00000050: 66 64 74 63 6f 6e 74 72 6f 6c 61 64 64 72 3d 39 fdtcontroladdr=9
00000060: 66 66 62 31 62 61 30 00 6c 6f 61 64 61 64 64 72 ffb1ba0.loadaddr
00000070: 3d 30 78 38 32 30 30 30 30 30 30 00 73 74 64 65 =0x82000000.stde
00000080: 72 72 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 rr=serial0@e0022
00000090: 30 30 30 00 73 74 64 69 6e 3d 73 65 72 69 61 6c 000.stdin=serial
000000a0: 30 40 65 30 30 32 32 30 30 30 00 73 74 64 6f 75 0@e0022000.stdou
000000b0: 74 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 30 t=serial0@e00220
000000c0: 30 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00..............
...
------------------->8----------------

Source of hexdump.c was copied from Linux kernel v4.7-rc2.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Mario Six <mario.six@gdsys.cc>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Stefan Roese <sr@denx.de>

# c232d14d 29-May-2018 Alex Kiernan <alex.kiernan@gmail.com>

mmc: Separate "mmc swrite" from fastboot

Introduce CONFIG_IMAGE_SPARSE and CONFIG_CMD_MMC_SWRITE so the "mmc
swrite" command is separated from the fastboot code.

Move image-sparse from common to lib so it's clear it's library code.

Rename CONFIG_FASTBOOT_FLASH_FILLBUF_SIZE to CONFIG_IMAGE_SPARSE_FILLBUF_SIZE
and migrate it to Kconfig.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Acked-by: Jassi Brar <jaswinder.singh@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6417572e 08-May-2018 Tom Rini <trini@konsulko.com>

lib/Kconfig: Mark OF_LIBFDT_OVERLAY as depending on OF_LIBFDT

The overlay code is only useful when OF_LIBFDT is set, so mark it as
depending on that first.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 58a46f88 25-Apr-2018 Praneeth Bajjuri <praneeth@ti.com>

configs: TI: Enable FIT Library overlay support

Enable the FDT library overlay support for all TI SOC family.

Without this option, when Loading fdt from FIT image, the
following warning is seen.

"config with overlays but CONFIG_OF_LIBFDT_OVERLAY not set".

Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
Suggested-by: Andrew F.Davis <afd@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>

# 14ad44ab 18-Apr-2018 Alex Kiernan <alex.kiernan@gmail.com>

spl: Split sprintf, strto* from SPL serial in Kconfig

When SPL serial is disabled, callers who need sprintf or strtoul fail
because their inclusion is guarded by CONFIG_SPL_SERIAL_SUPPORT/
CONFIG_TPL_SERIAL_SUPPORT.

Split printf, sprintf and strto into their own entries and then select
all of them if SERIAL_SUPPORT is enabled to match the current behaviour.

Include panic.o unconditionally as it can be called from anywhere which
uses BUG_ON().

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>

# e294ba06 04-Apr-2018 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-sunxi

Signed-off-by: Tom Rini <trini@konsulko.com>


# d14db11d 03-Apr-2018 Andre Przywara <andre.przywara@arm.com>

sunxi: revert disabling of features

In January some commits were introduced to mitigate the U-Boot image
size issues we encountered on sunxi builds.
Now with the MMC environment removed we can bring them back, as we
practically don't have a size limit anymore.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 32ce6179 13-Mar-2018 Bryan O'Donoghue <bryan.odonoghue@linaro.org>

optee: Add lib entries for sharing OPTEE code across ports

This patch adds code to lib to enable sharing of useful OPTEE code between
board-ports and architectures. The code on lib/optee/optee.c comes from the
TI omap2 port. Eventually the OMAP2 code will be patched to include the
shared code. The intention here is to add more useful OPTEE specific code
as more functionality gets added.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Cc: Harinarayan Bhatta <harinarayan@ti.com>
Cc: Andrew F. Davis <afd@ti.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Kever Yang <kever.yang@rock-chips.com>
Cc: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Cc: Peng Fan <peng.fan@nxp.com>
Tested-by: Peng Fan <peng.fan@nxp.com>

# 36c1877c 06-Feb-2018 Faiz Abbas <faiz_abbas@ti.com>

lib: Kconfig: Move DYNAMIC_CRC_TABLE to Kconfig

Add CONFIG prefix to DYNAMIC_CRC_TABLE and implement it in
Kconfig.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>

# a451bc27 05-Feb-2018 Adam Ford <aford173@gmail.com>

Convert LIB_UUID to Kconfig

config_fallback.h has some logic that checks a variety of options
and selects LIB_UUID if it hasn't already been selected. This
will all LIB_UUID in Kconfig and select this option for the list
of options to allow us to remove the logic from fallbacks

Signed-off-by: Adam Ford <aford173@gmail.com>

# a5a37567 06-Feb-2018 Adam Ford <aford173@gmail.com>

Convert CONFIG LIB_HW_RAND to Kconfig

config_fallbacks.h had some logic to automatically select
LIB_RAND if RANDOM_UUID or CMD_UUID were set if LIB_HW_RAND wasn't
already selected. By migrating LIB_HW_RAND to Kconfig, we can
remove this check from config_fallbacks.h and put it into Kconfig

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
[trini: Turn into a choice, add NET_RANDOM_ETHADDR]
Signed-off-by: Tom Rini <trini@konsulko.com>

# acd4d334 16-Jan-2018 Maxime Ripard <maxime.ripard@free-electrons.com>

net: regex: Disable by default on sunXi

The sunXi arm64 build has overflown, leading to the main U-boot binary
overwriting the environment when flashing the new image, or even worse,
overwriting itself when we're calling saveenv.

Disable this option that is not critical until we can adress the issue
properly.

Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 7e3caa81 03-Dec-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

Move CONFIG_PANIC_HANG to Kconfig

Freescale (NXP) boards have lots of defconfig files per board.
I used "imply PANIC_HANG" for them.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# da5337a6 08-Nov-2017 Nandor Han <nandor.han@ge.com>

rtc: add support for s35392a

Add support for S35392A RTC. The driver supports both U-Boot driver
models.

Signed-off-by: Nandor Han <nandor.han@ge.com>
Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
Cc: Heiko Schocher <hs@denx.de>

# f52bdf4b 14-Sep-2017 Jean-Jacques Hiblot <jjhiblot@ti.com>

lib: allow building lzo for the SPL

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 85d8bf57 03-Sep-2017 Marek Behún <kabel@kernel.org>

lib: Add CRC32-C

This is needed for BTRFS.

Signed-off-by: Marek Behun <marek.behun@nic.cz>

create mode 100644 lib/crc32c.c

# 7264f292 15-Aug-2017 York Sun <york.sun@nxp.com>

spl: fit: Eanble GZIP support for image decompression

Add Kconfig option SPL_GZIP and SPL_ZLIB to enable gunzip support for
SPL boot, eg. falcon boot compressed kernel image.

Signed-off-by: York Sun <york.sun@nxp.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6ef2f901 11-Aug-2017 Adam Ford <aford173@gmail.com>

Convert CONFIG_BCH to Kconfig

This converts the following to Kconfig:
CONFIG_BCH

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1a7ba1d 18-Aug-2017 Anatolij Gustschin <agust@denx.de>

Fix 'notes' typos

s/notes/nodes

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 96b9082c 03-Aug-2017 Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

rockchip: rk3188: rock: adjust for SPL/TPL split

With the changes to split SPL/TPL for the RK3368, I apparently missed
some needed adjustments to the RK3188 Kconfig and rock_defconfig.

This fixes build-issues for the rock board after applying the RK3368
enablement (and SPL/TPL) set that resulted from TPL_SERIAL_SUPPORT,
TPL_ROCKCHIP_BACK_TO_BROM and TPL_TINY_MEMSET being separate symbols
now.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d56b4b19 22-Jul-2017 Tom Rini <trini@konsulko.com>

configs: Migrate RBTREE, LZO, CMD_MTDPARTS, CMD_UBI and CMD_UBIFS

The above CONFIG options are in Kconfig, and now have correct depends and
inter-dependencies. Migrate these to configs/ from include/configs/. In the
case of CMD_UBIFS also change it to be a default y if CMD_UBI.

Signed-off-by: Tom Rini <trini@konsulko.com>

# aed998aa 17-May-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_LZMA to Kconfig

This converts the following to Kconfig:
CONFIG_LZMA

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

# b1a873df 26-Apr-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_CMD_AES et al to Kconfig

This converts the following to Kconfig:
CONFIG_CMD_AES
CONFIG_AES

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Add select AES to CMD_AES]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 173aafbf 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

cmd: Expose a Kconfig option to enable UBIFS commands

Create a new Kconfig entry to allow CMD_UBIFS selection from Kconfig and
add an hidden LZO option that can be selected by CMD_UBIFS.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>

# aa049152 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

mtd: ubi: Select RBTREE option from MTD_UBI Kconfig entry

Expose the RBTREE feature through Kconfig and select this option from the
MTD_UBI option.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>
[Rebased on master]
Signed-off-by: Jagan Teki <jagan@openedev.com>

# ab4458bd 02-Apr-2017 Simon Glass <sjg@chromium.org>

string: Provide a slimmed-down memset()

Most of the time the optimised memset() is what we want. For extreme
situations such as TPL it may be too large. For example on the 'rock'
board, using a simple loop saves a useful 48 bytes. With gcc 4.9 and
the rodata bug, this patch is enough to reduce the TPL image below the
limit.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>

# bea79d7d 14-Mar-2017 Andre Przywara <andre.przywara@arm.com>

Kconfig: introduce md5sum command selection

So far CONFIG_MD5SUM would need to be set by a board's include file.
Since the command is really generic, move it over to Kconfig to allow
it to be defined by either a board's defconfig, menuconfig or some
config snippet merged via mergeconfig.sh.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e663b350 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

smbios: Expose in efi_loader as table

We can pass SMBIOS easily as EFI configuration table to an EFI payload. This
patch adds enablement for that case.

While at it, we also enable SMBIOS generation for ARM systems, since they support
EFI_LOADER.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4b6dddc2 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

x86: Move smbios generation into arch independent directory

We will need the SMBIOS generation function on ARM as well going forward,
so let's move it into a non arch specific location.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# ebf7fff2 05-Oct-2016 Heiko Schocher <hs@denx.de>

spl: move FDT_FIXUP_PARTITIONS to Kconfig

Move FDT_FIXUP_PARTITIONS to Kconfig and cleanup existing
uses.

Signed-off-by: Heiko Schocher <hs@denx.de>

# ddf67f71 05-Jul-2016 Maxime Ripard <maxime.ripard@free-electrons.com>

libfdt: Add overlay application function

The device tree overlays are a good way to deal with user-modifyable
boards or boards with some kind of an expansion mechanism where we can
easily plug new board in (like the BBB, the Raspberry Pi or the CHIP).

Add a new function to merge overlays with a base device tree.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>

# 91b86e21 26-May-2016 Marek Vasut <marex@denx.de>

lib: Enable private libgcc by default

This patch decouples U-Boot binary from the toolchain on systems where
private libgcc is available. Instead of pulling in functions provided
by the libgcc from the toolchain, U-Boot will use it's own set of libgcc
functions. These functions are usually imported from Linux kernel, which
also uses it's own libgcc functions instead of the ones provided by the
toolchain.

This patch solves a rather common problem. The toolchain can usually
generate code for many variants of target architecture and often even
different endianness. The libgcc on the other hand is usually compiled
for one particular configuration and the functions provided by it may
or may not be suited for use in U-Boot. This can manifest in two ways,
either the U-Boot fails to compile altogether and linker will complain
or, in the much worse case, the resulting U-Boot will build, but will
misbehave in very subtle and hard to debug ways.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 67976306 30-Mar-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

cosmetic: Fix typos "privide"

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# ed980b8c 03-Mar-2016 Alexander Graf <agraf@csgraf.de>

efi_loader: hook up in build environment

Now that we have all the bits and pieces ready for EFI payload loading
support, hook them up in Makefiles and KConfigs so that we can build.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
[trini: Enable only when we of OF_LIBFDT, disable on kwb and colibri_pxa270]
Signed-off-by: Tom Rini <trini@konsulko.com>

# aa34fbc0 22-Feb-2016 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt to be used in SPL

Add an option to enable libfdt in SPL. This can be useful when decoding
FIT files in SPL.

We need to make sure this option is not enabled in SPL by this change.
Also this option needs to be enabled in host builds. Si add a new
IMAGE_USE_LIBFDT #define which can be used in files that are built on the
host but must also build for U-Boot and SPL.

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

# 69e173eb 22-Feb-2016 Simon Glass <sjg@chromium.org>

Move CONFIG_OF_LIBFDT to Kconfig

Move this option to Kconfig and tidy up existing boards.

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

# a187559e 05-Feb-2016 Bin Meng <bmeng.cn@gmail.com>

Use correct spelling of "U-Boot"

Correct spelling of "U-Boot" shall be used in all written text
(documentation, comments in source files etc.).

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Minkyu Kang <mk7.kang@samsung.com>

# 947c626d 14-Jan-2016 Tom Rini <trini@konsulko.com>

vsprintf.c: Always enable CONFIG_SYS_VSNPRINTF

Enabling this function always removes some class of string saftey issues.
The size change here in general is about 400 bytes and this seems a reasonable
trade-off.

Cc: Peng Fan <peng.fan@nxp.com>
Cc: Peter Robinson <pbrobinson@gmail.com>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Adrian Alonso <aalonso@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 7d9cde10 22-Nov-2015 Stefan Roese <sr@denx.de>

lib/tiny-printf.c: Add tiny printf function for space limited environments

This patch adds a small printf() version that supports all basic formats.
Its intented to be used in U-Boot SPL versions on platforms with very
limited internal RAM sizes.

To enable it, just define CONFIG_USE_TINY_PRINTF in your defconfig. This
will result in the SPL using this tiny function and the main U-Boot
still using the full-blown printf() function.

This code was copied from:
http://www.sparetimelabs.com/printfrevisited
With mostly only coding style related changes so that its checkpatch
clean.

The size reduction is about 2.5KiB. Here a comparison for the db-mv784mp-gp
(Marvell AXP) SPL:

Without this patch:
58963 18536 1928 79427 13643 ./spl/u-boot-spl

With this patch:
56542 18536 1956 77034 12cea ./spl/u-boot-spl

Note:
To make it possible to compile tiny-printf.c instead of vsprintf.c when
CONFIG_USE_TINY_PRINTF is defined, the functions printf() and vprintf() are
moved from common/console.c into vsprintf.c in this patch.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>

# 2419cd16 03-Oct-2015 Simon Glass <sjg@chromium.org>

dm: tpm: Drop CONFIG_DM_TPM

Now that all TPM drivers use driver model, we can drop the special driver
model CONFIG option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>

# 027b728d 06-Oct-2015 Julius Werner <jwerner@chromium.org>

Add support for LZ4 decompression algorithm

This patch adds support for LZ4-compressed FIT image contents. This
algorithm has a slightly worse compression ration than LZO while being
nearly twice as fast to decompress. When loading images from a fast
storage medium this usually results in a boot time win.

Sandbox-tested only since I don't have a U-Boot development system set
up right now. The code was imported unchanged from coreboot where it's
proven to work, though. I'm mostly interested in getting this recognized
by mkImage for use in a downstream project.

Signed-off-by: Julius Werner <jwerner@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# a7d660bc 22-Aug-2015 Simon Glass <sjg@chromium.org>

tpm: Add Kconfig options for TPMs

Add new Kconfig options for TPMs in preparation for moving boards to use
Kconfig for TPM configuration.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 867a6ac8 31-Jul-2015 Simon Glass <sjg@chromium.org>

efi: Add start-up library code

When running as an EFI application, U-Boot must request memory from EFI,
and provide access to the boot services U-Boot needs.

Add library code to perform these tasks. This includes efi_main() which is
the entry point from EFI. U-Boot is built as a shared library.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d1389403 23-Jun-2015 Simon Glass <sjg@chromium.org>

Add a dhrystone benchmark command

Drystone provides a convenient sanity check that the CPU is running at full
speed. Add this as a command which can be enabled as needed.

Note: I investigated using Coremark for this but there was a license
agreement and I could not work out if it was GPL-compatible.

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

# f7848d90 22-Jun-2015 Joe Hershberger <joe.hershberger@ni.com>

Allow CONFIG_REGEX to be disabled when CONFIG_NET

Instead of selecting REGEX when NET is enabled, make it the default, but
allow boards that are tiny to disable it and lose functionality on all
but the first Ethernet adapter.

cm-bf548, bf538f-ezkit, and bf533-stamp need this. None appear to have
more than one Ethernet interface.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# 3850dbe8 11-Jun-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

blackfin: fix undefined reference to srand and rand

Commit 9ba9e85f3f1c (net: Fix NET_RANDOM_ETHADDR dependencies)
accidentally dropped CONFIG_LIB_RAND defines for 14 Blackfin boards.

Prior to that commit, those boards defined CONFIG_LIB_RAND, but not
CONFIG_NET_RANDOM_ETHADDR. So, commit 9ba9e85f3f1c should not have
touched them, but in fact it ripped CONFIG_LIB_RAND off from all the
header files, which caused undefined reference to srand and rand.
CONFIG_LIB_RAND=y must be revived for such boards.

BTW, this commit indeed makes it better, but even with this fix,
three boards (bf533-stamp, bf538f-ezkit, cm-bf548) still can not
build due to region 'ram' overflowed error. This was cause by
commit 6eed3786c68c (net: Move the CMD_NET config to defconfigs)
because CMD_NET selects NET, and NET selects REGEX. Eventually,
some boards were newly enabled with CONFIG_REGEX, increasing the
memory footprint. A patch is expected to fix the build error.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 9ba9e85f 25-May-2015 Michal Simek <michal.simek@amd.com>

net: Fix NET_RANDOM_ETHADDR dependencies

NET_RANDOM_ETHADDR depends on lib/rand.c. This patch adds dependency to
Kconfig to ensure that library is also compiled.

Remove the definitions from Blackfin boards' include/configs.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 6501ff62 20-Apr-2015 Przemyslaw Marczak <p.marczak@samsung.com>

lib: Kconfig: add entry for errno_str() function

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1a60650c 21-Apr-2015 Joe Hershberger <joe.hershberger@ni.com>

kconfig: Move REGEX to Kconfig

Having this as a Kconfig allows it to be a dependent feature.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8156345d 06-Mar-2015 Simon Glass <sjg@chromium.org>

sandbox: Move CONFIG_SYS_VSNPRINTF to Kconfig

Move this over to Kconfig and tidy up.

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

# 94e3c8c4 19-Feb-2015 gaurav rana <gaurav.rana@freescale.com>

crypto/fsl - Add progressive hashing support using hardware acceleration.

Currently only normal hashing is supported using hardware acceleration.
Added support for progressive hashing using hardware.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
Signed-off-by: Gaurav Rana <gaurav.rana@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>

# d9f23c7f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

lib/rsa: Add Kconfig for devices supporting RSA Modular Exponentiation

Kconfig option added for devices which support RSA Verification.
1. RSA_SOFTWARE_EXP
Enables driver for supporting RSA Modular Exponentiation in Software
2. RSA_FREESCALE_EXP
Enables driver for supporting RSA Modular Exponentiation using Freescale specific
driver

The above drivers use RSA uclass

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
(Removed duplicate line in Kconfig comment)

Change-Id: I7663c4d5350e2bfc3dfa2696f70ef777d6ccc6f6

# c4beb22f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

FIT: Modify option FIT_SIGNATURE in Kconfig

For FIT signature based approach to work, RSA library needs to be selected.
The FIT_SIGNATURE option in Kconfig is modified to automatically select RSA.
Selecting RSA compiles the RSA library required for image verification.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 45ccec8f 23-Oct-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

kconfig: move CONFIG_USE_PRIVATE_LIBGCC to Kconfig

The private libgcc is supported only on ARM, MIPS, PowerPC, SH, x86.
Those architectures should "select" HAVE_PRIVATE_LIBGCC and
CONFIG_USE_PRIVATE_LIBGCC should depend on it.

Currently, this option is enabled on Tegra boards and x86 architecture.
Move the definition from header files to Kconfig.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Tested-by: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: Tom Warren <twarren@nvidia.com>

# 8c688bc4 23-Oct-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

kconfig: move CONFIG_SYS_HZ to lib/Kconfig

CONFIG_SYS_HZ is always defined as 1000 in config_fallbacks.h
(but some boards still have redundant definitions).

This commit moves the definition and the document in README to
Kconfig. Since lib/Kconfig can assure that CONFIG_SYS_HZ is 1000,
the sanity check in lib/time.c should be removed.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Reviewed-by: Marek Vasut <marex@denx.de>

# b0928da6 16-Sep-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

kconfig: move CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED to Kconfig

If this option is enabled, the objects under lib/ directory
are compiled with speed optimization, not size optimization.
(Currently, only used by some Blackfin boards.)

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# ed36323f 16-Sep-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

kconfig: add blank Kconfig files

This would be useful to start moving various config options.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# 53c47c59 19-Jan-2023 Tom Rini <trini@konsulko.com>

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


# 4b9b25d9 12-Jan-2023 Brandon Maier <brandon.maier@collins.com>

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

[1] https://github.com/torvalds/linux/commit/e0c1b49f5b674cca7b10549c53b3791d0bbc90a8
[2] https://github.com/facebook/zstd/blob/f302ad8811643c428c4e3498e28f53a0578020d3/lib/libzstd.mk#L31

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>

# ebc1d50a 21-Dec-2022 Simon Glass <sjg@chromium.org>

Revert "fdtdec: drop needlessly convoluted CONFIG_PHANDLE_CHECK_SEQ"

The fdt_path_offset() function is slow since it must scan the tree.
This substantial overhead now applies to all boards.

The original code may not be ideal but it is fit for purpose and is only
needed on a few boards.

Reverting this reduces time to set up driver model by about 30ms.

Before revert:

Accumulated time:
47,170 dm_r
53,237 dm_spl
572,986 dm_f

Accumulated time:
44,598 dm_r
50,347 dm_spl
549,133 dm_f

This reverts commit 26f981f295d00351b6f0c69b5317b254b2361cc0.

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

# 12619d4e 21-Dec-2022 Simon Glass <sjg@chromium.org>

trace: Don't require TIMER_EARLY

Some platforms cannot honour this and don't need trace before relocation.
Use 'imply' instead, so boards can disable this.

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

# 0c16fca9 07-Jan-2023 Simon Glass <sjg@chromium.org>

tpm: Add a proper Kconfig option for crc8 in SPL

The current approach is a bit of a hack and only works for the tpm
subsystem. Add a Kconfig so that crc8 can be enabled in SPL for other
purposes.

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

# 14f43797 19-Dec-2022 Tom Rini <trini@konsulko.com>

Merge tag 'v2023.01-rc4' into next

Prepare v2023.01-rc4

Signed-off-by: Tom Rini <trini@konsulko.com>


# ae3527f0 07-Dec-2022 Kautuk Consul <kconsul@ventanamicro.com>

arch/riscv: add semihosting support for RISC-V

We add RISC-V semihosting based serial console for JTAG based early
debugging.

The RISC-V semihosting specification is available at:
https://github.com/riscv/riscv-semihosting-spec/blob/main/riscv-semihosting-spec.adoc

Signed-off-by: Anup Patel <apatel@ventanamicro.com>
Signed-off-by: Kautuk Consul <kconsul@ventanamicro.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>

# 1c03ab9f 07-Dec-2022 Kautuk Consul <kconsul@ventanamicro.com>

lib: Add common semihosting library

We factor out the arch-independent parts of the ARM semihosting
implementation as a common library so that it can be shared
with RISC-V.

Signed-off-by: Kautuk Consul <kconsul@ventanamicro.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>

# 3b8dfc42 16-Nov-2022 Tom Rini <trini@konsulko.com>

Convert CONFIG_SYS_TIMER_COUNTS_DOWN to Kconfig

This converts the following to Kconfig:
CONFIG_SYS_TIMER_COUNTS_DOWN

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 86794052 21-Oct-2022 Sughosh Ganu <sughosh.ganu@linaro.org>

FWU: Add support for the FWU Multi Bank Update feature

The FWU Multi Bank Update feature supports updating firmware images
to one of multiple sets(also called banks) of images. The firmware
images are clubbed together in banks, with the system booting images
from the active bank. Information on the images such as which bank
they belong to is stored as part of the metadata structure, which is
stored on the same storage media as the firmware images on a dedicated
partition.

At the time of update, the metadata is read to identify the bank to
which the images need to be flashed(update bank). On a successful
update, the metadata is modified to set the updated bank as active
bank to subsequently boot from.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

# 40ed7be4 02-Aug-2022 Tom Rini <trini@konsulko.com>

Convert CONFIG_SYS_FDT_PAD to Kconfig

This converts the following to Kconfig:
CONFIG_SYS_FDT_PAD

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e67ffb5a 22-Jul-2022 Sughosh Ganu <sughosh.ganu@linaro.org>

tpm: rng: Add driver model interface for TPM RNG device

The TPM device has a builtin random number generator(RNG)
functionality. Expose the RNG functions of the TPM device to the
driver model so that they can be used by the EFI_RNG_PROTOCOL if the
protocol is installed.

Also change the function arguments and return type of the random
number functions to comply with the driver model api.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

# b340199f 10-Jun-2022 Tom Rini <trini@konsulko.com>

spl: Ensure all SPL symbols in Kconfig have some SPL dependency

Tighten up symbol dependencies in a number of places. Ensure that a SPL
specific option has at least a direct dependency on SPL. In places
where it's clear that we depend on something more specific, use that
dependency instead. This means in a very small number of places we can
drop redundant dependencies.

Reported-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 13ce351b 08-Jun-2022 Tom Rini <trini@konsulko.com>

vpl: Ensure all VPL symbols in Kconfig have some VPL dependency

Tighten up symbol dependencies in a number of places. Ensure that a VPL
specific option has at least a direct dependency on VPL. In places
where it's clear that we depend on something more specific, use that
dependency instead.

Reported-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 8bea4bf7 08-Jun-2022 Tom Rini <trini@konsulko.com>

tpl: Ensure all TPL symbols in Kconfig have some TPL dependency

Tighten up symbol dependencies in a number of places. Ensure that a TPL
specific option has at least a direct dependency on TPL. In places
where it's clear that we depend on something more specific, use that
dependency instead.

Reported-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 26f981f2 19-May-2022 Rasmus Villemoes <rasmus.villemoes@prevas.dk>

fdtdec: drop needlessly convoluted CONFIG_PHANDLE_CHECK_SEQ

Asking if the alias we found actually points at the device tree node
we passed in (in the guise of its offset from blob) can be done simply
by asking if the fdt_path_offset() of the alias' path is identical to
offset.

In fact, the current method suffers from the possibility of false
negatives: dtc does not necessarily emit a phandle property for a node
just because it is referenced in /aliases; it only emits a phandle
property for a node if it is referenced in <angle brackets>
somewhere. So if both the node we passed in and the alias node we're
considering don't have phandles, fdt_get_phandle() returns 0 for both.

Since the proper check is so simple, there's no reason to hide that
behind a config option (and if one really wanted that, it should be
called something else because there's no need to involve phandle in
the check).

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Acked-by: Aswath Govindraju <a-govindraju@ti.com>

# d30924f1 01-May-2022 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: fix selection of CONFIG_CHARSET

lib/charset.c is not optional for
EFI_APP || EFI_LOADER || UFS || UT_UNICODE.
These must select CONFIG_CHARSET.

Fixes: 726cd9836db0 ("efi: Make unicode printf available to the app")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>

# 747093dd 30-Apr-2022 Simon Glass <sjg@chromium.org>

vpl: Add Kconfig options for VPL

Add VPL versions of commonly used Kconfig options.

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

# 11232139 06-Apr-2022 Tom Rini <trini@konsulko.com>

nds32: Remove the architecture

As removal of nds32 has been ack'd for the Linux kernel, remove support
here as well.

Cc: Rick Chen <rick@andestech.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Rick Chen <rick@andestech.com>

# fd210fee 28-Mar-2022 Philippe Reynes <philippe.reynes@softathome.com>

lib: allow to build asn1 decoder and oid registry in SPL

This commit adds the options:
- SPL_ASN1_DECODER
- SPL_OID_REGISTRY

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>

# 7d44a985 28-Mar-2022 Philippe Reynes <philippe.reynes@softathome.com>

lib: Kconfig: enhance the help of OID_REGISTRY

Enhance the help for the config OID_REGISTRY.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>

# a0e71d96 28-Mar-2022 Philippe Reynes <philippe.reynes@softathome.com>

lib: Kconfig: enhance help for ASN1

Enhance the help for configs ASN1_COMPILER
and ASN1_decoder.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>

# 761a1786 27-Jan-2022 Tom Rini <trini@konsulko.com>

Merge tag 'dm-pull-26jan22' of https://source.denx.de/u-boot/custodians/u-boot-dm

acpi refactoring to allow non-x86 use
binman support for bintools (binary tools)
minor tools improvements in preparation for FDT signing
various minor fixes and improvements


# 334a9b9d 25-Nov-2021 Loic Poulain <loic.poulain@linaro.org>

lib/circbuf: Make circbuf selectable symbol

It is currenly only used from usbtty driver but make it properly
selectable via Kconfig symbol, for future usage.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>

# e1722fcb 01-Dec-2021 Simon Glass <sjg@chromium.org>

x86: Allow any arch to generate ACPI tables

These have sadly found their way to ARM now. Allow any arch to support
generating ACPI tables.

Disable this for the tools build.

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

# 7c3fd5c2 26-Dec-2021 Qu Wenruo <wqu@suse.com>

lib: add BLAKE2 hash support

The code is cross-ported from BLAKE2 reference implementation
(https://github.com/BLAKE2/BLAKE2).

With minimal change to remove unused macros/features.

Currently there is only one user inside U-boot (btrfs), and since it
only utilize BLAKE2B, all other favors are all removed.

Signed-off-by: Qu Wenruo <wqu@suse.com>
[trini: Rename ROUND to R to avoid clash with <linux/bitops.h>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 97f2a749 04-Jan-2022 Eugen Hristev <eugen.hristev@collabora.com>

lib: Kconfig: fix PHANDLE_CHECK_SEQ position outside of menu

CONFIG_PHANDLE_CHECK_SEQ is outside of the menu 'Library routines'
thus it's invisible in menuconfig and cannot be selected.
Fix this by moving the 'endmenu' after the PHANDLE_CHECK_SEQ definition

Fixes: c589132a1d ("fdt: Use phandle to distinguish DT nodes with same name")
Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
Reviewed-by: Aswath Govindraju <a-govindraju@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 726cd983 29-Dec-2021 Simon Glass <sjg@chromium.org>

efi: Make unicode printf available to the app

This is needed to show unicode strings. Enable this code in the app.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>

# 6405ab7a 24-Nov-2021 Simon Glass <sjg@chromium.org>

Convert CONFIG_PHYSMEM to Kconfig

This converts the following to Kconfig:
CONFIG_PHYSMEM

Signed-off-by: Simon Glass <sjg@chromium.org>
Suggested-by: Sean Anderson <seanga2@gmail.com>

# ac7606af 14-Nov-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

lmb: fix typo 'commun'

%s/commun/common/

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

# e7d285b2 25-Sep-2021 Simon Glass <sjg@chromium.org>

image: Use the correct checks for CRC32

Add a host Kconfig for CRC32. With this we can use CONFIG_IS_ENABLED(CRC32)
directly in the host build, so drop the unnecessary indirection.

Add a few more conditions to SPL_CRC32 to avoid build failures as well as
TPL_CRC32. Also update hash.c to make crc32 optional and to actually take
notice of SPL_CRC32.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# 2c21256b 25-Sep-2021 Simon Glass <sjg@chromium.org>

hash: Use Kconfig to enable hashing in host tools and SPL

At present when building host tools, we force CONFIG_SHAxxx to be enabled
regardless of the board Kconfig setting. This is done in the image.h
header file.

For SPL we currently just assume the algorithm is desired if U-Boot proper
enables it.

Clean this up by adding new Kconfig options to enable hashing on the host,
relying on CONFIG_IS_ENABLED() to deal with the different builds.

Add new SPL Kconfigs for hardware-accelerated hashing, to maintain the
current settings.

This allows us to drop the image.h code and the I_WANT_MD5 hack.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# 603d15a5 25-Sep-2021 Simon Glass <sjg@chromium.org>

spl: cypto: Bring back SPL_ versions of SHA

Unfortunately these were removed by mistake. This means that adding hash
support to SPL brings in all software algorithms, with a substantial
increase in code size.

The origin of the problem was renaming them to SPL_FIT_xxx and then these
were removed altogether in a later commit.

Add them back. This aligns with CONFIG_MD5, for example, which has an SPL
variant.

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: f5bc9c25f31 ("image: Rename SPL_SHAxxx_SUPPORT to SPL_FIT_SHAxxx")
Fixes: eb5171ddec9 ("common: Remove unused CONFIG_FIT_SHAxxx selectors")
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# 6674edaa 16-Sep-2021 Tom Rini <trini@konsulko.com>

Merge tag 'v2021.10-rc4' into next

Prepare v2021.10-rc4

Signed-off-by: Tom Rini <trini@konsulko.com>

# gpg: Signature made Tue 14 Sep 2021 06:58:32 PM EDT
# gpg: using RSA key 1A3C7F70E08FAB1707809BBF147C39FF9634B72C
# gpg: Good signature from "Thomas Rini <trini@konsulko.com>" [ultimate]

# Conflicts:
# board/Arcturus/ucp1020/spl.c
# cmd/mvebu/Kconfig
# common/Kconfig.boot
# common/image-fit.c
# configs/UCP1020_defconfig
# configs/sifive_unmatched_defconfig
# drivers/pci/Kconfig
# include/configs/UCP1020.h
# include/configs/sifive-unmatched.h
# lib/Makefile
# scripts/config_whitelist.txt


# 5145bc73 01-Sep-2021 Oleksandr Suvorov <oleksandr.suvorov@foundries.io>

lib: fix typos in Kconfig

There are trivial typos in the Kconfig file. Fixed them.
Also, fixed grammar in the descriptions with typos.

Fixes: d56b4b1974 ("configs: Migrate RBTREE, LZO, CMD_MTDPARTS, CMD_UBI and CMD_UBIFS")
Fixes: 7264f2928b ("spl: fit: Eanble GZIP support for image decompression")
Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# e60e4499 02-Sep-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

lib: Drop SHA512_ALGO in lieu of SHA512

SHA512_ALGO was used as a "either SHA512 or SHA384", although the
implementations of these two algorithms share a majority of code.

From a Kconfig interface perspective, it makes sense to present two
distinct options. This requires #ifdefing out the SHA512
implementation from sha512.c. The latter doesn't make any sense.

It's reasonable to say in Kconfig that SHA384 depends on SHA512, and
seems to be the more polite way to handle the selection.

Thus, automatically select SHA512 when SHA384 is enabled.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# b4c2c151 27-Aug-2021 Michal Simek <michal.simek@amd.com>

Kconfig: Remove all default n/no options

default n/no doesn't need to be specified. It is default option anyway.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
[trini: Rework FSP_USE_UPD portion]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 928a8be7 29-Jul-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

lib: ecdsa: Implement UCLASS_ECDSA verification on target

Implement the crypto_algo .verify() function for ecdsa256. Because
it backends on UCLASS_ECDSA, this change is focused on parsing the
keys from devicetree and passing this information to the specific
UCLASS driver.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# fa3f1f1d 24-Jul-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: disable CONFIG_SPL_HEXDUMP by default

CONFIG_HEXDUMP is needed to display UEFI variables using 'printenv -e'.

Enabling CONFIG_SPL_HEXDUMP only makes sense for debugging purposes.
Hence CONFIG_SPL_HEXDUMP should not be enabled by default.

The following boards currently have CONFIG_SPL_HEXDUMP=y. This includes
boards that don't use SPL at all.

axm_defconfig
imx8mm-cl-iot-gate_defconfig
imx8mm_venice_defconfig
imxrt1020-evk_defconfig
imxrt1050-evk_defconfig
kontron_sl28_defconfig
kp_imx53_defconfig
lx2160ardb_tfa_stmm_defconfig
mt7622_rfb_defconfig
octeon_ebb7304_defconfig
octeon_nic23_defconfig
qemu_arm64_defconfig
qemu_arm_defconfig
qemu-riscv32_defconfig
qemu-riscv32_smode_defconfig
qemu-riscv64_defconfig
qemu-riscv64_smode_defconfig
qemu-x86_64_defconfig
qemu-x86_defconfig
sandbox64_defconfig
sandbox_defconfig
stm32mp15_basic_defconfig
stm32mp15_trusted_defconfig
synquacer_developerbox_defconfig
taurus_defconfig
xilinx_versal_virt_defconfig

The patch only keeps it enabled on

sandbox_spl_defconfig

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 1a46cb6c 02-Jul-2021 Simon Glass <sjg@chromium.org>

lib: Create a new Kconfig option for charset conversion

Rather than looking at two KConfig options in the Makefile, create a new
Kconfig option for compiling lib/charset.c

Enable it for UFS also, which needs this support.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 26dd9936 08-Jul-2021 Steffen Jaeckel <jaeckel-floss@eyet-services.de>

lib: add crypt subsystem

Add the basic functionality required to support the standard crypt
format.
The files crypt-sha256.c and crypt-sha512.c originate from libxcrypt and
their formatting is therefor retained.
The integration is done via a crypt_compare() function in crypt.c.

```
libxcrypt $ git describe --long --always --all
tags/v4.4.17-0-g6b110bc
```

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 7d0f3fbb 11-Jun-2021 Tero Kristo <t-kristo@ti.com>

lib: rational: copy the rational fraction lib routines from Linux

Copy the best rational approximation calculation routines from Linux.
Typical usecase for these routines is to calculate the M/N divider
values for PLLs to reach a specific clock rate.

This is based on linux kernel commit:
"lib/math/rational.c: fix possible incorrect result from rational
fractions helper"
(sha1: 323dd2c3ed0641f49e89b4e420f9eef5d3d5a881)

Signed-off-by: Tero Kristo <t-kristo@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Tero Kristo <kristo@kernel.org>

# ec0512b1 24-May-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

Revert "lib: introduce HASH_CALCULATE option"

When we think of Kconfig, we usually think of features that we like
to enable or not. Ideally, we wouldn't use Kconfig to fix a build
issue, although sometimes it might make sense. With Kconfig it's hard
to guarantee that the fix is universal. We can only say that it works
for the set of tested configurations. In the majority of cases, it's
preferable to let the linker figure things out for us.

The reverted commit attempted to fix a build issue by adding an
invisible Kconfig option. This is wrong in several ways:

It invents a new Kconfig variable when CONFIG_HASH already
exists for the same purpose.
Second, hash-checksum.c makes use of the hash_progressive_lookup_algo()
symbol, which is only provided with CONFIG_HASH, but this dependency
was not expressed in the reverted patch.

It feels like Kconfig is turning into a listing of all available
source files, and a buffet to 'select' which ones to compile. The
purpose of this revert is to enable the next change to make use of
CONFIG_HASH instead of adding to Kconfig.

This reverts commit 87316da05f2fd49d3709275e64ef0c5980366ade.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Acked-by: Masahisa Kojima <masahisa.kojima@linaro.org>

# 1621d3c4 10-May-2021 Bin Meng <bmeng.cn@gmail.com>

lib: kconfig: Limit BINMAN_FDT for OF_SEPARATE or OF_EMBED

Generally speaking BINMAN_FDT makes sense for OF_SEPARATE or OF_EMBED.
For the other OF_CONTROL methods, it's quite possible binman node is
not available as binman is invoked during the build phase instead of
runtime. Let's only turn it on for OF_SEPARATE or OF_EMBED by default.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 87316da0 13-May-2021 Masahisa Kojima <masahisa.kojima@linaro.org>

lib: introduce HASH_CALCULATE option

Build error occurs when CONFIG_EFI_SECURE_BOOT or
CONFIG_EFI_CAPSULE_AUTHENTICATE is enabled,
because hash-checksum.c is not compiled.

Since hash_calculate() implemented in hash-checksum.c can be
commonly used aside from FIT image signature verification,
this commit itroduces HASH_CALCULATE option to decide
if hash-checksum.c shall be compiled.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# e2ae483c 13-May-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

hash: Kconfig option for SHA512 hardware acceleration

Commit a479f103dc1c ("hash: Allow for SHA512 hardware implementations")
defined function definitions for hardware accelerated SHA384 and SHA512.
If CONFIG_SHA_HW_ACCEL=y, these functions are used.

We already have boards using CONFIG_SHA_HW_ACCEL=y but none implements the
new functions hw_sha384() and hw_sha512().

For implementing the EFI TCG2 protocol we need SHA384 and SHA512. The
missing hardware acceleration functions lead to build errors on boards like
peach-pi_defconfig.

Introduce a new Kconfig symbol CONFIG_SHA512_HW_ACCEL to control if the
functions hw_sha384() and hw_sha512() shall be used to implement the SHA384
and SHA512 algorithms.

Fixes: a479f103dc1c ("hash: Allow for SHA512 hardware implementations")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

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

# 6d66502b 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: Add 2 config to define the max number of regions

Add 2 configs CONFIG_LMB_MEMORY_REGIONS and CONFIG_LMB_RESERVED_REGIONS
to change independently the max number of the regions in lmb
library.

When CONFIG_LMB_USE_MAX_REGIONS=y, move the lmb property arrays to
struct lmb and manage the array size with the element 'max' of struct
lmb_region; their are still allocated in stack.

When CONFIG_LMB_USE_MAX_REGIONS=n, keep the current location in
struct lmb_region to allow compiler optimization.

Increase CONFIG_LMB_RESERVED_REGIONS is useful to avoid lmb errors in
bootm when the number of reserved regions (not adjacent) is reached:
+ 1 region for relocated U-Boot
+ 1 region for initrd
+ 1 region for relocated linux device tree
+ reserved memory regions present in Linux device tree.

The current limit of 8 regions is reached with only 5 reserved regions
in DT.

see Linux kernel commit bf23c51f1f49 ("memblock: Move memblock arrays
to static storage in memblock.c and make their size a variable")

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# 4fa0150d 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: move MAX_LMB_REGIONS value in Kconfig

Move MAX_LMB_REGIONS value in Kconfig, the max number of the regions
in lmb library.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# 77b8cfef 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: move CONFIG_LMB in Kconfig

Migrate CONFIG_LMB in Kconfig.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# a479f103 16-Feb-2021 Joel Stanley <joel@jms.id.au>

hash: Allow for SHA512 hardware implementations

Similar to support for SHA1 and SHA256, allow the use of hardware hashing
engine by enabling the algorithm and setting CONFIG_SHA_HW_ACCEL /
CONFIG_SHA_PROG_HW_ACCEL.

Signed-off-by: Joel Stanley <joel@jms.id.au>

# f2c1442e 14-Mar-2021 Simon Glass <sjg@chromium.org>

bloblist: Make BLOBLIST_TABLES depend on BLOBLIST

Add an extra condition here since we cannot put x86 tables in a bloblist
when bloblists are not supported.

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

# e0103158 25-Feb-2021 Bin Meng <bmeng.cn@gmail.com>

lib: kconfig: Mention CONFIG_ADDR_MAP limitation in the help

Mention that CONFIG_ADDR_MAP only works in the post-relocation phase.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>

# 56e7257c 03-Feb-2021 Bin Meng <bmeng.cn@gmail.com>

lib: Fix BINMAN_FDT dependency

lib/binman.c references the following 3 ofnode APIs:
ofnode_first_subnode(), ofnode_path() and ofnode_read_bool().

These APIs get built only when DM is on. Fix the dependency then.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 59e4e391 18-Jan-2021 Tom Rini <trini@konsulko.com>

Merge https://gitlab.denx.de/u-boot/custodians/u-boot-riscv

- Update qemu-riscv.rst build instructions.
- Add support for SPI on Kendryte K210.
- Add Microchip PolarFire SoC Icicle Kit support.
- Add support for an early timer.
- Select TIMER_EARLY to avoid infinite recursion for Trace.


# a80f8513 17-Jan-2021 Pragnesh Patel <pragnesh.patel@sifive.com>

trace: select TIMER_EARLY to avoid infinite recursion

When tracing functions is enabled this adds calls to
__cyg_profile_func_enter() and __cyg_profile_func_exit() to the traced
functions.

__cyg_profile_func_enter() and __cyg_profile_func_exit() invoke
timer_get_us() to record the entry and exit time.

initr_dm() will make gd->dm_root = NULL and gd->timer = NULL, so
timer_get_us() -> get_ticks() -> dm_timer_init() will lead to an
indefinite recursion.

So select TIMER_EARLY when tracing got enabled.

Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Rick Chen <rick@andestech.com>

# 6205bbb1 04-Jan-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lib: cosmetic update of CONFIG_LIB_ELF description

Change 2 typo error in CONFIG_LIB_ELF description:
- Supoort => Support
- fir => for

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c589132a 02-Dec-2020 Aswath Govindraju <a-govindraju@ti.com>

fdt: Use phandle to distinguish DT nodes with same name

While assigning the sequence number to subsystem instances by reading the
aliases property, only DT nodes names are compared and not the complete
path. This causes a problem when there are two DT nodes with same name but
have different paths.

In arch/arm/dts/k3-am65-main.dtsi there are two USB controllers with the
same device tree node name but different path. When aliases are defined for
these USB controllers then fdtdec_get_alias_seq() fails to pick the correct
instance for a given index.

fdt_path_offset() function is slow and this would effect the U-Boot
startup. To avert the time penalty on all boards, apply this extra check
only when required by using a config option.

Fix it by comparing the phandles of DT nodes after the node names match,
under a config option.

Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Fix whitespace error in Kconfig:
Signed-off-by: Simon Glass <sjg@chromium.org>

# 28cef9ca 19-Nov-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

fs: fat: create correct short names

The current function set_name() used to create short names has the
following deficiencies resolved by this patch:

* Long names (e.g. FOO.TXT) are stored even if a short name is enough.
* Short names with spaces are created, e.g. "A ~1.TXT".
* Short names with illegal characters are created, e.g. "FOO++BAR".
* Debug output does not not consider that the short file name has no
concluding '\0'.

The solution for the following bug is split of into a separate patch:

* Short file names must be unique.

This patch only provides the loop over possible short file names.

Fixes: c30a15e590c ("FAT: Add FAT write feature")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# e4f8e543 05-Nov-2020 Simon Glass <sjg@chromium.org>

smbios: Drop the unused Kconfig options

Now that we can use devicetree to specify this information, drop the old
CONFIG options.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 44c74bdd 05-Nov-2020 Simon Glass <sjg@chromium.org>

sysinfo: Provide a default driver to set SMBIOS values

Some boards want to specify the manufacturer or product name but do not
need to have their own sysinfo driver.

Add a default driver which provides a way to specify this SMBIOS
information in the devicetree, without needing any board-specific
functionality.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d2cb7a22 04-Nov-2020 Simon Glass <sjg@chromium.org>

x86: Allow putting some tables in the bloblist

At present all tables are placed starting at address f0000 in memory, and
can be up to 64KB in size. If the tables are very large, this may not
provide enough space.

Also if the tables point to other tables (such as console log or a ramoops
area) then we must allocate other memory anyway.

The bloblist is a nice place to put these tables since it is contiguous,
which makes it easy to reserve this memory for linux using the 820 tables.

Add an option to put some of the tables in the bloblist. For SMBIOS and
ACPI, create suitable pointers from the f0000 region to the new location
of the tables.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
[bmeng: squashed in http://patchwork.ozlabs.org/project/uboot/patch/
20201105062407.1.I8091ad931cbbb5e3b6f6ababdf3f8d5db0d17bb9@changeid/]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# 415eab06 03-Nov-2020 Christian Gmeiner <christian.gmeiner@gmail.com>

smbios: add parsing API

Add a very simple API to be able to access SMBIOS strings
like vendor, model and bios version.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 72eda507 27-Oct-2020 Sean Anderson <seanga2@gmail.com>

lib: Add getopt

Some commands can get very unweildy if they have too many positional
arguments. Adding options makes them easier to read, remember, and
understand.

This implementation of getopt has been taken from barebox, which has had
option support for quite a while. I have made a few modifications to their
version, such as the removal of opterr in favor of a separate getopt_silent
function. In addition, I have moved all global variables into struct
getopt_context.

The getopt from barebox also re-orders the arguments passed to it so that
non-options are placed last. This allows users to specify options anywhere.
For example, `ls -l foo/ -R` would be re-ordered to `ls -l -R foo/` as
getopt parsed the options. However, this feature conflicts with the const
argv in cmd_tbl->cmd. This was originally added in 54841ab50c ("Make sure
that argv[] argument pointers are not modified."). The reason stated in
that commit is that hush requires argv to stay unmodified. Has this
situation changed? Barebox also uses hush, and does not have this problem.
Perhaps we could use their fix?

I have assigned maintenance of getopt to Simon Glass, as it is currently
only used by the log command. I would also be fine maintaining it.

Signed-off-by: Sean Anderson <seanga2@gmail.com>

# 26637e2e 12-Sep-2020 Simon Glass <sjg@chromium.org>

lib: Allow hexdump to be used in SPL

It is sometimes useful to output hex dumps in SPL. Add a config option to
allow this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# e87dfb05 05-Aug-2020 Andrii Anisov <andrii_anisov@epam.com>

lib: sscanf: add sscanf implementation

Port sscanf implementation from mini-os and introduce new
Kconfig option to enable it: CONFIG_SSCANF. Disable by default.

Signed-off-by: Andrii Anisov <andrii_anisov@epam.com>
Signed-off-by: Anastasiia Lukianenko <anastasiia_lukianenko@epam.com>
Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>

# 81014f73 30-Jul-2020 Joao Marcos Costa <joaomarcos.costa@bootlin.com>

include/u-boot, lib/zlib: add sources for zlib decompression

Add zlib (v1.2.11) uncompr() function to U-Boot. SquashFS depends on
this function to decompress data from a raw disk image. The actual
support for zlib into SquashFS sources will be added in a follow-up
commit.

Signed-off-by: Joao Marcos Costa <joaomarcos.costa@bootlin.com>

# 69be8fd1 03-Jun-2020 Marek Szyprowski <m.szyprowski@samsung.com>

powerpc: move ADDR_MAP to Kconfig

Move ADDR_MAP related config options from include/configs/*.h to the
proper place in lib/Kconfig. This has been done using
./tools/moveconfig.py and manual inspection of the generated changes.
This is a preparation to use ADDR_MAP helper on ARM 32bit Raspberry Pi4
board for mapping the PCIe XHCI MMIO, which is above the 4GiB identity
mapping limit.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# d16b38f4 15-Apr-2020 Reuben Dowle <reubendowle0@gmail.com>

Add support for SHA384 and SHA512

The current recommendation for best security practice from the US government
is to use SHA384 for TOP SECRET [1].

This patch adds support for SHA384 and SHA512 in the hash command, and also
allows FIT images to be hashed with these algorithms, and signed with
sha384,rsaXXXX and sha512,rsaXXXX

The SHA implementation is adapted from the linux kernel implementation.

[1] Commercial National Security Algorithm Suite
http://www.iad.gov/iad/programs/iad-initiatives/cnsa-suite.cfm

Signed-off-by: Reuben Dowle <reuben.dowle@4rf.com>

# 43e442a5 26-May-2020 Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

kconfig: fix some typos

Signed-off-by: Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

# eff5a547 22-May-2020 Michael Walle <michael@walle.cc>

cmd: zip: automatically pull in gzip()

Move the CONFIG_GZIP_COMPRESSED from a config.h macro to a Kconfig menu
item. It is not selectable by a user because there is no reason to do
so. Instead it will be automatically selected by the stuff which uses
gzip(), like the zip command.

Remove it from the config_whitelist.txt. Also remove
CONFIG_GZIP_COMPRESS_DEF_SZ as this was never used on any board. The
default seems to be sane, otherwise it should be added as a Kconfig
option.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8239be61 06-May-2020 Simon Glass <sjg@chromium.org>

lib: Allow MD5 to be enabled in SPL

At present the MD5 option cannot be enabled by board configs since it has
no Kconfig name. It is generally enabled, so long as FIT support is
present. But not all boards use FIT, particularly in SPL

Fix this and add an option for SPL as well. This allows board code to call
md5() even if FIT support is not enabled.

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

# 04cb3994 21-Apr-2020 Weijie Gao <weijie.gao@mediatek.com>

lib: enable lzma decompression support for SPL build

This patch enables LZMA decompression support for SPL build

Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>

# 2a2119e1 05-Mar-2020 Atish Patra <atishp@atishpatra.org>

lib: kconfig: Add option to set BZIP2 compression method

There is no way to select BZIP2 compression method.
Add it under library/compression config where all other
compression related configs are present.

Signed-off-by: Atish Patra <atish.patra@wdc.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 805b3cac 12-Feb-2020 Keerthy <j-keerthy@ti.com>

lib: elf: Move the generic elf loading/validating functions to lib

Move the generic elf loading/validating functions to lib/
so that they can be re-used and accessed by code existing
outside cmd.

While at it remove the duplicate static version of load_elf_image_phdr
under arch/arm/mach-imx/imx_bootaux.c.

Signed-off-by: Keerthy <j-keerthy@ti.com>
Suggested-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>

# 1611235b 19-Jan-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: Kconfig dependencies for pseudo-random library

drivers/rng/sandbox_rng.c requires rand() to be defined but configuration
option CONFIG_CONFIG_LIB_RAND selected in drivers/rng/Kconfig does not
exist.

test/lib/test_aes.c requires rand() to be defined.

Fix the selection criteria for choice "Pseudo-random library support type".

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 3c10dc95 06-Dec-2019 Simon Glass <sjg@chromium.org>

binman: Add a library to access binman entries

SPL and TPL can access information about binman entries using link-time
symbols but this is not available in U-Boot proper. Of course it could be
made available, but the intention is to just read the device tree.

Add support for this, so that U-Boot can locate entries.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# b4adf627 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: crypto: add x509 parser

Imported from linux kernel v5.3:
x509.asn1 without changes
x509_akid.asn1 without changes
x509_parser.h without changes
x509_cert_parser.c with changes marked as __UBOOT__
x509_public_key.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# a9b45e6e 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add oid registry utility

Imported from linux kernel v5.3:
build_OID_registry without changes
oid_registry.h without changes
oid_registry.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# ab8a0e06 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add asn1 decoder

Imported from linux kernel v5.3:
lib/asn1_decoder.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 2b12196d 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

cmd: add asn1_compiler

Imported from linux kernel v5.3:
asn1.h without changes
asn1_ber_bytecode.h without changes
asn1_decoder.h without changes
asn1_compiler.c without changes

This host command will be used to create a ASN1 parser, for example,
for pkcs7 messages or x509 certificates. More specifically, it will
generate *byte code* which will be interpreted by asn1 decoder library.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 05429b6c 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

rtc: move date.c from drivers/rtc/ to lib/

In the next commit, rtc_mktime(), for compatibility with linux, will be
implemented using rtc_mktime(), which is no longer drivers/rtc specific.
So move this file under lib/.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 37ef1774 10-Nov-2019 Thomas Hebb <tommyhebb@gmail.com>

Kconfig: disambiguate config names for tiny printf

27084c03d36a ("spl: Allow tiny printf() to be controlled in SPL and
TPL") split this option in two for TPL and SPL, but didn't change the
Kconfig names, making them hard to set quickly.

Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>

# 0d76afc0 27-Oct-2019 Simon Glass <sjg@chromium.org>

fdt: Add Kconfig options to control code size

For better or worse libfdt recent grew a lot of code that checks the
validity of the device tree in great detail. When using unsigned or
unverified data this makes things safer, but it does add to code size.

Add some controls to select the trade-off between safety and code size.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 27084c03 25-Sep-2019 Simon Glass <sjg@chromium.org>

spl: Allow tiny printf() to be controlled in SPL and TPL

At present there is only one control for this and it is used for both SPL
and TPL. But SPL might have a lot more space than TPL so the extra cost of
a full printf() might be acceptable.

Split the option into two, providing separate SPL and TPL controls. The
TPL setting defaults to the same as SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2a51e16b 07-Jun-2019 Tom Rini <trini@konsulko.com>

configs: Make USE_TINY_PRINTF depend on SPL||TPL and be default

The USE_TINY_PRINTF symbol only changes things within SPL and TPL
builds, so make it depend on that support. Next, make it default as
within these cases we should rarely have need of more advanced print
formats outside of the debug context.

To do this, in a few cases we need to correct our Kconfig dependencies
as we had cases of non-SPL targets select'ing this symbol. Finally, in
the case of a few boards we really do need the full printf
functionality.

Signed-off-by: Tom Rini <trini@konsulko.com>

# da0fb5fd 02-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: make call depth limit customizable

Up to now we had hard coded values for the call depth up to which trace
records are created: 200 for early tracing, 15 thereafter. UEFI
applications reach a call depth of 80 or above.

Provide customizing settings for the call trace depth limit and the early
call trace depth limit. Use the old values as defaults.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8509f22a 29-Apr-2019 Marek Behún <kabel@kernel.org>

lib: add Zstandard decompression support

Add the zstd library from Linux kernel (only decompression support).
There are minimal changes to build with U-Boot, otherwise the files are
identical to Linux commit dc35da16 from March 2018, the files had not
been touched since in kernel. Also SPDX lincese tags were added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 83a486b6 29-Apr-2019 Marek Behún <kabel@kernel.org>

lib: Add xxhash support

This adds the xxhash support from Linux. Files are almost identical to
those added to Linux in commit 5d240522 ("lib: Add xxhash module") (they
haven't been touched since in Linux). The only difference is to add some
includes to be compatible with U-Boot. Also SPDX lincese tags were
added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 5132361a 29-Apr-2019 Heiko Schocher <hs@denx.de>

lib: Kconfig: fix help text for GZIP

commit 95f4bbd581cf ("lib: fdt: Allow LZO and GZIP DT compression in U-Boot")

introduced Kconfig option for gzip in U-Boot, but help text
says gzip for SPL, which is wrong. Fix this.

Signed-off-by: Heiko Schocher <hs@denx.de>
Acked-by: Marek Vasut <marex@denx.de>

# 1c6eb075 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE_BUFFER_SIZE et al to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE_BUFFER_SIZE
CONFIG_TRACE_EARLY_SIZE
CONFIG_TRACE_EARLY
CONFIG_TRACE_EARLY_ADDR

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

# a24a78d7 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE

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

# 54969b40 21-Mar-2019 Thierry Reding <treding@nvidia.com>

fdtdec: Add Kconfig symbol for tests

Runtime tests are provided as a test_fdtdec command implementation. Add
a Kconfig symbol that allows this command to be built so that the tests
can be used.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 95f4bbd5 08-Mar-2019 Marek Vasut <marex@denx.de>

lib: fdt: Allow LZO and GZIP DT compression in U-Boot

Add required Kconfig symbols, Makefile bits and macro fixes in a
few places to support LZO and DT compression in U-Boot. This can
save a lot of space with multi-DTB fitImages.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>

# 6e705114 13-Jan-2019 Chris Packham <judge.packham@gmail.com>

lib: Kconfig: spelling fixes

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 048c6e89 06-Nov-2018 Simon Glass <sjg@chromium.org>

spl: lz4: Allow use of lz4 compression in SPL

In some cases U-Boot is compressed and it is useful to be able to
decompress it in SPL. Add a Kconfig and Makefile change to allow this.
Note that this does not actually implement decompression.

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

# 2895c4b7 15-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

kconfig: Introduce HAVE_ARCH_IOMAP

Introduce a new Kconfig option for architecture codes to control
whether it provides io{read,write}{8,16,32} I/O accessor functions.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5592a633 01-Oct-2018 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt in TPL

In some cases (e.g. sandbox with verified boot) it is useful to support
libfdt in TPL. Update the Kconfig to handle this.

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

# 6307896c 01-Oct-2018 Simon Glass <sjg@chromium.org>

tpm: Add support for SPL and TPL

At present the tpm can only be used in U-Boot proper. Updated it to work
in SPL and TPL also.

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

# ab948cd2 19-Jul-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

fdt_support: make FDT_FIXUP_PARTITIONS depend on CMD_MTDPARTS

fdt_fixup_mtdparts() calls mtdparts_init() and device_find(),
which are defined in cmd/mtdparts.c

The combination of FDT_FIXUP_PARTITIONS=y and CMD_MTDPARTS=n
emits the following link error:

common/fdt_support.c:903: undefined reference to `mtdparts_init'
common/fdt_support.c:914: undefined reference to `device_find'

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 3330584d 03-Jun-2018 Igor Opaniuk <igor.opaniuk@gmail.com>

avb2.0: integrate avb 2.0 into the build system

Integrate libavb into the build system. Introduce CONFIG_LIBAVB
build option.

Signed-off-by: Igor Opaniuk <igor.opaniuk@linaro.org>

# f8c987f8 05-Jun-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

lib: Add hexdump

Often during debugging session it's very interesting to see
what data we were dealing with. For example what we write or read
to/from memory or peripherals.

This change introduces functions that allow to dump binary
data with one simple function invocation like:
------------------->8----------------
print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, buf, len);
------------------->8----------------

which gives us the following:
------------------->8----------------
00000000: f2 b7 c9 88 62 61 75 64 72 61 74 65 3d 31 31 35 ....baudrate=115
00000010: 32 30 30 00 62 6f 6f 74 61 72 67 73 3d 63 6f 6e 200.bootargs=con
00000020: 73 6f 6c 65 3d 74 74 79 53 33 2c 31 31 35 32 30 sole=ttyS3,11520
00000030: 30 6e 38 00 62 6f 6f 74 64 65 6c 61 79 3d 33 00 0n8.bootdelay=3.
00000040: 62 6f 6f 74 66 69 6c 65 3d 75 49 6d 61 67 65 00 bootfile=uImage.
00000050: 66 64 74 63 6f 6e 74 72 6f 6c 61 64 64 72 3d 39 fdtcontroladdr=9
00000060: 66 66 62 31 62 61 30 00 6c 6f 61 64 61 64 64 72 ffb1ba0.loadaddr
00000070: 3d 30 78 38 32 30 30 30 30 30 30 00 73 74 64 65 =0x82000000.stde
00000080: 72 72 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 rr=serial0@e0022
00000090: 30 30 30 00 73 74 64 69 6e 3d 73 65 72 69 61 6c 000.stdin=serial
000000a0: 30 40 65 30 30 32 32 30 30 30 00 73 74 64 6f 75 0@e0022000.stdou
000000b0: 74 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 30 t=serial0@e00220
000000c0: 30 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00..............
...
------------------->8----------------

Source of hexdump.c was copied from Linux kernel v4.7-rc2.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Mario Six <mario.six@gdsys.cc>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Stefan Roese <sr@denx.de>

# c232d14d 29-May-2018 Alex Kiernan <alex.kiernan@gmail.com>

mmc: Separate "mmc swrite" from fastboot

Introduce CONFIG_IMAGE_SPARSE and CONFIG_CMD_MMC_SWRITE so the "mmc
swrite" command is separated from the fastboot code.

Move image-sparse from common to lib so it's clear it's library code.

Rename CONFIG_FASTBOOT_FLASH_FILLBUF_SIZE to CONFIG_IMAGE_SPARSE_FILLBUF_SIZE
and migrate it to Kconfig.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Acked-by: Jassi Brar <jaswinder.singh@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6417572e 08-May-2018 Tom Rini <trini@konsulko.com>

lib/Kconfig: Mark OF_LIBFDT_OVERLAY as depending on OF_LIBFDT

The overlay code is only useful when OF_LIBFDT is set, so mark it as
depending on that first.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 58a46f88 25-Apr-2018 Praneeth Bajjuri <praneeth@ti.com>

configs: TI: Enable FIT Library overlay support

Enable the FDT library overlay support for all TI SOC family.

Without this option, when Loading fdt from FIT image, the
following warning is seen.

"config with overlays but CONFIG_OF_LIBFDT_OVERLAY not set".

Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
Suggested-by: Andrew F.Davis <afd@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>

# 14ad44ab 18-Apr-2018 Alex Kiernan <alex.kiernan@gmail.com>

spl: Split sprintf, strto* from SPL serial in Kconfig

When SPL serial is disabled, callers who need sprintf or strtoul fail
because their inclusion is guarded by CONFIG_SPL_SERIAL_SUPPORT/
CONFIG_TPL_SERIAL_SUPPORT.

Split printf, sprintf and strto into their own entries and then select
all of them if SERIAL_SUPPORT is enabled to match the current behaviour.

Include panic.o unconditionally as it can be called from anywhere which
uses BUG_ON().

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>

# e294ba06 04-Apr-2018 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-sunxi

Signed-off-by: Tom Rini <trini@konsulko.com>


# d14db11d 03-Apr-2018 Andre Przywara <andre.przywara@arm.com>

sunxi: revert disabling of features

In January some commits were introduced to mitigate the U-Boot image
size issues we encountered on sunxi builds.
Now with the MMC environment removed we can bring them back, as we
practically don't have a size limit anymore.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 32ce6179 13-Mar-2018 Bryan O'Donoghue <bryan.odonoghue@linaro.org>

optee: Add lib entries for sharing OPTEE code across ports

This patch adds code to lib to enable sharing of useful OPTEE code between
board-ports and architectures. The code on lib/optee/optee.c comes from the
TI omap2 port. Eventually the OMAP2 code will be patched to include the
shared code. The intention here is to add more useful OPTEE specific code
as more functionality gets added.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Cc: Harinarayan Bhatta <harinarayan@ti.com>
Cc: Andrew F. Davis <afd@ti.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Kever Yang <kever.yang@rock-chips.com>
Cc: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Cc: Peng Fan <peng.fan@nxp.com>
Tested-by: Peng Fan <peng.fan@nxp.com>

# 36c1877c 06-Feb-2018 Faiz Abbas <faiz_abbas@ti.com>

lib: Kconfig: Move DYNAMIC_CRC_TABLE to Kconfig

Add CONFIG prefix to DYNAMIC_CRC_TABLE and implement it in
Kconfig.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>

# a451bc27 05-Feb-2018 Adam Ford <aford173@gmail.com>

Convert LIB_UUID to Kconfig

config_fallback.h has some logic that checks a variety of options
and selects LIB_UUID if it hasn't already been selected. This
will all LIB_UUID in Kconfig and select this option for the list
of options to allow us to remove the logic from fallbacks

Signed-off-by: Adam Ford <aford173@gmail.com>

# a5a37567 06-Feb-2018 Adam Ford <aford173@gmail.com>

Convert CONFIG LIB_HW_RAND to Kconfig

config_fallbacks.h had some logic to automatically select
LIB_RAND if RANDOM_UUID or CMD_UUID were set if LIB_HW_RAND wasn't
already selected. By migrating LIB_HW_RAND to Kconfig, we can
remove this check from config_fallbacks.h and put it into Kconfig

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
[trini: Turn into a choice, add NET_RANDOM_ETHADDR]
Signed-off-by: Tom Rini <trini@konsulko.com>

# acd4d334 16-Jan-2018 Maxime Ripard <maxime.ripard@free-electrons.com>

net: regex: Disable by default on sunXi

The sunXi arm64 build has overflown, leading to the main U-boot binary
overwriting the environment when flashing the new image, or even worse,
overwriting itself when we're calling saveenv.

Disable this option that is not critical until we can adress the issue
properly.

Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 7e3caa81 03-Dec-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

Move CONFIG_PANIC_HANG to Kconfig

Freescale (NXP) boards have lots of defconfig files per board.
I used "imply PANIC_HANG" for them.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# da5337a6 08-Nov-2017 Nandor Han <nandor.han@ge.com>

rtc: add support for s35392a

Add support for S35392A RTC. The driver supports both U-Boot driver
models.

Signed-off-by: Nandor Han <nandor.han@ge.com>
Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
Cc: Heiko Schocher <hs@denx.de>

# f52bdf4b 14-Sep-2017 Jean-Jacques Hiblot <jjhiblot@ti.com>

lib: allow building lzo for the SPL

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 85d8bf57 03-Sep-2017 Marek Behún <kabel@kernel.org>

lib: Add CRC32-C

This is needed for BTRFS.

Signed-off-by: Marek Behun <marek.behun@nic.cz>

create mode 100644 lib/crc32c.c

# 7264f292 15-Aug-2017 York Sun <york.sun@nxp.com>

spl: fit: Eanble GZIP support for image decompression

Add Kconfig option SPL_GZIP and SPL_ZLIB to enable gunzip support for
SPL boot, eg. falcon boot compressed kernel image.

Signed-off-by: York Sun <york.sun@nxp.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6ef2f901 11-Aug-2017 Adam Ford <aford173@gmail.com>

Convert CONFIG_BCH to Kconfig

This converts the following to Kconfig:
CONFIG_BCH

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1a7ba1d 18-Aug-2017 Anatolij Gustschin <agust@denx.de>

Fix 'notes' typos

s/notes/nodes

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 96b9082c 03-Aug-2017 Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

rockchip: rk3188: rock: adjust for SPL/TPL split

With the changes to split SPL/TPL for the RK3368, I apparently missed
some needed adjustments to the RK3188 Kconfig and rock_defconfig.

This fixes build-issues for the rock board after applying the RK3368
enablement (and SPL/TPL) set that resulted from TPL_SERIAL_SUPPORT,
TPL_ROCKCHIP_BACK_TO_BROM and TPL_TINY_MEMSET being separate symbols
now.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d56b4b19 22-Jul-2017 Tom Rini <trini@konsulko.com>

configs: Migrate RBTREE, LZO, CMD_MTDPARTS, CMD_UBI and CMD_UBIFS

The above CONFIG options are in Kconfig, and now have correct depends and
inter-dependencies. Migrate these to configs/ from include/configs/. In the
case of CMD_UBIFS also change it to be a default y if CMD_UBI.

Signed-off-by: Tom Rini <trini@konsulko.com>

# aed998aa 17-May-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_LZMA to Kconfig

This converts the following to Kconfig:
CONFIG_LZMA

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

# b1a873df 26-Apr-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_CMD_AES et al to Kconfig

This converts the following to Kconfig:
CONFIG_CMD_AES
CONFIG_AES

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Add select AES to CMD_AES]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 173aafbf 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

cmd: Expose a Kconfig option to enable UBIFS commands

Create a new Kconfig entry to allow CMD_UBIFS selection from Kconfig and
add an hidden LZO option that can be selected by CMD_UBIFS.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>

# aa049152 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

mtd: ubi: Select RBTREE option from MTD_UBI Kconfig entry

Expose the RBTREE feature through Kconfig and select this option from the
MTD_UBI option.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>
[Rebased on master]
Signed-off-by: Jagan Teki <jagan@openedev.com>

# ab4458bd 02-Apr-2017 Simon Glass <sjg@chromium.org>

string: Provide a slimmed-down memset()

Most of the time the optimised memset() is what we want. For extreme
situations such as TPL it may be too large. For example on the 'rock'
board, using a simple loop saves a useful 48 bytes. With gcc 4.9 and
the rodata bug, this patch is enough to reduce the TPL image below the
limit.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>

# bea79d7d 14-Mar-2017 Andre Przywara <andre.przywara@arm.com>

Kconfig: introduce md5sum command selection

So far CONFIG_MD5SUM would need to be set by a board's include file.
Since the command is really generic, move it over to Kconfig to allow
it to be defined by either a board's defconfig, menuconfig or some
config snippet merged via mergeconfig.sh.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e663b350 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

smbios: Expose in efi_loader as table

We can pass SMBIOS easily as EFI configuration table to an EFI payload. This
patch adds enablement for that case.

While at it, we also enable SMBIOS generation for ARM systems, since they support
EFI_LOADER.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4b6dddc2 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

x86: Move smbios generation into arch independent directory

We will need the SMBIOS generation function on ARM as well going forward,
so let's move it into a non arch specific location.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# ebf7fff2 05-Oct-2016 Heiko Schocher <hs@denx.de>

spl: move FDT_FIXUP_PARTITIONS to Kconfig

Move FDT_FIXUP_PARTITIONS to Kconfig and cleanup existing
uses.

Signed-off-by: Heiko Schocher <hs@denx.de>

# ddf67f71 05-Jul-2016 Maxime Ripard <maxime.ripard@free-electrons.com>

libfdt: Add overlay application function

The device tree overlays are a good way to deal with user-modifyable
boards or boards with some kind of an expansion mechanism where we can
easily plug new board in (like the BBB, the Raspberry Pi or the CHIP).

Add a new function to merge overlays with a base device tree.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>

# 91b86e21 26-May-2016 Marek Vasut <marex@denx.de>

lib: Enable private libgcc by default

This patch decouples U-Boot binary from the toolchain on systems where
private libgcc is available. Instead of pulling in functions provided
by the libgcc from the toolchain, U-Boot will use it's own set of libgcc
functions. These functions are usually imported from Linux kernel, which
also uses it's own libgcc functions instead of the ones provided by the
toolchain.

This patch solves a rather common problem. The toolchain can usually
generate code for many variants of target architecture and often even
different endianness. The libgcc on the other hand is usually compiled
for one particular configuration and the functions provided by it may
or may not be suited for use in U-Boot. This can manifest in two ways,
either the U-Boot fails to compile altogether and linker will complain
or, in the much worse case, the resulting U-Boot will build, but will
misbehave in very subtle and hard to debug ways.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 67976306 30-Mar-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

cosmetic: Fix typos "privide"

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# ed980b8c 03-Mar-2016 Alexander Graf <agraf@csgraf.de>

efi_loader: hook up in build environment

Now that we have all the bits and pieces ready for EFI payload loading
support, hook them up in Makefiles and KConfigs so that we can build.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
[trini: Enable only when we of OF_LIBFDT, disable on kwb and colibri_pxa270]
Signed-off-by: Tom Rini <trini@konsulko.com>

# aa34fbc0 22-Feb-2016 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt to be used in SPL

Add an option to enable libfdt in SPL. This can be useful when decoding
FIT files in SPL.

We need to make sure this option is not enabled in SPL by this change.
Also this option needs to be enabled in host builds. Si add a new
IMAGE_USE_LIBFDT #define which can be used in files that are built on the
host but must also build for U-Boot and SPL.

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

# 69e173eb 22-Feb-2016 Simon Glass <sjg@chromium.org>

Move CONFIG_OF_LIBFDT to Kconfig

Move this option to Kconfig and tidy up existing boards.

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

# a187559e 05-Feb-2016 Bin Meng <bmeng.cn@gmail.com>

Use correct spelling of "U-Boot"

Correct spelling of "U-Boot" shall be used in all written text
(documentation, comments in source files etc.).

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Minkyu Kang <mk7.kang@samsung.com>

# 947c626d 14-Jan-2016 Tom Rini <trini@konsulko.com>

vsprintf.c: Always enable CONFIG_SYS_VSNPRINTF

Enabling this function always removes some class of string saftey issues.
The size change here in general is about 400 bytes and this seems a reasonable
trade-off.

Cc: Peng Fan <peng.fan@nxp.com>
Cc: Peter Robinson <pbrobinson@gmail.com>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Adrian Alonso <aalonso@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 7d9cde10 22-Nov-2015 Stefan Roese <sr@denx.de>

lib/tiny-printf.c: Add tiny printf function for space limited environments

This patch adds a small printf() version that supports all basic formats.
Its intented to be used in U-Boot SPL versions on platforms with very
limited internal RAM sizes.

To enable it, just define CONFIG_USE_TINY_PRINTF in your defconfig. This
will result in the SPL using this tiny function and the main U-Boot
still using the full-blown printf() function.

This code was copied from:
http://www.sparetimelabs.com/printfrevisited
With mostly only coding style related changes so that its checkpatch
clean.

The size reduction is about 2.5KiB. Here a comparison for the db-mv784mp-gp
(Marvell AXP) SPL:

Without this patch:
58963 18536 1928 79427 13643 ./spl/u-boot-spl

With this patch:
56542 18536 1956 77034 12cea ./spl/u-boot-spl

Note:
To make it possible to compile tiny-printf.c instead of vsprintf.c when
CONFIG_USE_TINY_PRINTF is defined, the functions printf() and vprintf() are
moved from common/console.c into vsprintf.c in this patch.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>

# 2419cd16 03-Oct-2015 Simon Glass <sjg@chromium.org>

dm: tpm: Drop CONFIG_DM_TPM

Now that all TPM drivers use driver model, we can drop the special driver
model CONFIG option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>

# 027b728d 06-Oct-2015 Julius Werner <jwerner@chromium.org>

Add support for LZ4 decompression algorithm

This patch adds support for LZ4-compressed FIT image contents. This
algorithm has a slightly worse compression ration than LZO while being
nearly twice as fast to decompress. When loading images from a fast
storage medium this usually results in a boot time win.

Sandbox-tested only since I don't have a U-Boot development system set
up right now. The code was imported unchanged from coreboot where it's
proven to work, though. I'm mostly interested in getting this recognized
by mkImage for use in a downstream project.

Signed-off-by: Julius Werner <jwerner@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# a7d660bc 22-Aug-2015 Simon Glass <sjg@chromium.org>

tpm: Add Kconfig options for TPMs

Add new Kconfig options for TPMs in preparation for moving boards to use
Kconfig for TPM configuration.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 867a6ac8 31-Jul-2015 Simon Glass <sjg@chromium.org>

efi: Add start-up library code

When running as an EFI application, U-Boot must request memory from EFI,
and provide access to the boot services U-Boot needs.

Add library code to perform these tasks. This includes efi_main() which is
the entry point from EFI. U-Boot is built as a shared library.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d1389403 23-Jun-2015 Simon Glass <sjg@chromium.org>

Add a dhrystone benchmark command

Drystone provides a convenient sanity check that the CPU is running at full
speed. Add this as a command which can be enabled as needed.

Note: I investigated using Coremark for this but there was a license
agreement and I could not work out if it was GPL-compatible.

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

# f7848d90 22-Jun-2015 Joe Hershberger <joe.hershberger@ni.com>

Allow CONFIG_REGEX to be disabled when CONFIG_NET

Instead of selecting REGEX when NET is enabled, make it the default, but
allow boards that are tiny to disable it and lose functionality on all
but the first Ethernet adapter.

cm-bf548, bf538f-ezkit, and bf533-stamp need this. None appear to have
more than one Ethernet interface.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# 3850dbe8 11-Jun-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

blackfin: fix undefined reference to srand and rand

Commit 9ba9e85f3f1c (net: Fix NET_RANDOM_ETHADDR dependencies)
accidentally dropped CONFIG_LIB_RAND defines for 14 Blackfin boards.

Prior to that commit, those boards defined CONFIG_LIB_RAND, but not
CONFIG_NET_RANDOM_ETHADDR. So, commit 9ba9e85f3f1c should not have
touched them, but in fact it ripped CONFIG_LIB_RAND off from all the
header files, which caused undefined reference to srand and rand.
CONFIG_LIB_RAND=y must be revived for such boards.

BTW, this commit indeed makes it better, but even with this fix,
three boards (bf533-stamp, bf538f-ezkit, cm-bf548) still can not
build due to region 'ram' overflowed error. This was cause by
commit 6eed3786c68c (net: Move the CMD_NET config to defconfigs)
because CMD_NET selects NET, and NET selects REGEX. Eventually,
some boards were newly enabled with CONFIG_REGEX, increasing the
memory footprint. A patch is expected to fix the build error.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 9ba9e85f 25-May-2015 Michal Simek <michal.simek@amd.com>

net: Fix NET_RANDOM_ETHADDR dependencies

NET_RANDOM_ETHADDR depends on lib/rand.c. This patch adds dependency to
Kconfig to ensure that library is also compiled.

Remove the definitions from Blackfin boards' include/configs.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 6501ff62 20-Apr-2015 Przemyslaw Marczak <p.marczak@samsung.com>

lib: Kconfig: add entry for errno_str() function

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1a60650c 21-Apr-2015 Joe Hershberger <joe.hershberger@ni.com>

kconfig: Move REGEX to Kconfig

Having this as a Kconfig allows it to be a dependent feature.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8156345d 06-Mar-2015 Simon Glass <sjg@chromium.org>

sandbox: Move CONFIG_SYS_VSNPRINTF to Kconfig

Move this over to Kconfig and tidy up.

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

# 94e3c8c4 19-Feb-2015 gaurav rana <gaurav.rana@freescale.com>

crypto/fsl - Add progressive hashing support using hardware acceleration.

Currently only normal hashing is supported using hardware acceleration.
Added support for progressive hashing using hardware.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
Signed-off-by: Gaurav Rana <gaurav.rana@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>

# d9f23c7f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

lib/rsa: Add Kconfig for devices supporting RSA Modular Exponentiation

Kconfig option added for devices which support RSA Verification.
1. RSA_SOFTWARE_EXP
Enables driver for supporting RSA Modular Exponentiation in Software
2. RSA_FREESCALE_EXP
Enables driver for supporting RSA Modular Exponentiation using Freescale specific
driver

The above drivers use RSA uclass

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
(Removed duplicate line in Kconfig comment)

Change-Id: I7663c4d5350e2bfc3dfa2696f70ef777d6ccc6f6

# c4beb22f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

FIT: Modify option FIT_SIGNATURE in Kconfig

For FIT signature based approach to work, RSA library needs to be selected.
The FIT_SIGNATURE option in Kconfig is modified to automatically select RSA.
Selecting RSA compiles the RSA library required for image verification.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 45ccec8f 23-Oct-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

kconfig: move CONFIG_USE_PRIVATE_LIBGCC to Kconfig

The private libgcc is supported only on ARM, MIPS, PowerPC, SH, x86.
Those architectures should "select" HAVE_PRIVATE_LIBGCC and
CONFIG_USE_PRIVATE_LIBGCC should depend on it.

Currently, this option is enabled on Tegra boards and x86 architecture.
Move the definition from header files to Kconfig.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Tested-by: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: Tom Warren <twarren@nvidia.com>

# 8c688bc4 23-Oct-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

kconfig: move CONFIG_SYS_HZ to lib/Kconfig

CONFIG_SYS_HZ is always defined as 1000 in config_fallbacks.h
(but some boards still have redundant definitions).

This commit moves the definition and the document in README to
Kconfig. Since lib/Kconfig can assure that CONFIG_SYS_HZ is 1000,
the sanity check in lib/time.c should be removed.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Reviewed-by: Marek Vasut <marex@denx.de>

# b0928da6 16-Sep-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

kconfig: move CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED to Kconfig

If this option is enabled, the objects under lib/ directory
are compiled with speed optimization, not size optimization.
(Currently, only used by some Blackfin boards.)

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# ed36323f 16-Sep-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

kconfig: add blank Kconfig files

This would be useful to start moving various config options.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# 14f43797 19-Dec-2022 Tom Rini <trini@konsulko.com>

Merge tag 'v2023.01-rc4' into next

Prepare v2023.01-rc4

Signed-off-by: Tom Rini <trini@konsulko.com>


# ae3527f0 07-Dec-2022 Kautuk Consul <kconsul@ventanamicro.com>

arch/riscv: add semihosting support for RISC-V

We add RISC-V semihosting based serial console for JTAG based early
debugging.

The RISC-V semihosting specification is available at:
https://github.com/riscv/riscv-semihosting-spec/blob/main/riscv-semihosting-spec.adoc

Signed-off-by: Anup Patel <apatel@ventanamicro.com>
Signed-off-by: Kautuk Consul <kconsul@ventanamicro.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>

# 1c03ab9f 07-Dec-2022 Kautuk Consul <kconsul@ventanamicro.com>

lib: Add common semihosting library

We factor out the arch-independent parts of the ARM semihosting
implementation as a common library so that it can be shared
with RISC-V.

Signed-off-by: Kautuk Consul <kconsul@ventanamicro.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>

# 3b8dfc42 16-Nov-2022 Tom Rini <trini@konsulko.com>

Convert CONFIG_SYS_TIMER_COUNTS_DOWN to Kconfig

This converts the following to Kconfig:
CONFIG_SYS_TIMER_COUNTS_DOWN

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 86794052 21-Oct-2022 Sughosh Ganu <sughosh.ganu@linaro.org>

FWU: Add support for the FWU Multi Bank Update feature

The FWU Multi Bank Update feature supports updating firmware images
to one of multiple sets(also called banks) of images. The firmware
images are clubbed together in banks, with the system booting images
from the active bank. Information on the images such as which bank
they belong to is stored as part of the metadata structure, which is
stored on the same storage media as the firmware images on a dedicated
partition.

At the time of update, the metadata is read to identify the bank to
which the images need to be flashed(update bank). On a successful
update, the metadata is modified to set the updated bank as active
bank to subsequently boot from.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

# 40ed7be4 02-Aug-2022 Tom Rini <trini@konsulko.com>

Convert CONFIG_SYS_FDT_PAD to Kconfig

This converts the following to Kconfig:
CONFIG_SYS_FDT_PAD

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e67ffb5a 22-Jul-2022 Sughosh Ganu <sughosh.ganu@linaro.org>

tpm: rng: Add driver model interface for TPM RNG device

The TPM device has a builtin random number generator(RNG)
functionality. Expose the RNG functions of the TPM device to the
driver model so that they can be used by the EFI_RNG_PROTOCOL if the
protocol is installed.

Also change the function arguments and return type of the random
number functions to comply with the driver model api.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

# b340199f 10-Jun-2022 Tom Rini <trini@konsulko.com>

spl: Ensure all SPL symbols in Kconfig have some SPL dependency

Tighten up symbol dependencies in a number of places. Ensure that a SPL
specific option has at least a direct dependency on SPL. In places
where it's clear that we depend on something more specific, use that
dependency instead. This means in a very small number of places we can
drop redundant dependencies.

Reported-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 13ce351b 08-Jun-2022 Tom Rini <trini@konsulko.com>

vpl: Ensure all VPL symbols in Kconfig have some VPL dependency

Tighten up symbol dependencies in a number of places. Ensure that a VPL
specific option has at least a direct dependency on VPL. In places
where it's clear that we depend on something more specific, use that
dependency instead.

Reported-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 8bea4bf7 08-Jun-2022 Tom Rini <trini@konsulko.com>

tpl: Ensure all TPL symbols in Kconfig have some TPL dependency

Tighten up symbol dependencies in a number of places. Ensure that a TPL
specific option has at least a direct dependency on TPL. In places
where it's clear that we depend on something more specific, use that
dependency instead.

Reported-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 26f981f2 19-May-2022 Rasmus Villemoes <rasmus.villemoes@prevas.dk>

fdtdec: drop needlessly convoluted CONFIG_PHANDLE_CHECK_SEQ

Asking if the alias we found actually points at the device tree node
we passed in (in the guise of its offset from blob) can be done simply
by asking if the fdt_path_offset() of the alias' path is identical to
offset.

In fact, the current method suffers from the possibility of false
negatives: dtc does not necessarily emit a phandle property for a node
just because it is referenced in /aliases; it only emits a phandle
property for a node if it is referenced in <angle brackets>
somewhere. So if both the node we passed in and the alias node we're
considering don't have phandles, fdt_get_phandle() returns 0 for both.

Since the proper check is so simple, there's no reason to hide that
behind a config option (and if one really wanted that, it should be
called something else because there's no need to involve phandle in
the check).

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Acked-by: Aswath Govindraju <a-govindraju@ti.com>

# d30924f1 01-May-2022 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: fix selection of CONFIG_CHARSET

lib/charset.c is not optional for
EFI_APP || EFI_LOADER || UFS || UT_UNICODE.
These must select CONFIG_CHARSET.

Fixes: 726cd9836db0 ("efi: Make unicode printf available to the app")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>

# 747093dd 30-Apr-2022 Simon Glass <sjg@chromium.org>

vpl: Add Kconfig options for VPL

Add VPL versions of commonly used Kconfig options.

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

# 11232139 06-Apr-2022 Tom Rini <trini@konsulko.com>

nds32: Remove the architecture

As removal of nds32 has been ack'd for the Linux kernel, remove support
here as well.

Cc: Rick Chen <rick@andestech.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Rick Chen <rick@andestech.com>

# fd210fee 28-Mar-2022 Philippe Reynes <philippe.reynes@softathome.com>

lib: allow to build asn1 decoder and oid registry in SPL

This commit adds the options:
- SPL_ASN1_DECODER
- SPL_OID_REGISTRY

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>

# 7d44a985 28-Mar-2022 Philippe Reynes <philippe.reynes@softathome.com>

lib: Kconfig: enhance the help of OID_REGISTRY

Enhance the help for the config OID_REGISTRY.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>

# a0e71d96 28-Mar-2022 Philippe Reynes <philippe.reynes@softathome.com>

lib: Kconfig: enhance help for ASN1

Enhance the help for configs ASN1_COMPILER
and ASN1_decoder.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>

# 761a1786 27-Jan-2022 Tom Rini <trini@konsulko.com>

Merge tag 'dm-pull-26jan22' of https://source.denx.de/u-boot/custodians/u-boot-dm

acpi refactoring to allow non-x86 use
binman support for bintools (binary tools)
minor tools improvements in preparation for FDT signing
various minor fixes and improvements


# 334a9b9d 25-Nov-2021 Loic Poulain <loic.poulain@linaro.org>

lib/circbuf: Make circbuf selectable symbol

It is currenly only used from usbtty driver but make it properly
selectable via Kconfig symbol, for future usage.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>

# e1722fcb 01-Dec-2021 Simon Glass <sjg@chromium.org>

x86: Allow any arch to generate ACPI tables

These have sadly found their way to ARM now. Allow any arch to support
generating ACPI tables.

Disable this for the tools build.

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

# 7c3fd5c2 26-Dec-2021 Qu Wenruo <wqu@suse.com>

lib: add BLAKE2 hash support

The code is cross-ported from BLAKE2 reference implementation
(https://github.com/BLAKE2/BLAKE2).

With minimal change to remove unused macros/features.

Currently there is only one user inside U-boot (btrfs), and since it
only utilize BLAKE2B, all other favors are all removed.

Signed-off-by: Qu Wenruo <wqu@suse.com>
[trini: Rename ROUND to R to avoid clash with <linux/bitops.h>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 97f2a749 04-Jan-2022 Eugen Hristev <eugen.hristev@microchip.com>

lib: Kconfig: fix PHANDLE_CHECK_SEQ position outside of menu

CONFIG_PHANDLE_CHECK_SEQ is outside of the menu 'Library routines'
thus it's invisible in menuconfig and cannot be selected.
Fix this by moving the 'endmenu' after the PHANDLE_CHECK_SEQ definition

Fixes: c589132a1d ("fdt: Use phandle to distinguish DT nodes with same name")
Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
Reviewed-by: Aswath Govindraju <a-govindraju@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 726cd983 29-Dec-2021 Simon Glass <sjg@chromium.org>

efi: Make unicode printf available to the app

This is needed to show unicode strings. Enable this code in the app.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>

# 6405ab7a 24-Nov-2021 Simon Glass <sjg@chromium.org>

Convert CONFIG_PHYSMEM to Kconfig

This converts the following to Kconfig:
CONFIG_PHYSMEM

Signed-off-by: Simon Glass <sjg@chromium.org>
Suggested-by: Sean Anderson <seanga2@gmail.com>

# ac7606af 14-Nov-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

lmb: fix typo 'commun'

%s/commun/common/

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

# e7d285b2 25-Sep-2021 Simon Glass <sjg@chromium.org>

image: Use the correct checks for CRC32

Add a host Kconfig for CRC32. With this we can use CONFIG_IS_ENABLED(CRC32)
directly in the host build, so drop the unnecessary indirection.

Add a few more conditions to SPL_CRC32 to avoid build failures as well as
TPL_CRC32. Also update hash.c to make crc32 optional and to actually take
notice of SPL_CRC32.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# 2c21256b 25-Sep-2021 Simon Glass <sjg@chromium.org>

hash: Use Kconfig to enable hashing in host tools and SPL

At present when building host tools, we force CONFIG_SHAxxx to be enabled
regardless of the board Kconfig setting. This is done in the image.h
header file.

For SPL we currently just assume the algorithm is desired if U-Boot proper
enables it.

Clean this up by adding new Kconfig options to enable hashing on the host,
relying on CONFIG_IS_ENABLED() to deal with the different builds.

Add new SPL Kconfigs for hardware-accelerated hashing, to maintain the
current settings.

This allows us to drop the image.h code and the I_WANT_MD5 hack.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# 603d15a5 25-Sep-2021 Simon Glass <sjg@chromium.org>

spl: cypto: Bring back SPL_ versions of SHA

Unfortunately these were removed by mistake. This means that adding hash
support to SPL brings in all software algorithms, with a substantial
increase in code size.

The origin of the problem was renaming them to SPL_FIT_xxx and then these
were removed altogether in a later commit.

Add them back. This aligns with CONFIG_MD5, for example, which has an SPL
variant.

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: f5bc9c25f31 ("image: Rename SPL_SHAxxx_SUPPORT to SPL_FIT_SHAxxx")
Fixes: eb5171ddec9 ("common: Remove unused CONFIG_FIT_SHAxxx selectors")
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# 6674edaa 16-Sep-2021 Tom Rini <trini@konsulko.com>

Merge tag 'v2021.10-rc4' into next

Prepare v2021.10-rc4

Signed-off-by: Tom Rini <trini@konsulko.com>

# gpg: Signature made Tue 14 Sep 2021 06:58:32 PM EDT
# gpg: using RSA key 1A3C7F70E08FAB1707809BBF147C39FF9634B72C
# gpg: Good signature from "Thomas Rini <trini@konsulko.com>" [ultimate]

# Conflicts:
# board/Arcturus/ucp1020/spl.c
# cmd/mvebu/Kconfig
# common/Kconfig.boot
# common/image-fit.c
# configs/UCP1020_defconfig
# configs/sifive_unmatched_defconfig
# drivers/pci/Kconfig
# include/configs/UCP1020.h
# include/configs/sifive-unmatched.h
# lib/Makefile
# scripts/config_whitelist.txt


# 5145bc73 01-Sep-2021 Oleksandr Suvorov <oleksandr.suvorov@foundries.io>

lib: fix typos in Kconfig

There are trivial typos in the Kconfig file. Fixed them.
Also, fixed grammar in the descriptions with typos.

Fixes: d56b4b1974 ("configs: Migrate RBTREE, LZO, CMD_MTDPARTS, CMD_UBI and CMD_UBIFS")
Fixes: 7264f2928b ("spl: fit: Eanble GZIP support for image decompression")
Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# e60e4499 02-Sep-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

lib: Drop SHA512_ALGO in lieu of SHA512

SHA512_ALGO was used as a "either SHA512 or SHA384", although the
implementations of these two algorithms share a majority of code.

From a Kconfig interface perspective, it makes sense to present two
distinct options. This requires #ifdefing out the SHA512
implementation from sha512.c. The latter doesn't make any sense.

It's reasonable to say in Kconfig that SHA384 depends on SHA512, and
seems to be the more polite way to handle the selection.

Thus, automatically select SHA512 when SHA384 is enabled.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# b4c2c151 27-Aug-2021 Michal Simek <michal.simek@amd.com>

Kconfig: Remove all default n/no options

default n/no doesn't need to be specified. It is default option anyway.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
[trini: Rework FSP_USE_UPD portion]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 928a8be7 29-Jul-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

lib: ecdsa: Implement UCLASS_ECDSA verification on target

Implement the crypto_algo .verify() function for ecdsa256. Because
it backends on UCLASS_ECDSA, this change is focused on parsing the
keys from devicetree and passing this information to the specific
UCLASS driver.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# fa3f1f1d 24-Jul-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: disable CONFIG_SPL_HEXDUMP by default

CONFIG_HEXDUMP is needed to display UEFI variables using 'printenv -e'.

Enabling CONFIG_SPL_HEXDUMP only makes sense for debugging purposes.
Hence CONFIG_SPL_HEXDUMP should not be enabled by default.

The following boards currently have CONFIG_SPL_HEXDUMP=y. This includes
boards that don't use SPL at all.

axm_defconfig
imx8mm-cl-iot-gate_defconfig
imx8mm_venice_defconfig
imxrt1020-evk_defconfig
imxrt1050-evk_defconfig
kontron_sl28_defconfig
kp_imx53_defconfig
lx2160ardb_tfa_stmm_defconfig
mt7622_rfb_defconfig
octeon_ebb7304_defconfig
octeon_nic23_defconfig
qemu_arm64_defconfig
qemu_arm_defconfig
qemu-riscv32_defconfig
qemu-riscv32_smode_defconfig
qemu-riscv64_defconfig
qemu-riscv64_smode_defconfig
qemu-x86_64_defconfig
qemu-x86_defconfig
sandbox64_defconfig
sandbox_defconfig
stm32mp15_basic_defconfig
stm32mp15_trusted_defconfig
synquacer_developerbox_defconfig
taurus_defconfig
xilinx_versal_virt_defconfig

The patch only keeps it enabled on

sandbox_spl_defconfig

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 1a46cb6c 02-Jul-2021 Simon Glass <sjg@chromium.org>

lib: Create a new Kconfig option for charset conversion

Rather than looking at two KConfig options in the Makefile, create a new
Kconfig option for compiling lib/charset.c

Enable it for UFS also, which needs this support.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 26dd9936 08-Jul-2021 Steffen Jaeckel <jaeckel-floss@eyet-services.de>

lib: add crypt subsystem

Add the basic functionality required to support the standard crypt
format.
The files crypt-sha256.c and crypt-sha512.c originate from libxcrypt and
their formatting is therefor retained.
The integration is done via a crypt_compare() function in crypt.c.

```
libxcrypt $ git describe --long --always --all
tags/v4.4.17-0-g6b110bc
```

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 7d0f3fbb 11-Jun-2021 Tero Kristo <t-kristo@ti.com>

lib: rational: copy the rational fraction lib routines from Linux

Copy the best rational approximation calculation routines from Linux.
Typical usecase for these routines is to calculate the M/N divider
values for PLLs to reach a specific clock rate.

This is based on linux kernel commit:
"lib/math/rational.c: fix possible incorrect result from rational
fractions helper"
(sha1: 323dd2c3ed0641f49e89b4e420f9eef5d3d5a881)

Signed-off-by: Tero Kristo <t-kristo@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Tero Kristo <kristo@kernel.org>

# ec0512b1 24-May-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

Revert "lib: introduce HASH_CALCULATE option"

When we think of Kconfig, we usually think of features that we like
to enable or not. Ideally, we wouldn't use Kconfig to fix a build
issue, although sometimes it might make sense. With Kconfig it's hard
to guarantee that the fix is universal. We can only say that it works
for the set of tested configurations. In the majority of cases, it's
preferable to let the linker figure things out for us.

The reverted commit attempted to fix a build issue by adding an
invisible Kconfig option. This is wrong in several ways:

It invents a new Kconfig variable when CONFIG_HASH already
exists for the same purpose.
Second, hash-checksum.c makes use of the hash_progressive_lookup_algo()
symbol, which is only provided with CONFIG_HASH, but this dependency
was not expressed in the reverted patch.

It feels like Kconfig is turning into a listing of all available
source files, and a buffet to 'select' which ones to compile. The
purpose of this revert is to enable the next change to make use of
CONFIG_HASH instead of adding to Kconfig.

This reverts commit 87316da05f2fd49d3709275e64ef0c5980366ade.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Acked-by: Masahisa Kojima <masahisa.kojima@linaro.org>

# 1621d3c4 10-May-2021 Bin Meng <bmeng.cn@gmail.com>

lib: kconfig: Limit BINMAN_FDT for OF_SEPARATE or OF_EMBED

Generally speaking BINMAN_FDT makes sense for OF_SEPARATE or OF_EMBED.
For the other OF_CONTROL methods, it's quite possible binman node is
not available as binman is invoked during the build phase instead of
runtime. Let's only turn it on for OF_SEPARATE or OF_EMBED by default.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 87316da0 13-May-2021 Masahisa Kojima <masahisa.kojima@linaro.org>

lib: introduce HASH_CALCULATE option

Build error occurs when CONFIG_EFI_SECURE_BOOT or
CONFIG_EFI_CAPSULE_AUTHENTICATE is enabled,
because hash-checksum.c is not compiled.

Since hash_calculate() implemented in hash-checksum.c can be
commonly used aside from FIT image signature verification,
this commit itroduces HASH_CALCULATE option to decide
if hash-checksum.c shall be compiled.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# e2ae483c 13-May-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

hash: Kconfig option for SHA512 hardware acceleration

Commit a479f103dc1c ("hash: Allow for SHA512 hardware implementations")
defined function definitions for hardware accelerated SHA384 and SHA512.
If CONFIG_SHA_HW_ACCEL=y, these functions are used.

We already have boards using CONFIG_SHA_HW_ACCEL=y but none implements the
new functions hw_sha384() and hw_sha512().

For implementing the EFI TCG2 protocol we need SHA384 and SHA512. The
missing hardware acceleration functions lead to build errors on boards like
peach-pi_defconfig.

Introduce a new Kconfig symbol CONFIG_SHA512_HW_ACCEL to control if the
functions hw_sha384() and hw_sha512() shall be used to implement the SHA384
and SHA512 algorithms.

Fixes: a479f103dc1c ("hash: Allow for SHA512 hardware implementations")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

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

# 6d66502b 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: Add 2 config to define the max number of regions

Add 2 configs CONFIG_LMB_MEMORY_REGIONS and CONFIG_LMB_RESERVED_REGIONS
to change independently the max number of the regions in lmb
library.

When CONFIG_LMB_USE_MAX_REGIONS=y, move the lmb property arrays to
struct lmb and manage the array size with the element 'max' of struct
lmb_region; their are still allocated in stack.

When CONFIG_LMB_USE_MAX_REGIONS=n, keep the current location in
struct lmb_region to allow compiler optimization.

Increase CONFIG_LMB_RESERVED_REGIONS is useful to avoid lmb errors in
bootm when the number of reserved regions (not adjacent) is reached:
+ 1 region for relocated U-Boot
+ 1 region for initrd
+ 1 region for relocated linux device tree
+ reserved memory regions present in Linux device tree.

The current limit of 8 regions is reached with only 5 reserved regions
in DT.

see Linux kernel commit bf23c51f1f49 ("memblock: Move memblock arrays
to static storage in memblock.c and make their size a variable")

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# 4fa0150d 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: move MAX_LMB_REGIONS value in Kconfig

Move MAX_LMB_REGIONS value in Kconfig, the max number of the regions
in lmb library.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# 77b8cfef 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: move CONFIG_LMB in Kconfig

Migrate CONFIG_LMB in Kconfig.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# a479f103 16-Feb-2021 Joel Stanley <joel@jms.id.au>

hash: Allow for SHA512 hardware implementations

Similar to support for SHA1 and SHA256, allow the use of hardware hashing
engine by enabling the algorithm and setting CONFIG_SHA_HW_ACCEL /
CONFIG_SHA_PROG_HW_ACCEL.

Signed-off-by: Joel Stanley <joel@jms.id.au>

# f2c1442e 14-Mar-2021 Simon Glass <sjg@chromium.org>

bloblist: Make BLOBLIST_TABLES depend on BLOBLIST

Add an extra condition here since we cannot put x86 tables in a bloblist
when bloblists are not supported.

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

# e0103158 25-Feb-2021 Bin Meng <bmeng.cn@gmail.com>

lib: kconfig: Mention CONFIG_ADDR_MAP limitation in the help

Mention that CONFIG_ADDR_MAP only works in the post-relocation phase.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>

# 56e7257c 03-Feb-2021 Bin Meng <bmeng.cn@gmail.com>

lib: Fix BINMAN_FDT dependency

lib/binman.c references the following 3 ofnode APIs:
ofnode_first_subnode(), ofnode_path() and ofnode_read_bool().

These APIs get built only when DM is on. Fix the dependency then.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 59e4e391 18-Jan-2021 Tom Rini <trini@konsulko.com>

Merge https://gitlab.denx.de/u-boot/custodians/u-boot-riscv

- Update qemu-riscv.rst build instructions.
- Add support for SPI on Kendryte K210.
- Add Microchip PolarFire SoC Icicle Kit support.
- Add support for an early timer.
- Select TIMER_EARLY to avoid infinite recursion for Trace.


# a80f8513 17-Jan-2021 Pragnesh Patel <pragnesh.patel@sifive.com>

trace: select TIMER_EARLY to avoid infinite recursion

When tracing functions is enabled this adds calls to
__cyg_profile_func_enter() and __cyg_profile_func_exit() to the traced
functions.

__cyg_profile_func_enter() and __cyg_profile_func_exit() invoke
timer_get_us() to record the entry and exit time.

initr_dm() will make gd->dm_root = NULL and gd->timer = NULL, so
timer_get_us() -> get_ticks() -> dm_timer_init() will lead to an
indefinite recursion.

So select TIMER_EARLY when tracing got enabled.

Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Rick Chen <rick@andestech.com>

# 6205bbb1 04-Jan-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lib: cosmetic update of CONFIG_LIB_ELF description

Change 2 typo error in CONFIG_LIB_ELF description:
- Supoort => Support
- fir => for

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c589132a 02-Dec-2020 Aswath Govindraju <a-govindraju@ti.com>

fdt: Use phandle to distinguish DT nodes with same name

While assigning the sequence number to subsystem instances by reading the
aliases property, only DT nodes names are compared and not the complete
path. This causes a problem when there are two DT nodes with same name but
have different paths.

In arch/arm/dts/k3-am65-main.dtsi there are two USB controllers with the
same device tree node name but different path. When aliases are defined for
these USB controllers then fdtdec_get_alias_seq() fails to pick the correct
instance for a given index.

fdt_path_offset() function is slow and this would effect the U-Boot
startup. To avert the time penalty on all boards, apply this extra check
only when required by using a config option.

Fix it by comparing the phandles of DT nodes after the node names match,
under a config option.

Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Fix whitespace error in Kconfig:
Signed-off-by: Simon Glass <sjg@chromium.org>

# 28cef9ca 19-Nov-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

fs: fat: create correct short names

The current function set_name() used to create short names has the
following deficiencies resolved by this patch:

* Long names (e.g. FOO.TXT) are stored even if a short name is enough.
* Short names with spaces are created, e.g. "A ~1.TXT".
* Short names with illegal characters are created, e.g. "FOO++BAR".
* Debug output does not not consider that the short file name has no
concluding '\0'.

The solution for the following bug is split of into a separate patch:

* Short file names must be unique.

This patch only provides the loop over possible short file names.

Fixes: c30a15e590c ("FAT: Add FAT write feature")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# e4f8e543 05-Nov-2020 Simon Glass <sjg@chromium.org>

smbios: Drop the unused Kconfig options

Now that we can use devicetree to specify this information, drop the old
CONFIG options.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 44c74bdd 05-Nov-2020 Simon Glass <sjg@chromium.org>

sysinfo: Provide a default driver to set SMBIOS values

Some boards want to specify the manufacturer or product name but do not
need to have their own sysinfo driver.

Add a default driver which provides a way to specify this SMBIOS
information in the devicetree, without needing any board-specific
functionality.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d2cb7a22 04-Nov-2020 Simon Glass <sjg@chromium.org>

x86: Allow putting some tables in the bloblist

At present all tables are placed starting at address f0000 in memory, and
can be up to 64KB in size. If the tables are very large, this may not
provide enough space.

Also if the tables point to other tables (such as console log or a ramoops
area) then we must allocate other memory anyway.

The bloblist is a nice place to put these tables since it is contiguous,
which makes it easy to reserve this memory for linux using the 820 tables.

Add an option to put some of the tables in the bloblist. For SMBIOS and
ACPI, create suitable pointers from the f0000 region to the new location
of the tables.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
[bmeng: squashed in http://patchwork.ozlabs.org/project/uboot/patch/
20201105062407.1.I8091ad931cbbb5e3b6f6ababdf3f8d5db0d17bb9@changeid/]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# 415eab06 03-Nov-2020 Christian Gmeiner <christian.gmeiner@gmail.com>

smbios: add parsing API

Add a very simple API to be able to access SMBIOS strings
like vendor, model and bios version.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 72eda507 27-Oct-2020 Sean Anderson <seanga2@gmail.com>

lib: Add getopt

Some commands can get very unweildy if they have too many positional
arguments. Adding options makes them easier to read, remember, and
understand.

This implementation of getopt has been taken from barebox, which has had
option support for quite a while. I have made a few modifications to their
version, such as the removal of opterr in favor of a separate getopt_silent
function. In addition, I have moved all global variables into struct
getopt_context.

The getopt from barebox also re-orders the arguments passed to it so that
non-options are placed last. This allows users to specify options anywhere.
For example, `ls -l foo/ -R` would be re-ordered to `ls -l -R foo/` as
getopt parsed the options. However, this feature conflicts with the const
argv in cmd_tbl->cmd. This was originally added in 54841ab50c ("Make sure
that argv[] argument pointers are not modified."). The reason stated in
that commit is that hush requires argv to stay unmodified. Has this
situation changed? Barebox also uses hush, and does not have this problem.
Perhaps we could use their fix?

I have assigned maintenance of getopt to Simon Glass, as it is currently
only used by the log command. I would also be fine maintaining it.

Signed-off-by: Sean Anderson <seanga2@gmail.com>

# 26637e2e 12-Sep-2020 Simon Glass <sjg@chromium.org>

lib: Allow hexdump to be used in SPL

It is sometimes useful to output hex dumps in SPL. Add a config option to
allow this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# e87dfb05 05-Aug-2020 Andrii Anisov <andrii_anisov@epam.com>

lib: sscanf: add sscanf implementation

Port sscanf implementation from mini-os and introduce new
Kconfig option to enable it: CONFIG_SSCANF. Disable by default.

Signed-off-by: Andrii Anisov <andrii_anisov@epam.com>
Signed-off-by: Anastasiia Lukianenko <anastasiia_lukianenko@epam.com>
Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>

# 81014f73 30-Jul-2020 Joao Marcos Costa <joaomarcos.costa@bootlin.com>

include/u-boot, lib/zlib: add sources for zlib decompression

Add zlib (v1.2.11) uncompr() function to U-Boot. SquashFS depends on
this function to decompress data from a raw disk image. The actual
support for zlib into SquashFS sources will be added in a follow-up
commit.

Signed-off-by: Joao Marcos Costa <joaomarcos.costa@bootlin.com>

# 69be8fd1 03-Jun-2020 Marek Szyprowski <m.szyprowski@samsung.com>

powerpc: move ADDR_MAP to Kconfig

Move ADDR_MAP related config options from include/configs/*.h to the
proper place in lib/Kconfig. This has been done using
./tools/moveconfig.py and manual inspection of the generated changes.
This is a preparation to use ADDR_MAP helper on ARM 32bit Raspberry Pi4
board for mapping the PCIe XHCI MMIO, which is above the 4GiB identity
mapping limit.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# d16b38f4 15-Apr-2020 Reuben Dowle <reubendowle0@gmail.com>

Add support for SHA384 and SHA512

The current recommendation for best security practice from the US government
is to use SHA384 for TOP SECRET [1].

This patch adds support for SHA384 and SHA512 in the hash command, and also
allows FIT images to be hashed with these algorithms, and signed with
sha384,rsaXXXX and sha512,rsaXXXX

The SHA implementation is adapted from the linux kernel implementation.

[1] Commercial National Security Algorithm Suite
http://www.iad.gov/iad/programs/iad-initiatives/cnsa-suite.cfm

Signed-off-by: Reuben Dowle <reuben.dowle@4rf.com>

# 43e442a5 26-May-2020 Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

kconfig: fix some typos

Signed-off-by: Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

# eff5a547 22-May-2020 Michael Walle <michael@walle.cc>

cmd: zip: automatically pull in gzip()

Move the CONFIG_GZIP_COMPRESSED from a config.h macro to a Kconfig menu
item. It is not selectable by a user because there is no reason to do
so. Instead it will be automatically selected by the stuff which uses
gzip(), like the zip command.

Remove it from the config_whitelist.txt. Also remove
CONFIG_GZIP_COMPRESS_DEF_SZ as this was never used on any board. The
default seems to be sane, otherwise it should be added as a Kconfig
option.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8239be61 06-May-2020 Simon Glass <sjg@chromium.org>

lib: Allow MD5 to be enabled in SPL

At present the MD5 option cannot be enabled by board configs since it has
no Kconfig name. It is generally enabled, so long as FIT support is
present. But not all boards use FIT, particularly in SPL

Fix this and add an option for SPL as well. This allows board code to call
md5() even if FIT support is not enabled.

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

# 04cb3994 21-Apr-2020 Weijie Gao <weijie.gao@mediatek.com>

lib: enable lzma decompression support for SPL build

This patch enables LZMA decompression support for SPL build

Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>

# 2a2119e1 05-Mar-2020 Atish Patra <atishp@atishpatra.org>

lib: kconfig: Add option to set BZIP2 compression method

There is no way to select BZIP2 compression method.
Add it under library/compression config where all other
compression related configs are present.

Signed-off-by: Atish Patra <atish.patra@wdc.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 805b3cac 12-Feb-2020 Keerthy <j-keerthy@ti.com>

lib: elf: Move the generic elf loading/validating functions to lib

Move the generic elf loading/validating functions to lib/
so that they can be re-used and accessed by code existing
outside cmd.

While at it remove the duplicate static version of load_elf_image_phdr
under arch/arm/mach-imx/imx_bootaux.c.

Signed-off-by: Keerthy <j-keerthy@ti.com>
Suggested-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>

# 1611235b 19-Jan-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: Kconfig dependencies for pseudo-random library

drivers/rng/sandbox_rng.c requires rand() to be defined but configuration
option CONFIG_CONFIG_LIB_RAND selected in drivers/rng/Kconfig does not
exist.

test/lib/test_aes.c requires rand() to be defined.

Fix the selection criteria for choice "Pseudo-random library support type".

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 3c10dc95 06-Dec-2019 Simon Glass <sjg@chromium.org>

binman: Add a library to access binman entries

SPL and TPL can access information about binman entries using link-time
symbols but this is not available in U-Boot proper. Of course it could be
made available, but the intention is to just read the device tree.

Add support for this, so that U-Boot can locate entries.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# b4adf627 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: crypto: add x509 parser

Imported from linux kernel v5.3:
x509.asn1 without changes
x509_akid.asn1 without changes
x509_parser.h without changes
x509_cert_parser.c with changes marked as __UBOOT__
x509_public_key.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# a9b45e6e 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add oid registry utility

Imported from linux kernel v5.3:
build_OID_registry without changes
oid_registry.h without changes
oid_registry.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# ab8a0e06 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add asn1 decoder

Imported from linux kernel v5.3:
lib/asn1_decoder.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 2b12196d 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

cmd: add asn1_compiler

Imported from linux kernel v5.3:
asn1.h without changes
asn1_ber_bytecode.h without changes
asn1_decoder.h without changes
asn1_compiler.c without changes

This host command will be used to create a ASN1 parser, for example,
for pkcs7 messages or x509 certificates. More specifically, it will
generate *byte code* which will be interpreted by asn1 decoder library.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 05429b6c 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

rtc: move date.c from drivers/rtc/ to lib/

In the next commit, rtc_mktime(), for compatibility with linux, will be
implemented using rtc_mktime(), which is no longer drivers/rtc specific.
So move this file under lib/.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 37ef1774 10-Nov-2019 Thomas Hebb <tommyhebb@gmail.com>

Kconfig: disambiguate config names for tiny printf

27084c03d36a ("spl: Allow tiny printf() to be controlled in SPL and
TPL") split this option in two for TPL and SPL, but didn't change the
Kconfig names, making them hard to set quickly.

Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>

# 0d76afc0 27-Oct-2019 Simon Glass <sjg@chromium.org>

fdt: Add Kconfig options to control code size

For better or worse libfdt recent grew a lot of code that checks the
validity of the device tree in great detail. When using unsigned or
unverified data this makes things safer, but it does add to code size.

Add some controls to select the trade-off between safety and code size.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 27084c03 25-Sep-2019 Simon Glass <sjg@chromium.org>

spl: Allow tiny printf() to be controlled in SPL and TPL

At present there is only one control for this and it is used for both SPL
and TPL. But SPL might have a lot more space than TPL so the extra cost of
a full printf() might be acceptable.

Split the option into two, providing separate SPL and TPL controls. The
TPL setting defaults to the same as SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2a51e16b 07-Jun-2019 Tom Rini <trini@konsulko.com>

configs: Make USE_TINY_PRINTF depend on SPL||TPL and be default

The USE_TINY_PRINTF symbol only changes things within SPL and TPL
builds, so make it depend on that support. Next, make it default as
within these cases we should rarely have need of more advanced print
formats outside of the debug context.

To do this, in a few cases we need to correct our Kconfig dependencies
as we had cases of non-SPL targets select'ing this symbol. Finally, in
the case of a few boards we really do need the full printf
functionality.

Signed-off-by: Tom Rini <trini@konsulko.com>

# da0fb5fd 02-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: make call depth limit customizable

Up to now we had hard coded values for the call depth up to which trace
records are created: 200 for early tracing, 15 thereafter. UEFI
applications reach a call depth of 80 or above.

Provide customizing settings for the call trace depth limit and the early
call trace depth limit. Use the old values as defaults.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8509f22a 29-Apr-2019 Marek Behún <kabel@kernel.org>

lib: add Zstandard decompression support

Add the zstd library from Linux kernel (only decompression support).
There are minimal changes to build with U-Boot, otherwise the files are
identical to Linux commit dc35da16 from March 2018, the files had not
been touched since in kernel. Also SPDX lincese tags were added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 83a486b6 29-Apr-2019 Marek Behún <kabel@kernel.org>

lib: Add xxhash support

This adds the xxhash support from Linux. Files are almost identical to
those added to Linux in commit 5d240522 ("lib: Add xxhash module") (they
haven't been touched since in Linux). The only difference is to add some
includes to be compatible with U-Boot. Also SPDX lincese tags were
added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 5132361a 29-Apr-2019 Heiko Schocher <hs@denx.de>

lib: Kconfig: fix help text for GZIP

commit 95f4bbd581cf ("lib: fdt: Allow LZO and GZIP DT compression in U-Boot")

introduced Kconfig option for gzip in U-Boot, but help text
says gzip for SPL, which is wrong. Fix this.

Signed-off-by: Heiko Schocher <hs@denx.de>
Acked-by: Marek Vasut <marex@denx.de>

# 1c6eb075 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE_BUFFER_SIZE et al to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE_BUFFER_SIZE
CONFIG_TRACE_EARLY_SIZE
CONFIG_TRACE_EARLY
CONFIG_TRACE_EARLY_ADDR

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

# a24a78d7 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE

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

# 54969b40 21-Mar-2019 Thierry Reding <treding@nvidia.com>

fdtdec: Add Kconfig symbol for tests

Runtime tests are provided as a test_fdtdec command implementation. Add
a Kconfig symbol that allows this command to be built so that the tests
can be used.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 95f4bbd5 08-Mar-2019 Marek Vasut <marex@denx.de>

lib: fdt: Allow LZO and GZIP DT compression in U-Boot

Add required Kconfig symbols, Makefile bits and macro fixes in a
few places to support LZO and DT compression in U-Boot. This can
save a lot of space with multi-DTB fitImages.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>

# 6e705114 13-Jan-2019 Chris Packham <judge.packham@gmail.com>

lib: Kconfig: spelling fixes

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 048c6e89 06-Nov-2018 Simon Glass <sjg@chromium.org>

spl: lz4: Allow use of lz4 compression in SPL

In some cases U-Boot is compressed and it is useful to be able to
decompress it in SPL. Add a Kconfig and Makefile change to allow this.
Note that this does not actually implement decompression.

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

# 2895c4b7 15-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

kconfig: Introduce HAVE_ARCH_IOMAP

Introduce a new Kconfig option for architecture codes to control
whether it provides io{read,write}{8,16,32} I/O accessor functions.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5592a633 01-Oct-2018 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt in TPL

In some cases (e.g. sandbox with verified boot) it is useful to support
libfdt in TPL. Update the Kconfig to handle this.

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

# 6307896c 01-Oct-2018 Simon Glass <sjg@chromium.org>

tpm: Add support for SPL and TPL

At present the tpm can only be used in U-Boot proper. Updated it to work
in SPL and TPL also.

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

# ab948cd2 19-Jul-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

fdt_support: make FDT_FIXUP_PARTITIONS depend on CMD_MTDPARTS

fdt_fixup_mtdparts() calls mtdparts_init() and device_find(),
which are defined in cmd/mtdparts.c

The combination of FDT_FIXUP_PARTITIONS=y and CMD_MTDPARTS=n
emits the following link error:

common/fdt_support.c:903: undefined reference to `mtdparts_init'
common/fdt_support.c:914: undefined reference to `device_find'

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 3330584d 03-Jun-2018 Igor Opaniuk <igor.opaniuk@gmail.com>

avb2.0: integrate avb 2.0 into the build system

Integrate libavb into the build system. Introduce CONFIG_LIBAVB
build option.

Signed-off-by: Igor Opaniuk <igor.opaniuk@linaro.org>

# f8c987f8 05-Jun-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

lib: Add hexdump

Often during debugging session it's very interesting to see
what data we were dealing with. For example what we write or read
to/from memory or peripherals.

This change introduces functions that allow to dump binary
data with one simple function invocation like:
------------------->8----------------
print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, buf, len);
------------------->8----------------

which gives us the following:
------------------->8----------------
00000000: f2 b7 c9 88 62 61 75 64 72 61 74 65 3d 31 31 35 ....baudrate=115
00000010: 32 30 30 00 62 6f 6f 74 61 72 67 73 3d 63 6f 6e 200.bootargs=con
00000020: 73 6f 6c 65 3d 74 74 79 53 33 2c 31 31 35 32 30 sole=ttyS3,11520
00000030: 30 6e 38 00 62 6f 6f 74 64 65 6c 61 79 3d 33 00 0n8.bootdelay=3.
00000040: 62 6f 6f 74 66 69 6c 65 3d 75 49 6d 61 67 65 00 bootfile=uImage.
00000050: 66 64 74 63 6f 6e 74 72 6f 6c 61 64 64 72 3d 39 fdtcontroladdr=9
00000060: 66 66 62 31 62 61 30 00 6c 6f 61 64 61 64 64 72 ffb1ba0.loadaddr
00000070: 3d 30 78 38 32 30 30 30 30 30 30 00 73 74 64 65 =0x82000000.stde
00000080: 72 72 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 rr=serial0@e0022
00000090: 30 30 30 00 73 74 64 69 6e 3d 73 65 72 69 61 6c 000.stdin=serial
000000a0: 30 40 65 30 30 32 32 30 30 30 00 73 74 64 6f 75 0@e0022000.stdou
000000b0: 74 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 30 t=serial0@e00220
000000c0: 30 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00..............
...
------------------->8----------------

Source of hexdump.c was copied from Linux kernel v4.7-rc2.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Mario Six <mario.six@gdsys.cc>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Stefan Roese <sr@denx.de>

# c232d14d 29-May-2018 Alex Kiernan <alex.kiernan@gmail.com>

mmc: Separate "mmc swrite" from fastboot

Introduce CONFIG_IMAGE_SPARSE and CONFIG_CMD_MMC_SWRITE so the "mmc
swrite" command is separated from the fastboot code.

Move image-sparse from common to lib so it's clear it's library code.

Rename CONFIG_FASTBOOT_FLASH_FILLBUF_SIZE to CONFIG_IMAGE_SPARSE_FILLBUF_SIZE
and migrate it to Kconfig.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Acked-by: Jassi Brar <jaswinder.singh@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6417572e 08-May-2018 Tom Rini <trini@konsulko.com>

lib/Kconfig: Mark OF_LIBFDT_OVERLAY as depending on OF_LIBFDT

The overlay code is only useful when OF_LIBFDT is set, so mark it as
depending on that first.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 58a46f88 25-Apr-2018 Praneeth Bajjuri <praneeth@ti.com>

configs: TI: Enable FIT Library overlay support

Enable the FDT library overlay support for all TI SOC family.

Without this option, when Loading fdt from FIT image, the
following warning is seen.

"config with overlays but CONFIG_OF_LIBFDT_OVERLAY not set".

Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
Suggested-by: Andrew F.Davis <afd@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>

# 14ad44ab 18-Apr-2018 Alex Kiernan <alex.kiernan@gmail.com>

spl: Split sprintf, strto* from SPL serial in Kconfig

When SPL serial is disabled, callers who need sprintf or strtoul fail
because their inclusion is guarded by CONFIG_SPL_SERIAL_SUPPORT/
CONFIG_TPL_SERIAL_SUPPORT.

Split printf, sprintf and strto into their own entries and then select
all of them if SERIAL_SUPPORT is enabled to match the current behaviour.

Include panic.o unconditionally as it can be called from anywhere which
uses BUG_ON().

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>

# e294ba06 04-Apr-2018 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-sunxi

Signed-off-by: Tom Rini <trini@konsulko.com>


# d14db11d 03-Apr-2018 Andre Przywara <andre.przywara@arm.com>

sunxi: revert disabling of features

In January some commits were introduced to mitigate the U-Boot image
size issues we encountered on sunxi builds.
Now with the MMC environment removed we can bring them back, as we
practically don't have a size limit anymore.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 32ce6179 13-Mar-2018 Bryan O'Donoghue <bryan.odonoghue@linaro.org>

optee: Add lib entries for sharing OPTEE code across ports

This patch adds code to lib to enable sharing of useful OPTEE code between
board-ports and architectures. The code on lib/optee/optee.c comes from the
TI omap2 port. Eventually the OMAP2 code will be patched to include the
shared code. The intention here is to add more useful OPTEE specific code
as more functionality gets added.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Cc: Harinarayan Bhatta <harinarayan@ti.com>
Cc: Andrew F. Davis <afd@ti.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Kever Yang <kever.yang@rock-chips.com>
Cc: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Cc: Peng Fan <peng.fan@nxp.com>
Tested-by: Peng Fan <peng.fan@nxp.com>

# 36c1877c 06-Feb-2018 Faiz Abbas <faiz_abbas@ti.com>

lib: Kconfig: Move DYNAMIC_CRC_TABLE to Kconfig

Add CONFIG prefix to DYNAMIC_CRC_TABLE and implement it in
Kconfig.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>

# a451bc27 05-Feb-2018 Adam Ford <aford173@gmail.com>

Convert LIB_UUID to Kconfig

config_fallback.h has some logic that checks a variety of options
and selects LIB_UUID if it hasn't already been selected. This
will all LIB_UUID in Kconfig and select this option for the list
of options to allow us to remove the logic from fallbacks

Signed-off-by: Adam Ford <aford173@gmail.com>

# a5a37567 06-Feb-2018 Adam Ford <aford173@gmail.com>

Convert CONFIG LIB_HW_RAND to Kconfig

config_fallbacks.h had some logic to automatically select
LIB_RAND if RANDOM_UUID or CMD_UUID were set if LIB_HW_RAND wasn't
already selected. By migrating LIB_HW_RAND to Kconfig, we can
remove this check from config_fallbacks.h and put it into Kconfig

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
[trini: Turn into a choice, add NET_RANDOM_ETHADDR]
Signed-off-by: Tom Rini <trini@konsulko.com>

# acd4d334 16-Jan-2018 Maxime Ripard <maxime.ripard@free-electrons.com>

net: regex: Disable by default on sunXi

The sunXi arm64 build has overflown, leading to the main U-boot binary
overwriting the environment when flashing the new image, or even worse,
overwriting itself when we're calling saveenv.

Disable this option that is not critical until we can adress the issue
properly.

Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 7e3caa81 03-Dec-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

Move CONFIG_PANIC_HANG to Kconfig

Freescale (NXP) boards have lots of defconfig files per board.
I used "imply PANIC_HANG" for them.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# da5337a6 08-Nov-2017 Nandor Han <nandor.han@ge.com>

rtc: add support for s35392a

Add support for S35392A RTC. The driver supports both U-Boot driver
models.

Signed-off-by: Nandor Han <nandor.han@ge.com>
Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
Cc: Heiko Schocher <hs@denx.de>

# f52bdf4b 14-Sep-2017 Jean-Jacques Hiblot <jjhiblot@ti.com>

lib: allow building lzo for the SPL

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 85d8bf57 03-Sep-2017 Marek Behún <kabel@kernel.org>

lib: Add CRC32-C

This is needed for BTRFS.

Signed-off-by: Marek Behun <marek.behun@nic.cz>

create mode 100644 lib/crc32c.c

# 7264f292 15-Aug-2017 York Sun <york.sun@nxp.com>

spl: fit: Eanble GZIP support for image decompression

Add Kconfig option SPL_GZIP and SPL_ZLIB to enable gunzip support for
SPL boot, eg. falcon boot compressed kernel image.

Signed-off-by: York Sun <york.sun@nxp.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6ef2f901 11-Aug-2017 Adam Ford <aford173@gmail.com>

Convert CONFIG_BCH to Kconfig

This converts the following to Kconfig:
CONFIG_BCH

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1a7ba1d 18-Aug-2017 Anatolij Gustschin <agust@denx.de>

Fix 'notes' typos

s/notes/nodes

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 96b9082c 03-Aug-2017 Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

rockchip: rk3188: rock: adjust for SPL/TPL split

With the changes to split SPL/TPL for the RK3368, I apparently missed
some needed adjustments to the RK3188 Kconfig and rock_defconfig.

This fixes build-issues for the rock board after applying the RK3368
enablement (and SPL/TPL) set that resulted from TPL_SERIAL_SUPPORT,
TPL_ROCKCHIP_BACK_TO_BROM and TPL_TINY_MEMSET being separate symbols
now.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d56b4b19 22-Jul-2017 Tom Rini <trini@konsulko.com>

configs: Migrate RBTREE, LZO, CMD_MTDPARTS, CMD_UBI and CMD_UBIFS

The above CONFIG options are in Kconfig, and now have correct depends and
inter-dependencies. Migrate these to configs/ from include/configs/. In the
case of CMD_UBIFS also change it to be a default y if CMD_UBI.

Signed-off-by: Tom Rini <trini@konsulko.com>

# aed998aa 17-May-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_LZMA to Kconfig

This converts the following to Kconfig:
CONFIG_LZMA

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

# b1a873df 26-Apr-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_CMD_AES et al to Kconfig

This converts the following to Kconfig:
CONFIG_CMD_AES
CONFIG_AES

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Add select AES to CMD_AES]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 173aafbf 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

cmd: Expose a Kconfig option to enable UBIFS commands

Create a new Kconfig entry to allow CMD_UBIFS selection from Kconfig and
add an hidden LZO option that can be selected by CMD_UBIFS.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>

# aa049152 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

mtd: ubi: Select RBTREE option from MTD_UBI Kconfig entry

Expose the RBTREE feature through Kconfig and select this option from the
MTD_UBI option.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>
[Rebased on master]
Signed-off-by: Jagan Teki <jagan@openedev.com>

# ab4458bd 02-Apr-2017 Simon Glass <sjg@chromium.org>

string: Provide a slimmed-down memset()

Most of the time the optimised memset() is what we want. For extreme
situations such as TPL it may be too large. For example on the 'rock'
board, using a simple loop saves a useful 48 bytes. With gcc 4.9 and
the rodata bug, this patch is enough to reduce the TPL image below the
limit.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>

# bea79d7d 14-Mar-2017 Andre Przywara <andre.przywara@arm.com>

Kconfig: introduce md5sum command selection

So far CONFIG_MD5SUM would need to be set by a board's include file.
Since the command is really generic, move it over to Kconfig to allow
it to be defined by either a board's defconfig, menuconfig or some
config snippet merged via mergeconfig.sh.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e663b350 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

smbios: Expose in efi_loader as table

We can pass SMBIOS easily as EFI configuration table to an EFI payload. This
patch adds enablement for that case.

While at it, we also enable SMBIOS generation for ARM systems, since they support
EFI_LOADER.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4b6dddc2 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

x86: Move smbios generation into arch independent directory

We will need the SMBIOS generation function on ARM as well going forward,
so let's move it into a non arch specific location.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# ebf7fff2 05-Oct-2016 Heiko Schocher <hs@denx.de>

spl: move FDT_FIXUP_PARTITIONS to Kconfig

Move FDT_FIXUP_PARTITIONS to Kconfig and cleanup existing
uses.

Signed-off-by: Heiko Schocher <hs@denx.de>

# ddf67f71 05-Jul-2016 Maxime Ripard <maxime.ripard@free-electrons.com>

libfdt: Add overlay application function

The device tree overlays are a good way to deal with user-modifyable
boards or boards with some kind of an expansion mechanism where we can
easily plug new board in (like the BBB, the Raspberry Pi or the CHIP).

Add a new function to merge overlays with a base device tree.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>

# 91b86e21 26-May-2016 Marek Vasut <marex@denx.de>

lib: Enable private libgcc by default

This patch decouples U-Boot binary from the toolchain on systems where
private libgcc is available. Instead of pulling in functions provided
by the libgcc from the toolchain, U-Boot will use it's own set of libgcc
functions. These functions are usually imported from Linux kernel, which
also uses it's own libgcc functions instead of the ones provided by the
toolchain.

This patch solves a rather common problem. The toolchain can usually
generate code for many variants of target architecture and often even
different endianness. The libgcc on the other hand is usually compiled
for one particular configuration and the functions provided by it may
or may not be suited for use in U-Boot. This can manifest in two ways,
either the U-Boot fails to compile altogether and linker will complain
or, in the much worse case, the resulting U-Boot will build, but will
misbehave in very subtle and hard to debug ways.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 67976306 30-Mar-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

cosmetic: Fix typos "privide"

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# ed980b8c 03-Mar-2016 Alexander Graf <agraf@csgraf.de>

efi_loader: hook up in build environment

Now that we have all the bits and pieces ready for EFI payload loading
support, hook them up in Makefiles and KConfigs so that we can build.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
[trini: Enable only when we of OF_LIBFDT, disable on kwb and colibri_pxa270]
Signed-off-by: Tom Rini <trini@konsulko.com>

# aa34fbc0 22-Feb-2016 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt to be used in SPL

Add an option to enable libfdt in SPL. This can be useful when decoding
FIT files in SPL.

We need to make sure this option is not enabled in SPL by this change.
Also this option needs to be enabled in host builds. Si add a new
IMAGE_USE_LIBFDT #define which can be used in files that are built on the
host but must also build for U-Boot and SPL.

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

# 69e173eb 22-Feb-2016 Simon Glass <sjg@chromium.org>

Move CONFIG_OF_LIBFDT to Kconfig

Move this option to Kconfig and tidy up existing boards.

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

# a187559e 05-Feb-2016 Bin Meng <bmeng.cn@gmail.com>

Use correct spelling of "U-Boot"

Correct spelling of "U-Boot" shall be used in all written text
(documentation, comments in source files etc.).

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Minkyu Kang <mk7.kang@samsung.com>

# 947c626d 14-Jan-2016 Tom Rini <trini@konsulko.com>

vsprintf.c: Always enable CONFIG_SYS_VSNPRINTF

Enabling this function always removes some class of string saftey issues.
The size change here in general is about 400 bytes and this seems a reasonable
trade-off.

Cc: Peng Fan <peng.fan@nxp.com>
Cc: Peter Robinson <pbrobinson@gmail.com>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Adrian Alonso <aalonso@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 7d9cde10 22-Nov-2015 Stefan Roese <sr@denx.de>

lib/tiny-printf.c: Add tiny printf function for space limited environments

This patch adds a small printf() version that supports all basic formats.
Its intented to be used in U-Boot SPL versions on platforms with very
limited internal RAM sizes.

To enable it, just define CONFIG_USE_TINY_PRINTF in your defconfig. This
will result in the SPL using this tiny function and the main U-Boot
still using the full-blown printf() function.

This code was copied from:
http://www.sparetimelabs.com/printfrevisited
With mostly only coding style related changes so that its checkpatch
clean.

The size reduction is about 2.5KiB. Here a comparison for the db-mv784mp-gp
(Marvell AXP) SPL:

Without this patch:
58963 18536 1928 79427 13643 ./spl/u-boot-spl

With this patch:
56542 18536 1956 77034 12cea ./spl/u-boot-spl

Note:
To make it possible to compile tiny-printf.c instead of vsprintf.c when
CONFIG_USE_TINY_PRINTF is defined, the functions printf() and vprintf() are
moved from common/console.c into vsprintf.c in this patch.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>

# 2419cd16 03-Oct-2015 Simon Glass <sjg@chromium.org>

dm: tpm: Drop CONFIG_DM_TPM

Now that all TPM drivers use driver model, we can drop the special driver
model CONFIG option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>

# 027b728d 06-Oct-2015 Julius Werner <jwerner@chromium.org>

Add support for LZ4 decompression algorithm

This patch adds support for LZ4-compressed FIT image contents. This
algorithm has a slightly worse compression ration than LZO while being
nearly twice as fast to decompress. When loading images from a fast
storage medium this usually results in a boot time win.

Sandbox-tested only since I don't have a U-Boot development system set
up right now. The code was imported unchanged from coreboot where it's
proven to work, though. I'm mostly interested in getting this recognized
by mkImage for use in a downstream project.

Signed-off-by: Julius Werner <jwerner@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# a7d660bc 22-Aug-2015 Simon Glass <sjg@chromium.org>

tpm: Add Kconfig options for TPMs

Add new Kconfig options for TPMs in preparation for moving boards to use
Kconfig for TPM configuration.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 867a6ac8 31-Jul-2015 Simon Glass <sjg@chromium.org>

efi: Add start-up library code

When running as an EFI application, U-Boot must request memory from EFI,
and provide access to the boot services U-Boot needs.

Add library code to perform these tasks. This includes efi_main() which is
the entry point from EFI. U-Boot is built as a shared library.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d1389403 23-Jun-2015 Simon Glass <sjg@chromium.org>

Add a dhrystone benchmark command

Drystone provides a convenient sanity check that the CPU is running at full
speed. Add this as a command which can be enabled as needed.

Note: I investigated using Coremark for this but there was a license
agreement and I could not work out if it was GPL-compatible.

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

# f7848d90 22-Jun-2015 Joe Hershberger <joe.hershberger@ni.com>

Allow CONFIG_REGEX to be disabled when CONFIG_NET

Instead of selecting REGEX when NET is enabled, make it the default, but
allow boards that are tiny to disable it and lose functionality on all
but the first Ethernet adapter.

cm-bf548, bf538f-ezkit, and bf533-stamp need this. None appear to have
more than one Ethernet interface.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# 3850dbe8 11-Jun-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

blackfin: fix undefined reference to srand and rand

Commit 9ba9e85f3f1c (net: Fix NET_RANDOM_ETHADDR dependencies)
accidentally dropped CONFIG_LIB_RAND defines for 14 Blackfin boards.

Prior to that commit, those boards defined CONFIG_LIB_RAND, but not
CONFIG_NET_RANDOM_ETHADDR. So, commit 9ba9e85f3f1c should not have
touched them, but in fact it ripped CONFIG_LIB_RAND off from all the
header files, which caused undefined reference to srand and rand.
CONFIG_LIB_RAND=y must be revived for such boards.

BTW, this commit indeed makes it better, but even with this fix,
three boards (bf533-stamp, bf538f-ezkit, cm-bf548) still can not
build due to region 'ram' overflowed error. This was cause by
commit 6eed3786c68c (net: Move the CMD_NET config to defconfigs)
because CMD_NET selects NET, and NET selects REGEX. Eventually,
some boards were newly enabled with CONFIG_REGEX, increasing the
memory footprint. A patch is expected to fix the build error.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 9ba9e85f 25-May-2015 Michal Simek <michal.simek@amd.com>

net: Fix NET_RANDOM_ETHADDR dependencies

NET_RANDOM_ETHADDR depends on lib/rand.c. This patch adds dependency to
Kconfig to ensure that library is also compiled.

Remove the definitions from Blackfin boards' include/configs.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 6501ff62 20-Apr-2015 Przemyslaw Marczak <p.marczak@samsung.com>

lib: Kconfig: add entry for errno_str() function

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1a60650c 21-Apr-2015 Joe Hershberger <joe.hershberger@ni.com>

kconfig: Move REGEX to Kconfig

Having this as a Kconfig allows it to be a dependent feature.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8156345d 06-Mar-2015 Simon Glass <sjg@chromium.org>

sandbox: Move CONFIG_SYS_VSNPRINTF to Kconfig

Move this over to Kconfig and tidy up.

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

# 94e3c8c4 19-Feb-2015 gaurav rana <gaurav.rana@freescale.com>

crypto/fsl - Add progressive hashing support using hardware acceleration.

Currently only normal hashing is supported using hardware acceleration.
Added support for progressive hashing using hardware.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
Signed-off-by: Gaurav Rana <gaurav.rana@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>

# d9f23c7f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

lib/rsa: Add Kconfig for devices supporting RSA Modular Exponentiation

Kconfig option added for devices which support RSA Verification.
1. RSA_SOFTWARE_EXP
Enables driver for supporting RSA Modular Exponentiation in Software
2. RSA_FREESCALE_EXP
Enables driver for supporting RSA Modular Exponentiation using Freescale specific
driver

The above drivers use RSA uclass

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
(Removed duplicate line in Kconfig comment)

Change-Id: I7663c4d5350e2bfc3dfa2696f70ef777d6ccc6f6

# c4beb22f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

FIT: Modify option FIT_SIGNATURE in Kconfig

For FIT signature based approach to work, RSA library needs to be selected.
The FIT_SIGNATURE option in Kconfig is modified to automatically select RSA.
Selecting RSA compiles the RSA library required for image verification.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 45ccec8f 23-Oct-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

kconfig: move CONFIG_USE_PRIVATE_LIBGCC to Kconfig

The private libgcc is supported only on ARM, MIPS, PowerPC, SH, x86.
Those architectures should "select" HAVE_PRIVATE_LIBGCC and
CONFIG_USE_PRIVATE_LIBGCC should depend on it.

Currently, this option is enabled on Tegra boards and x86 architecture.
Move the definition from header files to Kconfig.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Tested-by: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: Tom Warren <twarren@nvidia.com>

# 8c688bc4 23-Oct-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

kconfig: move CONFIG_SYS_HZ to lib/Kconfig

CONFIG_SYS_HZ is always defined as 1000 in config_fallbacks.h
(but some boards still have redundant definitions).

This commit moves the definition and the document in README to
Kconfig. Since lib/Kconfig can assure that CONFIG_SYS_HZ is 1000,
the sanity check in lib/time.c should be removed.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Reviewed-by: Marek Vasut <marex@denx.de>

# b0928da6 16-Sep-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

kconfig: move CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED to Kconfig

If this option is enabled, the objects under lib/ directory
are compiled with speed optimization, not size optimization.
(Currently, only used by some Blackfin boards.)

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# ed36323f 16-Sep-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

kconfig: add blank Kconfig files

This would be useful to start moving various config options.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# ae3527f0 07-Dec-2022 Kautuk Consul <kconsul@ventanamicro.com>

arch/riscv: add semihosting support for RISC-V

We add RISC-V semihosting based serial console for JTAG based early
debugging.

The RISC-V semihosting specification is available at:
https://github.com/riscv/riscv-semihosting-spec/blob/main/riscv-semihosting-spec.adoc

Signed-off-by: Anup Patel <apatel@ventanamicro.com>
Signed-off-by: Kautuk Consul <kconsul@ventanamicro.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>

# 1c03ab9f 07-Dec-2022 Kautuk Consul <kconsul@ventanamicro.com>

lib: Add common semihosting library

We factor out the arch-independent parts of the ARM semihosting
implementation as a common library so that it can be shared
with RISC-V.

Signed-off-by: Kautuk Consul <kconsul@ventanamicro.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>

# 86794052 21-Oct-2022 Sughosh Ganu <sughosh.ganu@linaro.org>

FWU: Add support for the FWU Multi Bank Update feature

The FWU Multi Bank Update feature supports updating firmware images
to one of multiple sets(also called banks) of images. The firmware
images are clubbed together in banks, with the system booting images
from the active bank. Information on the images such as which bank
they belong to is stored as part of the metadata structure, which is
stored on the same storage media as the firmware images on a dedicated
partition.

At the time of update, the metadata is read to identify the bank to
which the images need to be flashed(update bank). On a successful
update, the metadata is modified to set the updated bank as active
bank to subsequently boot from.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

# 40ed7be4 02-Aug-2022 Tom Rini <trini@konsulko.com>

Convert CONFIG_SYS_FDT_PAD to Kconfig

This converts the following to Kconfig:
CONFIG_SYS_FDT_PAD

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e67ffb5a 22-Jul-2022 Sughosh Ganu <sughosh.ganu@linaro.org>

tpm: rng: Add driver model interface for TPM RNG device

The TPM device has a builtin random number generator(RNG)
functionality. Expose the RNG functions of the TPM device to the
driver model so that they can be used by the EFI_RNG_PROTOCOL if the
protocol is installed.

Also change the function arguments and return type of the random
number functions to comply with the driver model api.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

# b340199f 10-Jun-2022 Tom Rini <trini@konsulko.com>

spl: Ensure all SPL symbols in Kconfig have some SPL dependency

Tighten up symbol dependencies in a number of places. Ensure that a SPL
specific option has at least a direct dependency on SPL. In places
where it's clear that we depend on something more specific, use that
dependency instead. This means in a very small number of places we can
drop redundant dependencies.

Reported-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 13ce351b 08-Jun-2022 Tom Rini <trini@konsulko.com>

vpl: Ensure all VPL symbols in Kconfig have some VPL dependency

Tighten up symbol dependencies in a number of places. Ensure that a VPL
specific option has at least a direct dependency on VPL. In places
where it's clear that we depend on something more specific, use that
dependency instead.

Reported-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 8bea4bf7 08-Jun-2022 Tom Rini <trini@konsulko.com>

tpl: Ensure all TPL symbols in Kconfig have some TPL dependency

Tighten up symbol dependencies in a number of places. Ensure that a TPL
specific option has at least a direct dependency on TPL. In places
where it's clear that we depend on something more specific, use that
dependency instead.

Reported-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 26f981f2 19-May-2022 Rasmus Villemoes <rasmus.villemoes@prevas.dk>

fdtdec: drop needlessly convoluted CONFIG_PHANDLE_CHECK_SEQ

Asking if the alias we found actually points at the device tree node
we passed in (in the guise of its offset from blob) can be done simply
by asking if the fdt_path_offset() of the alias' path is identical to
offset.

In fact, the current method suffers from the possibility of false
negatives: dtc does not necessarily emit a phandle property for a node
just because it is referenced in /aliases; it only emits a phandle
property for a node if it is referenced in <angle brackets>
somewhere. So if both the node we passed in and the alias node we're
considering don't have phandles, fdt_get_phandle() returns 0 for both.

Since the proper check is so simple, there's no reason to hide that
behind a config option (and if one really wanted that, it should be
called something else because there's no need to involve phandle in
the check).

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Acked-by: Aswath Govindraju <a-govindraju@ti.com>

# d30924f1 01-May-2022 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: fix selection of CONFIG_CHARSET

lib/charset.c is not optional for
EFI_APP || EFI_LOADER || UFS || UT_UNICODE.
These must select CONFIG_CHARSET.

Fixes: 726cd9836db0 ("efi: Make unicode printf available to the app")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>

# 747093dd 30-Apr-2022 Simon Glass <sjg@chromium.org>

vpl: Add Kconfig options for VPL

Add VPL versions of commonly used Kconfig options.

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

# 11232139 06-Apr-2022 Tom Rini <trini@konsulko.com>

nds32: Remove the architecture

As removal of nds32 has been ack'd for the Linux kernel, remove support
here as well.

Cc: Rick Chen <rick@andestech.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Rick Chen <rick@andestech.com>

# fd210fee 28-Mar-2022 Philippe Reynes <philippe.reynes@softathome.com>

lib: allow to build asn1 decoder and oid registry in SPL

This commit adds the options:
- SPL_ASN1_DECODER
- SPL_OID_REGISTRY

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>

# 7d44a985 28-Mar-2022 Philippe Reynes <philippe.reynes@softathome.com>

lib: Kconfig: enhance the help of OID_REGISTRY

Enhance the help for the config OID_REGISTRY.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>

# a0e71d96 28-Mar-2022 Philippe Reynes <philippe.reynes@softathome.com>

lib: Kconfig: enhance help for ASN1

Enhance the help for configs ASN1_COMPILER
and ASN1_decoder.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>

# 761a1786 27-Jan-2022 Tom Rini <trini@konsulko.com>

Merge tag 'dm-pull-26jan22' of https://source.denx.de/u-boot/custodians/u-boot-dm

acpi refactoring to allow non-x86 use
binman support for bintools (binary tools)
minor tools improvements in preparation for FDT signing
various minor fixes and improvements


# 334a9b9d 25-Nov-2021 Loic Poulain <loic.poulain@linaro.org>

lib/circbuf: Make circbuf selectable symbol

It is currenly only used from usbtty driver but make it properly
selectable via Kconfig symbol, for future usage.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>

# e1722fcb 01-Dec-2021 Simon Glass <sjg@chromium.org>

x86: Allow any arch to generate ACPI tables

These have sadly found their way to ARM now. Allow any arch to support
generating ACPI tables.

Disable this for the tools build.

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

# 7c3fd5c2 26-Dec-2021 Qu Wenruo <wqu@suse.com>

lib: add BLAKE2 hash support

The code is cross-ported from BLAKE2 reference implementation
(https://github.com/BLAKE2/BLAKE2).

With minimal change to remove unused macros/features.

Currently there is only one user inside U-boot (btrfs), and since it
only utilize BLAKE2B, all other favors are all removed.

Signed-off-by: Qu Wenruo <wqu@suse.com>
[trini: Rename ROUND to R to avoid clash with <linux/bitops.h>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 97f2a749 04-Jan-2022 Eugen Hristev <eugen.hristev@microchip.com>

lib: Kconfig: fix PHANDLE_CHECK_SEQ position outside of menu

CONFIG_PHANDLE_CHECK_SEQ is outside of the menu 'Library routines'
thus it's invisible in menuconfig and cannot be selected.
Fix this by moving the 'endmenu' after the PHANDLE_CHECK_SEQ definition

Fixes: c589132a1d ("fdt: Use phandle to distinguish DT nodes with same name")
Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
Reviewed-by: Aswath Govindraju <a-govindraju@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 726cd983 29-Dec-2021 Simon Glass <sjg@chromium.org>

efi: Make unicode printf available to the app

This is needed to show unicode strings. Enable this code in the app.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>

# 6405ab7a 24-Nov-2021 Simon Glass <sjg@chromium.org>

Convert CONFIG_PHYSMEM to Kconfig

This converts the following to Kconfig:
CONFIG_PHYSMEM

Signed-off-by: Simon Glass <sjg@chromium.org>
Suggested-by: Sean Anderson <seanga2@gmail.com>

# ac7606af 14-Nov-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

lmb: fix typo 'commun'

%s/commun/common/

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

# e7d285b2 25-Sep-2021 Simon Glass <sjg@chromium.org>

image: Use the correct checks for CRC32

Add a host Kconfig for CRC32. With this we can use CONFIG_IS_ENABLED(CRC32)
directly in the host build, so drop the unnecessary indirection.

Add a few more conditions to SPL_CRC32 to avoid build failures as well as
TPL_CRC32. Also update hash.c to make crc32 optional and to actually take
notice of SPL_CRC32.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# 2c21256b 25-Sep-2021 Simon Glass <sjg@chromium.org>

hash: Use Kconfig to enable hashing in host tools and SPL

At present when building host tools, we force CONFIG_SHAxxx to be enabled
regardless of the board Kconfig setting. This is done in the image.h
header file.

For SPL we currently just assume the algorithm is desired if U-Boot proper
enables it.

Clean this up by adding new Kconfig options to enable hashing on the host,
relying on CONFIG_IS_ENABLED() to deal with the different builds.

Add new SPL Kconfigs for hardware-accelerated hashing, to maintain the
current settings.

This allows us to drop the image.h code and the I_WANT_MD5 hack.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# 603d15a5 25-Sep-2021 Simon Glass <sjg@chromium.org>

spl: cypto: Bring back SPL_ versions of SHA

Unfortunately these were removed by mistake. This means that adding hash
support to SPL brings in all software algorithms, with a substantial
increase in code size.

The origin of the problem was renaming them to SPL_FIT_xxx and then these
were removed altogether in a later commit.

Add them back. This aligns with CONFIG_MD5, for example, which has an SPL
variant.

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: f5bc9c25f31 ("image: Rename SPL_SHAxxx_SUPPORT to SPL_FIT_SHAxxx")
Fixes: eb5171ddec9 ("common: Remove unused CONFIG_FIT_SHAxxx selectors")
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# 6674edaa 16-Sep-2021 Tom Rini <trini@konsulko.com>

Merge tag 'v2021.10-rc4' into next

Prepare v2021.10-rc4

Signed-off-by: Tom Rini <trini@konsulko.com>

# gpg: Signature made Tue 14 Sep 2021 06:58:32 PM EDT
# gpg: using RSA key 1A3C7F70E08FAB1707809BBF147C39FF9634B72C
# gpg: Good signature from "Thomas Rini <trini@konsulko.com>" [ultimate]

# Conflicts:
# board/Arcturus/ucp1020/spl.c
# cmd/mvebu/Kconfig
# common/Kconfig.boot
# common/image-fit.c
# configs/UCP1020_defconfig
# configs/sifive_unmatched_defconfig
# drivers/pci/Kconfig
# include/configs/UCP1020.h
# include/configs/sifive-unmatched.h
# lib/Makefile
# scripts/config_whitelist.txt


# 5145bc73 01-Sep-2021 Oleksandr Suvorov <oleksandr.suvorov@foundries.io>

lib: fix typos in Kconfig

There are trivial typos in the Kconfig file. Fixed them.
Also, fixed grammar in the descriptions with typos.

Fixes: d56b4b1974 ("configs: Migrate RBTREE, LZO, CMD_MTDPARTS, CMD_UBI and CMD_UBIFS")
Fixes: 7264f2928b ("spl: fit: Eanble GZIP support for image decompression")
Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# e60e4499 02-Sep-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

lib: Drop SHA512_ALGO in lieu of SHA512

SHA512_ALGO was used as a "either SHA512 or SHA384", although the
implementations of these two algorithms share a majority of code.

From a Kconfig interface perspective, it makes sense to present two
distinct options. This requires #ifdefing out the SHA512
implementation from sha512.c. The latter doesn't make any sense.

It's reasonable to say in Kconfig that SHA384 depends on SHA512, and
seems to be the more polite way to handle the selection.

Thus, automatically select SHA512 when SHA384 is enabled.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# b4c2c151 27-Aug-2021 Michal Simek <michal.simek@amd.com>

Kconfig: Remove all default n/no options

default n/no doesn't need to be specified. It is default option anyway.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
[trini: Rework FSP_USE_UPD portion]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 928a8be7 29-Jul-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

lib: ecdsa: Implement UCLASS_ECDSA verification on target

Implement the crypto_algo .verify() function for ecdsa256. Because
it backends on UCLASS_ECDSA, this change is focused on parsing the
keys from devicetree and passing this information to the specific
UCLASS driver.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# fa3f1f1d 24-Jul-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: disable CONFIG_SPL_HEXDUMP by default

CONFIG_HEXDUMP is needed to display UEFI variables using 'printenv -e'.

Enabling CONFIG_SPL_HEXDUMP only makes sense for debugging purposes.
Hence CONFIG_SPL_HEXDUMP should not be enabled by default.

The following boards currently have CONFIG_SPL_HEXDUMP=y. This includes
boards that don't use SPL at all.

axm_defconfig
imx8mm-cl-iot-gate_defconfig
imx8mm_venice_defconfig
imxrt1020-evk_defconfig
imxrt1050-evk_defconfig
kontron_sl28_defconfig
kp_imx53_defconfig
lx2160ardb_tfa_stmm_defconfig
mt7622_rfb_defconfig
octeon_ebb7304_defconfig
octeon_nic23_defconfig
qemu_arm64_defconfig
qemu_arm_defconfig
qemu-riscv32_defconfig
qemu-riscv32_smode_defconfig
qemu-riscv64_defconfig
qemu-riscv64_smode_defconfig
qemu-x86_64_defconfig
qemu-x86_defconfig
sandbox64_defconfig
sandbox_defconfig
stm32mp15_basic_defconfig
stm32mp15_trusted_defconfig
synquacer_developerbox_defconfig
taurus_defconfig
xilinx_versal_virt_defconfig

The patch only keeps it enabled on

sandbox_spl_defconfig

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 1a46cb6c 02-Jul-2021 Simon Glass <sjg@chromium.org>

lib: Create a new Kconfig option for charset conversion

Rather than looking at two KConfig options in the Makefile, create a new
Kconfig option for compiling lib/charset.c

Enable it for UFS also, which needs this support.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 26dd9936 08-Jul-2021 Steffen Jaeckel <jaeckel-floss@eyet-services.de>

lib: add crypt subsystem

Add the basic functionality required to support the standard crypt
format.
The files crypt-sha256.c and crypt-sha512.c originate from libxcrypt and
their formatting is therefor retained.
The integration is done via a crypt_compare() function in crypt.c.

```
libxcrypt $ git describe --long --always --all
tags/v4.4.17-0-g6b110bc
```

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 7d0f3fbb 11-Jun-2021 Tero Kristo <t-kristo@ti.com>

lib: rational: copy the rational fraction lib routines from Linux

Copy the best rational approximation calculation routines from Linux.
Typical usecase for these routines is to calculate the M/N divider
values for PLLs to reach a specific clock rate.

This is based on linux kernel commit:
"lib/math/rational.c: fix possible incorrect result from rational
fractions helper"
(sha1: 323dd2c3ed0641f49e89b4e420f9eef5d3d5a881)

Signed-off-by: Tero Kristo <t-kristo@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Tero Kristo <kristo@kernel.org>

# ec0512b1 24-May-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

Revert "lib: introduce HASH_CALCULATE option"

When we think of Kconfig, we usually think of features that we like
to enable or not. Ideally, we wouldn't use Kconfig to fix a build
issue, although sometimes it might make sense. With Kconfig it's hard
to guarantee that the fix is universal. We can only say that it works
for the set of tested configurations. In the majority of cases, it's
preferable to let the linker figure things out for us.

The reverted commit attempted to fix a build issue by adding an
invisible Kconfig option. This is wrong in several ways:

It invents a new Kconfig variable when CONFIG_HASH already
exists for the same purpose.
Second, hash-checksum.c makes use of the hash_progressive_lookup_algo()
symbol, which is only provided with CONFIG_HASH, but this dependency
was not expressed in the reverted patch.

It feels like Kconfig is turning into a listing of all available
source files, and a buffet to 'select' which ones to compile. The
purpose of this revert is to enable the next change to make use of
CONFIG_HASH instead of adding to Kconfig.

This reverts commit 87316da05f2fd49d3709275e64ef0c5980366ade.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Acked-by: Masahisa Kojima <masahisa.kojima@linaro.org>

# 1621d3c4 10-May-2021 Bin Meng <bmeng.cn@gmail.com>

lib: kconfig: Limit BINMAN_FDT for OF_SEPARATE or OF_EMBED

Generally speaking BINMAN_FDT makes sense for OF_SEPARATE or OF_EMBED.
For the other OF_CONTROL methods, it's quite possible binman node is
not available as binman is invoked during the build phase instead of
runtime. Let's only turn it on for OF_SEPARATE or OF_EMBED by default.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 87316da0 13-May-2021 Masahisa Kojima <masahisa.kojima@linaro.org>

lib: introduce HASH_CALCULATE option

Build error occurs when CONFIG_EFI_SECURE_BOOT or
CONFIG_EFI_CAPSULE_AUTHENTICATE is enabled,
because hash-checksum.c is not compiled.

Since hash_calculate() implemented in hash-checksum.c can be
commonly used aside from FIT image signature verification,
this commit itroduces HASH_CALCULATE option to decide
if hash-checksum.c shall be compiled.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# e2ae483c 13-May-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

hash: Kconfig option for SHA512 hardware acceleration

Commit a479f103dc1c ("hash: Allow for SHA512 hardware implementations")
defined function definitions for hardware accelerated SHA384 and SHA512.
If CONFIG_SHA_HW_ACCEL=y, these functions are used.

We already have boards using CONFIG_SHA_HW_ACCEL=y but none implements the
new functions hw_sha384() and hw_sha512().

For implementing the EFI TCG2 protocol we need SHA384 and SHA512. The
missing hardware acceleration functions lead to build errors on boards like
peach-pi_defconfig.

Introduce a new Kconfig symbol CONFIG_SHA512_HW_ACCEL to control if the
functions hw_sha384() and hw_sha512() shall be used to implement the SHA384
and SHA512 algorithms.

Fixes: a479f103dc1c ("hash: Allow for SHA512 hardware implementations")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

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

# 6d66502b 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: Add 2 config to define the max number of regions

Add 2 configs CONFIG_LMB_MEMORY_REGIONS and CONFIG_LMB_RESERVED_REGIONS
to change independently the max number of the regions in lmb
library.

When CONFIG_LMB_USE_MAX_REGIONS=y, move the lmb property arrays to
struct lmb and manage the array size with the element 'max' of struct
lmb_region; their are still allocated in stack.

When CONFIG_LMB_USE_MAX_REGIONS=n, keep the current location in
struct lmb_region to allow compiler optimization.

Increase CONFIG_LMB_RESERVED_REGIONS is useful to avoid lmb errors in
bootm when the number of reserved regions (not adjacent) is reached:
+ 1 region for relocated U-Boot
+ 1 region for initrd
+ 1 region for relocated linux device tree
+ reserved memory regions present in Linux device tree.

The current limit of 8 regions is reached with only 5 reserved regions
in DT.

see Linux kernel commit bf23c51f1f49 ("memblock: Move memblock arrays
to static storage in memblock.c and make their size a variable")

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# 4fa0150d 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: move MAX_LMB_REGIONS value in Kconfig

Move MAX_LMB_REGIONS value in Kconfig, the max number of the regions
in lmb library.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# 77b8cfef 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: move CONFIG_LMB in Kconfig

Migrate CONFIG_LMB in Kconfig.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# a479f103 16-Feb-2021 Joel Stanley <joel@jms.id.au>

hash: Allow for SHA512 hardware implementations

Similar to support for SHA1 and SHA256, allow the use of hardware hashing
engine by enabling the algorithm and setting CONFIG_SHA_HW_ACCEL /
CONFIG_SHA_PROG_HW_ACCEL.

Signed-off-by: Joel Stanley <joel@jms.id.au>

# f2c1442e 14-Mar-2021 Simon Glass <sjg@chromium.org>

bloblist: Make BLOBLIST_TABLES depend on BLOBLIST

Add an extra condition here since we cannot put x86 tables in a bloblist
when bloblists are not supported.

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

# e0103158 25-Feb-2021 Bin Meng <bmeng.cn@gmail.com>

lib: kconfig: Mention CONFIG_ADDR_MAP limitation in the help

Mention that CONFIG_ADDR_MAP only works in the post-relocation phase.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>

# 56e7257c 03-Feb-2021 Bin Meng <bmeng.cn@gmail.com>

lib: Fix BINMAN_FDT dependency

lib/binman.c references the following 3 ofnode APIs:
ofnode_first_subnode(), ofnode_path() and ofnode_read_bool().

These APIs get built only when DM is on. Fix the dependency then.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 59e4e391 18-Jan-2021 Tom Rini <trini@konsulko.com>

Merge https://gitlab.denx.de/u-boot/custodians/u-boot-riscv

- Update qemu-riscv.rst build instructions.
- Add support for SPI on Kendryte K210.
- Add Microchip PolarFire SoC Icicle Kit support.
- Add support for an early timer.
- Select TIMER_EARLY to avoid infinite recursion for Trace.


# a80f8513 17-Jan-2021 Pragnesh Patel <pragnesh.patel@sifive.com>

trace: select TIMER_EARLY to avoid infinite recursion

When tracing functions is enabled this adds calls to
__cyg_profile_func_enter() and __cyg_profile_func_exit() to the traced
functions.

__cyg_profile_func_enter() and __cyg_profile_func_exit() invoke
timer_get_us() to record the entry and exit time.

initr_dm() will make gd->dm_root = NULL and gd->timer = NULL, so
timer_get_us() -> get_ticks() -> dm_timer_init() will lead to an
indefinite recursion.

So select TIMER_EARLY when tracing got enabled.

Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Rick Chen <rick@andestech.com>

# 6205bbb1 04-Jan-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lib: cosmetic update of CONFIG_LIB_ELF description

Change 2 typo error in CONFIG_LIB_ELF description:
- Supoort => Support
- fir => for

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c589132a 02-Dec-2020 Aswath Govindraju <a-govindraju@ti.com>

fdt: Use phandle to distinguish DT nodes with same name

While assigning the sequence number to subsystem instances by reading the
aliases property, only DT nodes names are compared and not the complete
path. This causes a problem when there are two DT nodes with same name but
have different paths.

In arch/arm/dts/k3-am65-main.dtsi there are two USB controllers with the
same device tree node name but different path. When aliases are defined for
these USB controllers then fdtdec_get_alias_seq() fails to pick the correct
instance for a given index.

fdt_path_offset() function is slow and this would effect the U-Boot
startup. To avert the time penalty on all boards, apply this extra check
only when required by using a config option.

Fix it by comparing the phandles of DT nodes after the node names match,
under a config option.

Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Fix whitespace error in Kconfig:
Signed-off-by: Simon Glass <sjg@chromium.org>

# 28cef9ca 19-Nov-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

fs: fat: create correct short names

The current function set_name() used to create short names has the
following deficiencies resolved by this patch:

* Long names (e.g. FOO.TXT) are stored even if a short name is enough.
* Short names with spaces are created, e.g. "A ~1.TXT".
* Short names with illegal characters are created, e.g. "FOO++BAR".
* Debug output does not not consider that the short file name has no
concluding '\0'.

The solution for the following bug is split of into a separate patch:

* Short file names must be unique.

This patch only provides the loop over possible short file names.

Fixes: c30a15e590c ("FAT: Add FAT write feature")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# e4f8e543 05-Nov-2020 Simon Glass <sjg@chromium.org>

smbios: Drop the unused Kconfig options

Now that we can use devicetree to specify this information, drop the old
CONFIG options.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 44c74bdd 05-Nov-2020 Simon Glass <sjg@chromium.org>

sysinfo: Provide a default driver to set SMBIOS values

Some boards want to specify the manufacturer or product name but do not
need to have their own sysinfo driver.

Add a default driver which provides a way to specify this SMBIOS
information in the devicetree, without needing any board-specific
functionality.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d2cb7a22 04-Nov-2020 Simon Glass <sjg@chromium.org>

x86: Allow putting some tables in the bloblist

At present all tables are placed starting at address f0000 in memory, and
can be up to 64KB in size. If the tables are very large, this may not
provide enough space.

Also if the tables point to other tables (such as console log or a ramoops
area) then we must allocate other memory anyway.

The bloblist is a nice place to put these tables since it is contiguous,
which makes it easy to reserve this memory for linux using the 820 tables.

Add an option to put some of the tables in the bloblist. For SMBIOS and
ACPI, create suitable pointers from the f0000 region to the new location
of the tables.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
[bmeng: squashed in http://patchwork.ozlabs.org/project/uboot/patch/
20201105062407.1.I8091ad931cbbb5e3b6f6ababdf3f8d5db0d17bb9@changeid/]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# 415eab06 03-Nov-2020 Christian Gmeiner <christian.gmeiner@gmail.com>

smbios: add parsing API

Add a very simple API to be able to access SMBIOS strings
like vendor, model and bios version.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 72eda507 27-Oct-2020 Sean Anderson <seanga2@gmail.com>

lib: Add getopt

Some commands can get very unweildy if they have too many positional
arguments. Adding options makes them easier to read, remember, and
understand.

This implementation of getopt has been taken from barebox, which has had
option support for quite a while. I have made a few modifications to their
version, such as the removal of opterr in favor of a separate getopt_silent
function. In addition, I have moved all global variables into struct
getopt_context.

The getopt from barebox also re-orders the arguments passed to it so that
non-options are placed last. This allows users to specify options anywhere.
For example, `ls -l foo/ -R` would be re-ordered to `ls -l -R foo/` as
getopt parsed the options. However, this feature conflicts with the const
argv in cmd_tbl->cmd. This was originally added in 54841ab50c ("Make sure
that argv[] argument pointers are not modified."). The reason stated in
that commit is that hush requires argv to stay unmodified. Has this
situation changed? Barebox also uses hush, and does not have this problem.
Perhaps we could use their fix?

I have assigned maintenance of getopt to Simon Glass, as it is currently
only used by the log command. I would also be fine maintaining it.

Signed-off-by: Sean Anderson <seanga2@gmail.com>

# 26637e2e 12-Sep-2020 Simon Glass <sjg@chromium.org>

lib: Allow hexdump to be used in SPL

It is sometimes useful to output hex dumps in SPL. Add a config option to
allow this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# e87dfb05 05-Aug-2020 Andrii Anisov <andrii_anisov@epam.com>

lib: sscanf: add sscanf implementation

Port sscanf implementation from mini-os and introduce new
Kconfig option to enable it: CONFIG_SSCANF. Disable by default.

Signed-off-by: Andrii Anisov <andrii_anisov@epam.com>
Signed-off-by: Anastasiia Lukianenko <anastasiia_lukianenko@epam.com>
Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>

# 81014f73 30-Jul-2020 Joao Marcos Costa <joaomarcos.costa@bootlin.com>

include/u-boot, lib/zlib: add sources for zlib decompression

Add zlib (v1.2.11) uncompr() function to U-Boot. SquashFS depends on
this function to decompress data from a raw disk image. The actual
support for zlib into SquashFS sources will be added in a follow-up
commit.

Signed-off-by: Joao Marcos Costa <joaomarcos.costa@bootlin.com>

# 69be8fd1 03-Jun-2020 Marek Szyprowski <m.szyprowski@samsung.com>

powerpc: move ADDR_MAP to Kconfig

Move ADDR_MAP related config options from include/configs/*.h to the
proper place in lib/Kconfig. This has been done using
./tools/moveconfig.py and manual inspection of the generated changes.
This is a preparation to use ADDR_MAP helper on ARM 32bit Raspberry Pi4
board for mapping the PCIe XHCI MMIO, which is above the 4GiB identity
mapping limit.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# d16b38f4 15-Apr-2020 Reuben Dowle <reubendowle0@gmail.com>

Add support for SHA384 and SHA512

The current recommendation for best security practice from the US government
is to use SHA384 for TOP SECRET [1].

This patch adds support for SHA384 and SHA512 in the hash command, and also
allows FIT images to be hashed with these algorithms, and signed with
sha384,rsaXXXX and sha512,rsaXXXX

The SHA implementation is adapted from the linux kernel implementation.

[1] Commercial National Security Algorithm Suite
http://www.iad.gov/iad/programs/iad-initiatives/cnsa-suite.cfm

Signed-off-by: Reuben Dowle <reuben.dowle@4rf.com>

# 43e442a5 26-May-2020 Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

kconfig: fix some typos

Signed-off-by: Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

# eff5a547 22-May-2020 Michael Walle <michael@walle.cc>

cmd: zip: automatically pull in gzip()

Move the CONFIG_GZIP_COMPRESSED from a config.h macro to a Kconfig menu
item. It is not selectable by a user because there is no reason to do
so. Instead it will be automatically selected by the stuff which uses
gzip(), like the zip command.

Remove it from the config_whitelist.txt. Also remove
CONFIG_GZIP_COMPRESS_DEF_SZ as this was never used on any board. The
default seems to be sane, otherwise it should be added as a Kconfig
option.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8239be61 06-May-2020 Simon Glass <sjg@chromium.org>

lib: Allow MD5 to be enabled in SPL

At present the MD5 option cannot be enabled by board configs since it has
no Kconfig name. It is generally enabled, so long as FIT support is
present. But not all boards use FIT, particularly in SPL

Fix this and add an option for SPL as well. This allows board code to call
md5() even if FIT support is not enabled.

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

# 04cb3994 21-Apr-2020 Weijie Gao <weijie.gao@mediatek.com>

lib: enable lzma decompression support for SPL build

This patch enables LZMA decompression support for SPL build

Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>

# 2a2119e1 05-Mar-2020 Atish Patra <atishp@atishpatra.org>

lib: kconfig: Add option to set BZIP2 compression method

There is no way to select BZIP2 compression method.
Add it under library/compression config where all other
compression related configs are present.

Signed-off-by: Atish Patra <atish.patra@wdc.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 805b3cac 12-Feb-2020 Keerthy <j-keerthy@ti.com>

lib: elf: Move the generic elf loading/validating functions to lib

Move the generic elf loading/validating functions to lib/
so that they can be re-used and accessed by code existing
outside cmd.

While at it remove the duplicate static version of load_elf_image_phdr
under arch/arm/mach-imx/imx_bootaux.c.

Signed-off-by: Keerthy <j-keerthy@ti.com>
Suggested-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>

# 1611235b 19-Jan-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: Kconfig dependencies for pseudo-random library

drivers/rng/sandbox_rng.c requires rand() to be defined but configuration
option CONFIG_CONFIG_LIB_RAND selected in drivers/rng/Kconfig does not
exist.

test/lib/test_aes.c requires rand() to be defined.

Fix the selection criteria for choice "Pseudo-random library support type".

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 3c10dc95 06-Dec-2019 Simon Glass <sjg@chromium.org>

binman: Add a library to access binman entries

SPL and TPL can access information about binman entries using link-time
symbols but this is not available in U-Boot proper. Of course it could be
made available, but the intention is to just read the device tree.

Add support for this, so that U-Boot can locate entries.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# b4adf627 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: crypto: add x509 parser

Imported from linux kernel v5.3:
x509.asn1 without changes
x509_akid.asn1 without changes
x509_parser.h without changes
x509_cert_parser.c with changes marked as __UBOOT__
x509_public_key.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# a9b45e6e 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add oid registry utility

Imported from linux kernel v5.3:
build_OID_registry without changes
oid_registry.h without changes
oid_registry.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# ab8a0e06 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add asn1 decoder

Imported from linux kernel v5.3:
lib/asn1_decoder.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 2b12196d 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

cmd: add asn1_compiler

Imported from linux kernel v5.3:
asn1.h without changes
asn1_ber_bytecode.h without changes
asn1_decoder.h without changes
asn1_compiler.c without changes

This host command will be used to create a ASN1 parser, for example,
for pkcs7 messages or x509 certificates. More specifically, it will
generate *byte code* which will be interpreted by asn1 decoder library.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 05429b6c 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

rtc: move date.c from drivers/rtc/ to lib/

In the next commit, rtc_mktime(), for compatibility with linux, will be
implemented using rtc_mktime(), which is no longer drivers/rtc specific.
So move this file under lib/.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 37ef1774 10-Nov-2019 Thomas Hebb <tommyhebb@gmail.com>

Kconfig: disambiguate config names for tiny printf

27084c03d36a ("spl: Allow tiny printf() to be controlled in SPL and
TPL") split this option in two for TPL and SPL, but didn't change the
Kconfig names, making them hard to set quickly.

Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>

# 0d76afc0 27-Oct-2019 Simon Glass <sjg@chromium.org>

fdt: Add Kconfig options to control code size

For better or worse libfdt recent grew a lot of code that checks the
validity of the device tree in great detail. When using unsigned or
unverified data this makes things safer, but it does add to code size.

Add some controls to select the trade-off between safety and code size.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 27084c03 25-Sep-2019 Simon Glass <sjg@chromium.org>

spl: Allow tiny printf() to be controlled in SPL and TPL

At present there is only one control for this and it is used for both SPL
and TPL. But SPL might have a lot more space than TPL so the extra cost of
a full printf() might be acceptable.

Split the option into two, providing separate SPL and TPL controls. The
TPL setting defaults to the same as SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2a51e16b 07-Jun-2019 Tom Rini <trini@konsulko.com>

configs: Make USE_TINY_PRINTF depend on SPL||TPL and be default

The USE_TINY_PRINTF symbol only changes things within SPL and TPL
builds, so make it depend on that support. Next, make it default as
within these cases we should rarely have need of more advanced print
formats outside of the debug context.

To do this, in a few cases we need to correct our Kconfig dependencies
as we had cases of non-SPL targets select'ing this symbol. Finally, in
the case of a few boards we really do need the full printf
functionality.

Signed-off-by: Tom Rini <trini@konsulko.com>

# da0fb5fd 02-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: make call depth limit customizable

Up to now we had hard coded values for the call depth up to which trace
records are created: 200 for early tracing, 15 thereafter. UEFI
applications reach a call depth of 80 or above.

Provide customizing settings for the call trace depth limit and the early
call trace depth limit. Use the old values as defaults.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8509f22a 29-Apr-2019 Marek Behún <kabel@kernel.org>

lib: add Zstandard decompression support

Add the zstd library from Linux kernel (only decompression support).
There are minimal changes to build with U-Boot, otherwise the files are
identical to Linux commit dc35da16 from March 2018, the files had not
been touched since in kernel. Also SPDX lincese tags were added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 83a486b6 29-Apr-2019 Marek Behún <kabel@kernel.org>

lib: Add xxhash support

This adds the xxhash support from Linux. Files are almost identical to
those added to Linux in commit 5d240522 ("lib: Add xxhash module") (they
haven't been touched since in Linux). The only difference is to add some
includes to be compatible with U-Boot. Also SPDX lincese tags were
added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 5132361a 29-Apr-2019 Heiko Schocher <hs@denx.de>

lib: Kconfig: fix help text for GZIP

commit 95f4bbd581cf ("lib: fdt: Allow LZO and GZIP DT compression in U-Boot")

introduced Kconfig option for gzip in U-Boot, but help text
says gzip for SPL, which is wrong. Fix this.

Signed-off-by: Heiko Schocher <hs@denx.de>
Acked-by: Marek Vasut <marex@denx.de>

# 1c6eb075 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE_BUFFER_SIZE et al to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE_BUFFER_SIZE
CONFIG_TRACE_EARLY_SIZE
CONFIG_TRACE_EARLY
CONFIG_TRACE_EARLY_ADDR

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

# a24a78d7 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE

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

# 54969b40 21-Mar-2019 Thierry Reding <treding@nvidia.com>

fdtdec: Add Kconfig symbol for tests

Runtime tests are provided as a test_fdtdec command implementation. Add
a Kconfig symbol that allows this command to be built so that the tests
can be used.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 95f4bbd5 08-Mar-2019 Marek Vasut <marex@denx.de>

lib: fdt: Allow LZO and GZIP DT compression in U-Boot

Add required Kconfig symbols, Makefile bits and macro fixes in a
few places to support LZO and DT compression in U-Boot. This can
save a lot of space with multi-DTB fitImages.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>

# 6e705114 13-Jan-2019 Chris Packham <judge.packham@gmail.com>

lib: Kconfig: spelling fixes

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 048c6e89 06-Nov-2018 Simon Glass <sjg@chromium.org>

spl: lz4: Allow use of lz4 compression in SPL

In some cases U-Boot is compressed and it is useful to be able to
decompress it in SPL. Add a Kconfig and Makefile change to allow this.
Note that this does not actually implement decompression.

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

# 2895c4b7 15-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

kconfig: Introduce HAVE_ARCH_IOMAP

Introduce a new Kconfig option for architecture codes to control
whether it provides io{read,write}{8,16,32} I/O accessor functions.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5592a633 01-Oct-2018 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt in TPL

In some cases (e.g. sandbox with verified boot) it is useful to support
libfdt in TPL. Update the Kconfig to handle this.

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

# 6307896c 01-Oct-2018 Simon Glass <sjg@chromium.org>

tpm: Add support for SPL and TPL

At present the tpm can only be used in U-Boot proper. Updated it to work
in SPL and TPL also.

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

# ab948cd2 19-Jul-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

fdt_support: make FDT_FIXUP_PARTITIONS depend on CMD_MTDPARTS

fdt_fixup_mtdparts() calls mtdparts_init() and device_find(),
which are defined in cmd/mtdparts.c

The combination of FDT_FIXUP_PARTITIONS=y and CMD_MTDPARTS=n
emits the following link error:

common/fdt_support.c:903: undefined reference to `mtdparts_init'
common/fdt_support.c:914: undefined reference to `device_find'

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 3330584d 03-Jun-2018 Igor Opaniuk <igor.opaniuk@gmail.com>

avb2.0: integrate avb 2.0 into the build system

Integrate libavb into the build system. Introduce CONFIG_LIBAVB
build option.

Signed-off-by: Igor Opaniuk <igor.opaniuk@linaro.org>

# f8c987f8 05-Jun-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

lib: Add hexdump

Often during debugging session it's very interesting to see
what data we were dealing with. For example what we write or read
to/from memory or peripherals.

This change introduces functions that allow to dump binary
data with one simple function invocation like:
------------------->8----------------
print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, buf, len);
------------------->8----------------

which gives us the following:
------------------->8----------------
00000000: f2 b7 c9 88 62 61 75 64 72 61 74 65 3d 31 31 35 ....baudrate=115
00000010: 32 30 30 00 62 6f 6f 74 61 72 67 73 3d 63 6f 6e 200.bootargs=con
00000020: 73 6f 6c 65 3d 74 74 79 53 33 2c 31 31 35 32 30 sole=ttyS3,11520
00000030: 30 6e 38 00 62 6f 6f 74 64 65 6c 61 79 3d 33 00 0n8.bootdelay=3.
00000040: 62 6f 6f 74 66 69 6c 65 3d 75 49 6d 61 67 65 00 bootfile=uImage.
00000050: 66 64 74 63 6f 6e 74 72 6f 6c 61 64 64 72 3d 39 fdtcontroladdr=9
00000060: 66 66 62 31 62 61 30 00 6c 6f 61 64 61 64 64 72 ffb1ba0.loadaddr
00000070: 3d 30 78 38 32 30 30 30 30 30 30 00 73 74 64 65 =0x82000000.stde
00000080: 72 72 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 rr=serial0@e0022
00000090: 30 30 30 00 73 74 64 69 6e 3d 73 65 72 69 61 6c 000.stdin=serial
000000a0: 30 40 65 30 30 32 32 30 30 30 00 73 74 64 6f 75 0@e0022000.stdou
000000b0: 74 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 30 t=serial0@e00220
000000c0: 30 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00..............
...
------------------->8----------------

Source of hexdump.c was copied from Linux kernel v4.7-rc2.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Mario Six <mario.six@gdsys.cc>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Stefan Roese <sr@denx.de>

# c232d14d 29-May-2018 Alex Kiernan <alex.kiernan@gmail.com>

mmc: Separate "mmc swrite" from fastboot

Introduce CONFIG_IMAGE_SPARSE and CONFIG_CMD_MMC_SWRITE so the "mmc
swrite" command is separated from the fastboot code.

Move image-sparse from common to lib so it's clear it's library code.

Rename CONFIG_FASTBOOT_FLASH_FILLBUF_SIZE to CONFIG_IMAGE_SPARSE_FILLBUF_SIZE
and migrate it to Kconfig.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Acked-by: Jassi Brar <jaswinder.singh@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6417572e 08-May-2018 Tom Rini <trini@konsulko.com>

lib/Kconfig: Mark OF_LIBFDT_OVERLAY as depending on OF_LIBFDT

The overlay code is only useful when OF_LIBFDT is set, so mark it as
depending on that first.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 58a46f88 25-Apr-2018 Praneeth Bajjuri <praneeth@ti.com>

configs: TI: Enable FIT Library overlay support

Enable the FDT library overlay support for all TI SOC family.

Without this option, when Loading fdt from FIT image, the
following warning is seen.

"config with overlays but CONFIG_OF_LIBFDT_OVERLAY not set".

Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
Suggested-by: Andrew F.Davis <afd@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>

# 14ad44ab 18-Apr-2018 Alex Kiernan <alex.kiernan@gmail.com>

spl: Split sprintf, strto* from SPL serial in Kconfig

When SPL serial is disabled, callers who need sprintf or strtoul fail
because their inclusion is guarded by CONFIG_SPL_SERIAL_SUPPORT/
CONFIG_TPL_SERIAL_SUPPORT.

Split printf, sprintf and strto into their own entries and then select
all of them if SERIAL_SUPPORT is enabled to match the current behaviour.

Include panic.o unconditionally as it can be called from anywhere which
uses BUG_ON().

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>

# e294ba06 04-Apr-2018 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-sunxi

Signed-off-by: Tom Rini <trini@konsulko.com>


# d14db11d 03-Apr-2018 Andre Przywara <andre.przywara@arm.com>

sunxi: revert disabling of features

In January some commits were introduced to mitigate the U-Boot image
size issues we encountered on sunxi builds.
Now with the MMC environment removed we can bring them back, as we
practically don't have a size limit anymore.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 32ce6179 13-Mar-2018 Bryan O'Donoghue <bryan.odonoghue@linaro.org>

optee: Add lib entries for sharing OPTEE code across ports

This patch adds code to lib to enable sharing of useful OPTEE code between
board-ports and architectures. The code on lib/optee/optee.c comes from the
TI omap2 port. Eventually the OMAP2 code will be patched to include the
shared code. The intention here is to add more useful OPTEE specific code
as more functionality gets added.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Cc: Harinarayan Bhatta <harinarayan@ti.com>
Cc: Andrew F. Davis <afd@ti.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Kever Yang <kever.yang@rock-chips.com>
Cc: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Cc: Peng Fan <peng.fan@nxp.com>
Tested-by: Peng Fan <peng.fan@nxp.com>

# 36c1877c 06-Feb-2018 Faiz Abbas <faiz_abbas@ti.com>

lib: Kconfig: Move DYNAMIC_CRC_TABLE to Kconfig

Add CONFIG prefix to DYNAMIC_CRC_TABLE and implement it in
Kconfig.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>

# a451bc27 05-Feb-2018 Adam Ford <aford173@gmail.com>

Convert LIB_UUID to Kconfig

config_fallback.h has some logic that checks a variety of options
and selects LIB_UUID if it hasn't already been selected. This
will all LIB_UUID in Kconfig and select this option for the list
of options to allow us to remove the logic from fallbacks

Signed-off-by: Adam Ford <aford173@gmail.com>

# a5a37567 06-Feb-2018 Adam Ford <aford173@gmail.com>

Convert CONFIG LIB_HW_RAND to Kconfig

config_fallbacks.h had some logic to automatically select
LIB_RAND if RANDOM_UUID or CMD_UUID were set if LIB_HW_RAND wasn't
already selected. By migrating LIB_HW_RAND to Kconfig, we can
remove this check from config_fallbacks.h and put it into Kconfig

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
[trini: Turn into a choice, add NET_RANDOM_ETHADDR]
Signed-off-by: Tom Rini <trini@konsulko.com>

# acd4d334 16-Jan-2018 Maxime Ripard <maxime.ripard@free-electrons.com>

net: regex: Disable by default on sunXi

The sunXi arm64 build has overflown, leading to the main U-boot binary
overwriting the environment when flashing the new image, or even worse,
overwriting itself when we're calling saveenv.

Disable this option that is not critical until we can adress the issue
properly.

Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 7e3caa81 03-Dec-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

Move CONFIG_PANIC_HANG to Kconfig

Freescale (NXP) boards have lots of defconfig files per board.
I used "imply PANIC_HANG" for them.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# da5337a6 08-Nov-2017 Nandor Han <nandor.han@ge.com>

rtc: add support for s35392a

Add support for S35392A RTC. The driver supports both U-Boot driver
models.

Signed-off-by: Nandor Han <nandor.han@ge.com>
Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
Cc: Heiko Schocher <hs@denx.de>

# f52bdf4b 14-Sep-2017 Jean-Jacques Hiblot <jjhiblot@ti.com>

lib: allow building lzo for the SPL

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 85d8bf57 03-Sep-2017 Marek Behún <kabel@kernel.org>

lib: Add CRC32-C

This is needed for BTRFS.

Signed-off-by: Marek Behun <marek.behun@nic.cz>

create mode 100644 lib/crc32c.c

# 7264f292 15-Aug-2017 York Sun <york.sun@nxp.com>

spl: fit: Eanble GZIP support for image decompression

Add Kconfig option SPL_GZIP and SPL_ZLIB to enable gunzip support for
SPL boot, eg. falcon boot compressed kernel image.

Signed-off-by: York Sun <york.sun@nxp.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6ef2f901 11-Aug-2017 Adam Ford <aford173@gmail.com>

Convert CONFIG_BCH to Kconfig

This converts the following to Kconfig:
CONFIG_BCH

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1a7ba1d 18-Aug-2017 Anatolij Gustschin <agust@denx.de>

Fix 'notes' typos

s/notes/nodes

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 96b9082c 03-Aug-2017 Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

rockchip: rk3188: rock: adjust for SPL/TPL split

With the changes to split SPL/TPL for the RK3368, I apparently missed
some needed adjustments to the RK3188 Kconfig and rock_defconfig.

This fixes build-issues for the rock board after applying the RK3368
enablement (and SPL/TPL) set that resulted from TPL_SERIAL_SUPPORT,
TPL_ROCKCHIP_BACK_TO_BROM and TPL_TINY_MEMSET being separate symbols
now.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d56b4b19 22-Jul-2017 Tom Rini <trini@konsulko.com>

configs: Migrate RBTREE, LZO, CMD_MTDPARTS, CMD_UBI and CMD_UBIFS

The above CONFIG options are in Kconfig, and now have correct depends and
inter-dependencies. Migrate these to configs/ from include/configs/. In the
case of CMD_UBIFS also change it to be a default y if CMD_UBI.

Signed-off-by: Tom Rini <trini@konsulko.com>

# aed998aa 17-May-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_LZMA to Kconfig

This converts the following to Kconfig:
CONFIG_LZMA

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

# b1a873df 26-Apr-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_CMD_AES et al to Kconfig

This converts the following to Kconfig:
CONFIG_CMD_AES
CONFIG_AES

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Add select AES to CMD_AES]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 173aafbf 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

cmd: Expose a Kconfig option to enable UBIFS commands

Create a new Kconfig entry to allow CMD_UBIFS selection from Kconfig and
add an hidden LZO option that can be selected by CMD_UBIFS.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>

# aa049152 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

mtd: ubi: Select RBTREE option from MTD_UBI Kconfig entry

Expose the RBTREE feature through Kconfig and select this option from the
MTD_UBI option.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>
[Rebased on master]
Signed-off-by: Jagan Teki <jagan@openedev.com>

# ab4458bd 02-Apr-2017 Simon Glass <sjg@chromium.org>

string: Provide a slimmed-down memset()

Most of the time the optimised memset() is what we want. For extreme
situations such as TPL it may be too large. For example on the 'rock'
board, using a simple loop saves a useful 48 bytes. With gcc 4.9 and
the rodata bug, this patch is enough to reduce the TPL image below the
limit.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>

# bea79d7d 14-Mar-2017 Andre Przywara <andre.przywara@arm.com>

Kconfig: introduce md5sum command selection

So far CONFIG_MD5SUM would need to be set by a board's include file.
Since the command is really generic, move it over to Kconfig to allow
it to be defined by either a board's defconfig, menuconfig or some
config snippet merged via mergeconfig.sh.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e663b350 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

smbios: Expose in efi_loader as table

We can pass SMBIOS easily as EFI configuration table to an EFI payload. This
patch adds enablement for that case.

While at it, we also enable SMBIOS generation for ARM systems, since they support
EFI_LOADER.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4b6dddc2 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

x86: Move smbios generation into arch independent directory

We will need the SMBIOS generation function on ARM as well going forward,
so let's move it into a non arch specific location.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# ebf7fff2 05-Oct-2016 Heiko Schocher <hs@denx.de>

spl: move FDT_FIXUP_PARTITIONS to Kconfig

Move FDT_FIXUP_PARTITIONS to Kconfig and cleanup existing
uses.

Signed-off-by: Heiko Schocher <hs@denx.de>

# ddf67f71 05-Jul-2016 Maxime Ripard <maxime.ripard@free-electrons.com>

libfdt: Add overlay application function

The device tree overlays are a good way to deal with user-modifyable
boards or boards with some kind of an expansion mechanism where we can
easily plug new board in (like the BBB, the Raspberry Pi or the CHIP).

Add a new function to merge overlays with a base device tree.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>

# 91b86e21 26-May-2016 Marek Vasut <marex@denx.de>

lib: Enable private libgcc by default

This patch decouples U-Boot binary from the toolchain on systems where
private libgcc is available. Instead of pulling in functions provided
by the libgcc from the toolchain, U-Boot will use it's own set of libgcc
functions. These functions are usually imported from Linux kernel, which
also uses it's own libgcc functions instead of the ones provided by the
toolchain.

This patch solves a rather common problem. The toolchain can usually
generate code for many variants of target architecture and often even
different endianness. The libgcc on the other hand is usually compiled
for one particular configuration and the functions provided by it may
or may not be suited for use in U-Boot. This can manifest in two ways,
either the U-Boot fails to compile altogether and linker will complain
or, in the much worse case, the resulting U-Boot will build, but will
misbehave in very subtle and hard to debug ways.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 67976306 30-Mar-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

cosmetic: Fix typos "privide"

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# ed980b8c 03-Mar-2016 Alexander Graf <agraf@csgraf.de>

efi_loader: hook up in build environment

Now that we have all the bits and pieces ready for EFI payload loading
support, hook them up in Makefiles and KConfigs so that we can build.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
[trini: Enable only when we of OF_LIBFDT, disable on kwb and colibri_pxa270]
Signed-off-by: Tom Rini <trini@konsulko.com>

# aa34fbc0 22-Feb-2016 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt to be used in SPL

Add an option to enable libfdt in SPL. This can be useful when decoding
FIT files in SPL.

We need to make sure this option is not enabled in SPL by this change.
Also this option needs to be enabled in host builds. Si add a new
IMAGE_USE_LIBFDT #define which can be used in files that are built on the
host but must also build for U-Boot and SPL.

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

# 69e173eb 22-Feb-2016 Simon Glass <sjg@chromium.org>

Move CONFIG_OF_LIBFDT to Kconfig

Move this option to Kconfig and tidy up existing boards.

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

# a187559e 05-Feb-2016 Bin Meng <bmeng.cn@gmail.com>

Use correct spelling of "U-Boot"

Correct spelling of "U-Boot" shall be used in all written text
(documentation, comments in source files etc.).

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Minkyu Kang <mk7.kang@samsung.com>

# 947c626d 14-Jan-2016 Tom Rini <trini@konsulko.com>

vsprintf.c: Always enable CONFIG_SYS_VSNPRINTF

Enabling this function always removes some class of string saftey issues.
The size change here in general is about 400 bytes and this seems a reasonable
trade-off.

Cc: Peng Fan <peng.fan@nxp.com>
Cc: Peter Robinson <pbrobinson@gmail.com>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Adrian Alonso <aalonso@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 7d9cde10 22-Nov-2015 Stefan Roese <sr@denx.de>

lib/tiny-printf.c: Add tiny printf function for space limited environments

This patch adds a small printf() version that supports all basic formats.
Its intented to be used in U-Boot SPL versions on platforms with very
limited internal RAM sizes.

To enable it, just define CONFIG_USE_TINY_PRINTF in your defconfig. This
will result in the SPL using this tiny function and the main U-Boot
still using the full-blown printf() function.

This code was copied from:
http://www.sparetimelabs.com/printfrevisited
With mostly only coding style related changes so that its checkpatch
clean.

The size reduction is about 2.5KiB. Here a comparison for the db-mv784mp-gp
(Marvell AXP) SPL:

Without this patch:
58963 18536 1928 79427 13643 ./spl/u-boot-spl

With this patch:
56542 18536 1956 77034 12cea ./spl/u-boot-spl

Note:
To make it possible to compile tiny-printf.c instead of vsprintf.c when
CONFIG_USE_TINY_PRINTF is defined, the functions printf() and vprintf() are
moved from common/console.c into vsprintf.c in this patch.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>

# 2419cd16 03-Oct-2015 Simon Glass <sjg@chromium.org>

dm: tpm: Drop CONFIG_DM_TPM

Now that all TPM drivers use driver model, we can drop the special driver
model CONFIG option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>

# 027b728d 06-Oct-2015 Julius Werner <jwerner@chromium.org>

Add support for LZ4 decompression algorithm

This patch adds support for LZ4-compressed FIT image contents. This
algorithm has a slightly worse compression ration than LZO while being
nearly twice as fast to decompress. When loading images from a fast
storage medium this usually results in a boot time win.

Sandbox-tested only since I don't have a U-Boot development system set
up right now. The code was imported unchanged from coreboot where it's
proven to work, though. I'm mostly interested in getting this recognized
by mkImage for use in a downstream project.

Signed-off-by: Julius Werner <jwerner@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# a7d660bc 22-Aug-2015 Simon Glass <sjg@chromium.org>

tpm: Add Kconfig options for TPMs

Add new Kconfig options for TPMs in preparation for moving boards to use
Kconfig for TPM configuration.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 867a6ac8 31-Jul-2015 Simon Glass <sjg@chromium.org>

efi: Add start-up library code

When running as an EFI application, U-Boot must request memory from EFI,
and provide access to the boot services U-Boot needs.

Add library code to perform these tasks. This includes efi_main() which is
the entry point from EFI. U-Boot is built as a shared library.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d1389403 23-Jun-2015 Simon Glass <sjg@chromium.org>

Add a dhrystone benchmark command

Drystone provides a convenient sanity check that the CPU is running at full
speed. Add this as a command which can be enabled as needed.

Note: I investigated using Coremark for this but there was a license
agreement and I could not work out if it was GPL-compatible.

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

# f7848d90 22-Jun-2015 Joe Hershberger <joe.hershberger@ni.com>

Allow CONFIG_REGEX to be disabled when CONFIG_NET

Instead of selecting REGEX when NET is enabled, make it the default, but
allow boards that are tiny to disable it and lose functionality on all
but the first Ethernet adapter.

cm-bf548, bf538f-ezkit, and bf533-stamp need this. None appear to have
more than one Ethernet interface.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# 3850dbe8 11-Jun-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

blackfin: fix undefined reference to srand and rand

Commit 9ba9e85f3f1c (net: Fix NET_RANDOM_ETHADDR dependencies)
accidentally dropped CONFIG_LIB_RAND defines for 14 Blackfin boards.

Prior to that commit, those boards defined CONFIG_LIB_RAND, but not
CONFIG_NET_RANDOM_ETHADDR. So, commit 9ba9e85f3f1c should not have
touched them, but in fact it ripped CONFIG_LIB_RAND off from all the
header files, which caused undefined reference to srand and rand.
CONFIG_LIB_RAND=y must be revived for such boards.

BTW, this commit indeed makes it better, but even with this fix,
three boards (bf533-stamp, bf538f-ezkit, cm-bf548) still can not
build due to region 'ram' overflowed error. This was cause by
commit 6eed3786c68c (net: Move the CMD_NET config to defconfigs)
because CMD_NET selects NET, and NET selects REGEX. Eventually,
some boards were newly enabled with CONFIG_REGEX, increasing the
memory footprint. A patch is expected to fix the build error.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 9ba9e85f 25-May-2015 Michal Simek <michal.simek@amd.com>

net: Fix NET_RANDOM_ETHADDR dependencies

NET_RANDOM_ETHADDR depends on lib/rand.c. This patch adds dependency to
Kconfig to ensure that library is also compiled.

Remove the definitions from Blackfin boards' include/configs.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 6501ff62 20-Apr-2015 Przemyslaw Marczak <p.marczak@samsung.com>

lib: Kconfig: add entry for errno_str() function

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1a60650c 21-Apr-2015 Joe Hershberger <joe.hershberger@ni.com>

kconfig: Move REGEX to Kconfig

Having this as a Kconfig allows it to be a dependent feature.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8156345d 06-Mar-2015 Simon Glass <sjg@chromium.org>

sandbox: Move CONFIG_SYS_VSNPRINTF to Kconfig

Move this over to Kconfig and tidy up.

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

# 94e3c8c4 19-Feb-2015 gaurav rana <gaurav.rana@freescale.com>

crypto/fsl - Add progressive hashing support using hardware acceleration.

Currently only normal hashing is supported using hardware acceleration.
Added support for progressive hashing using hardware.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
Signed-off-by: Gaurav Rana <gaurav.rana@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>

# d9f23c7f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

lib/rsa: Add Kconfig for devices supporting RSA Modular Exponentiation

Kconfig option added for devices which support RSA Verification.
1. RSA_SOFTWARE_EXP
Enables driver for supporting RSA Modular Exponentiation in Software
2. RSA_FREESCALE_EXP
Enables driver for supporting RSA Modular Exponentiation using Freescale specific
driver

The above drivers use RSA uclass

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
(Removed duplicate line in Kconfig comment)

Change-Id: I7663c4d5350e2bfc3dfa2696f70ef777d6ccc6f6

# c4beb22f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

FIT: Modify option FIT_SIGNATURE in Kconfig

For FIT signature based approach to work, RSA library needs to be selected.
The FIT_SIGNATURE option in Kconfig is modified to automatically select RSA.
Selecting RSA compiles the RSA library required for image verification.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 45ccec8f 23-Oct-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

kconfig: move CONFIG_USE_PRIVATE_LIBGCC to Kconfig

The private libgcc is supported only on ARM, MIPS, PowerPC, SH, x86.
Those architectures should "select" HAVE_PRIVATE_LIBGCC and
CONFIG_USE_PRIVATE_LIBGCC should depend on it.

Currently, this option is enabled on Tegra boards and x86 architecture.
Move the definition from header files to Kconfig.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Tested-by: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: Tom Warren <twarren@nvidia.com>

# 8c688bc4 23-Oct-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

kconfig: move CONFIG_SYS_HZ to lib/Kconfig

CONFIG_SYS_HZ is always defined as 1000 in config_fallbacks.h
(but some boards still have redundant definitions).

This commit moves the definition and the document in README to
Kconfig. Since lib/Kconfig can assure that CONFIG_SYS_HZ is 1000,
the sanity check in lib/time.c should be removed.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Reviewed-by: Marek Vasut <marex@denx.de>

# b0928da6 16-Sep-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

kconfig: move CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED to Kconfig

If this option is enabled, the objects under lib/ directory
are compiled with speed optimization, not size optimization.
(Currently, only used by some Blackfin boards.)

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# ed36323f 16-Sep-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

kconfig: add blank Kconfig files

This would be useful to start moving various config options.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# 86794052 21-Oct-2022 Sughosh Ganu <sughosh.ganu@linaro.org>

FWU: Add support for the FWU Multi Bank Update feature

The FWU Multi Bank Update feature supports updating firmware images
to one of multiple sets(also called banks) of images. The firmware
images are clubbed together in banks, with the system booting images
from the active bank. Information on the images such as which bank
they belong to is stored as part of the metadata structure, which is
stored on the same storage media as the firmware images on a dedicated
partition.

At the time of update, the metadata is read to identify the bank to
which the images need to be flashed(update bank). On a successful
update, the metadata is modified to set the updated bank as active
bank to subsequently boot from.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

# 40ed7be4 02-Aug-2022 Tom Rini <trini@konsulko.com>

Convert CONFIG_SYS_FDT_PAD to Kconfig

This converts the following to Kconfig:
CONFIG_SYS_FDT_PAD

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e67ffb5a 22-Jul-2022 Sughosh Ganu <sughosh.ganu@linaro.org>

tpm: rng: Add driver model interface for TPM RNG device

The TPM device has a builtin random number generator(RNG)
functionality. Expose the RNG functions of the TPM device to the
driver model so that they can be used by the EFI_RNG_PROTOCOL if the
protocol is installed.

Also change the function arguments and return type of the random
number functions to comply with the driver model api.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

# b340199f 10-Jun-2022 Tom Rini <trini@konsulko.com>

spl: Ensure all SPL symbols in Kconfig have some SPL dependency

Tighten up symbol dependencies in a number of places. Ensure that a SPL
specific option has at least a direct dependency on SPL. In places
where it's clear that we depend on something more specific, use that
dependency instead. This means in a very small number of places we can
drop redundant dependencies.

Reported-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 13ce351b 08-Jun-2022 Tom Rini <trini@konsulko.com>

vpl: Ensure all VPL symbols in Kconfig have some VPL dependency

Tighten up symbol dependencies in a number of places. Ensure that a VPL
specific option has at least a direct dependency on VPL. In places
where it's clear that we depend on something more specific, use that
dependency instead.

Reported-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 8bea4bf7 08-Jun-2022 Tom Rini <trini@konsulko.com>

tpl: Ensure all TPL symbols in Kconfig have some TPL dependency

Tighten up symbol dependencies in a number of places. Ensure that a TPL
specific option has at least a direct dependency on TPL. In places
where it's clear that we depend on something more specific, use that
dependency instead.

Reported-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 26f981f2 19-May-2022 Rasmus Villemoes <rasmus.villemoes@prevas.dk>

fdtdec: drop needlessly convoluted CONFIG_PHANDLE_CHECK_SEQ

Asking if the alias we found actually points at the device tree node
we passed in (in the guise of its offset from blob) can be done simply
by asking if the fdt_path_offset() of the alias' path is identical to
offset.

In fact, the current method suffers from the possibility of false
negatives: dtc does not necessarily emit a phandle property for a node
just because it is referenced in /aliases; it only emits a phandle
property for a node if it is referenced in <angle brackets>
somewhere. So if both the node we passed in and the alias node we're
considering don't have phandles, fdt_get_phandle() returns 0 for both.

Since the proper check is so simple, there's no reason to hide that
behind a config option (and if one really wanted that, it should be
called something else because there's no need to involve phandle in
the check).

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Acked-by: Aswath Govindraju <a-govindraju@ti.com>

# d30924f1 01-May-2022 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: fix selection of CONFIG_CHARSET

lib/charset.c is not optional for
EFI_APP || EFI_LOADER || UFS || UT_UNICODE.
These must select CONFIG_CHARSET.

Fixes: 726cd9836db0 ("efi: Make unicode printf available to the app")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>

# 747093dd 30-Apr-2022 Simon Glass <sjg@chromium.org>

vpl: Add Kconfig options for VPL

Add VPL versions of commonly used Kconfig options.

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

# 11232139 06-Apr-2022 Tom Rini <trini@konsulko.com>

nds32: Remove the architecture

As removal of nds32 has been ack'd for the Linux kernel, remove support
here as well.

Cc: Rick Chen <rick@andestech.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Rick Chen <rick@andestech.com>

# fd210fee 28-Mar-2022 Philippe Reynes <philippe.reynes@softathome.com>

lib: allow to build asn1 decoder and oid registry in SPL

This commit adds the options:
- SPL_ASN1_DECODER
- SPL_OID_REGISTRY

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>

# 7d44a985 28-Mar-2022 Philippe Reynes <philippe.reynes@softathome.com>

lib: Kconfig: enhance the help of OID_REGISTRY

Enhance the help for the config OID_REGISTRY.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>

# a0e71d96 28-Mar-2022 Philippe Reynes <philippe.reynes@softathome.com>

lib: Kconfig: enhance help for ASN1

Enhance the help for configs ASN1_COMPILER
and ASN1_decoder.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>

# 761a1786 27-Jan-2022 Tom Rini <trini@konsulko.com>

Merge tag 'dm-pull-26jan22' of https://source.denx.de/u-boot/custodians/u-boot-dm

acpi refactoring to allow non-x86 use
binman support for bintools (binary tools)
minor tools improvements in preparation for FDT signing
various minor fixes and improvements


# 334a9b9d 25-Nov-2021 Loic Poulain <loic.poulain@linaro.org>

lib/circbuf: Make circbuf selectable symbol

It is currenly only used from usbtty driver but make it properly
selectable via Kconfig symbol, for future usage.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>

# e1722fcb 01-Dec-2021 Simon Glass <sjg@chromium.org>

x86: Allow any arch to generate ACPI tables

These have sadly found their way to ARM now. Allow any arch to support
generating ACPI tables.

Disable this for the tools build.

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

# 7c3fd5c2 26-Dec-2021 Qu Wenruo <wqu@suse.com>

lib: add BLAKE2 hash support

The code is cross-ported from BLAKE2 reference implementation
(https://github.com/BLAKE2/BLAKE2).

With minimal change to remove unused macros/features.

Currently there is only one user inside U-boot (btrfs), and since it
only utilize BLAKE2B, all other favors are all removed.

Signed-off-by: Qu Wenruo <wqu@suse.com>
[trini: Rename ROUND to R to avoid clash with <linux/bitops.h>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 97f2a749 04-Jan-2022 Eugen Hristev <eugen.hristev@microchip.com>

lib: Kconfig: fix PHANDLE_CHECK_SEQ position outside of menu

CONFIG_PHANDLE_CHECK_SEQ is outside of the menu 'Library routines'
thus it's invisible in menuconfig and cannot be selected.
Fix this by moving the 'endmenu' after the PHANDLE_CHECK_SEQ definition

Fixes: c589132a1d ("fdt: Use phandle to distinguish DT nodes with same name")
Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
Reviewed-by: Aswath Govindraju <a-govindraju@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 726cd983 29-Dec-2021 Simon Glass <sjg@chromium.org>

efi: Make unicode printf available to the app

This is needed to show unicode strings. Enable this code in the app.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>

# 6405ab7a 24-Nov-2021 Simon Glass <sjg@chromium.org>

Convert CONFIG_PHYSMEM to Kconfig

This converts the following to Kconfig:
CONFIG_PHYSMEM

Signed-off-by: Simon Glass <sjg@chromium.org>
Suggested-by: Sean Anderson <seanga2@gmail.com>

# ac7606af 14-Nov-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

lmb: fix typo 'commun'

%s/commun/common/

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

# e7d285b2 25-Sep-2021 Simon Glass <sjg@chromium.org>

image: Use the correct checks for CRC32

Add a host Kconfig for CRC32. With this we can use CONFIG_IS_ENABLED(CRC32)
directly in the host build, so drop the unnecessary indirection.

Add a few more conditions to SPL_CRC32 to avoid build failures as well as
TPL_CRC32. Also update hash.c to make crc32 optional and to actually take
notice of SPL_CRC32.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# 2c21256b 25-Sep-2021 Simon Glass <sjg@chromium.org>

hash: Use Kconfig to enable hashing in host tools and SPL

At present when building host tools, we force CONFIG_SHAxxx to be enabled
regardless of the board Kconfig setting. This is done in the image.h
header file.

For SPL we currently just assume the algorithm is desired if U-Boot proper
enables it.

Clean this up by adding new Kconfig options to enable hashing on the host,
relying on CONFIG_IS_ENABLED() to deal with the different builds.

Add new SPL Kconfigs for hardware-accelerated hashing, to maintain the
current settings.

This allows us to drop the image.h code and the I_WANT_MD5 hack.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# 603d15a5 25-Sep-2021 Simon Glass <sjg@chromium.org>

spl: cypto: Bring back SPL_ versions of SHA

Unfortunately these were removed by mistake. This means that adding hash
support to SPL brings in all software algorithms, with a substantial
increase in code size.

The origin of the problem was renaming them to SPL_FIT_xxx and then these
were removed altogether in a later commit.

Add them back. This aligns with CONFIG_MD5, for example, which has an SPL
variant.

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: f5bc9c25f31 ("image: Rename SPL_SHAxxx_SUPPORT to SPL_FIT_SHAxxx")
Fixes: eb5171ddec9 ("common: Remove unused CONFIG_FIT_SHAxxx selectors")
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# 6674edaa 16-Sep-2021 Tom Rini <trini@konsulko.com>

Merge tag 'v2021.10-rc4' into next

Prepare v2021.10-rc4

Signed-off-by: Tom Rini <trini@konsulko.com>

# gpg: Signature made Tue 14 Sep 2021 06:58:32 PM EDT
# gpg: using RSA key 1A3C7F70E08FAB1707809BBF147C39FF9634B72C
# gpg: Good signature from "Thomas Rini <trini@konsulko.com>" [ultimate]

# Conflicts:
# board/Arcturus/ucp1020/spl.c
# cmd/mvebu/Kconfig
# common/Kconfig.boot
# common/image-fit.c
# configs/UCP1020_defconfig
# configs/sifive_unmatched_defconfig
# drivers/pci/Kconfig
# include/configs/UCP1020.h
# include/configs/sifive-unmatched.h
# lib/Makefile
# scripts/config_whitelist.txt


# 5145bc73 01-Sep-2021 Oleksandr Suvorov <oleksandr.suvorov@foundries.io>

lib: fix typos in Kconfig

There are trivial typos in the Kconfig file. Fixed them.
Also, fixed grammar in the descriptions with typos.

Fixes: d56b4b1974 ("configs: Migrate RBTREE, LZO, CMD_MTDPARTS, CMD_UBI and CMD_UBIFS")
Fixes: 7264f2928b ("spl: fit: Eanble GZIP support for image decompression")
Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# e60e4499 02-Sep-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

lib: Drop SHA512_ALGO in lieu of SHA512

SHA512_ALGO was used as a "either SHA512 or SHA384", although the
implementations of these two algorithms share a majority of code.

From a Kconfig interface perspective, it makes sense to present two
distinct options. This requires #ifdefing out the SHA512
implementation from sha512.c. The latter doesn't make any sense.

It's reasonable to say in Kconfig that SHA384 depends on SHA512, and
seems to be the more polite way to handle the selection.

Thus, automatically select SHA512 when SHA384 is enabled.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# b4c2c151 27-Aug-2021 Michal Simek <michal.simek@amd.com>

Kconfig: Remove all default n/no options

default n/no doesn't need to be specified. It is default option anyway.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
[trini: Rework FSP_USE_UPD portion]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 928a8be7 29-Jul-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

lib: ecdsa: Implement UCLASS_ECDSA verification on target

Implement the crypto_algo .verify() function for ecdsa256. Because
it backends on UCLASS_ECDSA, this change is focused on parsing the
keys from devicetree and passing this information to the specific
UCLASS driver.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# fa3f1f1d 24-Jul-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: disable CONFIG_SPL_HEXDUMP by default

CONFIG_HEXDUMP is needed to display UEFI variables using 'printenv -e'.

Enabling CONFIG_SPL_HEXDUMP only makes sense for debugging purposes.
Hence CONFIG_SPL_HEXDUMP should not be enabled by default.

The following boards currently have CONFIG_SPL_HEXDUMP=y. This includes
boards that don't use SPL at all.

axm_defconfig
imx8mm-cl-iot-gate_defconfig
imx8mm_venice_defconfig
imxrt1020-evk_defconfig
imxrt1050-evk_defconfig
kontron_sl28_defconfig
kp_imx53_defconfig
lx2160ardb_tfa_stmm_defconfig
mt7622_rfb_defconfig
octeon_ebb7304_defconfig
octeon_nic23_defconfig
qemu_arm64_defconfig
qemu_arm_defconfig
qemu-riscv32_defconfig
qemu-riscv32_smode_defconfig
qemu-riscv64_defconfig
qemu-riscv64_smode_defconfig
qemu-x86_64_defconfig
qemu-x86_defconfig
sandbox64_defconfig
sandbox_defconfig
stm32mp15_basic_defconfig
stm32mp15_trusted_defconfig
synquacer_developerbox_defconfig
taurus_defconfig
xilinx_versal_virt_defconfig

The patch only keeps it enabled on

sandbox_spl_defconfig

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 1a46cb6c 02-Jul-2021 Simon Glass <sjg@chromium.org>

lib: Create a new Kconfig option for charset conversion

Rather than looking at two KConfig options in the Makefile, create a new
Kconfig option for compiling lib/charset.c

Enable it for UFS also, which needs this support.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 26dd9936 08-Jul-2021 Steffen Jaeckel <jaeckel-floss@eyet-services.de>

lib: add crypt subsystem

Add the basic functionality required to support the standard crypt
format.
The files crypt-sha256.c and crypt-sha512.c originate from libxcrypt and
their formatting is therefor retained.
The integration is done via a crypt_compare() function in crypt.c.

```
libxcrypt $ git describe --long --always --all
tags/v4.4.17-0-g6b110bc
```

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 7d0f3fbb 11-Jun-2021 Tero Kristo <t-kristo@ti.com>

lib: rational: copy the rational fraction lib routines from Linux

Copy the best rational approximation calculation routines from Linux.
Typical usecase for these routines is to calculate the M/N divider
values for PLLs to reach a specific clock rate.

This is based on linux kernel commit:
"lib/math/rational.c: fix possible incorrect result from rational
fractions helper"
(sha1: 323dd2c3ed0641f49e89b4e420f9eef5d3d5a881)

Signed-off-by: Tero Kristo <t-kristo@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Tero Kristo <kristo@kernel.org>

# ec0512b1 24-May-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

Revert "lib: introduce HASH_CALCULATE option"

When we think of Kconfig, we usually think of features that we like
to enable or not. Ideally, we wouldn't use Kconfig to fix a build
issue, although sometimes it might make sense. With Kconfig it's hard
to guarantee that the fix is universal. We can only say that it works
for the set of tested configurations. In the majority of cases, it's
preferable to let the linker figure things out for us.

The reverted commit attempted to fix a build issue by adding an
invisible Kconfig option. This is wrong in several ways:

It invents a new Kconfig variable when CONFIG_HASH already
exists for the same purpose.
Second, hash-checksum.c makes use of the hash_progressive_lookup_algo()
symbol, which is only provided with CONFIG_HASH, but this dependency
was not expressed in the reverted patch.

It feels like Kconfig is turning into a listing of all available
source files, and a buffet to 'select' which ones to compile. The
purpose of this revert is to enable the next change to make use of
CONFIG_HASH instead of adding to Kconfig.

This reverts commit 87316da05f2fd49d3709275e64ef0c5980366ade.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Acked-by: Masahisa Kojima <masahisa.kojima@linaro.org>

# 1621d3c4 10-May-2021 Bin Meng <bmeng.cn@gmail.com>

lib: kconfig: Limit BINMAN_FDT for OF_SEPARATE or OF_EMBED

Generally speaking BINMAN_FDT makes sense for OF_SEPARATE or OF_EMBED.
For the other OF_CONTROL methods, it's quite possible binman node is
not available as binman is invoked during the build phase instead of
runtime. Let's only turn it on for OF_SEPARATE or OF_EMBED by default.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 87316da0 13-May-2021 Masahisa Kojima <masahisa.kojima@linaro.org>

lib: introduce HASH_CALCULATE option

Build error occurs when CONFIG_EFI_SECURE_BOOT or
CONFIG_EFI_CAPSULE_AUTHENTICATE is enabled,
because hash-checksum.c is not compiled.

Since hash_calculate() implemented in hash-checksum.c can be
commonly used aside from FIT image signature verification,
this commit itroduces HASH_CALCULATE option to decide
if hash-checksum.c shall be compiled.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# e2ae483c 13-May-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

hash: Kconfig option for SHA512 hardware acceleration

Commit a479f103dc1c ("hash: Allow for SHA512 hardware implementations")
defined function definitions for hardware accelerated SHA384 and SHA512.
If CONFIG_SHA_HW_ACCEL=y, these functions are used.

We already have boards using CONFIG_SHA_HW_ACCEL=y but none implements the
new functions hw_sha384() and hw_sha512().

For implementing the EFI TCG2 protocol we need SHA384 and SHA512. The
missing hardware acceleration functions lead to build errors on boards like
peach-pi_defconfig.

Introduce a new Kconfig symbol CONFIG_SHA512_HW_ACCEL to control if the
functions hw_sha384() and hw_sha512() shall be used to implement the SHA384
and SHA512 algorithms.

Fixes: a479f103dc1c ("hash: Allow for SHA512 hardware implementations")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

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

# 6d66502b 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: Add 2 config to define the max number of regions

Add 2 configs CONFIG_LMB_MEMORY_REGIONS and CONFIG_LMB_RESERVED_REGIONS
to change independently the max number of the regions in lmb
library.

When CONFIG_LMB_USE_MAX_REGIONS=y, move the lmb property arrays to
struct lmb and manage the array size with the element 'max' of struct
lmb_region; their are still allocated in stack.

When CONFIG_LMB_USE_MAX_REGIONS=n, keep the current location in
struct lmb_region to allow compiler optimization.

Increase CONFIG_LMB_RESERVED_REGIONS is useful to avoid lmb errors in
bootm when the number of reserved regions (not adjacent) is reached:
+ 1 region for relocated U-Boot
+ 1 region for initrd
+ 1 region for relocated linux device tree
+ reserved memory regions present in Linux device tree.

The current limit of 8 regions is reached with only 5 reserved regions
in DT.

see Linux kernel commit bf23c51f1f49 ("memblock: Move memblock arrays
to static storage in memblock.c and make their size a variable")

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# 4fa0150d 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: move MAX_LMB_REGIONS value in Kconfig

Move MAX_LMB_REGIONS value in Kconfig, the max number of the regions
in lmb library.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# 77b8cfef 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: move CONFIG_LMB in Kconfig

Migrate CONFIG_LMB in Kconfig.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# a479f103 16-Feb-2021 Joel Stanley <joel@jms.id.au>

hash: Allow for SHA512 hardware implementations

Similar to support for SHA1 and SHA256, allow the use of hardware hashing
engine by enabling the algorithm and setting CONFIG_SHA_HW_ACCEL /
CONFIG_SHA_PROG_HW_ACCEL.

Signed-off-by: Joel Stanley <joel@jms.id.au>

# f2c1442e 14-Mar-2021 Simon Glass <sjg@chromium.org>

bloblist: Make BLOBLIST_TABLES depend on BLOBLIST

Add an extra condition here since we cannot put x86 tables in a bloblist
when bloblists are not supported.

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

# e0103158 25-Feb-2021 Bin Meng <bmeng.cn@gmail.com>

lib: kconfig: Mention CONFIG_ADDR_MAP limitation in the help

Mention that CONFIG_ADDR_MAP only works in the post-relocation phase.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>

# 56e7257c 03-Feb-2021 Bin Meng <bmeng.cn@gmail.com>

lib: Fix BINMAN_FDT dependency

lib/binman.c references the following 3 ofnode APIs:
ofnode_first_subnode(), ofnode_path() and ofnode_read_bool().

These APIs get built only when DM is on. Fix the dependency then.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 59e4e391 18-Jan-2021 Tom Rini <trini@konsulko.com>

Merge https://gitlab.denx.de/u-boot/custodians/u-boot-riscv

- Update qemu-riscv.rst build instructions.
- Add support for SPI on Kendryte K210.
- Add Microchip PolarFire SoC Icicle Kit support.
- Add support for an early timer.
- Select TIMER_EARLY to avoid infinite recursion for Trace.


# a80f8513 17-Jan-2021 Pragnesh Patel <pragnesh.patel@sifive.com>

trace: select TIMER_EARLY to avoid infinite recursion

When tracing functions is enabled this adds calls to
__cyg_profile_func_enter() and __cyg_profile_func_exit() to the traced
functions.

__cyg_profile_func_enter() and __cyg_profile_func_exit() invoke
timer_get_us() to record the entry and exit time.

initr_dm() will make gd->dm_root = NULL and gd->timer = NULL, so
timer_get_us() -> get_ticks() -> dm_timer_init() will lead to an
indefinite recursion.

So select TIMER_EARLY when tracing got enabled.

Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Rick Chen <rick@andestech.com>

# 6205bbb1 04-Jan-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lib: cosmetic update of CONFIG_LIB_ELF description

Change 2 typo error in CONFIG_LIB_ELF description:
- Supoort => Support
- fir => for

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c589132a 02-Dec-2020 Aswath Govindraju <a-govindraju@ti.com>

fdt: Use phandle to distinguish DT nodes with same name

While assigning the sequence number to subsystem instances by reading the
aliases property, only DT nodes names are compared and not the complete
path. This causes a problem when there are two DT nodes with same name but
have different paths.

In arch/arm/dts/k3-am65-main.dtsi there are two USB controllers with the
same device tree node name but different path. When aliases are defined for
these USB controllers then fdtdec_get_alias_seq() fails to pick the correct
instance for a given index.

fdt_path_offset() function is slow and this would effect the U-Boot
startup. To avert the time penalty on all boards, apply this extra check
only when required by using a config option.

Fix it by comparing the phandles of DT nodes after the node names match,
under a config option.

Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Fix whitespace error in Kconfig:
Signed-off-by: Simon Glass <sjg@chromium.org>

# 28cef9ca 19-Nov-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

fs: fat: create correct short names

The current function set_name() used to create short names has the
following deficiencies resolved by this patch:

* Long names (e.g. FOO.TXT) are stored even if a short name is enough.
* Short names with spaces are created, e.g. "A ~1.TXT".
* Short names with illegal characters are created, e.g. "FOO++BAR".
* Debug output does not not consider that the short file name has no
concluding '\0'.

The solution for the following bug is split of into a separate patch:

* Short file names must be unique.

This patch only provides the loop over possible short file names.

Fixes: c30a15e590c ("FAT: Add FAT write feature")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# e4f8e543 05-Nov-2020 Simon Glass <sjg@chromium.org>

smbios: Drop the unused Kconfig options

Now that we can use devicetree to specify this information, drop the old
CONFIG options.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 44c74bdd 05-Nov-2020 Simon Glass <sjg@chromium.org>

sysinfo: Provide a default driver to set SMBIOS values

Some boards want to specify the manufacturer or product name but do not
need to have their own sysinfo driver.

Add a default driver which provides a way to specify this SMBIOS
information in the devicetree, without needing any board-specific
functionality.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d2cb7a22 04-Nov-2020 Simon Glass <sjg@chromium.org>

x86: Allow putting some tables in the bloblist

At present all tables are placed starting at address f0000 in memory, and
can be up to 64KB in size. If the tables are very large, this may not
provide enough space.

Also if the tables point to other tables (such as console log or a ramoops
area) then we must allocate other memory anyway.

The bloblist is a nice place to put these tables since it is contiguous,
which makes it easy to reserve this memory for linux using the 820 tables.

Add an option to put some of the tables in the bloblist. For SMBIOS and
ACPI, create suitable pointers from the f0000 region to the new location
of the tables.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
[bmeng: squashed in http://patchwork.ozlabs.org/project/uboot/patch/
20201105062407.1.I8091ad931cbbb5e3b6f6ababdf3f8d5db0d17bb9@changeid/]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# 415eab06 03-Nov-2020 Christian Gmeiner <christian.gmeiner@gmail.com>

smbios: add parsing API

Add a very simple API to be able to access SMBIOS strings
like vendor, model and bios version.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 72eda507 27-Oct-2020 Sean Anderson <seanga2@gmail.com>

lib: Add getopt

Some commands can get very unweildy if they have too many positional
arguments. Adding options makes them easier to read, remember, and
understand.

This implementation of getopt has been taken from barebox, which has had
option support for quite a while. I have made a few modifications to their
version, such as the removal of opterr in favor of a separate getopt_silent
function. In addition, I have moved all global variables into struct
getopt_context.

The getopt from barebox also re-orders the arguments passed to it so that
non-options are placed last. This allows users to specify options anywhere.
For example, `ls -l foo/ -R` would be re-ordered to `ls -l -R foo/` as
getopt parsed the options. However, this feature conflicts with the const
argv in cmd_tbl->cmd. This was originally added in 54841ab50c ("Make sure
that argv[] argument pointers are not modified."). The reason stated in
that commit is that hush requires argv to stay unmodified. Has this
situation changed? Barebox also uses hush, and does not have this problem.
Perhaps we could use their fix?

I have assigned maintenance of getopt to Simon Glass, as it is currently
only used by the log command. I would also be fine maintaining it.

Signed-off-by: Sean Anderson <seanga2@gmail.com>

# 26637e2e 12-Sep-2020 Simon Glass <sjg@chromium.org>

lib: Allow hexdump to be used in SPL

It is sometimes useful to output hex dumps in SPL. Add a config option to
allow this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# e87dfb05 05-Aug-2020 Andrii Anisov <andrii_anisov@epam.com>

lib: sscanf: add sscanf implementation

Port sscanf implementation from mini-os and introduce new
Kconfig option to enable it: CONFIG_SSCANF. Disable by default.

Signed-off-by: Andrii Anisov <andrii_anisov@epam.com>
Signed-off-by: Anastasiia Lukianenko <anastasiia_lukianenko@epam.com>
Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>

# 81014f73 30-Jul-2020 Joao Marcos Costa <joaomarcos.costa@bootlin.com>

include/u-boot, lib/zlib: add sources for zlib decompression

Add zlib (v1.2.11) uncompr() function to U-Boot. SquashFS depends on
this function to decompress data from a raw disk image. The actual
support for zlib into SquashFS sources will be added in a follow-up
commit.

Signed-off-by: Joao Marcos Costa <joaomarcos.costa@bootlin.com>

# 69be8fd1 03-Jun-2020 Marek Szyprowski <m.szyprowski@samsung.com>

powerpc: move ADDR_MAP to Kconfig

Move ADDR_MAP related config options from include/configs/*.h to the
proper place in lib/Kconfig. This has been done using
./tools/moveconfig.py and manual inspection of the generated changes.
This is a preparation to use ADDR_MAP helper on ARM 32bit Raspberry Pi4
board for mapping the PCIe XHCI MMIO, which is above the 4GiB identity
mapping limit.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# d16b38f4 15-Apr-2020 Reuben Dowle <reubendowle0@gmail.com>

Add support for SHA384 and SHA512

The current recommendation for best security practice from the US government
is to use SHA384 for TOP SECRET [1].

This patch adds support for SHA384 and SHA512 in the hash command, and also
allows FIT images to be hashed with these algorithms, and signed with
sha384,rsaXXXX and sha512,rsaXXXX

The SHA implementation is adapted from the linux kernel implementation.

[1] Commercial National Security Algorithm Suite
http://www.iad.gov/iad/programs/iad-initiatives/cnsa-suite.cfm

Signed-off-by: Reuben Dowle <reuben.dowle@4rf.com>

# 43e442a5 26-May-2020 Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

kconfig: fix some typos

Signed-off-by: Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

# eff5a547 22-May-2020 Michael Walle <michael@walle.cc>

cmd: zip: automatically pull in gzip()

Move the CONFIG_GZIP_COMPRESSED from a config.h macro to a Kconfig menu
item. It is not selectable by a user because there is no reason to do
so. Instead it will be automatically selected by the stuff which uses
gzip(), like the zip command.

Remove it from the config_whitelist.txt. Also remove
CONFIG_GZIP_COMPRESS_DEF_SZ as this was never used on any board. The
default seems to be sane, otherwise it should be added as a Kconfig
option.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8239be61 06-May-2020 Simon Glass <sjg@chromium.org>

lib: Allow MD5 to be enabled in SPL

At present the MD5 option cannot be enabled by board configs since it has
no Kconfig name. It is generally enabled, so long as FIT support is
present. But not all boards use FIT, particularly in SPL

Fix this and add an option for SPL as well. This allows board code to call
md5() even if FIT support is not enabled.

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

# 04cb3994 21-Apr-2020 Weijie Gao <weijie.gao@mediatek.com>

lib: enable lzma decompression support for SPL build

This patch enables LZMA decompression support for SPL build

Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>

# 2a2119e1 05-Mar-2020 Atish Patra <atishp@atishpatra.org>

lib: kconfig: Add option to set BZIP2 compression method

There is no way to select BZIP2 compression method.
Add it under library/compression config where all other
compression related configs are present.

Signed-off-by: Atish Patra <atish.patra@wdc.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 805b3cac 12-Feb-2020 Keerthy <j-keerthy@ti.com>

lib: elf: Move the generic elf loading/validating functions to lib

Move the generic elf loading/validating functions to lib/
so that they can be re-used and accessed by code existing
outside cmd.

While at it remove the duplicate static version of load_elf_image_phdr
under arch/arm/mach-imx/imx_bootaux.c.

Signed-off-by: Keerthy <j-keerthy@ti.com>
Suggested-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>

# 1611235b 19-Jan-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: Kconfig dependencies for pseudo-random library

drivers/rng/sandbox_rng.c requires rand() to be defined but configuration
option CONFIG_CONFIG_LIB_RAND selected in drivers/rng/Kconfig does not
exist.

test/lib/test_aes.c requires rand() to be defined.

Fix the selection criteria for choice "Pseudo-random library support type".

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 3c10dc95 06-Dec-2019 Simon Glass <sjg@chromium.org>

binman: Add a library to access binman entries

SPL and TPL can access information about binman entries using link-time
symbols but this is not available in U-Boot proper. Of course it could be
made available, but the intention is to just read the device tree.

Add support for this, so that U-Boot can locate entries.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# b4adf627 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: crypto: add x509 parser

Imported from linux kernel v5.3:
x509.asn1 without changes
x509_akid.asn1 without changes
x509_parser.h without changes
x509_cert_parser.c with changes marked as __UBOOT__
x509_public_key.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# a9b45e6e 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add oid registry utility

Imported from linux kernel v5.3:
build_OID_registry without changes
oid_registry.h without changes
oid_registry.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# ab8a0e06 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add asn1 decoder

Imported from linux kernel v5.3:
lib/asn1_decoder.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 2b12196d 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

cmd: add asn1_compiler

Imported from linux kernel v5.3:
asn1.h without changes
asn1_ber_bytecode.h without changes
asn1_decoder.h without changes
asn1_compiler.c without changes

This host command will be used to create a ASN1 parser, for example,
for pkcs7 messages or x509 certificates. More specifically, it will
generate *byte code* which will be interpreted by asn1 decoder library.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 05429b6c 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

rtc: move date.c from drivers/rtc/ to lib/

In the next commit, rtc_mktime(), for compatibility with linux, will be
implemented using rtc_mktime(), which is no longer drivers/rtc specific.
So move this file under lib/.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 37ef1774 10-Nov-2019 Thomas Hebb <tommyhebb@gmail.com>

Kconfig: disambiguate config names for tiny printf

27084c03d36a ("spl: Allow tiny printf() to be controlled in SPL and
TPL") split this option in two for TPL and SPL, but didn't change the
Kconfig names, making them hard to set quickly.

Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>

# 0d76afc0 27-Oct-2019 Simon Glass <sjg@chromium.org>

fdt: Add Kconfig options to control code size

For better or worse libfdt recent grew a lot of code that checks the
validity of the device tree in great detail. When using unsigned or
unverified data this makes things safer, but it does add to code size.

Add some controls to select the trade-off between safety and code size.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 27084c03 25-Sep-2019 Simon Glass <sjg@chromium.org>

spl: Allow tiny printf() to be controlled in SPL and TPL

At present there is only one control for this and it is used for both SPL
and TPL. But SPL might have a lot more space than TPL so the extra cost of
a full printf() might be acceptable.

Split the option into two, providing separate SPL and TPL controls. The
TPL setting defaults to the same as SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2a51e16b 07-Jun-2019 Tom Rini <trini@konsulko.com>

configs: Make USE_TINY_PRINTF depend on SPL||TPL and be default

The USE_TINY_PRINTF symbol only changes things within SPL and TPL
builds, so make it depend on that support. Next, make it default as
within these cases we should rarely have need of more advanced print
formats outside of the debug context.

To do this, in a few cases we need to correct our Kconfig dependencies
as we had cases of non-SPL targets select'ing this symbol. Finally, in
the case of a few boards we really do need the full printf
functionality.

Signed-off-by: Tom Rini <trini@konsulko.com>

# da0fb5fd 02-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: make call depth limit customizable

Up to now we had hard coded values for the call depth up to which trace
records are created: 200 for early tracing, 15 thereafter. UEFI
applications reach a call depth of 80 or above.

Provide customizing settings for the call trace depth limit and the early
call trace depth limit. Use the old values as defaults.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8509f22a 29-Apr-2019 Marek Behún <kabel@kernel.org>

lib: add Zstandard decompression support

Add the zstd library from Linux kernel (only decompression support).
There are minimal changes to build with U-Boot, otherwise the files are
identical to Linux commit dc35da16 from March 2018, the files had not
been touched since in kernel. Also SPDX lincese tags were added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 83a486b6 29-Apr-2019 Marek Behún <kabel@kernel.org>

lib: Add xxhash support

This adds the xxhash support from Linux. Files are almost identical to
those added to Linux in commit 5d240522 ("lib: Add xxhash module") (they
haven't been touched since in Linux). The only difference is to add some
includes to be compatible with U-Boot. Also SPDX lincese tags were
added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 5132361a 29-Apr-2019 Heiko Schocher <hs@denx.de>

lib: Kconfig: fix help text for GZIP

commit 95f4bbd581cf ("lib: fdt: Allow LZO and GZIP DT compression in U-Boot")

introduced Kconfig option for gzip in U-Boot, but help text
says gzip for SPL, which is wrong. Fix this.

Signed-off-by: Heiko Schocher <hs@denx.de>
Acked-by: Marek Vasut <marex@denx.de>

# 1c6eb075 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE_BUFFER_SIZE et al to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE_BUFFER_SIZE
CONFIG_TRACE_EARLY_SIZE
CONFIG_TRACE_EARLY
CONFIG_TRACE_EARLY_ADDR

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

# a24a78d7 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE

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

# 54969b40 21-Mar-2019 Thierry Reding <treding@nvidia.com>

fdtdec: Add Kconfig symbol for tests

Runtime tests are provided as a test_fdtdec command implementation. Add
a Kconfig symbol that allows this command to be built so that the tests
can be used.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 95f4bbd5 08-Mar-2019 Marek Vasut <marex@denx.de>

lib: fdt: Allow LZO and GZIP DT compression in U-Boot

Add required Kconfig symbols, Makefile bits and macro fixes in a
few places to support LZO and DT compression in U-Boot. This can
save a lot of space with multi-DTB fitImages.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>

# 6e705114 13-Jan-2019 Chris Packham <judge.packham@gmail.com>

lib: Kconfig: spelling fixes

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 048c6e89 06-Nov-2018 Simon Glass <sjg@chromium.org>

spl: lz4: Allow use of lz4 compression in SPL

In some cases U-Boot is compressed and it is useful to be able to
decompress it in SPL. Add a Kconfig and Makefile change to allow this.
Note that this does not actually implement decompression.

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

# 2895c4b7 15-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

kconfig: Introduce HAVE_ARCH_IOMAP

Introduce a new Kconfig option for architecture codes to control
whether it provides io{read,write}{8,16,32} I/O accessor functions.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5592a633 01-Oct-2018 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt in TPL

In some cases (e.g. sandbox with verified boot) it is useful to support
libfdt in TPL. Update the Kconfig to handle this.

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

# 6307896c 01-Oct-2018 Simon Glass <sjg@chromium.org>

tpm: Add support for SPL and TPL

At present the tpm can only be used in U-Boot proper. Updated it to work
in SPL and TPL also.

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

# ab948cd2 19-Jul-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

fdt_support: make FDT_FIXUP_PARTITIONS depend on CMD_MTDPARTS

fdt_fixup_mtdparts() calls mtdparts_init() and device_find(),
which are defined in cmd/mtdparts.c

The combination of FDT_FIXUP_PARTITIONS=y and CMD_MTDPARTS=n
emits the following link error:

common/fdt_support.c:903: undefined reference to `mtdparts_init'
common/fdt_support.c:914: undefined reference to `device_find'

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 3330584d 03-Jun-2018 Igor Opaniuk <igor.opaniuk@gmail.com>

avb2.0: integrate avb 2.0 into the build system

Integrate libavb into the build system. Introduce CONFIG_LIBAVB
build option.

Signed-off-by: Igor Opaniuk <igor.opaniuk@linaro.org>

# f8c987f8 05-Jun-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

lib: Add hexdump

Often during debugging session it's very interesting to see
what data we were dealing with. For example what we write or read
to/from memory or peripherals.

This change introduces functions that allow to dump binary
data with one simple function invocation like:
------------------->8----------------
print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, buf, len);
------------------->8----------------

which gives us the following:
------------------->8----------------
00000000: f2 b7 c9 88 62 61 75 64 72 61 74 65 3d 31 31 35 ....baudrate=115
00000010: 32 30 30 00 62 6f 6f 74 61 72 67 73 3d 63 6f 6e 200.bootargs=con
00000020: 73 6f 6c 65 3d 74 74 79 53 33 2c 31 31 35 32 30 sole=ttyS3,11520
00000030: 30 6e 38 00 62 6f 6f 74 64 65 6c 61 79 3d 33 00 0n8.bootdelay=3.
00000040: 62 6f 6f 74 66 69 6c 65 3d 75 49 6d 61 67 65 00 bootfile=uImage.
00000050: 66 64 74 63 6f 6e 74 72 6f 6c 61 64 64 72 3d 39 fdtcontroladdr=9
00000060: 66 66 62 31 62 61 30 00 6c 6f 61 64 61 64 64 72 ffb1ba0.loadaddr
00000070: 3d 30 78 38 32 30 30 30 30 30 30 00 73 74 64 65 =0x82000000.stde
00000080: 72 72 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 rr=serial0@e0022
00000090: 30 30 30 00 73 74 64 69 6e 3d 73 65 72 69 61 6c 000.stdin=serial
000000a0: 30 40 65 30 30 32 32 30 30 30 00 73 74 64 6f 75 0@e0022000.stdou
000000b0: 74 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 30 t=serial0@e00220
000000c0: 30 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00..............
...
------------------->8----------------

Source of hexdump.c was copied from Linux kernel v4.7-rc2.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Mario Six <mario.six@gdsys.cc>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Stefan Roese <sr@denx.de>

# c232d14d 29-May-2018 Alex Kiernan <alex.kiernan@gmail.com>

mmc: Separate "mmc swrite" from fastboot

Introduce CONFIG_IMAGE_SPARSE and CONFIG_CMD_MMC_SWRITE so the "mmc
swrite" command is separated from the fastboot code.

Move image-sparse from common to lib so it's clear it's library code.

Rename CONFIG_FASTBOOT_FLASH_FILLBUF_SIZE to CONFIG_IMAGE_SPARSE_FILLBUF_SIZE
and migrate it to Kconfig.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Acked-by: Jassi Brar <jaswinder.singh@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6417572e 08-May-2018 Tom Rini <trini@konsulko.com>

lib/Kconfig: Mark OF_LIBFDT_OVERLAY as depending on OF_LIBFDT

The overlay code is only useful when OF_LIBFDT is set, so mark it as
depending on that first.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 58a46f88 25-Apr-2018 Praneeth Bajjuri <praneeth@ti.com>

configs: TI: Enable FIT Library overlay support

Enable the FDT library overlay support for all TI SOC family.

Without this option, when Loading fdt from FIT image, the
following warning is seen.

"config with overlays but CONFIG_OF_LIBFDT_OVERLAY not set".

Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
Suggested-by: Andrew F.Davis <afd@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>

# 14ad44ab 18-Apr-2018 Alex Kiernan <alex.kiernan@gmail.com>

spl: Split sprintf, strto* from SPL serial in Kconfig

When SPL serial is disabled, callers who need sprintf or strtoul fail
because their inclusion is guarded by CONFIG_SPL_SERIAL_SUPPORT/
CONFIG_TPL_SERIAL_SUPPORT.

Split printf, sprintf and strto into their own entries and then select
all of them if SERIAL_SUPPORT is enabled to match the current behaviour.

Include panic.o unconditionally as it can be called from anywhere which
uses BUG_ON().

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>

# e294ba06 04-Apr-2018 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-sunxi

Signed-off-by: Tom Rini <trini@konsulko.com>


# d14db11d 03-Apr-2018 Andre Przywara <andre.przywara@arm.com>

sunxi: revert disabling of features

In January some commits were introduced to mitigate the U-Boot image
size issues we encountered on sunxi builds.
Now with the MMC environment removed we can bring them back, as we
practically don't have a size limit anymore.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 32ce6179 13-Mar-2018 Bryan O'Donoghue <bryan.odonoghue@linaro.org>

optee: Add lib entries for sharing OPTEE code across ports

This patch adds code to lib to enable sharing of useful OPTEE code between
board-ports and architectures. The code on lib/optee/optee.c comes from the
TI omap2 port. Eventually the OMAP2 code will be patched to include the
shared code. The intention here is to add more useful OPTEE specific code
as more functionality gets added.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Cc: Harinarayan Bhatta <harinarayan@ti.com>
Cc: Andrew F. Davis <afd@ti.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Kever Yang <kever.yang@rock-chips.com>
Cc: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Cc: Peng Fan <peng.fan@nxp.com>
Tested-by: Peng Fan <peng.fan@nxp.com>

# 36c1877c 06-Feb-2018 Faiz Abbas <faiz_abbas@ti.com>

lib: Kconfig: Move DYNAMIC_CRC_TABLE to Kconfig

Add CONFIG prefix to DYNAMIC_CRC_TABLE and implement it in
Kconfig.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>

# a451bc27 05-Feb-2018 Adam Ford <aford173@gmail.com>

Convert LIB_UUID to Kconfig

config_fallback.h has some logic that checks a variety of options
and selects LIB_UUID if it hasn't already been selected. This
will all LIB_UUID in Kconfig and select this option for the list
of options to allow us to remove the logic from fallbacks

Signed-off-by: Adam Ford <aford173@gmail.com>

# a5a37567 06-Feb-2018 Adam Ford <aford173@gmail.com>

Convert CONFIG LIB_HW_RAND to Kconfig

config_fallbacks.h had some logic to automatically select
LIB_RAND if RANDOM_UUID or CMD_UUID were set if LIB_HW_RAND wasn't
already selected. By migrating LIB_HW_RAND to Kconfig, we can
remove this check from config_fallbacks.h and put it into Kconfig

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
[trini: Turn into a choice, add NET_RANDOM_ETHADDR]
Signed-off-by: Tom Rini <trini@konsulko.com>

# acd4d334 16-Jan-2018 Maxime Ripard <maxime.ripard@free-electrons.com>

net: regex: Disable by default on sunXi

The sunXi arm64 build has overflown, leading to the main U-boot binary
overwriting the environment when flashing the new image, or even worse,
overwriting itself when we're calling saveenv.

Disable this option that is not critical until we can adress the issue
properly.

Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 7e3caa81 03-Dec-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

Move CONFIG_PANIC_HANG to Kconfig

Freescale (NXP) boards have lots of defconfig files per board.
I used "imply PANIC_HANG" for them.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# da5337a6 08-Nov-2017 Nandor Han <nandor.han@ge.com>

rtc: add support for s35392a

Add support for S35392A RTC. The driver supports both U-Boot driver
models.

Signed-off-by: Nandor Han <nandor.han@ge.com>
Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
Cc: Heiko Schocher <hs@denx.de>

# f52bdf4b 14-Sep-2017 Jean-Jacques Hiblot <jjhiblot@ti.com>

lib: allow building lzo for the SPL

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 85d8bf57 03-Sep-2017 Marek Behún <kabel@kernel.org>

lib: Add CRC32-C

This is needed for BTRFS.

Signed-off-by: Marek Behun <marek.behun@nic.cz>

create mode 100644 lib/crc32c.c

# 7264f292 15-Aug-2017 York Sun <york.sun@nxp.com>

spl: fit: Eanble GZIP support for image decompression

Add Kconfig option SPL_GZIP and SPL_ZLIB to enable gunzip support for
SPL boot, eg. falcon boot compressed kernel image.

Signed-off-by: York Sun <york.sun@nxp.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6ef2f901 11-Aug-2017 Adam Ford <aford173@gmail.com>

Convert CONFIG_BCH to Kconfig

This converts the following to Kconfig:
CONFIG_BCH

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1a7ba1d 18-Aug-2017 Anatolij Gustschin <agust@denx.de>

Fix 'notes' typos

s/notes/nodes

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 96b9082c 03-Aug-2017 Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

rockchip: rk3188: rock: adjust for SPL/TPL split

With the changes to split SPL/TPL for the RK3368, I apparently missed
some needed adjustments to the RK3188 Kconfig and rock_defconfig.

This fixes build-issues for the rock board after applying the RK3368
enablement (and SPL/TPL) set that resulted from TPL_SERIAL_SUPPORT,
TPL_ROCKCHIP_BACK_TO_BROM and TPL_TINY_MEMSET being separate symbols
now.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d56b4b19 22-Jul-2017 Tom Rini <trini@konsulko.com>

configs: Migrate RBTREE, LZO, CMD_MTDPARTS, CMD_UBI and CMD_UBIFS

The above CONFIG options are in Kconfig, and now have correct depends and
inter-dependencies. Migrate these to configs/ from include/configs/. In the
case of CMD_UBIFS also change it to be a default y if CMD_UBI.

Signed-off-by: Tom Rini <trini@konsulko.com>

# aed998aa 17-May-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_LZMA to Kconfig

This converts the following to Kconfig:
CONFIG_LZMA

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

# b1a873df 26-Apr-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_CMD_AES et al to Kconfig

This converts the following to Kconfig:
CONFIG_CMD_AES
CONFIG_AES

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Add select AES to CMD_AES]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 173aafbf 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

cmd: Expose a Kconfig option to enable UBIFS commands

Create a new Kconfig entry to allow CMD_UBIFS selection from Kconfig and
add an hidden LZO option that can be selected by CMD_UBIFS.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>

# aa049152 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

mtd: ubi: Select RBTREE option from MTD_UBI Kconfig entry

Expose the RBTREE feature through Kconfig and select this option from the
MTD_UBI option.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>
[Rebased on master]
Signed-off-by: Jagan Teki <jagan@openedev.com>

# ab4458bd 02-Apr-2017 Simon Glass <sjg@chromium.org>

string: Provide a slimmed-down memset()

Most of the time the optimised memset() is what we want. For extreme
situations such as TPL it may be too large. For example on the 'rock'
board, using a simple loop saves a useful 48 bytes. With gcc 4.9 and
the rodata bug, this patch is enough to reduce the TPL image below the
limit.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>

# bea79d7d 14-Mar-2017 Andre Przywara <andre.przywara@arm.com>

Kconfig: introduce md5sum command selection

So far CONFIG_MD5SUM would need to be set by a board's include file.
Since the command is really generic, move it over to Kconfig to allow
it to be defined by either a board's defconfig, menuconfig or some
config snippet merged via mergeconfig.sh.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e663b350 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

smbios: Expose in efi_loader as table

We can pass SMBIOS easily as EFI configuration table to an EFI payload. This
patch adds enablement for that case.

While at it, we also enable SMBIOS generation for ARM systems, since they support
EFI_LOADER.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4b6dddc2 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

x86: Move smbios generation into arch independent directory

We will need the SMBIOS generation function on ARM as well going forward,
so let's move it into a non arch specific location.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# ebf7fff2 05-Oct-2016 Heiko Schocher <hs@denx.de>

spl: move FDT_FIXUP_PARTITIONS to Kconfig

Move FDT_FIXUP_PARTITIONS to Kconfig and cleanup existing
uses.

Signed-off-by: Heiko Schocher <hs@denx.de>

# ddf67f71 05-Jul-2016 Maxime Ripard <maxime.ripard@free-electrons.com>

libfdt: Add overlay application function

The device tree overlays are a good way to deal with user-modifyable
boards or boards with some kind of an expansion mechanism where we can
easily plug new board in (like the BBB, the Raspberry Pi or the CHIP).

Add a new function to merge overlays with a base device tree.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>

# 91b86e21 26-May-2016 Marek Vasut <marex@denx.de>

lib: Enable private libgcc by default

This patch decouples U-Boot binary from the toolchain on systems where
private libgcc is available. Instead of pulling in functions provided
by the libgcc from the toolchain, U-Boot will use it's own set of libgcc
functions. These functions are usually imported from Linux kernel, which
also uses it's own libgcc functions instead of the ones provided by the
toolchain.

This patch solves a rather common problem. The toolchain can usually
generate code for many variants of target architecture and often even
different endianness. The libgcc on the other hand is usually compiled
for one particular configuration and the functions provided by it may
or may not be suited for use in U-Boot. This can manifest in two ways,
either the U-Boot fails to compile altogether and linker will complain
or, in the much worse case, the resulting U-Boot will build, but will
misbehave in very subtle and hard to debug ways.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 67976306 30-Mar-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

cosmetic: Fix typos "privide"

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# ed980b8c 03-Mar-2016 Alexander Graf <agraf@csgraf.de>

efi_loader: hook up in build environment

Now that we have all the bits and pieces ready for EFI payload loading
support, hook them up in Makefiles and KConfigs so that we can build.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
[trini: Enable only when we of OF_LIBFDT, disable on kwb and colibri_pxa270]
Signed-off-by: Tom Rini <trini@konsulko.com>

# aa34fbc0 22-Feb-2016 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt to be used in SPL

Add an option to enable libfdt in SPL. This can be useful when decoding
FIT files in SPL.

We need to make sure this option is not enabled in SPL by this change.
Also this option needs to be enabled in host builds. Si add a new
IMAGE_USE_LIBFDT #define which can be used in files that are built on the
host but must also build for U-Boot and SPL.

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

# 69e173eb 22-Feb-2016 Simon Glass <sjg@chromium.org>

Move CONFIG_OF_LIBFDT to Kconfig

Move this option to Kconfig and tidy up existing boards.

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

# a187559e 05-Feb-2016 Bin Meng <bmeng.cn@gmail.com>

Use correct spelling of "U-Boot"

Correct spelling of "U-Boot" shall be used in all written text
(documentation, comments in source files etc.).

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Minkyu Kang <mk7.kang@samsung.com>

# 947c626d 14-Jan-2016 Tom Rini <trini@konsulko.com>

vsprintf.c: Always enable CONFIG_SYS_VSNPRINTF

Enabling this function always removes some class of string saftey issues.
The size change here in general is about 400 bytes and this seems a reasonable
trade-off.

Cc: Peng Fan <peng.fan@nxp.com>
Cc: Peter Robinson <pbrobinson@gmail.com>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Adrian Alonso <aalonso@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 7d9cde10 22-Nov-2015 Stefan Roese <sr@denx.de>

lib/tiny-printf.c: Add tiny printf function for space limited environments

This patch adds a small printf() version that supports all basic formats.
Its intented to be used in U-Boot SPL versions on platforms with very
limited internal RAM sizes.

To enable it, just define CONFIG_USE_TINY_PRINTF in your defconfig. This
will result in the SPL using this tiny function and the main U-Boot
still using the full-blown printf() function.

This code was copied from:
http://www.sparetimelabs.com/printfrevisited
With mostly only coding style related changes so that its checkpatch
clean.

The size reduction is about 2.5KiB. Here a comparison for the db-mv784mp-gp
(Marvell AXP) SPL:

Without this patch:
58963 18536 1928 79427 13643 ./spl/u-boot-spl

With this patch:
56542 18536 1956 77034 12cea ./spl/u-boot-spl

Note:
To make it possible to compile tiny-printf.c instead of vsprintf.c when
CONFIG_USE_TINY_PRINTF is defined, the functions printf() and vprintf() are
moved from common/console.c into vsprintf.c in this patch.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>

# 2419cd16 03-Oct-2015 Simon Glass <sjg@chromium.org>

dm: tpm: Drop CONFIG_DM_TPM

Now that all TPM drivers use driver model, we can drop the special driver
model CONFIG option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>

# 027b728d 06-Oct-2015 Julius Werner <jwerner@chromium.org>

Add support for LZ4 decompression algorithm

This patch adds support for LZ4-compressed FIT image contents. This
algorithm has a slightly worse compression ration than LZO while being
nearly twice as fast to decompress. When loading images from a fast
storage medium this usually results in a boot time win.

Sandbox-tested only since I don't have a U-Boot development system set
up right now. The code was imported unchanged from coreboot where it's
proven to work, though. I'm mostly interested in getting this recognized
by mkImage for use in a downstream project.

Signed-off-by: Julius Werner <jwerner@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# a7d660bc 22-Aug-2015 Simon Glass <sjg@chromium.org>

tpm: Add Kconfig options for TPMs

Add new Kconfig options for TPMs in preparation for moving boards to use
Kconfig for TPM configuration.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 867a6ac8 31-Jul-2015 Simon Glass <sjg@chromium.org>

efi: Add start-up library code

When running as an EFI application, U-Boot must request memory from EFI,
and provide access to the boot services U-Boot needs.

Add library code to perform these tasks. This includes efi_main() which is
the entry point from EFI. U-Boot is built as a shared library.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d1389403 23-Jun-2015 Simon Glass <sjg@chromium.org>

Add a dhrystone benchmark command

Drystone provides a convenient sanity check that the CPU is running at full
speed. Add this as a command which can be enabled as needed.

Note: I investigated using Coremark for this but there was a license
agreement and I could not work out if it was GPL-compatible.

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

# f7848d90 22-Jun-2015 Joe Hershberger <joe.hershberger@ni.com>

Allow CONFIG_REGEX to be disabled when CONFIG_NET

Instead of selecting REGEX when NET is enabled, make it the default, but
allow boards that are tiny to disable it and lose functionality on all
but the first Ethernet adapter.

cm-bf548, bf538f-ezkit, and bf533-stamp need this. None appear to have
more than one Ethernet interface.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# 3850dbe8 11-Jun-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

blackfin: fix undefined reference to srand and rand

Commit 9ba9e85f3f1c (net: Fix NET_RANDOM_ETHADDR dependencies)
accidentally dropped CONFIG_LIB_RAND defines for 14 Blackfin boards.

Prior to that commit, those boards defined CONFIG_LIB_RAND, but not
CONFIG_NET_RANDOM_ETHADDR. So, commit 9ba9e85f3f1c should not have
touched them, but in fact it ripped CONFIG_LIB_RAND off from all the
header files, which caused undefined reference to srand and rand.
CONFIG_LIB_RAND=y must be revived for such boards.

BTW, this commit indeed makes it better, but even with this fix,
three boards (bf533-stamp, bf538f-ezkit, cm-bf548) still can not
build due to region 'ram' overflowed error. This was cause by
commit 6eed3786c68c (net: Move the CMD_NET config to defconfigs)
because CMD_NET selects NET, and NET selects REGEX. Eventually,
some boards were newly enabled with CONFIG_REGEX, increasing the
memory footprint. A patch is expected to fix the build error.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 9ba9e85f 25-May-2015 Michal Simek <michal.simek@amd.com>

net: Fix NET_RANDOM_ETHADDR dependencies

NET_RANDOM_ETHADDR depends on lib/rand.c. This patch adds dependency to
Kconfig to ensure that library is also compiled.

Remove the definitions from Blackfin boards' include/configs.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 6501ff62 20-Apr-2015 Przemyslaw Marczak <p.marczak@samsung.com>

lib: Kconfig: add entry for errno_str() function

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1a60650c 21-Apr-2015 Joe Hershberger <joe.hershberger@ni.com>

kconfig: Move REGEX to Kconfig

Having this as a Kconfig allows it to be a dependent feature.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8156345d 06-Mar-2015 Simon Glass <sjg@chromium.org>

sandbox: Move CONFIG_SYS_VSNPRINTF to Kconfig

Move this over to Kconfig and tidy up.

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

# 94e3c8c4 19-Feb-2015 gaurav rana <gaurav.rana@freescale.com>

crypto/fsl - Add progressive hashing support using hardware acceleration.

Currently only normal hashing is supported using hardware acceleration.
Added support for progressive hashing using hardware.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
Signed-off-by: Gaurav Rana <gaurav.rana@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>

# d9f23c7f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

lib/rsa: Add Kconfig for devices supporting RSA Modular Exponentiation

Kconfig option added for devices which support RSA Verification.
1. RSA_SOFTWARE_EXP
Enables driver for supporting RSA Modular Exponentiation in Software
2. RSA_FREESCALE_EXP
Enables driver for supporting RSA Modular Exponentiation using Freescale specific
driver

The above drivers use RSA uclass

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
(Removed duplicate line in Kconfig comment)

Change-Id: I7663c4d5350e2bfc3dfa2696f70ef777d6ccc6f6

# c4beb22f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

FIT: Modify option FIT_SIGNATURE in Kconfig

For FIT signature based approach to work, RSA library needs to be selected.
The FIT_SIGNATURE option in Kconfig is modified to automatically select RSA.
Selecting RSA compiles the RSA library required for image verification.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 45ccec8f 23-Oct-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

kconfig: move CONFIG_USE_PRIVATE_LIBGCC to Kconfig

The private libgcc is supported only on ARM, MIPS, PowerPC, SH, x86.
Those architectures should "select" HAVE_PRIVATE_LIBGCC and
CONFIG_USE_PRIVATE_LIBGCC should depend on it.

Currently, this option is enabled on Tegra boards and x86 architecture.
Move the definition from header files to Kconfig.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Tested-by: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: Tom Warren <twarren@nvidia.com>

# 8c688bc4 23-Oct-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

kconfig: move CONFIG_SYS_HZ to lib/Kconfig

CONFIG_SYS_HZ is always defined as 1000 in config_fallbacks.h
(but some boards still have redundant definitions).

This commit moves the definition and the document in README to
Kconfig. Since lib/Kconfig can assure that CONFIG_SYS_HZ is 1000,
the sanity check in lib/time.c should be removed.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Reviewed-by: Marek Vasut <marex@denx.de>

# b0928da6 16-Sep-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

kconfig: move CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED to Kconfig

If this option is enabled, the objects under lib/ directory
are compiled with speed optimization, not size optimization.
(Currently, only used by some Blackfin boards.)

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# ed36323f 16-Sep-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

kconfig: add blank Kconfig files

This would be useful to start moving various config options.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# 40ed7be4 02-Aug-2022 Tom Rini <trini@konsulko.com>

Convert CONFIG_SYS_FDT_PAD to Kconfig

This converts the following to Kconfig:
CONFIG_SYS_FDT_PAD

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e67ffb5a 22-Jul-2022 Sughosh Ganu <sughosh.ganu@linaro.org>

tpm: rng: Add driver model interface for TPM RNG device

The TPM device has a builtin random number generator(RNG)
functionality. Expose the RNG functions of the TPM device to the
driver model so that they can be used by the EFI_RNG_PROTOCOL if the
protocol is installed.

Also change the function arguments and return type of the random
number functions to comply with the driver model api.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

# b340199f 10-Jun-2022 Tom Rini <trini@konsulko.com>

spl: Ensure all SPL symbols in Kconfig have some SPL dependency

Tighten up symbol dependencies in a number of places. Ensure that a SPL
specific option has at least a direct dependency on SPL. In places
where it's clear that we depend on something more specific, use that
dependency instead. This means in a very small number of places we can
drop redundant dependencies.

Reported-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 13ce351b 08-Jun-2022 Tom Rini <trini@konsulko.com>

vpl: Ensure all VPL symbols in Kconfig have some VPL dependency

Tighten up symbol dependencies in a number of places. Ensure that a VPL
specific option has at least a direct dependency on VPL. In places
where it's clear that we depend on something more specific, use that
dependency instead.

Reported-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 8bea4bf7 08-Jun-2022 Tom Rini <trini@konsulko.com>

tpl: Ensure all TPL symbols in Kconfig have some TPL dependency

Tighten up symbol dependencies in a number of places. Ensure that a TPL
specific option has at least a direct dependency on TPL. In places
where it's clear that we depend on something more specific, use that
dependency instead.

Reported-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 26f981f2 19-May-2022 Rasmus Villemoes <rasmus.villemoes@prevas.dk>

fdtdec: drop needlessly convoluted CONFIG_PHANDLE_CHECK_SEQ

Asking if the alias we found actually points at the device tree node
we passed in (in the guise of its offset from blob) can be done simply
by asking if the fdt_path_offset() of the alias' path is identical to
offset.

In fact, the current method suffers from the possibility of false
negatives: dtc does not necessarily emit a phandle property for a node
just because it is referenced in /aliases; it only emits a phandle
property for a node if it is referenced in <angle brackets>
somewhere. So if both the node we passed in and the alias node we're
considering don't have phandles, fdt_get_phandle() returns 0 for both.

Since the proper check is so simple, there's no reason to hide that
behind a config option (and if one really wanted that, it should be
called something else because there's no need to involve phandle in
the check).

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Acked-by: Aswath Govindraju <a-govindraju@ti.com>

# d30924f1 01-May-2022 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: fix selection of CONFIG_CHARSET

lib/charset.c is not optional for
EFI_APP || EFI_LOADER || UFS || UT_UNICODE.
These must select CONFIG_CHARSET.

Fixes: 726cd9836db0 ("efi: Make unicode printf available to the app")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>

# 747093dd 30-Apr-2022 Simon Glass <sjg@chromium.org>

vpl: Add Kconfig options for VPL

Add VPL versions of commonly used Kconfig options.

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

# 11232139 06-Apr-2022 Tom Rini <trini@konsulko.com>

nds32: Remove the architecture

As removal of nds32 has been ack'd for the Linux kernel, remove support
here as well.

Cc: Rick Chen <rick@andestech.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Rick Chen <rick@andestech.com>

# fd210fee 28-Mar-2022 Philippe Reynes <philippe.reynes@softathome.com>

lib: allow to build asn1 decoder and oid registry in SPL

This commit adds the options:
- SPL_ASN1_DECODER
- SPL_OID_REGISTRY

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>

# 7d44a985 28-Mar-2022 Philippe Reynes <philippe.reynes@softathome.com>

lib: Kconfig: enhance the help of OID_REGISTRY

Enhance the help for the config OID_REGISTRY.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>

# a0e71d96 28-Mar-2022 Philippe Reynes <philippe.reynes@softathome.com>

lib: Kconfig: enhance help for ASN1

Enhance the help for configs ASN1_COMPILER
and ASN1_decoder.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>

# 761a1786 27-Jan-2022 Tom Rini <trini@konsulko.com>

Merge tag 'dm-pull-26jan22' of https://source.denx.de/u-boot/custodians/u-boot-dm

acpi refactoring to allow non-x86 use
binman support for bintools (binary tools)
minor tools improvements in preparation for FDT signing
various minor fixes and improvements


# 334a9b9d 25-Nov-2021 Loic Poulain <loic.poulain@linaro.org>

lib/circbuf: Make circbuf selectable symbol

It is currenly only used from usbtty driver but make it properly
selectable via Kconfig symbol, for future usage.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>

# e1722fcb 01-Dec-2021 Simon Glass <sjg@chromium.org>

x86: Allow any arch to generate ACPI tables

These have sadly found their way to ARM now. Allow any arch to support
generating ACPI tables.

Disable this for the tools build.

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

# 7c3fd5c2 26-Dec-2021 Qu Wenruo <wqu@suse.com>

lib: add BLAKE2 hash support

The code is cross-ported from BLAKE2 reference implementation
(https://github.com/BLAKE2/BLAKE2).

With minimal change to remove unused macros/features.

Currently there is only one user inside U-boot (btrfs), and since it
only utilize BLAKE2B, all other favors are all removed.

Signed-off-by: Qu Wenruo <wqu@suse.com>
[trini: Rename ROUND to R to avoid clash with <linux/bitops.h>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 97f2a749 04-Jan-2022 Eugen Hristev <eugen.hristev@microchip.com>

lib: Kconfig: fix PHANDLE_CHECK_SEQ position outside of menu

CONFIG_PHANDLE_CHECK_SEQ is outside of the menu 'Library routines'
thus it's invisible in menuconfig and cannot be selected.
Fix this by moving the 'endmenu' after the PHANDLE_CHECK_SEQ definition

Fixes: c589132a1d ("fdt: Use phandle to distinguish DT nodes with same name")
Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
Reviewed-by: Aswath Govindraju <a-govindraju@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 726cd983 29-Dec-2021 Simon Glass <sjg@chromium.org>

efi: Make unicode printf available to the app

This is needed to show unicode strings. Enable this code in the app.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>

# 6405ab7a 24-Nov-2021 Simon Glass <sjg@chromium.org>

Convert CONFIG_PHYSMEM to Kconfig

This converts the following to Kconfig:
CONFIG_PHYSMEM

Signed-off-by: Simon Glass <sjg@chromium.org>
Suggested-by: Sean Anderson <seanga2@gmail.com>

# ac7606af 14-Nov-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

lmb: fix typo 'commun'

%s/commun/common/

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

# e7d285b2 25-Sep-2021 Simon Glass <sjg@chromium.org>

image: Use the correct checks for CRC32

Add a host Kconfig for CRC32. With this we can use CONFIG_IS_ENABLED(CRC32)
directly in the host build, so drop the unnecessary indirection.

Add a few more conditions to SPL_CRC32 to avoid build failures as well as
TPL_CRC32. Also update hash.c to make crc32 optional and to actually take
notice of SPL_CRC32.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# 2c21256b 25-Sep-2021 Simon Glass <sjg@chromium.org>

hash: Use Kconfig to enable hashing in host tools and SPL

At present when building host tools, we force CONFIG_SHAxxx to be enabled
regardless of the board Kconfig setting. This is done in the image.h
header file.

For SPL we currently just assume the algorithm is desired if U-Boot proper
enables it.

Clean this up by adding new Kconfig options to enable hashing on the host,
relying on CONFIG_IS_ENABLED() to deal with the different builds.

Add new SPL Kconfigs for hardware-accelerated hashing, to maintain the
current settings.

This allows us to drop the image.h code and the I_WANT_MD5 hack.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# 603d15a5 25-Sep-2021 Simon Glass <sjg@chromium.org>

spl: cypto: Bring back SPL_ versions of SHA

Unfortunately these were removed by mistake. This means that adding hash
support to SPL brings in all software algorithms, with a substantial
increase in code size.

The origin of the problem was renaming them to SPL_FIT_xxx and then these
were removed altogether in a later commit.

Add them back. This aligns with CONFIG_MD5, for example, which has an SPL
variant.

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: f5bc9c25f31 ("image: Rename SPL_SHAxxx_SUPPORT to SPL_FIT_SHAxxx")
Fixes: eb5171ddec9 ("common: Remove unused CONFIG_FIT_SHAxxx selectors")
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# 6674edaa 16-Sep-2021 Tom Rini <trini@konsulko.com>

Merge tag 'v2021.10-rc4' into next

Prepare v2021.10-rc4

Signed-off-by: Tom Rini <trini@konsulko.com>

# gpg: Signature made Tue 14 Sep 2021 06:58:32 PM EDT
# gpg: using RSA key 1A3C7F70E08FAB1707809BBF147C39FF9634B72C
# gpg: Good signature from "Thomas Rini <trini@konsulko.com>" [ultimate]

# Conflicts:
# board/Arcturus/ucp1020/spl.c
# cmd/mvebu/Kconfig
# common/Kconfig.boot
# common/image-fit.c
# configs/UCP1020_defconfig
# configs/sifive_unmatched_defconfig
# drivers/pci/Kconfig
# include/configs/UCP1020.h
# include/configs/sifive-unmatched.h
# lib/Makefile
# scripts/config_whitelist.txt


# 5145bc73 01-Sep-2021 Oleksandr Suvorov <oleksandr.suvorov@foundries.io>

lib: fix typos in Kconfig

There are trivial typos in the Kconfig file. Fixed them.
Also, fixed grammar in the descriptions with typos.

Fixes: d56b4b1974 ("configs: Migrate RBTREE, LZO, CMD_MTDPARTS, CMD_UBI and CMD_UBIFS")
Fixes: 7264f2928b ("spl: fit: Eanble GZIP support for image decompression")
Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# e60e4499 02-Sep-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

lib: Drop SHA512_ALGO in lieu of SHA512

SHA512_ALGO was used as a "either SHA512 or SHA384", although the
implementations of these two algorithms share a majority of code.

From a Kconfig interface perspective, it makes sense to present two
distinct options. This requires #ifdefing out the SHA512
implementation from sha512.c. The latter doesn't make any sense.

It's reasonable to say in Kconfig that SHA384 depends on SHA512, and
seems to be the more polite way to handle the selection.

Thus, automatically select SHA512 when SHA384 is enabled.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# b4c2c151 27-Aug-2021 Michal Simek <michal.simek@amd.com>

Kconfig: Remove all default n/no options

default n/no doesn't need to be specified. It is default option anyway.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
[trini: Rework FSP_USE_UPD portion]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 928a8be7 29-Jul-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

lib: ecdsa: Implement UCLASS_ECDSA verification on target

Implement the crypto_algo .verify() function for ecdsa256. Because
it backends on UCLASS_ECDSA, this change is focused on parsing the
keys from devicetree and passing this information to the specific
UCLASS driver.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# fa3f1f1d 24-Jul-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: disable CONFIG_SPL_HEXDUMP by default

CONFIG_HEXDUMP is needed to display UEFI variables using 'printenv -e'.

Enabling CONFIG_SPL_HEXDUMP only makes sense for debugging purposes.
Hence CONFIG_SPL_HEXDUMP should not be enabled by default.

The following boards currently have CONFIG_SPL_HEXDUMP=y. This includes
boards that don't use SPL at all.

axm_defconfig
imx8mm-cl-iot-gate_defconfig
imx8mm_venice_defconfig
imxrt1020-evk_defconfig
imxrt1050-evk_defconfig
kontron_sl28_defconfig
kp_imx53_defconfig
lx2160ardb_tfa_stmm_defconfig
mt7622_rfb_defconfig
octeon_ebb7304_defconfig
octeon_nic23_defconfig
qemu_arm64_defconfig
qemu_arm_defconfig
qemu-riscv32_defconfig
qemu-riscv32_smode_defconfig
qemu-riscv64_defconfig
qemu-riscv64_smode_defconfig
qemu-x86_64_defconfig
qemu-x86_defconfig
sandbox64_defconfig
sandbox_defconfig
stm32mp15_basic_defconfig
stm32mp15_trusted_defconfig
synquacer_developerbox_defconfig
taurus_defconfig
xilinx_versal_virt_defconfig

The patch only keeps it enabled on

sandbox_spl_defconfig

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 1a46cb6c 02-Jul-2021 Simon Glass <sjg@chromium.org>

lib: Create a new Kconfig option for charset conversion

Rather than looking at two KConfig options in the Makefile, create a new
Kconfig option for compiling lib/charset.c

Enable it for UFS also, which needs this support.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 26dd9936 08-Jul-2021 Steffen Jaeckel <jaeckel-floss@eyet-services.de>

lib: add crypt subsystem

Add the basic functionality required to support the standard crypt
format.
The files crypt-sha256.c and crypt-sha512.c originate from libxcrypt and
their formatting is therefor retained.
The integration is done via a crypt_compare() function in crypt.c.

```
libxcrypt $ git describe --long --always --all
tags/v4.4.17-0-g6b110bc
```

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 7d0f3fbb 11-Jun-2021 Tero Kristo <t-kristo@ti.com>

lib: rational: copy the rational fraction lib routines from Linux

Copy the best rational approximation calculation routines from Linux.
Typical usecase for these routines is to calculate the M/N divider
values for PLLs to reach a specific clock rate.

This is based on linux kernel commit:
"lib/math/rational.c: fix possible incorrect result from rational
fractions helper"
(sha1: 323dd2c3ed0641f49e89b4e420f9eef5d3d5a881)

Signed-off-by: Tero Kristo <t-kristo@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Tero Kristo <kristo@kernel.org>

# ec0512b1 24-May-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

Revert "lib: introduce HASH_CALCULATE option"

When we think of Kconfig, we usually think of features that we like
to enable or not. Ideally, we wouldn't use Kconfig to fix a build
issue, although sometimes it might make sense. With Kconfig it's hard
to guarantee that the fix is universal. We can only say that it works
for the set of tested configurations. In the majority of cases, it's
preferable to let the linker figure things out for us.

The reverted commit attempted to fix a build issue by adding an
invisible Kconfig option. This is wrong in several ways:

It invents a new Kconfig variable when CONFIG_HASH already
exists for the same purpose.
Second, hash-checksum.c makes use of the hash_progressive_lookup_algo()
symbol, which is only provided with CONFIG_HASH, but this dependency
was not expressed in the reverted patch.

It feels like Kconfig is turning into a listing of all available
source files, and a buffet to 'select' which ones to compile. The
purpose of this revert is to enable the next change to make use of
CONFIG_HASH instead of adding to Kconfig.

This reverts commit 87316da05f2fd49d3709275e64ef0c5980366ade.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Acked-by: Masahisa Kojima <masahisa.kojima@linaro.org>

# 1621d3c4 10-May-2021 Bin Meng <bmeng.cn@gmail.com>

lib: kconfig: Limit BINMAN_FDT for OF_SEPARATE or OF_EMBED

Generally speaking BINMAN_FDT makes sense for OF_SEPARATE or OF_EMBED.
For the other OF_CONTROL methods, it's quite possible binman node is
not available as binman is invoked during the build phase instead of
runtime. Let's only turn it on for OF_SEPARATE or OF_EMBED by default.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 87316da0 13-May-2021 Masahisa Kojima <masahisa.kojima@linaro.org>

lib: introduce HASH_CALCULATE option

Build error occurs when CONFIG_EFI_SECURE_BOOT or
CONFIG_EFI_CAPSULE_AUTHENTICATE is enabled,
because hash-checksum.c is not compiled.

Since hash_calculate() implemented in hash-checksum.c can be
commonly used aside from FIT image signature verification,
this commit itroduces HASH_CALCULATE option to decide
if hash-checksum.c shall be compiled.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# e2ae483c 13-May-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

hash: Kconfig option for SHA512 hardware acceleration

Commit a479f103dc1c ("hash: Allow for SHA512 hardware implementations")
defined function definitions for hardware accelerated SHA384 and SHA512.
If CONFIG_SHA_HW_ACCEL=y, these functions are used.

We already have boards using CONFIG_SHA_HW_ACCEL=y but none implements the
new functions hw_sha384() and hw_sha512().

For implementing the EFI TCG2 protocol we need SHA384 and SHA512. The
missing hardware acceleration functions lead to build errors on boards like
peach-pi_defconfig.

Introduce a new Kconfig symbol CONFIG_SHA512_HW_ACCEL to control if the
functions hw_sha384() and hw_sha512() shall be used to implement the SHA384
and SHA512 algorithms.

Fixes: a479f103dc1c ("hash: Allow for SHA512 hardware implementations")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

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

# 6d66502b 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: Add 2 config to define the max number of regions

Add 2 configs CONFIG_LMB_MEMORY_REGIONS and CONFIG_LMB_RESERVED_REGIONS
to change independently the max number of the regions in lmb
library.

When CONFIG_LMB_USE_MAX_REGIONS=y, move the lmb property arrays to
struct lmb and manage the array size with the element 'max' of struct
lmb_region; their are still allocated in stack.

When CONFIG_LMB_USE_MAX_REGIONS=n, keep the current location in
struct lmb_region to allow compiler optimization.

Increase CONFIG_LMB_RESERVED_REGIONS is useful to avoid lmb errors in
bootm when the number of reserved regions (not adjacent) is reached:
+ 1 region for relocated U-Boot
+ 1 region for initrd
+ 1 region for relocated linux device tree
+ reserved memory regions present in Linux device tree.

The current limit of 8 regions is reached with only 5 reserved regions
in DT.

see Linux kernel commit bf23c51f1f49 ("memblock: Move memblock arrays
to static storage in memblock.c and make their size a variable")

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# 4fa0150d 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: move MAX_LMB_REGIONS value in Kconfig

Move MAX_LMB_REGIONS value in Kconfig, the max number of the regions
in lmb library.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# 77b8cfef 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: move CONFIG_LMB in Kconfig

Migrate CONFIG_LMB in Kconfig.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# a479f103 16-Feb-2021 Joel Stanley <joel@jms.id.au>

hash: Allow for SHA512 hardware implementations

Similar to support for SHA1 and SHA256, allow the use of hardware hashing
engine by enabling the algorithm and setting CONFIG_SHA_HW_ACCEL /
CONFIG_SHA_PROG_HW_ACCEL.

Signed-off-by: Joel Stanley <joel@jms.id.au>

# f2c1442e 14-Mar-2021 Simon Glass <sjg@chromium.org>

bloblist: Make BLOBLIST_TABLES depend on BLOBLIST

Add an extra condition here since we cannot put x86 tables in a bloblist
when bloblists are not supported.

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

# e0103158 25-Feb-2021 Bin Meng <bmeng.cn@gmail.com>

lib: kconfig: Mention CONFIG_ADDR_MAP limitation in the help

Mention that CONFIG_ADDR_MAP only works in the post-relocation phase.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>

# 56e7257c 03-Feb-2021 Bin Meng <bmeng.cn@gmail.com>

lib: Fix BINMAN_FDT dependency

lib/binman.c references the following 3 ofnode APIs:
ofnode_first_subnode(), ofnode_path() and ofnode_read_bool().

These APIs get built only when DM is on. Fix the dependency then.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 59e4e391 18-Jan-2021 Tom Rini <trini@konsulko.com>

Merge https://gitlab.denx.de/u-boot/custodians/u-boot-riscv

- Update qemu-riscv.rst build instructions.
- Add support for SPI on Kendryte K210.
- Add Microchip PolarFire SoC Icicle Kit support.
- Add support for an early timer.
- Select TIMER_EARLY to avoid infinite recursion for Trace.


# a80f8513 17-Jan-2021 Pragnesh Patel <pragnesh.patel@sifive.com>

trace: select TIMER_EARLY to avoid infinite recursion

When tracing functions is enabled this adds calls to
__cyg_profile_func_enter() and __cyg_profile_func_exit() to the traced
functions.

__cyg_profile_func_enter() and __cyg_profile_func_exit() invoke
timer_get_us() to record the entry and exit time.

initr_dm() will make gd->dm_root = NULL and gd->timer = NULL, so
timer_get_us() -> get_ticks() -> dm_timer_init() will lead to an
indefinite recursion.

So select TIMER_EARLY when tracing got enabled.

Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Rick Chen <rick@andestech.com>

# 6205bbb1 04-Jan-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lib: cosmetic update of CONFIG_LIB_ELF description

Change 2 typo error in CONFIG_LIB_ELF description:
- Supoort => Support
- fir => for

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c589132a 02-Dec-2020 Aswath Govindraju <a-govindraju@ti.com>

fdt: Use phandle to distinguish DT nodes with same name

While assigning the sequence number to subsystem instances by reading the
aliases property, only DT nodes names are compared and not the complete
path. This causes a problem when there are two DT nodes with same name but
have different paths.

In arch/arm/dts/k3-am65-main.dtsi there are two USB controllers with the
same device tree node name but different path. When aliases are defined for
these USB controllers then fdtdec_get_alias_seq() fails to pick the correct
instance for a given index.

fdt_path_offset() function is slow and this would effect the U-Boot
startup. To avert the time penalty on all boards, apply this extra check
only when required by using a config option.

Fix it by comparing the phandles of DT nodes after the node names match,
under a config option.

Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Fix whitespace error in Kconfig:
Signed-off-by: Simon Glass <sjg@chromium.org>

# 28cef9ca 19-Nov-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

fs: fat: create correct short names

The current function set_name() used to create short names has the
following deficiencies resolved by this patch:

* Long names (e.g. FOO.TXT) are stored even if a short name is enough.
* Short names with spaces are created, e.g. "A ~1.TXT".
* Short names with illegal characters are created, e.g. "FOO++BAR".
* Debug output does not not consider that the short file name has no
concluding '\0'.

The solution for the following bug is split of into a separate patch:

* Short file names must be unique.

This patch only provides the loop over possible short file names.

Fixes: c30a15e590c ("FAT: Add FAT write feature")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# e4f8e543 05-Nov-2020 Simon Glass <sjg@chromium.org>

smbios: Drop the unused Kconfig options

Now that we can use devicetree to specify this information, drop the old
CONFIG options.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 44c74bdd 05-Nov-2020 Simon Glass <sjg@chromium.org>

sysinfo: Provide a default driver to set SMBIOS values

Some boards want to specify the manufacturer or product name but do not
need to have their own sysinfo driver.

Add a default driver which provides a way to specify this SMBIOS
information in the devicetree, without needing any board-specific
functionality.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d2cb7a22 04-Nov-2020 Simon Glass <sjg@chromium.org>

x86: Allow putting some tables in the bloblist

At present all tables are placed starting at address f0000 in memory, and
can be up to 64KB in size. If the tables are very large, this may not
provide enough space.

Also if the tables point to other tables (such as console log or a ramoops
area) then we must allocate other memory anyway.

The bloblist is a nice place to put these tables since it is contiguous,
which makes it easy to reserve this memory for linux using the 820 tables.

Add an option to put some of the tables in the bloblist. For SMBIOS and
ACPI, create suitable pointers from the f0000 region to the new location
of the tables.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
[bmeng: squashed in http://patchwork.ozlabs.org/project/uboot/patch/
20201105062407.1.I8091ad931cbbb5e3b6f6ababdf3f8d5db0d17bb9@changeid/]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# 415eab06 03-Nov-2020 Christian Gmeiner <christian.gmeiner@gmail.com>

smbios: add parsing API

Add a very simple API to be able to access SMBIOS strings
like vendor, model and bios version.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 72eda507 27-Oct-2020 Sean Anderson <seanga2@gmail.com>

lib: Add getopt

Some commands can get very unweildy if they have too many positional
arguments. Adding options makes them easier to read, remember, and
understand.

This implementation of getopt has been taken from barebox, which has had
option support for quite a while. I have made a few modifications to their
version, such as the removal of opterr in favor of a separate getopt_silent
function. In addition, I have moved all global variables into struct
getopt_context.

The getopt from barebox also re-orders the arguments passed to it so that
non-options are placed last. This allows users to specify options anywhere.
For example, `ls -l foo/ -R` would be re-ordered to `ls -l -R foo/` as
getopt parsed the options. However, this feature conflicts with the const
argv in cmd_tbl->cmd. This was originally added in 54841ab50c ("Make sure
that argv[] argument pointers are not modified."). The reason stated in
that commit is that hush requires argv to stay unmodified. Has this
situation changed? Barebox also uses hush, and does not have this problem.
Perhaps we could use their fix?

I have assigned maintenance of getopt to Simon Glass, as it is currently
only used by the log command. I would also be fine maintaining it.

Signed-off-by: Sean Anderson <seanga2@gmail.com>

# 26637e2e 12-Sep-2020 Simon Glass <sjg@chromium.org>

lib: Allow hexdump to be used in SPL

It is sometimes useful to output hex dumps in SPL. Add a config option to
allow this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# e87dfb05 05-Aug-2020 Andrii Anisov <andrii_anisov@epam.com>

lib: sscanf: add sscanf implementation

Port sscanf implementation from mini-os and introduce new
Kconfig option to enable it: CONFIG_SSCANF. Disable by default.

Signed-off-by: Andrii Anisov <andrii_anisov@epam.com>
Signed-off-by: Anastasiia Lukianenko <anastasiia_lukianenko@epam.com>
Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>

# 81014f73 30-Jul-2020 Joao Marcos Costa <joaomarcos.costa@bootlin.com>

include/u-boot, lib/zlib: add sources for zlib decompression

Add zlib (v1.2.11) uncompr() function to U-Boot. SquashFS depends on
this function to decompress data from a raw disk image. The actual
support for zlib into SquashFS sources will be added in a follow-up
commit.

Signed-off-by: Joao Marcos Costa <joaomarcos.costa@bootlin.com>

# 69be8fd1 03-Jun-2020 Marek Szyprowski <m.szyprowski@samsung.com>

powerpc: move ADDR_MAP to Kconfig

Move ADDR_MAP related config options from include/configs/*.h to the
proper place in lib/Kconfig. This has been done using
./tools/moveconfig.py and manual inspection of the generated changes.
This is a preparation to use ADDR_MAP helper on ARM 32bit Raspberry Pi4
board for mapping the PCIe XHCI MMIO, which is above the 4GiB identity
mapping limit.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# d16b38f4 15-Apr-2020 Reuben Dowle <reubendowle0@gmail.com>

Add support for SHA384 and SHA512

The current recommendation for best security practice from the US government
is to use SHA384 for TOP SECRET [1].

This patch adds support for SHA384 and SHA512 in the hash command, and also
allows FIT images to be hashed with these algorithms, and signed with
sha384,rsaXXXX and sha512,rsaXXXX

The SHA implementation is adapted from the linux kernel implementation.

[1] Commercial National Security Algorithm Suite
http://www.iad.gov/iad/programs/iad-initiatives/cnsa-suite.cfm

Signed-off-by: Reuben Dowle <reuben.dowle@4rf.com>

# 43e442a5 26-May-2020 Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

kconfig: fix some typos

Signed-off-by: Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

# eff5a547 22-May-2020 Michael Walle <michael@walle.cc>

cmd: zip: automatically pull in gzip()

Move the CONFIG_GZIP_COMPRESSED from a config.h macro to a Kconfig menu
item. It is not selectable by a user because there is no reason to do
so. Instead it will be automatically selected by the stuff which uses
gzip(), like the zip command.

Remove it from the config_whitelist.txt. Also remove
CONFIG_GZIP_COMPRESS_DEF_SZ as this was never used on any board. The
default seems to be sane, otherwise it should be added as a Kconfig
option.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8239be61 06-May-2020 Simon Glass <sjg@chromium.org>

lib: Allow MD5 to be enabled in SPL

At present the MD5 option cannot be enabled by board configs since it has
no Kconfig name. It is generally enabled, so long as FIT support is
present. But not all boards use FIT, particularly in SPL

Fix this and add an option for SPL as well. This allows board code to call
md5() even if FIT support is not enabled.

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

# 04cb3994 21-Apr-2020 Weijie Gao <weijie.gao@mediatek.com>

lib: enable lzma decompression support for SPL build

This patch enables LZMA decompression support for SPL build

Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>

# 2a2119e1 05-Mar-2020 Atish Patra <atishp@atishpatra.org>

lib: kconfig: Add option to set BZIP2 compression method

There is no way to select BZIP2 compression method.
Add it under library/compression config where all other
compression related configs are present.

Signed-off-by: Atish Patra <atish.patra@wdc.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 805b3cac 12-Feb-2020 Keerthy <j-keerthy@ti.com>

lib: elf: Move the generic elf loading/validating functions to lib

Move the generic elf loading/validating functions to lib/
so that they can be re-used and accessed by code existing
outside cmd.

While at it remove the duplicate static version of load_elf_image_phdr
under arch/arm/mach-imx/imx_bootaux.c.

Signed-off-by: Keerthy <j-keerthy@ti.com>
Suggested-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>

# 1611235b 19-Jan-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: Kconfig dependencies for pseudo-random library

drivers/rng/sandbox_rng.c requires rand() to be defined but configuration
option CONFIG_CONFIG_LIB_RAND selected in drivers/rng/Kconfig does not
exist.

test/lib/test_aes.c requires rand() to be defined.

Fix the selection criteria for choice "Pseudo-random library support type".

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 3c10dc95 06-Dec-2019 Simon Glass <sjg@chromium.org>

binman: Add a library to access binman entries

SPL and TPL can access information about binman entries using link-time
symbols but this is not available in U-Boot proper. Of course it could be
made available, but the intention is to just read the device tree.

Add support for this, so that U-Boot can locate entries.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# b4adf627 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: crypto: add x509 parser

Imported from linux kernel v5.3:
x509.asn1 without changes
x509_akid.asn1 without changes
x509_parser.h without changes
x509_cert_parser.c with changes marked as __UBOOT__
x509_public_key.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# a9b45e6e 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add oid registry utility

Imported from linux kernel v5.3:
build_OID_registry without changes
oid_registry.h without changes
oid_registry.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# ab8a0e06 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add asn1 decoder

Imported from linux kernel v5.3:
lib/asn1_decoder.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 2b12196d 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

cmd: add asn1_compiler

Imported from linux kernel v5.3:
asn1.h without changes
asn1_ber_bytecode.h without changes
asn1_decoder.h without changes
asn1_compiler.c without changes

This host command will be used to create a ASN1 parser, for example,
for pkcs7 messages or x509 certificates. More specifically, it will
generate *byte code* which will be interpreted by asn1 decoder library.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 05429b6c 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

rtc: move date.c from drivers/rtc/ to lib/

In the next commit, rtc_mktime(), for compatibility with linux, will be
implemented using rtc_mktime(), which is no longer drivers/rtc specific.
So move this file under lib/.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 37ef1774 10-Nov-2019 Thomas Hebb <tommyhebb@gmail.com>

Kconfig: disambiguate config names for tiny printf

27084c03d36a ("spl: Allow tiny printf() to be controlled in SPL and
TPL") split this option in two for TPL and SPL, but didn't change the
Kconfig names, making them hard to set quickly.

Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>

# 0d76afc0 27-Oct-2019 Simon Glass <sjg@chromium.org>

fdt: Add Kconfig options to control code size

For better or worse libfdt recent grew a lot of code that checks the
validity of the device tree in great detail. When using unsigned or
unverified data this makes things safer, but it does add to code size.

Add some controls to select the trade-off between safety and code size.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 27084c03 25-Sep-2019 Simon Glass <sjg@chromium.org>

spl: Allow tiny printf() to be controlled in SPL and TPL

At present there is only one control for this and it is used for both SPL
and TPL. But SPL might have a lot more space than TPL so the extra cost of
a full printf() might be acceptable.

Split the option into two, providing separate SPL and TPL controls. The
TPL setting defaults to the same as SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2a51e16b 07-Jun-2019 Tom Rini <trini@konsulko.com>

configs: Make USE_TINY_PRINTF depend on SPL||TPL and be default

The USE_TINY_PRINTF symbol only changes things within SPL and TPL
builds, so make it depend on that support. Next, make it default as
within these cases we should rarely have need of more advanced print
formats outside of the debug context.

To do this, in a few cases we need to correct our Kconfig dependencies
as we had cases of non-SPL targets select'ing this symbol. Finally, in
the case of a few boards we really do need the full printf
functionality.

Signed-off-by: Tom Rini <trini@konsulko.com>

# da0fb5fd 02-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: make call depth limit customizable

Up to now we had hard coded values for the call depth up to which trace
records are created: 200 for early tracing, 15 thereafter. UEFI
applications reach a call depth of 80 or above.

Provide customizing settings for the call trace depth limit and the early
call trace depth limit. Use the old values as defaults.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8509f22a 29-Apr-2019 Marek Behún <kabel@kernel.org>

lib: add Zstandard decompression support

Add the zstd library from Linux kernel (only decompression support).
There are minimal changes to build with U-Boot, otherwise the files are
identical to Linux commit dc35da16 from March 2018, the files had not
been touched since in kernel. Also SPDX lincese tags were added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 83a486b6 29-Apr-2019 Marek Behún <kabel@kernel.org>

lib: Add xxhash support

This adds the xxhash support from Linux. Files are almost identical to
those added to Linux in commit 5d240522 ("lib: Add xxhash module") (they
haven't been touched since in Linux). The only difference is to add some
includes to be compatible with U-Boot. Also SPDX lincese tags were
added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 5132361a 29-Apr-2019 Heiko Schocher <hs@denx.de>

lib: Kconfig: fix help text for GZIP

commit 95f4bbd581cf ("lib: fdt: Allow LZO and GZIP DT compression in U-Boot")

introduced Kconfig option for gzip in U-Boot, but help text
says gzip for SPL, which is wrong. Fix this.

Signed-off-by: Heiko Schocher <hs@denx.de>
Acked-by: Marek Vasut <marex@denx.de>

# 1c6eb075 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE_BUFFER_SIZE et al to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE_BUFFER_SIZE
CONFIG_TRACE_EARLY_SIZE
CONFIG_TRACE_EARLY
CONFIG_TRACE_EARLY_ADDR

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

# a24a78d7 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE

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

# 54969b40 21-Mar-2019 Thierry Reding <treding@nvidia.com>

fdtdec: Add Kconfig symbol for tests

Runtime tests are provided as a test_fdtdec command implementation. Add
a Kconfig symbol that allows this command to be built so that the tests
can be used.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 95f4bbd5 08-Mar-2019 Marek Vasut <marex@denx.de>

lib: fdt: Allow LZO and GZIP DT compression in U-Boot

Add required Kconfig symbols, Makefile bits and macro fixes in a
few places to support LZO and DT compression in U-Boot. This can
save a lot of space with multi-DTB fitImages.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>

# 6e705114 13-Jan-2019 Chris Packham <judge.packham@gmail.com>

lib: Kconfig: spelling fixes

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 048c6e89 06-Nov-2018 Simon Glass <sjg@chromium.org>

spl: lz4: Allow use of lz4 compression in SPL

In some cases U-Boot is compressed and it is useful to be able to
decompress it in SPL. Add a Kconfig and Makefile change to allow this.
Note that this does not actually implement decompression.

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

# 2895c4b7 15-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

kconfig: Introduce HAVE_ARCH_IOMAP

Introduce a new Kconfig option for architecture codes to control
whether it provides io{read,write}{8,16,32} I/O accessor functions.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5592a633 01-Oct-2018 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt in TPL

In some cases (e.g. sandbox with verified boot) it is useful to support
libfdt in TPL. Update the Kconfig to handle this.

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

# 6307896c 01-Oct-2018 Simon Glass <sjg@chromium.org>

tpm: Add support for SPL and TPL

At present the tpm can only be used in U-Boot proper. Updated it to work
in SPL and TPL also.

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

# ab948cd2 19-Jul-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

fdt_support: make FDT_FIXUP_PARTITIONS depend on CMD_MTDPARTS

fdt_fixup_mtdparts() calls mtdparts_init() and device_find(),
which are defined in cmd/mtdparts.c

The combination of FDT_FIXUP_PARTITIONS=y and CMD_MTDPARTS=n
emits the following link error:

common/fdt_support.c:903: undefined reference to `mtdparts_init'
common/fdt_support.c:914: undefined reference to `device_find'

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 3330584d 03-Jun-2018 Igor Opaniuk <igor.opaniuk@gmail.com>

avb2.0: integrate avb 2.0 into the build system

Integrate libavb into the build system. Introduce CONFIG_LIBAVB
build option.

Signed-off-by: Igor Opaniuk <igor.opaniuk@linaro.org>

# f8c987f8 05-Jun-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

lib: Add hexdump

Often during debugging session it's very interesting to see
what data we were dealing with. For example what we write or read
to/from memory or peripherals.

This change introduces functions that allow to dump binary
data with one simple function invocation like:
------------------->8----------------
print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, buf, len);
------------------->8----------------

which gives us the following:
------------------->8----------------
00000000: f2 b7 c9 88 62 61 75 64 72 61 74 65 3d 31 31 35 ....baudrate=115
00000010: 32 30 30 00 62 6f 6f 74 61 72 67 73 3d 63 6f 6e 200.bootargs=con
00000020: 73 6f 6c 65 3d 74 74 79 53 33 2c 31 31 35 32 30 sole=ttyS3,11520
00000030: 30 6e 38 00 62 6f 6f 74 64 65 6c 61 79 3d 33 00 0n8.bootdelay=3.
00000040: 62 6f 6f 74 66 69 6c 65 3d 75 49 6d 61 67 65 00 bootfile=uImage.
00000050: 66 64 74 63 6f 6e 74 72 6f 6c 61 64 64 72 3d 39 fdtcontroladdr=9
00000060: 66 66 62 31 62 61 30 00 6c 6f 61 64 61 64 64 72 ffb1ba0.loadaddr
00000070: 3d 30 78 38 32 30 30 30 30 30 30 00 73 74 64 65 =0x82000000.stde
00000080: 72 72 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 rr=serial0@e0022
00000090: 30 30 30 00 73 74 64 69 6e 3d 73 65 72 69 61 6c 000.stdin=serial
000000a0: 30 40 65 30 30 32 32 30 30 30 00 73 74 64 6f 75 0@e0022000.stdou
000000b0: 74 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 30 t=serial0@e00220
000000c0: 30 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00..............
...
------------------->8----------------

Source of hexdump.c was copied from Linux kernel v4.7-rc2.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Mario Six <mario.six@gdsys.cc>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Stefan Roese <sr@denx.de>

# c232d14d 29-May-2018 Alex Kiernan <alex.kiernan@gmail.com>

mmc: Separate "mmc swrite" from fastboot

Introduce CONFIG_IMAGE_SPARSE and CONFIG_CMD_MMC_SWRITE so the "mmc
swrite" command is separated from the fastboot code.

Move image-sparse from common to lib so it's clear it's library code.

Rename CONFIG_FASTBOOT_FLASH_FILLBUF_SIZE to CONFIG_IMAGE_SPARSE_FILLBUF_SIZE
and migrate it to Kconfig.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Acked-by: Jassi Brar <jaswinder.singh@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6417572e 08-May-2018 Tom Rini <trini@konsulko.com>

lib/Kconfig: Mark OF_LIBFDT_OVERLAY as depending on OF_LIBFDT

The overlay code is only useful when OF_LIBFDT is set, so mark it as
depending on that first.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 58a46f88 25-Apr-2018 Praneeth Bajjuri <praneeth@ti.com>

configs: TI: Enable FIT Library overlay support

Enable the FDT library overlay support for all TI SOC family.

Without this option, when Loading fdt from FIT image, the
following warning is seen.

"config with overlays but CONFIG_OF_LIBFDT_OVERLAY not set".

Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
Suggested-by: Andrew F.Davis <afd@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>

# 14ad44ab 18-Apr-2018 Alex Kiernan <alex.kiernan@gmail.com>

spl: Split sprintf, strto* from SPL serial in Kconfig

When SPL serial is disabled, callers who need sprintf or strtoul fail
because their inclusion is guarded by CONFIG_SPL_SERIAL_SUPPORT/
CONFIG_TPL_SERIAL_SUPPORT.

Split printf, sprintf and strto into their own entries and then select
all of them if SERIAL_SUPPORT is enabled to match the current behaviour.

Include panic.o unconditionally as it can be called from anywhere which
uses BUG_ON().

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>

# e294ba06 04-Apr-2018 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-sunxi

Signed-off-by: Tom Rini <trini@konsulko.com>


# d14db11d 03-Apr-2018 Andre Przywara <andre.przywara@arm.com>

sunxi: revert disabling of features

In January some commits were introduced to mitigate the U-Boot image
size issues we encountered on sunxi builds.
Now with the MMC environment removed we can bring them back, as we
practically don't have a size limit anymore.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 32ce6179 13-Mar-2018 Bryan O'Donoghue <bryan.odonoghue@linaro.org>

optee: Add lib entries for sharing OPTEE code across ports

This patch adds code to lib to enable sharing of useful OPTEE code between
board-ports and architectures. The code on lib/optee/optee.c comes from the
TI omap2 port. Eventually the OMAP2 code will be patched to include the
shared code. The intention here is to add more useful OPTEE specific code
as more functionality gets added.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Cc: Harinarayan Bhatta <harinarayan@ti.com>
Cc: Andrew F. Davis <afd@ti.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Kever Yang <kever.yang@rock-chips.com>
Cc: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Cc: Peng Fan <peng.fan@nxp.com>
Tested-by: Peng Fan <peng.fan@nxp.com>

# 36c1877c 06-Feb-2018 Faiz Abbas <faiz_abbas@ti.com>

lib: Kconfig: Move DYNAMIC_CRC_TABLE to Kconfig

Add CONFIG prefix to DYNAMIC_CRC_TABLE and implement it in
Kconfig.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>

# a451bc27 05-Feb-2018 Adam Ford <aford173@gmail.com>

Convert LIB_UUID to Kconfig

config_fallback.h has some logic that checks a variety of options
and selects LIB_UUID if it hasn't already been selected. This
will all LIB_UUID in Kconfig and select this option for the list
of options to allow us to remove the logic from fallbacks

Signed-off-by: Adam Ford <aford173@gmail.com>

# a5a37567 06-Feb-2018 Adam Ford <aford173@gmail.com>

Convert CONFIG LIB_HW_RAND to Kconfig

config_fallbacks.h had some logic to automatically select
LIB_RAND if RANDOM_UUID or CMD_UUID were set if LIB_HW_RAND wasn't
already selected. By migrating LIB_HW_RAND to Kconfig, we can
remove this check from config_fallbacks.h and put it into Kconfig

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
[trini: Turn into a choice, add NET_RANDOM_ETHADDR]
Signed-off-by: Tom Rini <trini@konsulko.com>

# acd4d334 16-Jan-2018 Maxime Ripard <maxime.ripard@free-electrons.com>

net: regex: Disable by default on sunXi

The sunXi arm64 build has overflown, leading to the main U-boot binary
overwriting the environment when flashing the new image, or even worse,
overwriting itself when we're calling saveenv.

Disable this option that is not critical until we can adress the issue
properly.

Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 7e3caa81 03-Dec-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

Move CONFIG_PANIC_HANG to Kconfig

Freescale (NXP) boards have lots of defconfig files per board.
I used "imply PANIC_HANG" for them.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# da5337a6 08-Nov-2017 Nandor Han <nandor.han@ge.com>

rtc: add support for s35392a

Add support for S35392A RTC. The driver supports both U-Boot driver
models.

Signed-off-by: Nandor Han <nandor.han@ge.com>
Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
Cc: Heiko Schocher <hs@denx.de>

# f52bdf4b 14-Sep-2017 Jean-Jacques Hiblot <jjhiblot@ti.com>

lib: allow building lzo for the SPL

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 85d8bf57 03-Sep-2017 Marek Behún <kabel@kernel.org>

lib: Add CRC32-C

This is needed for BTRFS.

Signed-off-by: Marek Behun <marek.behun@nic.cz>

create mode 100644 lib/crc32c.c

# 7264f292 15-Aug-2017 York Sun <york.sun@nxp.com>

spl: fit: Eanble GZIP support for image decompression

Add Kconfig option SPL_GZIP and SPL_ZLIB to enable gunzip support for
SPL boot, eg. falcon boot compressed kernel image.

Signed-off-by: York Sun <york.sun@nxp.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6ef2f901 11-Aug-2017 Adam Ford <aford173@gmail.com>

Convert CONFIG_BCH to Kconfig

This converts the following to Kconfig:
CONFIG_BCH

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1a7ba1d 18-Aug-2017 Anatolij Gustschin <agust@denx.de>

Fix 'notes' typos

s/notes/nodes

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 96b9082c 03-Aug-2017 Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

rockchip: rk3188: rock: adjust for SPL/TPL split

With the changes to split SPL/TPL for the RK3368, I apparently missed
some needed adjustments to the RK3188 Kconfig and rock_defconfig.

This fixes build-issues for the rock board after applying the RK3368
enablement (and SPL/TPL) set that resulted from TPL_SERIAL_SUPPORT,
TPL_ROCKCHIP_BACK_TO_BROM and TPL_TINY_MEMSET being separate symbols
now.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d56b4b19 22-Jul-2017 Tom Rini <trini@konsulko.com>

configs: Migrate RBTREE, LZO, CMD_MTDPARTS, CMD_UBI and CMD_UBIFS

The above CONFIG options are in Kconfig, and now have correct depends and
inter-dependencies. Migrate these to configs/ from include/configs/. In the
case of CMD_UBIFS also change it to be a default y if CMD_UBI.

Signed-off-by: Tom Rini <trini@konsulko.com>

# aed998aa 17-May-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_LZMA to Kconfig

This converts the following to Kconfig:
CONFIG_LZMA

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

# b1a873df 26-Apr-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_CMD_AES et al to Kconfig

This converts the following to Kconfig:
CONFIG_CMD_AES
CONFIG_AES

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Add select AES to CMD_AES]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 173aafbf 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

cmd: Expose a Kconfig option to enable UBIFS commands

Create a new Kconfig entry to allow CMD_UBIFS selection from Kconfig and
add an hidden LZO option that can be selected by CMD_UBIFS.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>

# aa049152 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

mtd: ubi: Select RBTREE option from MTD_UBI Kconfig entry

Expose the RBTREE feature through Kconfig and select this option from the
MTD_UBI option.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>
[Rebased on master]
Signed-off-by: Jagan Teki <jagan@openedev.com>

# ab4458bd 02-Apr-2017 Simon Glass <sjg@chromium.org>

string: Provide a slimmed-down memset()

Most of the time the optimised memset() is what we want. For extreme
situations such as TPL it may be too large. For example on the 'rock'
board, using a simple loop saves a useful 48 bytes. With gcc 4.9 and
the rodata bug, this patch is enough to reduce the TPL image below the
limit.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>

# bea79d7d 14-Mar-2017 Andre Przywara <andre.przywara@arm.com>

Kconfig: introduce md5sum command selection

So far CONFIG_MD5SUM would need to be set by a board's include file.
Since the command is really generic, move it over to Kconfig to allow
it to be defined by either a board's defconfig, menuconfig or some
config snippet merged via mergeconfig.sh.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e663b350 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

smbios: Expose in efi_loader as table

We can pass SMBIOS easily as EFI configuration table to an EFI payload. This
patch adds enablement for that case.

While at it, we also enable SMBIOS generation for ARM systems, since they support
EFI_LOADER.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4b6dddc2 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

x86: Move smbios generation into arch independent directory

We will need the SMBIOS generation function on ARM as well going forward,
so let's move it into a non arch specific location.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# ebf7fff2 05-Oct-2016 Heiko Schocher <hs@denx.de>

spl: move FDT_FIXUP_PARTITIONS to Kconfig

Move FDT_FIXUP_PARTITIONS to Kconfig and cleanup existing
uses.

Signed-off-by: Heiko Schocher <hs@denx.de>

# ddf67f71 05-Jul-2016 Maxime Ripard <maxime.ripard@free-electrons.com>

libfdt: Add overlay application function

The device tree overlays are a good way to deal with user-modifyable
boards or boards with some kind of an expansion mechanism where we can
easily plug new board in (like the BBB, the Raspberry Pi or the CHIP).

Add a new function to merge overlays with a base device tree.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>

# 91b86e21 26-May-2016 Marek Vasut <marex@denx.de>

lib: Enable private libgcc by default

This patch decouples U-Boot binary from the toolchain on systems where
private libgcc is available. Instead of pulling in functions provided
by the libgcc from the toolchain, U-Boot will use it's own set of libgcc
functions. These functions are usually imported from Linux kernel, which
also uses it's own libgcc functions instead of the ones provided by the
toolchain.

This patch solves a rather common problem. The toolchain can usually
generate code for many variants of target architecture and often even
different endianness. The libgcc on the other hand is usually compiled
for one particular configuration and the functions provided by it may
or may not be suited for use in U-Boot. This can manifest in two ways,
either the U-Boot fails to compile altogether and linker will complain
or, in the much worse case, the resulting U-Boot will build, but will
misbehave in very subtle and hard to debug ways.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 67976306 30-Mar-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

cosmetic: Fix typos "privide"

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# ed980b8c 03-Mar-2016 Alexander Graf <agraf@csgraf.de>

efi_loader: hook up in build environment

Now that we have all the bits and pieces ready for EFI payload loading
support, hook them up in Makefiles and KConfigs so that we can build.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
[trini: Enable only when we of OF_LIBFDT, disable on kwb and colibri_pxa270]
Signed-off-by: Tom Rini <trini@konsulko.com>

# aa34fbc0 22-Feb-2016 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt to be used in SPL

Add an option to enable libfdt in SPL. This can be useful when decoding
FIT files in SPL.

We need to make sure this option is not enabled in SPL by this change.
Also this option needs to be enabled in host builds. Si add a new
IMAGE_USE_LIBFDT #define which can be used in files that are built on the
host but must also build for U-Boot and SPL.

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

# 69e173eb 22-Feb-2016 Simon Glass <sjg@chromium.org>

Move CONFIG_OF_LIBFDT to Kconfig

Move this option to Kconfig and tidy up existing boards.

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

# a187559e 05-Feb-2016 Bin Meng <bmeng.cn@gmail.com>

Use correct spelling of "U-Boot"

Correct spelling of "U-Boot" shall be used in all written text
(documentation, comments in source files etc.).

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Minkyu Kang <mk7.kang@samsung.com>

# 947c626d 14-Jan-2016 Tom Rini <trini@konsulko.com>

vsprintf.c: Always enable CONFIG_SYS_VSNPRINTF

Enabling this function always removes some class of string saftey issues.
The size change here in general is about 400 bytes and this seems a reasonable
trade-off.

Cc: Peng Fan <peng.fan@nxp.com>
Cc: Peter Robinson <pbrobinson@gmail.com>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Adrian Alonso <aalonso@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 7d9cde10 22-Nov-2015 Stefan Roese <sr@denx.de>

lib/tiny-printf.c: Add tiny printf function for space limited environments

This patch adds a small printf() version that supports all basic formats.
Its intented to be used in U-Boot SPL versions on platforms with very
limited internal RAM sizes.

To enable it, just define CONFIG_USE_TINY_PRINTF in your defconfig. This
will result in the SPL using this tiny function and the main U-Boot
still using the full-blown printf() function.

This code was copied from:
http://www.sparetimelabs.com/printfrevisited
With mostly only coding style related changes so that its checkpatch
clean.

The size reduction is about 2.5KiB. Here a comparison for the db-mv784mp-gp
(Marvell AXP) SPL:

Without this patch:
58963 18536 1928 79427 13643 ./spl/u-boot-spl

With this patch:
56542 18536 1956 77034 12cea ./spl/u-boot-spl

Note:
To make it possible to compile tiny-printf.c instead of vsprintf.c when
CONFIG_USE_TINY_PRINTF is defined, the functions printf() and vprintf() are
moved from common/console.c into vsprintf.c in this patch.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>

# 2419cd16 03-Oct-2015 Simon Glass <sjg@chromium.org>

dm: tpm: Drop CONFIG_DM_TPM

Now that all TPM drivers use driver model, we can drop the special driver
model CONFIG option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>

# 027b728d 06-Oct-2015 Julius Werner <jwerner@chromium.org>

Add support for LZ4 decompression algorithm

This patch adds support for LZ4-compressed FIT image contents. This
algorithm has a slightly worse compression ration than LZO while being
nearly twice as fast to decompress. When loading images from a fast
storage medium this usually results in a boot time win.

Sandbox-tested only since I don't have a U-Boot development system set
up right now. The code was imported unchanged from coreboot where it's
proven to work, though. I'm mostly interested in getting this recognized
by mkImage for use in a downstream project.

Signed-off-by: Julius Werner <jwerner@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# a7d660bc 22-Aug-2015 Simon Glass <sjg@chromium.org>

tpm: Add Kconfig options for TPMs

Add new Kconfig options for TPMs in preparation for moving boards to use
Kconfig for TPM configuration.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 867a6ac8 31-Jul-2015 Simon Glass <sjg@chromium.org>

efi: Add start-up library code

When running as an EFI application, U-Boot must request memory from EFI,
and provide access to the boot services U-Boot needs.

Add library code to perform these tasks. This includes efi_main() which is
the entry point from EFI. U-Boot is built as a shared library.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d1389403 23-Jun-2015 Simon Glass <sjg@chromium.org>

Add a dhrystone benchmark command

Drystone provides a convenient sanity check that the CPU is running at full
speed. Add this as a command which can be enabled as needed.

Note: I investigated using Coremark for this but there was a license
agreement and I could not work out if it was GPL-compatible.

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

# f7848d90 22-Jun-2015 Joe Hershberger <joe.hershberger@ni.com>

Allow CONFIG_REGEX to be disabled when CONFIG_NET

Instead of selecting REGEX when NET is enabled, make it the default, but
allow boards that are tiny to disable it and lose functionality on all
but the first Ethernet adapter.

cm-bf548, bf538f-ezkit, and bf533-stamp need this. None appear to have
more than one Ethernet interface.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# 3850dbe8 11-Jun-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

blackfin: fix undefined reference to srand and rand

Commit 9ba9e85f3f1c (net: Fix NET_RANDOM_ETHADDR dependencies)
accidentally dropped CONFIG_LIB_RAND defines for 14 Blackfin boards.

Prior to that commit, those boards defined CONFIG_LIB_RAND, but not
CONFIG_NET_RANDOM_ETHADDR. So, commit 9ba9e85f3f1c should not have
touched them, but in fact it ripped CONFIG_LIB_RAND off from all the
header files, which caused undefined reference to srand and rand.
CONFIG_LIB_RAND=y must be revived for such boards.

BTW, this commit indeed makes it better, but even with this fix,
three boards (bf533-stamp, bf538f-ezkit, cm-bf548) still can not
build due to region 'ram' overflowed error. This was cause by
commit 6eed3786c68c (net: Move the CMD_NET config to defconfigs)
because CMD_NET selects NET, and NET selects REGEX. Eventually,
some boards were newly enabled with CONFIG_REGEX, increasing the
memory footprint. A patch is expected to fix the build error.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 9ba9e85f 25-May-2015 Michal Simek <michal.simek@amd.com>

net: Fix NET_RANDOM_ETHADDR dependencies

NET_RANDOM_ETHADDR depends on lib/rand.c. This patch adds dependency to
Kconfig to ensure that library is also compiled.

Remove the definitions from Blackfin boards' include/configs.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 6501ff62 20-Apr-2015 Przemyslaw Marczak <p.marczak@samsung.com>

lib: Kconfig: add entry for errno_str() function

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1a60650c 21-Apr-2015 Joe Hershberger <joe.hershberger@ni.com>

kconfig: Move REGEX to Kconfig

Having this as a Kconfig allows it to be a dependent feature.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8156345d 06-Mar-2015 Simon Glass <sjg@chromium.org>

sandbox: Move CONFIG_SYS_VSNPRINTF to Kconfig

Move this over to Kconfig and tidy up.

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

# 94e3c8c4 19-Feb-2015 gaurav rana <gaurav.rana@freescale.com>

crypto/fsl - Add progressive hashing support using hardware acceleration.

Currently only normal hashing is supported using hardware acceleration.
Added support for progressive hashing using hardware.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
Signed-off-by: Gaurav Rana <gaurav.rana@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>

# d9f23c7f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

lib/rsa: Add Kconfig for devices supporting RSA Modular Exponentiation

Kconfig option added for devices which support RSA Verification.
1. RSA_SOFTWARE_EXP
Enables driver for supporting RSA Modular Exponentiation in Software
2. RSA_FREESCALE_EXP
Enables driver for supporting RSA Modular Exponentiation using Freescale specific
driver

The above drivers use RSA uclass

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
(Removed duplicate line in Kconfig comment)

Change-Id: I7663c4d5350e2bfc3dfa2696f70ef777d6ccc6f6

# c4beb22f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

FIT: Modify option FIT_SIGNATURE in Kconfig

For FIT signature based approach to work, RSA library needs to be selected.
The FIT_SIGNATURE option in Kconfig is modified to automatically select RSA.
Selecting RSA compiles the RSA library required for image verification.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 45ccec8f 23-Oct-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

kconfig: move CONFIG_USE_PRIVATE_LIBGCC to Kconfig

The private libgcc is supported only on ARM, MIPS, PowerPC, SH, x86.
Those architectures should "select" HAVE_PRIVATE_LIBGCC and
CONFIG_USE_PRIVATE_LIBGCC should depend on it.

Currently, this option is enabled on Tegra boards and x86 architecture.
Move the definition from header files to Kconfig.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Tested-by: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: Tom Warren <twarren@nvidia.com>

# 8c688bc4 23-Oct-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

kconfig: move CONFIG_SYS_HZ to lib/Kconfig

CONFIG_SYS_HZ is always defined as 1000 in config_fallbacks.h
(but some boards still have redundant definitions).

This commit moves the definition and the document in README to
Kconfig. Since lib/Kconfig can assure that CONFIG_SYS_HZ is 1000,
the sanity check in lib/time.c should be removed.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Reviewed-by: Marek Vasut <marex@denx.de>

# b0928da6 16-Sep-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

kconfig: move CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED to Kconfig

If this option is enabled, the objects under lib/ directory
are compiled with speed optimization, not size optimization.
(Currently, only used by some Blackfin boards.)

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# ed36323f 16-Sep-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

kconfig: add blank Kconfig files

This would be useful to start moving various config options.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# e67ffb5a 22-Jul-2022 Sughosh Ganu <sughosh.ganu@linaro.org>

tpm: rng: Add driver model interface for TPM RNG device

The TPM device has a builtin random number generator(RNG)
functionality. Expose the RNG functions of the TPM device to the
driver model so that they can be used by the EFI_RNG_PROTOCOL if the
protocol is installed.

Also change the function arguments and return type of the random
number functions to comply with the driver model api.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

# b340199f 10-Jun-2022 Tom Rini <trini@konsulko.com>

spl: Ensure all SPL symbols in Kconfig have some SPL dependency

Tighten up symbol dependencies in a number of places. Ensure that a SPL
specific option has at least a direct dependency on SPL. In places
where it's clear that we depend on something more specific, use that
dependency instead. This means in a very small number of places we can
drop redundant dependencies.

Reported-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 13ce351b 08-Jun-2022 Tom Rini <trini@konsulko.com>

vpl: Ensure all VPL symbols in Kconfig have some VPL dependency

Tighten up symbol dependencies in a number of places. Ensure that a VPL
specific option has at least a direct dependency on VPL. In places
where it's clear that we depend on something more specific, use that
dependency instead.

Reported-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 8bea4bf7 08-Jun-2022 Tom Rini <trini@konsulko.com>

tpl: Ensure all TPL symbols in Kconfig have some TPL dependency

Tighten up symbol dependencies in a number of places. Ensure that a TPL
specific option has at least a direct dependency on TPL. In places
where it's clear that we depend on something more specific, use that
dependency instead.

Reported-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 26f981f2 19-May-2022 Rasmus Villemoes <rasmus.villemoes@prevas.dk>

fdtdec: drop needlessly convoluted CONFIG_PHANDLE_CHECK_SEQ

Asking if the alias we found actually points at the device tree node
we passed in (in the guise of its offset from blob) can be done simply
by asking if the fdt_path_offset() of the alias' path is identical to
offset.

In fact, the current method suffers from the possibility of false
negatives: dtc does not necessarily emit a phandle property for a node
just because it is referenced in /aliases; it only emits a phandle
property for a node if it is referenced in <angle brackets>
somewhere. So if both the node we passed in and the alias node we're
considering don't have phandles, fdt_get_phandle() returns 0 for both.

Since the proper check is so simple, there's no reason to hide that
behind a config option (and if one really wanted that, it should be
called something else because there's no need to involve phandle in
the check).

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Acked-by: Aswath Govindraju <a-govindraju@ti.com>

# d30924f1 01-May-2022 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: fix selection of CONFIG_CHARSET

lib/charset.c is not optional for
EFI_APP || EFI_LOADER || UFS || UT_UNICODE.
These must select CONFIG_CHARSET.

Fixes: 726cd9836db0 ("efi: Make unicode printf available to the app")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>

# 747093dd 30-Apr-2022 Simon Glass <sjg@chromium.org>

vpl: Add Kconfig options for VPL

Add VPL versions of commonly used Kconfig options.

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

# 11232139 06-Apr-2022 Tom Rini <trini@konsulko.com>

nds32: Remove the architecture

As removal of nds32 has been ack'd for the Linux kernel, remove support
here as well.

Cc: Rick Chen <rick@andestech.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Rick Chen <rick@andestech.com>

# fd210fee 28-Mar-2022 Philippe Reynes <philippe.reynes@softathome.com>

lib: allow to build asn1 decoder and oid registry in SPL

This commit adds the options:
- SPL_ASN1_DECODER
- SPL_OID_REGISTRY

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>

# 7d44a985 28-Mar-2022 Philippe Reynes <philippe.reynes@softathome.com>

lib: Kconfig: enhance the help of OID_REGISTRY

Enhance the help for the config OID_REGISTRY.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>

# a0e71d96 28-Mar-2022 Philippe Reynes <philippe.reynes@softathome.com>

lib: Kconfig: enhance help for ASN1

Enhance the help for configs ASN1_COMPILER
and ASN1_decoder.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>

# 761a1786 27-Jan-2022 Tom Rini <trini@konsulko.com>

Merge tag 'dm-pull-26jan22' of https://source.denx.de/u-boot/custodians/u-boot-dm

acpi refactoring to allow non-x86 use
binman support for bintools (binary tools)
minor tools improvements in preparation for FDT signing
various minor fixes and improvements


# 334a9b9d 25-Nov-2021 Loic Poulain <loic.poulain@linaro.org>

lib/circbuf: Make circbuf selectable symbol

It is currenly only used from usbtty driver but make it properly
selectable via Kconfig symbol, for future usage.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>

# e1722fcb 01-Dec-2021 Simon Glass <sjg@chromium.org>

x86: Allow any arch to generate ACPI tables

These have sadly found their way to ARM now. Allow any arch to support
generating ACPI tables.

Disable this for the tools build.

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

# 7c3fd5c2 26-Dec-2021 Qu Wenruo <wqu@suse.com>

lib: add BLAKE2 hash support

The code is cross-ported from BLAKE2 reference implementation
(https://github.com/BLAKE2/BLAKE2).

With minimal change to remove unused macros/features.

Currently there is only one user inside U-boot (btrfs), and since it
only utilize BLAKE2B, all other favors are all removed.

Signed-off-by: Qu Wenruo <wqu@suse.com>
[trini: Rename ROUND to R to avoid clash with <linux/bitops.h>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 97f2a749 04-Jan-2022 Eugen Hristev <eugen.hristev@microchip.com>

lib: Kconfig: fix PHANDLE_CHECK_SEQ position outside of menu

CONFIG_PHANDLE_CHECK_SEQ is outside of the menu 'Library routines'
thus it's invisible in menuconfig and cannot be selected.
Fix this by moving the 'endmenu' after the PHANDLE_CHECK_SEQ definition

Fixes: c589132a1d ("fdt: Use phandle to distinguish DT nodes with same name")
Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
Reviewed-by: Aswath Govindraju <a-govindraju@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 726cd983 29-Dec-2021 Simon Glass <sjg@chromium.org>

efi: Make unicode printf available to the app

This is needed to show unicode strings. Enable this code in the app.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>

# 6405ab7a 24-Nov-2021 Simon Glass <sjg@chromium.org>

Convert CONFIG_PHYSMEM to Kconfig

This converts the following to Kconfig:
CONFIG_PHYSMEM

Signed-off-by: Simon Glass <sjg@chromium.org>
Suggested-by: Sean Anderson <seanga2@gmail.com>

# ac7606af 14-Nov-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

lmb: fix typo 'commun'

%s/commun/common/

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

# e7d285b2 25-Sep-2021 Simon Glass <sjg@chromium.org>

image: Use the correct checks for CRC32

Add a host Kconfig for CRC32. With this we can use CONFIG_IS_ENABLED(CRC32)
directly in the host build, so drop the unnecessary indirection.

Add a few more conditions to SPL_CRC32 to avoid build failures as well as
TPL_CRC32. Also update hash.c to make crc32 optional and to actually take
notice of SPL_CRC32.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# 2c21256b 25-Sep-2021 Simon Glass <sjg@chromium.org>

hash: Use Kconfig to enable hashing in host tools and SPL

At present when building host tools, we force CONFIG_SHAxxx to be enabled
regardless of the board Kconfig setting. This is done in the image.h
header file.

For SPL we currently just assume the algorithm is desired if U-Boot proper
enables it.

Clean this up by adding new Kconfig options to enable hashing on the host,
relying on CONFIG_IS_ENABLED() to deal with the different builds.

Add new SPL Kconfigs for hardware-accelerated hashing, to maintain the
current settings.

This allows us to drop the image.h code and the I_WANT_MD5 hack.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# 603d15a5 25-Sep-2021 Simon Glass <sjg@chromium.org>

spl: cypto: Bring back SPL_ versions of SHA

Unfortunately these were removed by mistake. This means that adding hash
support to SPL brings in all software algorithms, with a substantial
increase in code size.

The origin of the problem was renaming them to SPL_FIT_xxx and then these
were removed altogether in a later commit.

Add them back. This aligns with CONFIG_MD5, for example, which has an SPL
variant.

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: f5bc9c25f31 ("image: Rename SPL_SHAxxx_SUPPORT to SPL_FIT_SHAxxx")
Fixes: eb5171ddec9 ("common: Remove unused CONFIG_FIT_SHAxxx selectors")
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# 6674edaa 16-Sep-2021 Tom Rini <trini@konsulko.com>

Merge tag 'v2021.10-rc4' into next

Prepare v2021.10-rc4

Signed-off-by: Tom Rini <trini@konsulko.com>

# gpg: Signature made Tue 14 Sep 2021 06:58:32 PM EDT
# gpg: using RSA key 1A3C7F70E08FAB1707809BBF147C39FF9634B72C
# gpg: Good signature from "Thomas Rini <trini@konsulko.com>" [ultimate]

# Conflicts:
# board/Arcturus/ucp1020/spl.c
# cmd/mvebu/Kconfig
# common/Kconfig.boot
# common/image-fit.c
# configs/UCP1020_defconfig
# configs/sifive_unmatched_defconfig
# drivers/pci/Kconfig
# include/configs/UCP1020.h
# include/configs/sifive-unmatched.h
# lib/Makefile
# scripts/config_whitelist.txt


# 5145bc73 01-Sep-2021 Oleksandr Suvorov <oleksandr.suvorov@foundries.io>

lib: fix typos in Kconfig

There are trivial typos in the Kconfig file. Fixed them.
Also, fixed grammar in the descriptions with typos.

Fixes: d56b4b1974 ("configs: Migrate RBTREE, LZO, CMD_MTDPARTS, CMD_UBI and CMD_UBIFS")
Fixes: 7264f2928b ("spl: fit: Eanble GZIP support for image decompression")
Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# e60e4499 02-Sep-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

lib: Drop SHA512_ALGO in lieu of SHA512

SHA512_ALGO was used as a "either SHA512 or SHA384", although the
implementations of these two algorithms share a majority of code.

From a Kconfig interface perspective, it makes sense to present two
distinct options. This requires #ifdefing out the SHA512
implementation from sha512.c. The latter doesn't make any sense.

It's reasonable to say in Kconfig that SHA384 depends on SHA512, and
seems to be the more polite way to handle the selection.

Thus, automatically select SHA512 when SHA384 is enabled.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# b4c2c151 27-Aug-2021 Michal Simek <michal.simek@amd.com>

Kconfig: Remove all default n/no options

default n/no doesn't need to be specified. It is default option anyway.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
[trini: Rework FSP_USE_UPD portion]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 928a8be7 29-Jul-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

lib: ecdsa: Implement UCLASS_ECDSA verification on target

Implement the crypto_algo .verify() function for ecdsa256. Because
it backends on UCLASS_ECDSA, this change is focused on parsing the
keys from devicetree and passing this information to the specific
UCLASS driver.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# fa3f1f1d 24-Jul-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: disable CONFIG_SPL_HEXDUMP by default

CONFIG_HEXDUMP is needed to display UEFI variables using 'printenv -e'.

Enabling CONFIG_SPL_HEXDUMP only makes sense for debugging purposes.
Hence CONFIG_SPL_HEXDUMP should not be enabled by default.

The following boards currently have CONFIG_SPL_HEXDUMP=y. This includes
boards that don't use SPL at all.

axm_defconfig
imx8mm-cl-iot-gate_defconfig
imx8mm_venice_defconfig
imxrt1020-evk_defconfig
imxrt1050-evk_defconfig
kontron_sl28_defconfig
kp_imx53_defconfig
lx2160ardb_tfa_stmm_defconfig
mt7622_rfb_defconfig
octeon_ebb7304_defconfig
octeon_nic23_defconfig
qemu_arm64_defconfig
qemu_arm_defconfig
qemu-riscv32_defconfig
qemu-riscv32_smode_defconfig
qemu-riscv64_defconfig
qemu-riscv64_smode_defconfig
qemu-x86_64_defconfig
qemu-x86_defconfig
sandbox64_defconfig
sandbox_defconfig
stm32mp15_basic_defconfig
stm32mp15_trusted_defconfig
synquacer_developerbox_defconfig
taurus_defconfig
xilinx_versal_virt_defconfig

The patch only keeps it enabled on

sandbox_spl_defconfig

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 1a46cb6c 02-Jul-2021 Simon Glass <sjg@chromium.org>

lib: Create a new Kconfig option for charset conversion

Rather than looking at two KConfig options in the Makefile, create a new
Kconfig option for compiling lib/charset.c

Enable it for UFS also, which needs this support.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 26dd9936 08-Jul-2021 Steffen Jaeckel <jaeckel-floss@eyet-services.de>

lib: add crypt subsystem

Add the basic functionality required to support the standard crypt
format.
The files crypt-sha256.c and crypt-sha512.c originate from libxcrypt and
their formatting is therefor retained.
The integration is done via a crypt_compare() function in crypt.c.

```
libxcrypt $ git describe --long --always --all
tags/v4.4.17-0-g6b110bc
```

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 7d0f3fbb 11-Jun-2021 Tero Kristo <t-kristo@ti.com>

lib: rational: copy the rational fraction lib routines from Linux

Copy the best rational approximation calculation routines from Linux.
Typical usecase for these routines is to calculate the M/N divider
values for PLLs to reach a specific clock rate.

This is based on linux kernel commit:
"lib/math/rational.c: fix possible incorrect result from rational
fractions helper"
(sha1: 323dd2c3ed0641f49e89b4e420f9eef5d3d5a881)

Signed-off-by: Tero Kristo <t-kristo@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Tero Kristo <kristo@kernel.org>

# ec0512b1 24-May-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

Revert "lib: introduce HASH_CALCULATE option"

When we think of Kconfig, we usually think of features that we like
to enable or not. Ideally, we wouldn't use Kconfig to fix a build
issue, although sometimes it might make sense. With Kconfig it's hard
to guarantee that the fix is universal. We can only say that it works
for the set of tested configurations. In the majority of cases, it's
preferable to let the linker figure things out for us.

The reverted commit attempted to fix a build issue by adding an
invisible Kconfig option. This is wrong in several ways:

It invents a new Kconfig variable when CONFIG_HASH already
exists for the same purpose.
Second, hash-checksum.c makes use of the hash_progressive_lookup_algo()
symbol, which is only provided with CONFIG_HASH, but this dependency
was not expressed in the reverted patch.

It feels like Kconfig is turning into a listing of all available
source files, and a buffet to 'select' which ones to compile. The
purpose of this revert is to enable the next change to make use of
CONFIG_HASH instead of adding to Kconfig.

This reverts commit 87316da05f2fd49d3709275e64ef0c5980366ade.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Acked-by: Masahisa Kojima <masahisa.kojima@linaro.org>

# 1621d3c4 10-May-2021 Bin Meng <bmeng.cn@gmail.com>

lib: kconfig: Limit BINMAN_FDT for OF_SEPARATE or OF_EMBED

Generally speaking BINMAN_FDT makes sense for OF_SEPARATE or OF_EMBED.
For the other OF_CONTROL methods, it's quite possible binman node is
not available as binman is invoked during the build phase instead of
runtime. Let's only turn it on for OF_SEPARATE or OF_EMBED by default.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 87316da0 13-May-2021 Masahisa Kojima <masahisa.kojima@linaro.org>

lib: introduce HASH_CALCULATE option

Build error occurs when CONFIG_EFI_SECURE_BOOT or
CONFIG_EFI_CAPSULE_AUTHENTICATE is enabled,
because hash-checksum.c is not compiled.

Since hash_calculate() implemented in hash-checksum.c can be
commonly used aside from FIT image signature verification,
this commit itroduces HASH_CALCULATE option to decide
if hash-checksum.c shall be compiled.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# e2ae483c 13-May-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

hash: Kconfig option for SHA512 hardware acceleration

Commit a479f103dc1c ("hash: Allow for SHA512 hardware implementations")
defined function definitions for hardware accelerated SHA384 and SHA512.
If CONFIG_SHA_HW_ACCEL=y, these functions are used.

We already have boards using CONFIG_SHA_HW_ACCEL=y but none implements the
new functions hw_sha384() and hw_sha512().

For implementing the EFI TCG2 protocol we need SHA384 and SHA512. The
missing hardware acceleration functions lead to build errors on boards like
peach-pi_defconfig.

Introduce a new Kconfig symbol CONFIG_SHA512_HW_ACCEL to control if the
functions hw_sha384() and hw_sha512() shall be used to implement the SHA384
and SHA512 algorithms.

Fixes: a479f103dc1c ("hash: Allow for SHA512 hardware implementations")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

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

# 6d66502b 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: Add 2 config to define the max number of regions

Add 2 configs CONFIG_LMB_MEMORY_REGIONS and CONFIG_LMB_RESERVED_REGIONS
to change independently the max number of the regions in lmb
library.

When CONFIG_LMB_USE_MAX_REGIONS=y, move the lmb property arrays to
struct lmb and manage the array size with the element 'max' of struct
lmb_region; their are still allocated in stack.

When CONFIG_LMB_USE_MAX_REGIONS=n, keep the current location in
struct lmb_region to allow compiler optimization.

Increase CONFIG_LMB_RESERVED_REGIONS is useful to avoid lmb errors in
bootm when the number of reserved regions (not adjacent) is reached:
+ 1 region for relocated U-Boot
+ 1 region for initrd
+ 1 region for relocated linux device tree
+ reserved memory regions present in Linux device tree.

The current limit of 8 regions is reached with only 5 reserved regions
in DT.

see Linux kernel commit bf23c51f1f49 ("memblock: Move memblock arrays
to static storage in memblock.c and make their size a variable")

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# 4fa0150d 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: move MAX_LMB_REGIONS value in Kconfig

Move MAX_LMB_REGIONS value in Kconfig, the max number of the regions
in lmb library.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# 77b8cfef 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: move CONFIG_LMB in Kconfig

Migrate CONFIG_LMB in Kconfig.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# a479f103 16-Feb-2021 Joel Stanley <joel@jms.id.au>

hash: Allow for SHA512 hardware implementations

Similar to support for SHA1 and SHA256, allow the use of hardware hashing
engine by enabling the algorithm and setting CONFIG_SHA_HW_ACCEL /
CONFIG_SHA_PROG_HW_ACCEL.

Signed-off-by: Joel Stanley <joel@jms.id.au>

# f2c1442e 14-Mar-2021 Simon Glass <sjg@chromium.org>

bloblist: Make BLOBLIST_TABLES depend on BLOBLIST

Add an extra condition here since we cannot put x86 tables in a bloblist
when bloblists are not supported.

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

# e0103158 25-Feb-2021 Bin Meng <bmeng.cn@gmail.com>

lib: kconfig: Mention CONFIG_ADDR_MAP limitation in the help

Mention that CONFIG_ADDR_MAP only works in the post-relocation phase.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>

# 56e7257c 03-Feb-2021 Bin Meng <bmeng.cn@gmail.com>

lib: Fix BINMAN_FDT dependency

lib/binman.c references the following 3 ofnode APIs:
ofnode_first_subnode(), ofnode_path() and ofnode_read_bool().

These APIs get built only when DM is on. Fix the dependency then.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 59e4e391 18-Jan-2021 Tom Rini <trini@konsulko.com>

Merge https://gitlab.denx.de/u-boot/custodians/u-boot-riscv

- Update qemu-riscv.rst build instructions.
- Add support for SPI on Kendryte K210.
- Add Microchip PolarFire SoC Icicle Kit support.
- Add support for an early timer.
- Select TIMER_EARLY to avoid infinite recursion for Trace.


# a80f8513 17-Jan-2021 Pragnesh Patel <pragnesh.patel@sifive.com>

trace: select TIMER_EARLY to avoid infinite recursion

When tracing functions is enabled this adds calls to
__cyg_profile_func_enter() and __cyg_profile_func_exit() to the traced
functions.

__cyg_profile_func_enter() and __cyg_profile_func_exit() invoke
timer_get_us() to record the entry and exit time.

initr_dm() will make gd->dm_root = NULL and gd->timer = NULL, so
timer_get_us() -> get_ticks() -> dm_timer_init() will lead to an
indefinite recursion.

So select TIMER_EARLY when tracing got enabled.

Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Rick Chen <rick@andestech.com>

# 6205bbb1 04-Jan-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lib: cosmetic update of CONFIG_LIB_ELF description

Change 2 typo error in CONFIG_LIB_ELF description:
- Supoort => Support
- fir => for

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c589132a 02-Dec-2020 Aswath Govindraju <a-govindraju@ti.com>

fdt: Use phandle to distinguish DT nodes with same name

While assigning the sequence number to subsystem instances by reading the
aliases property, only DT nodes names are compared and not the complete
path. This causes a problem when there are two DT nodes with same name but
have different paths.

In arch/arm/dts/k3-am65-main.dtsi there are two USB controllers with the
same device tree node name but different path. When aliases are defined for
these USB controllers then fdtdec_get_alias_seq() fails to pick the correct
instance for a given index.

fdt_path_offset() function is slow and this would effect the U-Boot
startup. To avert the time penalty on all boards, apply this extra check
only when required by using a config option.

Fix it by comparing the phandles of DT nodes after the node names match,
under a config option.

Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Fix whitespace error in Kconfig:
Signed-off-by: Simon Glass <sjg@chromium.org>

# 28cef9ca 19-Nov-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

fs: fat: create correct short names

The current function set_name() used to create short names has the
following deficiencies resolved by this patch:

* Long names (e.g. FOO.TXT) are stored even if a short name is enough.
* Short names with spaces are created, e.g. "A ~1.TXT".
* Short names with illegal characters are created, e.g. "FOO++BAR".
* Debug output does not not consider that the short file name has no
concluding '\0'.

The solution for the following bug is split of into a separate patch:

* Short file names must be unique.

This patch only provides the loop over possible short file names.

Fixes: c30a15e590c ("FAT: Add FAT write feature")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# e4f8e543 05-Nov-2020 Simon Glass <sjg@chromium.org>

smbios: Drop the unused Kconfig options

Now that we can use devicetree to specify this information, drop the old
CONFIG options.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 44c74bdd 05-Nov-2020 Simon Glass <sjg@chromium.org>

sysinfo: Provide a default driver to set SMBIOS values

Some boards want to specify the manufacturer or product name but do not
need to have their own sysinfo driver.

Add a default driver which provides a way to specify this SMBIOS
information in the devicetree, without needing any board-specific
functionality.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d2cb7a22 04-Nov-2020 Simon Glass <sjg@chromium.org>

x86: Allow putting some tables in the bloblist

At present all tables are placed starting at address f0000 in memory, and
can be up to 64KB in size. If the tables are very large, this may not
provide enough space.

Also if the tables point to other tables (such as console log or a ramoops
area) then we must allocate other memory anyway.

The bloblist is a nice place to put these tables since it is contiguous,
which makes it easy to reserve this memory for linux using the 820 tables.

Add an option to put some of the tables in the bloblist. For SMBIOS and
ACPI, create suitable pointers from the f0000 region to the new location
of the tables.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
[bmeng: squashed in http://patchwork.ozlabs.org/project/uboot/patch/
20201105062407.1.I8091ad931cbbb5e3b6f6ababdf3f8d5db0d17bb9@changeid/]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# 415eab06 03-Nov-2020 Christian Gmeiner <christian.gmeiner@gmail.com>

smbios: add parsing API

Add a very simple API to be able to access SMBIOS strings
like vendor, model and bios version.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 72eda507 27-Oct-2020 Sean Anderson <seanga2@gmail.com>

lib: Add getopt

Some commands can get very unweildy if they have too many positional
arguments. Adding options makes them easier to read, remember, and
understand.

This implementation of getopt has been taken from barebox, which has had
option support for quite a while. I have made a few modifications to their
version, such as the removal of opterr in favor of a separate getopt_silent
function. In addition, I have moved all global variables into struct
getopt_context.

The getopt from barebox also re-orders the arguments passed to it so that
non-options are placed last. This allows users to specify options anywhere.
For example, `ls -l foo/ -R` would be re-ordered to `ls -l -R foo/` as
getopt parsed the options. However, this feature conflicts with the const
argv in cmd_tbl->cmd. This was originally added in 54841ab50c ("Make sure
that argv[] argument pointers are not modified."). The reason stated in
that commit is that hush requires argv to stay unmodified. Has this
situation changed? Barebox also uses hush, and does not have this problem.
Perhaps we could use their fix?

I have assigned maintenance of getopt to Simon Glass, as it is currently
only used by the log command. I would also be fine maintaining it.

Signed-off-by: Sean Anderson <seanga2@gmail.com>

# 26637e2e 12-Sep-2020 Simon Glass <sjg@chromium.org>

lib: Allow hexdump to be used in SPL

It is sometimes useful to output hex dumps in SPL. Add a config option to
allow this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# e87dfb05 05-Aug-2020 Andrii Anisov <andrii_anisov@epam.com>

lib: sscanf: add sscanf implementation

Port sscanf implementation from mini-os and introduce new
Kconfig option to enable it: CONFIG_SSCANF. Disable by default.

Signed-off-by: Andrii Anisov <andrii_anisov@epam.com>
Signed-off-by: Anastasiia Lukianenko <anastasiia_lukianenko@epam.com>
Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>

# 81014f73 30-Jul-2020 Joao Marcos Costa <joaomarcos.costa@bootlin.com>

include/u-boot, lib/zlib: add sources for zlib decompression

Add zlib (v1.2.11) uncompr() function to U-Boot. SquashFS depends on
this function to decompress data from a raw disk image. The actual
support for zlib into SquashFS sources will be added in a follow-up
commit.

Signed-off-by: Joao Marcos Costa <joaomarcos.costa@bootlin.com>

# 69be8fd1 03-Jun-2020 Marek Szyprowski <m.szyprowski@samsung.com>

powerpc: move ADDR_MAP to Kconfig

Move ADDR_MAP related config options from include/configs/*.h to the
proper place in lib/Kconfig. This has been done using
./tools/moveconfig.py and manual inspection of the generated changes.
This is a preparation to use ADDR_MAP helper on ARM 32bit Raspberry Pi4
board for mapping the PCIe XHCI MMIO, which is above the 4GiB identity
mapping limit.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# d16b38f4 15-Apr-2020 Reuben Dowle <reubendowle0@gmail.com>

Add support for SHA384 and SHA512

The current recommendation for best security practice from the US government
is to use SHA384 for TOP SECRET [1].

This patch adds support for SHA384 and SHA512 in the hash command, and also
allows FIT images to be hashed with these algorithms, and signed with
sha384,rsaXXXX and sha512,rsaXXXX

The SHA implementation is adapted from the linux kernel implementation.

[1] Commercial National Security Algorithm Suite
http://www.iad.gov/iad/programs/iad-initiatives/cnsa-suite.cfm

Signed-off-by: Reuben Dowle <reuben.dowle@4rf.com>

# 43e442a5 26-May-2020 Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

kconfig: fix some typos

Signed-off-by: Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

# eff5a547 22-May-2020 Michael Walle <michael@walle.cc>

cmd: zip: automatically pull in gzip()

Move the CONFIG_GZIP_COMPRESSED from a config.h macro to a Kconfig menu
item. It is not selectable by a user because there is no reason to do
so. Instead it will be automatically selected by the stuff which uses
gzip(), like the zip command.

Remove it from the config_whitelist.txt. Also remove
CONFIG_GZIP_COMPRESS_DEF_SZ as this was never used on any board. The
default seems to be sane, otherwise it should be added as a Kconfig
option.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8239be61 06-May-2020 Simon Glass <sjg@chromium.org>

lib: Allow MD5 to be enabled in SPL

At present the MD5 option cannot be enabled by board configs since it has
no Kconfig name. It is generally enabled, so long as FIT support is
present. But not all boards use FIT, particularly in SPL

Fix this and add an option for SPL as well. This allows board code to call
md5() even if FIT support is not enabled.

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

# 04cb3994 21-Apr-2020 Weijie Gao <weijie.gao@mediatek.com>

lib: enable lzma decompression support for SPL build

This patch enables LZMA decompression support for SPL build

Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>

# 2a2119e1 05-Mar-2020 Atish Patra <atishp@atishpatra.org>

lib: kconfig: Add option to set BZIP2 compression method

There is no way to select BZIP2 compression method.
Add it under library/compression config where all other
compression related configs are present.

Signed-off-by: Atish Patra <atish.patra@wdc.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 805b3cac 12-Feb-2020 Keerthy <j-keerthy@ti.com>

lib: elf: Move the generic elf loading/validating functions to lib

Move the generic elf loading/validating functions to lib/
so that they can be re-used and accessed by code existing
outside cmd.

While at it remove the duplicate static version of load_elf_image_phdr
under arch/arm/mach-imx/imx_bootaux.c.

Signed-off-by: Keerthy <j-keerthy@ti.com>
Suggested-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>

# 1611235b 19-Jan-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: Kconfig dependencies for pseudo-random library

drivers/rng/sandbox_rng.c requires rand() to be defined but configuration
option CONFIG_CONFIG_LIB_RAND selected in drivers/rng/Kconfig does not
exist.

test/lib/test_aes.c requires rand() to be defined.

Fix the selection criteria for choice "Pseudo-random library support type".

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 3c10dc95 06-Dec-2019 Simon Glass <sjg@chromium.org>

binman: Add a library to access binman entries

SPL and TPL can access information about binman entries using link-time
symbols but this is not available in U-Boot proper. Of course it could be
made available, but the intention is to just read the device tree.

Add support for this, so that U-Boot can locate entries.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# b4adf627 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: crypto: add x509 parser

Imported from linux kernel v5.3:
x509.asn1 without changes
x509_akid.asn1 without changes
x509_parser.h without changes
x509_cert_parser.c with changes marked as __UBOOT__
x509_public_key.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# a9b45e6e 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add oid registry utility

Imported from linux kernel v5.3:
build_OID_registry without changes
oid_registry.h without changes
oid_registry.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# ab8a0e06 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add asn1 decoder

Imported from linux kernel v5.3:
lib/asn1_decoder.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 2b12196d 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

cmd: add asn1_compiler

Imported from linux kernel v5.3:
asn1.h without changes
asn1_ber_bytecode.h without changes
asn1_decoder.h without changes
asn1_compiler.c without changes

This host command will be used to create a ASN1 parser, for example,
for pkcs7 messages or x509 certificates. More specifically, it will
generate *byte code* which will be interpreted by asn1 decoder library.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 05429b6c 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

rtc: move date.c from drivers/rtc/ to lib/

In the next commit, rtc_mktime(), for compatibility with linux, will be
implemented using rtc_mktime(), which is no longer drivers/rtc specific.
So move this file under lib/.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 37ef1774 10-Nov-2019 Thomas Hebb <tommyhebb@gmail.com>

Kconfig: disambiguate config names for tiny printf

27084c03d36a ("spl: Allow tiny printf() to be controlled in SPL and
TPL") split this option in two for TPL and SPL, but didn't change the
Kconfig names, making them hard to set quickly.

Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>

# 0d76afc0 27-Oct-2019 Simon Glass <sjg@chromium.org>

fdt: Add Kconfig options to control code size

For better or worse libfdt recent grew a lot of code that checks the
validity of the device tree in great detail. When using unsigned or
unverified data this makes things safer, but it does add to code size.

Add some controls to select the trade-off between safety and code size.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 27084c03 25-Sep-2019 Simon Glass <sjg@chromium.org>

spl: Allow tiny printf() to be controlled in SPL and TPL

At present there is only one control for this and it is used for both SPL
and TPL. But SPL might have a lot more space than TPL so the extra cost of
a full printf() might be acceptable.

Split the option into two, providing separate SPL and TPL controls. The
TPL setting defaults to the same as SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2a51e16b 07-Jun-2019 Tom Rini <trini@konsulko.com>

configs: Make USE_TINY_PRINTF depend on SPL||TPL and be default

The USE_TINY_PRINTF symbol only changes things within SPL and TPL
builds, so make it depend on that support. Next, make it default as
within these cases we should rarely have need of more advanced print
formats outside of the debug context.

To do this, in a few cases we need to correct our Kconfig dependencies
as we had cases of non-SPL targets select'ing this symbol. Finally, in
the case of a few boards we really do need the full printf
functionality.

Signed-off-by: Tom Rini <trini@konsulko.com>

# da0fb5fd 02-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: make call depth limit customizable

Up to now we had hard coded values for the call depth up to which trace
records are created: 200 for early tracing, 15 thereafter. UEFI
applications reach a call depth of 80 or above.

Provide customizing settings for the call trace depth limit and the early
call trace depth limit. Use the old values as defaults.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8509f22a 29-Apr-2019 Marek Behún <kabel@kernel.org>

lib: add Zstandard decompression support

Add the zstd library from Linux kernel (only decompression support).
There are minimal changes to build with U-Boot, otherwise the files are
identical to Linux commit dc35da16 from March 2018, the files had not
been touched since in kernel. Also SPDX lincese tags were added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 83a486b6 29-Apr-2019 Marek Behún <kabel@kernel.org>

lib: Add xxhash support

This adds the xxhash support from Linux. Files are almost identical to
those added to Linux in commit 5d240522 ("lib: Add xxhash module") (they
haven't been touched since in Linux). The only difference is to add some
includes to be compatible with U-Boot. Also SPDX lincese tags were
added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 5132361a 29-Apr-2019 Heiko Schocher <hs@denx.de>

lib: Kconfig: fix help text for GZIP

commit 95f4bbd581cf ("lib: fdt: Allow LZO and GZIP DT compression in U-Boot")

introduced Kconfig option for gzip in U-Boot, but help text
says gzip for SPL, which is wrong. Fix this.

Signed-off-by: Heiko Schocher <hs@denx.de>
Acked-by: Marek Vasut <marex@denx.de>

# 1c6eb075 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE_BUFFER_SIZE et al to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE_BUFFER_SIZE
CONFIG_TRACE_EARLY_SIZE
CONFIG_TRACE_EARLY
CONFIG_TRACE_EARLY_ADDR

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

# a24a78d7 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE

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

# 54969b40 21-Mar-2019 Thierry Reding <treding@nvidia.com>

fdtdec: Add Kconfig symbol for tests

Runtime tests are provided as a test_fdtdec command implementation. Add
a Kconfig symbol that allows this command to be built so that the tests
can be used.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 95f4bbd5 08-Mar-2019 Marek Vasut <marex@denx.de>

lib: fdt: Allow LZO and GZIP DT compression in U-Boot

Add required Kconfig symbols, Makefile bits and macro fixes in a
few places to support LZO and DT compression in U-Boot. This can
save a lot of space with multi-DTB fitImages.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>

# 6e705114 13-Jan-2019 Chris Packham <judge.packham@gmail.com>

lib: Kconfig: spelling fixes

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 048c6e89 06-Nov-2018 Simon Glass <sjg@chromium.org>

spl: lz4: Allow use of lz4 compression in SPL

In some cases U-Boot is compressed and it is useful to be able to
decompress it in SPL. Add a Kconfig and Makefile change to allow this.
Note that this does not actually implement decompression.

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

# 2895c4b7 15-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

kconfig: Introduce HAVE_ARCH_IOMAP

Introduce a new Kconfig option for architecture codes to control
whether it provides io{read,write}{8,16,32} I/O accessor functions.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5592a633 01-Oct-2018 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt in TPL

In some cases (e.g. sandbox with verified boot) it is useful to support
libfdt in TPL. Update the Kconfig to handle this.

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

# 6307896c 01-Oct-2018 Simon Glass <sjg@chromium.org>

tpm: Add support for SPL and TPL

At present the tpm can only be used in U-Boot proper. Updated it to work
in SPL and TPL also.

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

# ab948cd2 19-Jul-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

fdt_support: make FDT_FIXUP_PARTITIONS depend on CMD_MTDPARTS

fdt_fixup_mtdparts() calls mtdparts_init() and device_find(),
which are defined in cmd/mtdparts.c

The combination of FDT_FIXUP_PARTITIONS=y and CMD_MTDPARTS=n
emits the following link error:

common/fdt_support.c:903: undefined reference to `mtdparts_init'
common/fdt_support.c:914: undefined reference to `device_find'

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 3330584d 03-Jun-2018 Igor Opaniuk <igor.opaniuk@gmail.com>

avb2.0: integrate avb 2.0 into the build system

Integrate libavb into the build system. Introduce CONFIG_LIBAVB
build option.

Signed-off-by: Igor Opaniuk <igor.opaniuk@linaro.org>

# f8c987f8 05-Jun-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

lib: Add hexdump

Often during debugging session it's very interesting to see
what data we were dealing with. For example what we write or read
to/from memory or peripherals.

This change introduces functions that allow to dump binary
data with one simple function invocation like:
------------------->8----------------
print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, buf, len);
------------------->8----------------

which gives us the following:
------------------->8----------------
00000000: f2 b7 c9 88 62 61 75 64 72 61 74 65 3d 31 31 35 ....baudrate=115
00000010: 32 30 30 00 62 6f 6f 74 61 72 67 73 3d 63 6f 6e 200.bootargs=con
00000020: 73 6f 6c 65 3d 74 74 79 53 33 2c 31 31 35 32 30 sole=ttyS3,11520
00000030: 30 6e 38 00 62 6f 6f 74 64 65 6c 61 79 3d 33 00 0n8.bootdelay=3.
00000040: 62 6f 6f 74 66 69 6c 65 3d 75 49 6d 61 67 65 00 bootfile=uImage.
00000050: 66 64 74 63 6f 6e 74 72 6f 6c 61 64 64 72 3d 39 fdtcontroladdr=9
00000060: 66 66 62 31 62 61 30 00 6c 6f 61 64 61 64 64 72 ffb1ba0.loadaddr
00000070: 3d 30 78 38 32 30 30 30 30 30 30 00 73 74 64 65 =0x82000000.stde
00000080: 72 72 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 rr=serial0@e0022
00000090: 30 30 30 00 73 74 64 69 6e 3d 73 65 72 69 61 6c 000.stdin=serial
000000a0: 30 40 65 30 30 32 32 30 30 30 00 73 74 64 6f 75 0@e0022000.stdou
000000b0: 74 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 30 t=serial0@e00220
000000c0: 30 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00..............
...
------------------->8----------------

Source of hexdump.c was copied from Linux kernel v4.7-rc2.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Mario Six <mario.six@gdsys.cc>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Stefan Roese <sr@denx.de>

# c232d14d 29-May-2018 Alex Kiernan <alex.kiernan@gmail.com>

mmc: Separate "mmc swrite" from fastboot

Introduce CONFIG_IMAGE_SPARSE and CONFIG_CMD_MMC_SWRITE so the "mmc
swrite" command is separated from the fastboot code.

Move image-sparse from common to lib so it's clear it's library code.

Rename CONFIG_FASTBOOT_FLASH_FILLBUF_SIZE to CONFIG_IMAGE_SPARSE_FILLBUF_SIZE
and migrate it to Kconfig.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Acked-by: Jassi Brar <jaswinder.singh@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6417572e 08-May-2018 Tom Rini <trini@konsulko.com>

lib/Kconfig: Mark OF_LIBFDT_OVERLAY as depending on OF_LIBFDT

The overlay code is only useful when OF_LIBFDT is set, so mark it as
depending on that first.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 58a46f88 25-Apr-2018 Praneeth Bajjuri <praneeth@ti.com>

configs: TI: Enable FIT Library overlay support

Enable the FDT library overlay support for all TI SOC family.

Without this option, when Loading fdt from FIT image, the
following warning is seen.

"config with overlays but CONFIG_OF_LIBFDT_OVERLAY not set".

Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
Suggested-by: Andrew F.Davis <afd@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>

# 14ad44ab 18-Apr-2018 Alex Kiernan <alex.kiernan@gmail.com>

spl: Split sprintf, strto* from SPL serial in Kconfig

When SPL serial is disabled, callers who need sprintf or strtoul fail
because their inclusion is guarded by CONFIG_SPL_SERIAL_SUPPORT/
CONFIG_TPL_SERIAL_SUPPORT.

Split printf, sprintf and strto into their own entries and then select
all of them if SERIAL_SUPPORT is enabled to match the current behaviour.

Include panic.o unconditionally as it can be called from anywhere which
uses BUG_ON().

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>

# e294ba06 04-Apr-2018 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-sunxi

Signed-off-by: Tom Rini <trini@konsulko.com>


# d14db11d 03-Apr-2018 Andre Przywara <andre.przywara@arm.com>

sunxi: revert disabling of features

In January some commits were introduced to mitigate the U-Boot image
size issues we encountered on sunxi builds.
Now with the MMC environment removed we can bring them back, as we
practically don't have a size limit anymore.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 32ce6179 13-Mar-2018 Bryan O'Donoghue <bryan.odonoghue@linaro.org>

optee: Add lib entries for sharing OPTEE code across ports

This patch adds code to lib to enable sharing of useful OPTEE code between
board-ports and architectures. The code on lib/optee/optee.c comes from the
TI omap2 port. Eventually the OMAP2 code will be patched to include the
shared code. The intention here is to add more useful OPTEE specific code
as more functionality gets added.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Cc: Harinarayan Bhatta <harinarayan@ti.com>
Cc: Andrew F. Davis <afd@ti.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Kever Yang <kever.yang@rock-chips.com>
Cc: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Cc: Peng Fan <peng.fan@nxp.com>
Tested-by: Peng Fan <peng.fan@nxp.com>

# 36c1877c 06-Feb-2018 Faiz Abbas <faiz_abbas@ti.com>

lib: Kconfig: Move DYNAMIC_CRC_TABLE to Kconfig

Add CONFIG prefix to DYNAMIC_CRC_TABLE and implement it in
Kconfig.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>

# a451bc27 05-Feb-2018 Adam Ford <aford173@gmail.com>

Convert LIB_UUID to Kconfig

config_fallback.h has some logic that checks a variety of options
and selects LIB_UUID if it hasn't already been selected. This
will all LIB_UUID in Kconfig and select this option for the list
of options to allow us to remove the logic from fallbacks

Signed-off-by: Adam Ford <aford173@gmail.com>

# a5a37567 06-Feb-2018 Adam Ford <aford173@gmail.com>

Convert CONFIG LIB_HW_RAND to Kconfig

config_fallbacks.h had some logic to automatically select
LIB_RAND if RANDOM_UUID or CMD_UUID were set if LIB_HW_RAND wasn't
already selected. By migrating LIB_HW_RAND to Kconfig, we can
remove this check from config_fallbacks.h and put it into Kconfig

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
[trini: Turn into a choice, add NET_RANDOM_ETHADDR]
Signed-off-by: Tom Rini <trini@konsulko.com>

# acd4d334 16-Jan-2018 Maxime Ripard <maxime.ripard@free-electrons.com>

net: regex: Disable by default on sunXi

The sunXi arm64 build has overflown, leading to the main U-boot binary
overwriting the environment when flashing the new image, or even worse,
overwriting itself when we're calling saveenv.

Disable this option that is not critical until we can adress the issue
properly.

Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 7e3caa81 03-Dec-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

Move CONFIG_PANIC_HANG to Kconfig

Freescale (NXP) boards have lots of defconfig files per board.
I used "imply PANIC_HANG" for them.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# da5337a6 08-Nov-2017 Nandor Han <nandor.han@ge.com>

rtc: add support for s35392a

Add support for S35392A RTC. The driver supports both U-Boot driver
models.

Signed-off-by: Nandor Han <nandor.han@ge.com>
Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
Cc: Heiko Schocher <hs@denx.de>

# f52bdf4b 14-Sep-2017 Jean-Jacques Hiblot <jjhiblot@ti.com>

lib: allow building lzo for the SPL

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 85d8bf57 03-Sep-2017 Marek Behún <kabel@kernel.org>

lib: Add CRC32-C

This is needed for BTRFS.

Signed-off-by: Marek Behun <marek.behun@nic.cz>

create mode 100644 lib/crc32c.c

# 7264f292 15-Aug-2017 York Sun <york.sun@nxp.com>

spl: fit: Eanble GZIP support for image decompression

Add Kconfig option SPL_GZIP and SPL_ZLIB to enable gunzip support for
SPL boot, eg. falcon boot compressed kernel image.

Signed-off-by: York Sun <york.sun@nxp.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6ef2f901 11-Aug-2017 Adam Ford <aford173@gmail.com>

Convert CONFIG_BCH to Kconfig

This converts the following to Kconfig:
CONFIG_BCH

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1a7ba1d 18-Aug-2017 Anatolij Gustschin <agust@denx.de>

Fix 'notes' typos

s/notes/nodes

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 96b9082c 03-Aug-2017 Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

rockchip: rk3188: rock: adjust for SPL/TPL split

With the changes to split SPL/TPL for the RK3368, I apparently missed
some needed adjustments to the RK3188 Kconfig and rock_defconfig.

This fixes build-issues for the rock board after applying the RK3368
enablement (and SPL/TPL) set that resulted from TPL_SERIAL_SUPPORT,
TPL_ROCKCHIP_BACK_TO_BROM and TPL_TINY_MEMSET being separate symbols
now.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d56b4b19 22-Jul-2017 Tom Rini <trini@konsulko.com>

configs: Migrate RBTREE, LZO, CMD_MTDPARTS, CMD_UBI and CMD_UBIFS

The above CONFIG options are in Kconfig, and now have correct depends and
inter-dependencies. Migrate these to configs/ from include/configs/. In the
case of CMD_UBIFS also change it to be a default y if CMD_UBI.

Signed-off-by: Tom Rini <trini@konsulko.com>

# aed998aa 17-May-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_LZMA to Kconfig

This converts the following to Kconfig:
CONFIG_LZMA

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

# b1a873df 26-Apr-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_CMD_AES et al to Kconfig

This converts the following to Kconfig:
CONFIG_CMD_AES
CONFIG_AES

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Add select AES to CMD_AES]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 173aafbf 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

cmd: Expose a Kconfig option to enable UBIFS commands

Create a new Kconfig entry to allow CMD_UBIFS selection from Kconfig and
add an hidden LZO option that can be selected by CMD_UBIFS.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>

# aa049152 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

mtd: ubi: Select RBTREE option from MTD_UBI Kconfig entry

Expose the RBTREE feature through Kconfig and select this option from the
MTD_UBI option.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>
[Rebased on master]
Signed-off-by: Jagan Teki <jagan@openedev.com>

# ab4458bd 02-Apr-2017 Simon Glass <sjg@chromium.org>

string: Provide a slimmed-down memset()

Most of the time the optimised memset() is what we want. For extreme
situations such as TPL it may be too large. For example on the 'rock'
board, using a simple loop saves a useful 48 bytes. With gcc 4.9 and
the rodata bug, this patch is enough to reduce the TPL image below the
limit.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>

# bea79d7d 14-Mar-2017 Andre Przywara <andre.przywara@arm.com>

Kconfig: introduce md5sum command selection

So far CONFIG_MD5SUM would need to be set by a board's include file.
Since the command is really generic, move it over to Kconfig to allow
it to be defined by either a board's defconfig, menuconfig or some
config snippet merged via mergeconfig.sh.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e663b350 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

smbios: Expose in efi_loader as table

We can pass SMBIOS easily as EFI configuration table to an EFI payload. This
patch adds enablement for that case.

While at it, we also enable SMBIOS generation for ARM systems, since they support
EFI_LOADER.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4b6dddc2 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

x86: Move smbios generation into arch independent directory

We will need the SMBIOS generation function on ARM as well going forward,
so let's move it into a non arch specific location.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# ebf7fff2 05-Oct-2016 Heiko Schocher <hs@denx.de>

spl: move FDT_FIXUP_PARTITIONS to Kconfig

Move FDT_FIXUP_PARTITIONS to Kconfig and cleanup existing
uses.

Signed-off-by: Heiko Schocher <hs@denx.de>

# ddf67f71 05-Jul-2016 Maxime Ripard <maxime.ripard@free-electrons.com>

libfdt: Add overlay application function

The device tree overlays are a good way to deal with user-modifyable
boards or boards with some kind of an expansion mechanism where we can
easily plug new board in (like the BBB, the Raspberry Pi or the CHIP).

Add a new function to merge overlays with a base device tree.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>

# 91b86e21 26-May-2016 Marek Vasut <marex@denx.de>

lib: Enable private libgcc by default

This patch decouples U-Boot binary from the toolchain on systems where
private libgcc is available. Instead of pulling in functions provided
by the libgcc from the toolchain, U-Boot will use it's own set of libgcc
functions. These functions are usually imported from Linux kernel, which
also uses it's own libgcc functions instead of the ones provided by the
toolchain.

This patch solves a rather common problem. The toolchain can usually
generate code for many variants of target architecture and often even
different endianness. The libgcc on the other hand is usually compiled
for one particular configuration and the functions provided by it may
or may not be suited for use in U-Boot. This can manifest in two ways,
either the U-Boot fails to compile altogether and linker will complain
or, in the much worse case, the resulting U-Boot will build, but will
misbehave in very subtle and hard to debug ways.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 67976306 30-Mar-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

cosmetic: Fix typos "privide"

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# ed980b8c 03-Mar-2016 Alexander Graf <agraf@csgraf.de>

efi_loader: hook up in build environment

Now that we have all the bits and pieces ready for EFI payload loading
support, hook them up in Makefiles and KConfigs so that we can build.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
[trini: Enable only when we of OF_LIBFDT, disable on kwb and colibri_pxa270]
Signed-off-by: Tom Rini <trini@konsulko.com>

# aa34fbc0 22-Feb-2016 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt to be used in SPL

Add an option to enable libfdt in SPL. This can be useful when decoding
FIT files in SPL.

We need to make sure this option is not enabled in SPL by this change.
Also this option needs to be enabled in host builds. Si add a new
IMAGE_USE_LIBFDT #define which can be used in files that are built on the
host but must also build for U-Boot and SPL.

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

# 69e173eb 22-Feb-2016 Simon Glass <sjg@chromium.org>

Move CONFIG_OF_LIBFDT to Kconfig

Move this option to Kconfig and tidy up existing boards.

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

# a187559e 05-Feb-2016 Bin Meng <bmeng.cn@gmail.com>

Use correct spelling of "U-Boot"

Correct spelling of "U-Boot" shall be used in all written text
(documentation, comments in source files etc.).

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Minkyu Kang <mk7.kang@samsung.com>

# 947c626d 14-Jan-2016 Tom Rini <trini@konsulko.com>

vsprintf.c: Always enable CONFIG_SYS_VSNPRINTF

Enabling this function always removes some class of string saftey issues.
The size change here in general is about 400 bytes and this seems a reasonable
trade-off.

Cc: Peng Fan <peng.fan@nxp.com>
Cc: Peter Robinson <pbrobinson@gmail.com>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Adrian Alonso <aalonso@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 7d9cde10 22-Nov-2015 Stefan Roese <sr@denx.de>

lib/tiny-printf.c: Add tiny printf function for space limited environments

This patch adds a small printf() version that supports all basic formats.
Its intented to be used in U-Boot SPL versions on platforms with very
limited internal RAM sizes.

To enable it, just define CONFIG_USE_TINY_PRINTF in your defconfig. This
will result in the SPL using this tiny function and the main U-Boot
still using the full-blown printf() function.

This code was copied from:
http://www.sparetimelabs.com/printfrevisited
With mostly only coding style related changes so that its checkpatch
clean.

The size reduction is about 2.5KiB. Here a comparison for the db-mv784mp-gp
(Marvell AXP) SPL:

Without this patch:
58963 18536 1928 79427 13643 ./spl/u-boot-spl

With this patch:
56542 18536 1956 77034 12cea ./spl/u-boot-spl

Note:
To make it possible to compile tiny-printf.c instead of vsprintf.c when
CONFIG_USE_TINY_PRINTF is defined, the functions printf() and vprintf() are
moved from common/console.c into vsprintf.c in this patch.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>

# 2419cd16 03-Oct-2015 Simon Glass <sjg@chromium.org>

dm: tpm: Drop CONFIG_DM_TPM

Now that all TPM drivers use driver model, we can drop the special driver
model CONFIG option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>

# 027b728d 06-Oct-2015 Julius Werner <jwerner@chromium.org>

Add support for LZ4 decompression algorithm

This patch adds support for LZ4-compressed FIT image contents. This
algorithm has a slightly worse compression ration than LZO while being
nearly twice as fast to decompress. When loading images from a fast
storage medium this usually results in a boot time win.

Sandbox-tested only since I don't have a U-Boot development system set
up right now. The code was imported unchanged from coreboot where it's
proven to work, though. I'm mostly interested in getting this recognized
by mkImage for use in a downstream project.

Signed-off-by: Julius Werner <jwerner@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# a7d660bc 22-Aug-2015 Simon Glass <sjg@chromium.org>

tpm: Add Kconfig options for TPMs

Add new Kconfig options for TPMs in preparation for moving boards to use
Kconfig for TPM configuration.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 867a6ac8 31-Jul-2015 Simon Glass <sjg@chromium.org>

efi: Add start-up library code

When running as an EFI application, U-Boot must request memory from EFI,
and provide access to the boot services U-Boot needs.

Add library code to perform these tasks. This includes efi_main() which is
the entry point from EFI. U-Boot is built as a shared library.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d1389403 23-Jun-2015 Simon Glass <sjg@chromium.org>

Add a dhrystone benchmark command

Drystone provides a convenient sanity check that the CPU is running at full
speed. Add this as a command which can be enabled as needed.

Note: I investigated using Coremark for this but there was a license
agreement and I could not work out if it was GPL-compatible.

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

# f7848d90 22-Jun-2015 Joe Hershberger <joe.hershberger@ni.com>

Allow CONFIG_REGEX to be disabled when CONFIG_NET

Instead of selecting REGEX when NET is enabled, make it the default, but
allow boards that are tiny to disable it and lose functionality on all
but the first Ethernet adapter.

cm-bf548, bf538f-ezkit, and bf533-stamp need this. None appear to have
more than one Ethernet interface.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# 3850dbe8 11-Jun-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

blackfin: fix undefined reference to srand and rand

Commit 9ba9e85f3f1c (net: Fix NET_RANDOM_ETHADDR dependencies)
accidentally dropped CONFIG_LIB_RAND defines for 14 Blackfin boards.

Prior to that commit, those boards defined CONFIG_LIB_RAND, but not
CONFIG_NET_RANDOM_ETHADDR. So, commit 9ba9e85f3f1c should not have
touched them, but in fact it ripped CONFIG_LIB_RAND off from all the
header files, which caused undefined reference to srand and rand.
CONFIG_LIB_RAND=y must be revived for such boards.

BTW, this commit indeed makes it better, but even with this fix,
three boards (bf533-stamp, bf538f-ezkit, cm-bf548) still can not
build due to region 'ram' overflowed error. This was cause by
commit 6eed3786c68c (net: Move the CMD_NET config to defconfigs)
because CMD_NET selects NET, and NET selects REGEX. Eventually,
some boards were newly enabled with CONFIG_REGEX, increasing the
memory footprint. A patch is expected to fix the build error.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 9ba9e85f 25-May-2015 Michal Simek <michal.simek@amd.com>

net: Fix NET_RANDOM_ETHADDR dependencies

NET_RANDOM_ETHADDR depends on lib/rand.c. This patch adds dependency to
Kconfig to ensure that library is also compiled.

Remove the definitions from Blackfin boards' include/configs.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 6501ff62 20-Apr-2015 Przemyslaw Marczak <p.marczak@samsung.com>

lib: Kconfig: add entry for errno_str() function

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1a60650c 21-Apr-2015 Joe Hershberger <joe.hershberger@ni.com>

kconfig: Move REGEX to Kconfig

Having this as a Kconfig allows it to be a dependent feature.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8156345d 06-Mar-2015 Simon Glass <sjg@chromium.org>

sandbox: Move CONFIG_SYS_VSNPRINTF to Kconfig

Move this over to Kconfig and tidy up.

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

# 94e3c8c4 19-Feb-2015 gaurav rana <gaurav.rana@freescale.com>

crypto/fsl - Add progressive hashing support using hardware acceleration.

Currently only normal hashing is supported using hardware acceleration.
Added support for progressive hashing using hardware.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
Signed-off-by: Gaurav Rana <gaurav.rana@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>

# d9f23c7f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

lib/rsa: Add Kconfig for devices supporting RSA Modular Exponentiation

Kconfig option added for devices which support RSA Verification.
1. RSA_SOFTWARE_EXP
Enables driver for supporting RSA Modular Exponentiation in Software
2. RSA_FREESCALE_EXP
Enables driver for supporting RSA Modular Exponentiation using Freescale specific
driver

The above drivers use RSA uclass

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
(Removed duplicate line in Kconfig comment)

Change-Id: I7663c4d5350e2bfc3dfa2696f70ef777d6ccc6f6

# c4beb22f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

FIT: Modify option FIT_SIGNATURE in Kconfig

For FIT signature based approach to work, RSA library needs to be selected.
The FIT_SIGNATURE option in Kconfig is modified to automatically select RSA.
Selecting RSA compiles the RSA library required for image verification.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 45ccec8f 23-Oct-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

kconfig: move CONFIG_USE_PRIVATE_LIBGCC to Kconfig

The private libgcc is supported only on ARM, MIPS, PowerPC, SH, x86.
Those architectures should "select" HAVE_PRIVATE_LIBGCC and
CONFIG_USE_PRIVATE_LIBGCC should depend on it.

Currently, this option is enabled on Tegra boards and x86 architecture.
Move the definition from header files to Kconfig.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Tested-by: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: Tom Warren <twarren@nvidia.com>

# 8c688bc4 23-Oct-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

kconfig: move CONFIG_SYS_HZ to lib/Kconfig

CONFIG_SYS_HZ is always defined as 1000 in config_fallbacks.h
(but some boards still have redundant definitions).

This commit moves the definition and the document in README to
Kconfig. Since lib/Kconfig can assure that CONFIG_SYS_HZ is 1000,
the sanity check in lib/time.c should be removed.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Reviewed-by: Marek Vasut <marex@denx.de>

# b0928da6 16-Sep-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

kconfig: move CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED to Kconfig

If this option is enabled, the objects under lib/ directory
are compiled with speed optimization, not size optimization.
(Currently, only used by some Blackfin boards.)

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# ed36323f 16-Sep-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

kconfig: add blank Kconfig files

This would be useful to start moving various config options.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# b340199f 10-Jun-2022 Tom Rini <trini@konsulko.com>

spl: Ensure all SPL symbols in Kconfig have some SPL dependency

Tighten up symbol dependencies in a number of places. Ensure that a SPL
specific option has at least a direct dependency on SPL. In places
where it's clear that we depend on something more specific, use that
dependency instead. This means in a very small number of places we can
drop redundant dependencies.

Reported-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 13ce351b 08-Jun-2022 Tom Rini <trini@konsulko.com>

vpl: Ensure all VPL symbols in Kconfig have some VPL dependency

Tighten up symbol dependencies in a number of places. Ensure that a VPL
specific option has at least a direct dependency on VPL. In places
where it's clear that we depend on something more specific, use that
dependency instead.

Reported-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 8bea4bf7 08-Jun-2022 Tom Rini <trini@konsulko.com>

tpl: Ensure all TPL symbols in Kconfig have some TPL dependency

Tighten up symbol dependencies in a number of places. Ensure that a TPL
specific option has at least a direct dependency on TPL. In places
where it's clear that we depend on something more specific, use that
dependency instead.

Reported-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 26f981f2 19-May-2022 Rasmus Villemoes <rasmus.villemoes@prevas.dk>

fdtdec: drop needlessly convoluted CONFIG_PHANDLE_CHECK_SEQ

Asking if the alias we found actually points at the device tree node
we passed in (in the guise of its offset from blob) can be done simply
by asking if the fdt_path_offset() of the alias' path is identical to
offset.

In fact, the current method suffers from the possibility of false
negatives: dtc does not necessarily emit a phandle property for a node
just because it is referenced in /aliases; it only emits a phandle
property for a node if it is referenced in <angle brackets>
somewhere. So if both the node we passed in and the alias node we're
considering don't have phandles, fdt_get_phandle() returns 0 for both.

Since the proper check is so simple, there's no reason to hide that
behind a config option (and if one really wanted that, it should be
called something else because there's no need to involve phandle in
the check).

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Acked-by: Aswath Govindraju <a-govindraju@ti.com>

# d30924f1 01-May-2022 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: fix selection of CONFIG_CHARSET

lib/charset.c is not optional for
EFI_APP || EFI_LOADER || UFS || UT_UNICODE.
These must select CONFIG_CHARSET.

Fixes: 726cd9836db0 ("efi: Make unicode printf available to the app")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>

# 747093dd 30-Apr-2022 Simon Glass <sjg@chromium.org>

vpl: Add Kconfig options for VPL

Add VPL versions of commonly used Kconfig options.

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

# 11232139 06-Apr-2022 Tom Rini <trini@konsulko.com>

nds32: Remove the architecture

As removal of nds32 has been ack'd for the Linux kernel, remove support
here as well.

Cc: Rick Chen <rick@andestech.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Rick Chen <rick@andestech.com>

# fd210fee 28-Mar-2022 Philippe Reynes <philippe.reynes@softathome.com>

lib: allow to build asn1 decoder and oid registry in SPL

This commit adds the options:
- SPL_ASN1_DECODER
- SPL_OID_REGISTRY

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>

# 7d44a985 28-Mar-2022 Philippe Reynes <philippe.reynes@softathome.com>

lib: Kconfig: enhance the help of OID_REGISTRY

Enhance the help for the config OID_REGISTRY.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>

# a0e71d96 28-Mar-2022 Philippe Reynes <philippe.reynes@softathome.com>

lib: Kconfig: enhance help for ASN1

Enhance the help for configs ASN1_COMPILER
and ASN1_decoder.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>

# 761a1786 27-Jan-2022 Tom Rini <trini@konsulko.com>

Merge tag 'dm-pull-26jan22' of https://source.denx.de/u-boot/custodians/u-boot-dm

acpi refactoring to allow non-x86 use
binman support for bintools (binary tools)
minor tools improvements in preparation for FDT signing
various minor fixes and improvements


# 334a9b9d 25-Nov-2021 Loic Poulain <loic.poulain@linaro.org>

lib/circbuf: Make circbuf selectable symbol

It is currenly only used from usbtty driver but make it properly
selectable via Kconfig symbol, for future usage.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>

# e1722fcb 01-Dec-2021 Simon Glass <sjg@chromium.org>

x86: Allow any arch to generate ACPI tables

These have sadly found their way to ARM now. Allow any arch to support
generating ACPI tables.

Disable this for the tools build.

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

# 7c3fd5c2 26-Dec-2021 Qu Wenruo <wqu@suse.com>

lib: add BLAKE2 hash support

The code is cross-ported from BLAKE2 reference implementation
(https://github.com/BLAKE2/BLAKE2).

With minimal change to remove unused macros/features.

Currently there is only one user inside U-boot (btrfs), and since it
only utilize BLAKE2B, all other favors are all removed.

Signed-off-by: Qu Wenruo <wqu@suse.com>
[trini: Rename ROUND to R to avoid clash with <linux/bitops.h>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 97f2a749 04-Jan-2022 Eugen Hristev <eugen.hristev@microchip.com>

lib: Kconfig: fix PHANDLE_CHECK_SEQ position outside of menu

CONFIG_PHANDLE_CHECK_SEQ is outside of the menu 'Library routines'
thus it's invisible in menuconfig and cannot be selected.
Fix this by moving the 'endmenu' after the PHANDLE_CHECK_SEQ definition

Fixes: c589132a1d ("fdt: Use phandle to distinguish DT nodes with same name")
Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
Reviewed-by: Aswath Govindraju <a-govindraju@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 726cd983 29-Dec-2021 Simon Glass <sjg@chromium.org>

efi: Make unicode printf available to the app

This is needed to show unicode strings. Enable this code in the app.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>

# 6405ab7a 24-Nov-2021 Simon Glass <sjg@chromium.org>

Convert CONFIG_PHYSMEM to Kconfig

This converts the following to Kconfig:
CONFIG_PHYSMEM

Signed-off-by: Simon Glass <sjg@chromium.org>
Suggested-by: Sean Anderson <seanga2@gmail.com>

# ac7606af 14-Nov-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

lmb: fix typo 'commun'

%s/commun/common/

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

# e7d285b2 25-Sep-2021 Simon Glass <sjg@chromium.org>

image: Use the correct checks for CRC32

Add a host Kconfig for CRC32. With this we can use CONFIG_IS_ENABLED(CRC32)
directly in the host build, so drop the unnecessary indirection.

Add a few more conditions to SPL_CRC32 to avoid build failures as well as
TPL_CRC32. Also update hash.c to make crc32 optional and to actually take
notice of SPL_CRC32.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# 2c21256b 25-Sep-2021 Simon Glass <sjg@chromium.org>

hash: Use Kconfig to enable hashing in host tools and SPL

At present when building host tools, we force CONFIG_SHAxxx to be enabled
regardless of the board Kconfig setting. This is done in the image.h
header file.

For SPL we currently just assume the algorithm is desired if U-Boot proper
enables it.

Clean this up by adding new Kconfig options to enable hashing on the host,
relying on CONFIG_IS_ENABLED() to deal with the different builds.

Add new SPL Kconfigs for hardware-accelerated hashing, to maintain the
current settings.

This allows us to drop the image.h code and the I_WANT_MD5 hack.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# 603d15a5 25-Sep-2021 Simon Glass <sjg@chromium.org>

spl: cypto: Bring back SPL_ versions of SHA

Unfortunately these were removed by mistake. This means that adding hash
support to SPL brings in all software algorithms, with a substantial
increase in code size.

The origin of the problem was renaming them to SPL_FIT_xxx and then these
were removed altogether in a later commit.

Add them back. This aligns with CONFIG_MD5, for example, which has an SPL
variant.

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: f5bc9c25f31 ("image: Rename SPL_SHAxxx_SUPPORT to SPL_FIT_SHAxxx")
Fixes: eb5171ddec9 ("common: Remove unused CONFIG_FIT_SHAxxx selectors")
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# 6674edaa 16-Sep-2021 Tom Rini <trini@konsulko.com>

Merge tag 'v2021.10-rc4' into next

Prepare v2021.10-rc4

Signed-off-by: Tom Rini <trini@konsulko.com>

# gpg: Signature made Tue 14 Sep 2021 06:58:32 PM EDT
# gpg: using RSA key 1A3C7F70E08FAB1707809BBF147C39FF9634B72C
# gpg: Good signature from "Thomas Rini <trini@konsulko.com>" [ultimate]

# Conflicts:
# board/Arcturus/ucp1020/spl.c
# cmd/mvebu/Kconfig
# common/Kconfig.boot
# common/image-fit.c
# configs/UCP1020_defconfig
# configs/sifive_unmatched_defconfig
# drivers/pci/Kconfig
# include/configs/UCP1020.h
# include/configs/sifive-unmatched.h
# lib/Makefile
# scripts/config_whitelist.txt


# 5145bc73 01-Sep-2021 Oleksandr Suvorov <oleksandr.suvorov@foundries.io>

lib: fix typos in Kconfig

There are trivial typos in the Kconfig file. Fixed them.
Also, fixed grammar in the descriptions with typos.

Fixes: d56b4b1974 ("configs: Migrate RBTREE, LZO, CMD_MTDPARTS, CMD_UBI and CMD_UBIFS")
Fixes: 7264f2928b ("spl: fit: Eanble GZIP support for image decompression")
Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# e60e4499 02-Sep-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

lib: Drop SHA512_ALGO in lieu of SHA512

SHA512_ALGO was used as a "either SHA512 or SHA384", although the
implementations of these two algorithms share a majority of code.

From a Kconfig interface perspective, it makes sense to present two
distinct options. This requires #ifdefing out the SHA512
implementation from sha512.c. The latter doesn't make any sense.

It's reasonable to say in Kconfig that SHA384 depends on SHA512, and
seems to be the more polite way to handle the selection.

Thus, automatically select SHA512 when SHA384 is enabled.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# b4c2c151 27-Aug-2021 Michal Simek <michal.simek@amd.com>

Kconfig: Remove all default n/no options

default n/no doesn't need to be specified. It is default option anyway.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
[trini: Rework FSP_USE_UPD portion]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 928a8be7 29-Jul-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

lib: ecdsa: Implement UCLASS_ECDSA verification on target

Implement the crypto_algo .verify() function for ecdsa256. Because
it backends on UCLASS_ECDSA, this change is focused on parsing the
keys from devicetree and passing this information to the specific
UCLASS driver.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# fa3f1f1d 24-Jul-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: disable CONFIG_SPL_HEXDUMP by default

CONFIG_HEXDUMP is needed to display UEFI variables using 'printenv -e'.

Enabling CONFIG_SPL_HEXDUMP only makes sense for debugging purposes.
Hence CONFIG_SPL_HEXDUMP should not be enabled by default.

The following boards currently have CONFIG_SPL_HEXDUMP=y. This includes
boards that don't use SPL at all.

axm_defconfig
imx8mm-cl-iot-gate_defconfig
imx8mm_venice_defconfig
imxrt1020-evk_defconfig
imxrt1050-evk_defconfig
kontron_sl28_defconfig
kp_imx53_defconfig
lx2160ardb_tfa_stmm_defconfig
mt7622_rfb_defconfig
octeon_ebb7304_defconfig
octeon_nic23_defconfig
qemu_arm64_defconfig
qemu_arm_defconfig
qemu-riscv32_defconfig
qemu-riscv32_smode_defconfig
qemu-riscv64_defconfig
qemu-riscv64_smode_defconfig
qemu-x86_64_defconfig
qemu-x86_defconfig
sandbox64_defconfig
sandbox_defconfig
stm32mp15_basic_defconfig
stm32mp15_trusted_defconfig
synquacer_developerbox_defconfig
taurus_defconfig
xilinx_versal_virt_defconfig

The patch only keeps it enabled on

sandbox_spl_defconfig

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 1a46cb6c 02-Jul-2021 Simon Glass <sjg@chromium.org>

lib: Create a new Kconfig option for charset conversion

Rather than looking at two KConfig options in the Makefile, create a new
Kconfig option for compiling lib/charset.c

Enable it for UFS also, which needs this support.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 26dd9936 08-Jul-2021 Steffen Jaeckel <jaeckel-floss@eyet-services.de>

lib: add crypt subsystem

Add the basic functionality required to support the standard crypt
format.
The files crypt-sha256.c and crypt-sha512.c originate from libxcrypt and
their formatting is therefor retained.
The integration is done via a crypt_compare() function in crypt.c.

```
libxcrypt $ git describe --long --always --all
tags/v4.4.17-0-g6b110bc
```

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 7d0f3fbb 11-Jun-2021 Tero Kristo <t-kristo@ti.com>

lib: rational: copy the rational fraction lib routines from Linux

Copy the best rational approximation calculation routines from Linux.
Typical usecase for these routines is to calculate the M/N divider
values for PLLs to reach a specific clock rate.

This is based on linux kernel commit:
"lib/math/rational.c: fix possible incorrect result from rational
fractions helper"
(sha1: 323dd2c3ed0641f49e89b4e420f9eef5d3d5a881)

Signed-off-by: Tero Kristo <t-kristo@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Tero Kristo <kristo@kernel.org>

# ec0512b1 24-May-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

Revert "lib: introduce HASH_CALCULATE option"

When we think of Kconfig, we usually think of features that we like
to enable or not. Ideally, we wouldn't use Kconfig to fix a build
issue, although sometimes it might make sense. With Kconfig it's hard
to guarantee that the fix is universal. We can only say that it works
for the set of tested configurations. In the majority of cases, it's
preferable to let the linker figure things out for us.

The reverted commit attempted to fix a build issue by adding an
invisible Kconfig option. This is wrong in several ways:

It invents a new Kconfig variable when CONFIG_HASH already
exists for the same purpose.
Second, hash-checksum.c makes use of the hash_progressive_lookup_algo()
symbol, which is only provided with CONFIG_HASH, but this dependency
was not expressed in the reverted patch.

It feels like Kconfig is turning into a listing of all available
source files, and a buffet to 'select' which ones to compile. The
purpose of this revert is to enable the next change to make use of
CONFIG_HASH instead of adding to Kconfig.

This reverts commit 87316da05f2fd49d3709275e64ef0c5980366ade.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Acked-by: Masahisa Kojima <masahisa.kojima@linaro.org>

# 1621d3c4 10-May-2021 Bin Meng <bmeng.cn@gmail.com>

lib: kconfig: Limit BINMAN_FDT for OF_SEPARATE or OF_EMBED

Generally speaking BINMAN_FDT makes sense for OF_SEPARATE or OF_EMBED.
For the other OF_CONTROL methods, it's quite possible binman node is
not available as binman is invoked during the build phase instead of
runtime. Let's only turn it on for OF_SEPARATE or OF_EMBED by default.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 87316da0 13-May-2021 Masahisa Kojima <masahisa.kojima@linaro.org>

lib: introduce HASH_CALCULATE option

Build error occurs when CONFIG_EFI_SECURE_BOOT or
CONFIG_EFI_CAPSULE_AUTHENTICATE is enabled,
because hash-checksum.c is not compiled.

Since hash_calculate() implemented in hash-checksum.c can be
commonly used aside from FIT image signature verification,
this commit itroduces HASH_CALCULATE option to decide
if hash-checksum.c shall be compiled.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# e2ae483c 13-May-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

hash: Kconfig option for SHA512 hardware acceleration

Commit a479f103dc1c ("hash: Allow for SHA512 hardware implementations")
defined function definitions for hardware accelerated SHA384 and SHA512.
If CONFIG_SHA_HW_ACCEL=y, these functions are used.

We already have boards using CONFIG_SHA_HW_ACCEL=y but none implements the
new functions hw_sha384() and hw_sha512().

For implementing the EFI TCG2 protocol we need SHA384 and SHA512. The
missing hardware acceleration functions lead to build errors on boards like
peach-pi_defconfig.

Introduce a new Kconfig symbol CONFIG_SHA512_HW_ACCEL to control if the
functions hw_sha384() and hw_sha512() shall be used to implement the SHA384
and SHA512 algorithms.

Fixes: a479f103dc1c ("hash: Allow for SHA512 hardware implementations")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

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

# 6d66502b 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: Add 2 config to define the max number of regions

Add 2 configs CONFIG_LMB_MEMORY_REGIONS and CONFIG_LMB_RESERVED_REGIONS
to change independently the max number of the regions in lmb
library.

When CONFIG_LMB_USE_MAX_REGIONS=y, move the lmb property arrays to
struct lmb and manage the array size with the element 'max' of struct
lmb_region; their are still allocated in stack.

When CONFIG_LMB_USE_MAX_REGIONS=n, keep the current location in
struct lmb_region to allow compiler optimization.

Increase CONFIG_LMB_RESERVED_REGIONS is useful to avoid lmb errors in
bootm when the number of reserved regions (not adjacent) is reached:
+ 1 region for relocated U-Boot
+ 1 region for initrd
+ 1 region for relocated linux device tree
+ reserved memory regions present in Linux device tree.

The current limit of 8 regions is reached with only 5 reserved regions
in DT.

see Linux kernel commit bf23c51f1f49 ("memblock: Move memblock arrays
to static storage in memblock.c and make their size a variable")

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# 4fa0150d 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: move MAX_LMB_REGIONS value in Kconfig

Move MAX_LMB_REGIONS value in Kconfig, the max number of the regions
in lmb library.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# 77b8cfef 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: move CONFIG_LMB in Kconfig

Migrate CONFIG_LMB in Kconfig.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# a479f103 16-Feb-2021 Joel Stanley <joel@jms.id.au>

hash: Allow for SHA512 hardware implementations

Similar to support for SHA1 and SHA256, allow the use of hardware hashing
engine by enabling the algorithm and setting CONFIG_SHA_HW_ACCEL /
CONFIG_SHA_PROG_HW_ACCEL.

Signed-off-by: Joel Stanley <joel@jms.id.au>

# f2c1442e 14-Mar-2021 Simon Glass <sjg@chromium.org>

bloblist: Make BLOBLIST_TABLES depend on BLOBLIST

Add an extra condition here since we cannot put x86 tables in a bloblist
when bloblists are not supported.

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

# e0103158 25-Feb-2021 Bin Meng <bmeng.cn@gmail.com>

lib: kconfig: Mention CONFIG_ADDR_MAP limitation in the help

Mention that CONFIG_ADDR_MAP only works in the post-relocation phase.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>

# 56e7257c 03-Feb-2021 Bin Meng <bmeng.cn@gmail.com>

lib: Fix BINMAN_FDT dependency

lib/binman.c references the following 3 ofnode APIs:
ofnode_first_subnode(), ofnode_path() and ofnode_read_bool().

These APIs get built only when DM is on. Fix the dependency then.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 59e4e391 18-Jan-2021 Tom Rini <trini@konsulko.com>

Merge https://gitlab.denx.de/u-boot/custodians/u-boot-riscv

- Update qemu-riscv.rst build instructions.
- Add support for SPI on Kendryte K210.
- Add Microchip PolarFire SoC Icicle Kit support.
- Add support for an early timer.
- Select TIMER_EARLY to avoid infinite recursion for Trace.


# a80f8513 17-Jan-2021 Pragnesh Patel <pragnesh.patel@sifive.com>

trace: select TIMER_EARLY to avoid infinite recursion

When tracing functions is enabled this adds calls to
__cyg_profile_func_enter() and __cyg_profile_func_exit() to the traced
functions.

__cyg_profile_func_enter() and __cyg_profile_func_exit() invoke
timer_get_us() to record the entry and exit time.

initr_dm() will make gd->dm_root = NULL and gd->timer = NULL, so
timer_get_us() -> get_ticks() -> dm_timer_init() will lead to an
indefinite recursion.

So select TIMER_EARLY when tracing got enabled.

Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Rick Chen <rick@andestech.com>

# 6205bbb1 04-Jan-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lib: cosmetic update of CONFIG_LIB_ELF description

Change 2 typo error in CONFIG_LIB_ELF description:
- Supoort => Support
- fir => for

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c589132a 02-Dec-2020 Aswath Govindraju <a-govindraju@ti.com>

fdt: Use phandle to distinguish DT nodes with same name

While assigning the sequence number to subsystem instances by reading the
aliases property, only DT nodes names are compared and not the complete
path. This causes a problem when there are two DT nodes with same name but
have different paths.

In arch/arm/dts/k3-am65-main.dtsi there are two USB controllers with the
same device tree node name but different path. When aliases are defined for
these USB controllers then fdtdec_get_alias_seq() fails to pick the correct
instance for a given index.

fdt_path_offset() function is slow and this would effect the U-Boot
startup. To avert the time penalty on all boards, apply this extra check
only when required by using a config option.

Fix it by comparing the phandles of DT nodes after the node names match,
under a config option.

Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Fix whitespace error in Kconfig:
Signed-off-by: Simon Glass <sjg@chromium.org>

# 28cef9ca 19-Nov-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

fs: fat: create correct short names

The current function set_name() used to create short names has the
following deficiencies resolved by this patch:

* Long names (e.g. FOO.TXT) are stored even if a short name is enough.
* Short names with spaces are created, e.g. "A ~1.TXT".
* Short names with illegal characters are created, e.g. "FOO++BAR".
* Debug output does not not consider that the short file name has no
concluding '\0'.

The solution for the following bug is split of into a separate patch:

* Short file names must be unique.

This patch only provides the loop over possible short file names.

Fixes: c30a15e590c ("FAT: Add FAT write feature")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# e4f8e543 05-Nov-2020 Simon Glass <sjg@chromium.org>

smbios: Drop the unused Kconfig options

Now that we can use devicetree to specify this information, drop the old
CONFIG options.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 44c74bdd 05-Nov-2020 Simon Glass <sjg@chromium.org>

sysinfo: Provide a default driver to set SMBIOS values

Some boards want to specify the manufacturer or product name but do not
need to have their own sysinfo driver.

Add a default driver which provides a way to specify this SMBIOS
information in the devicetree, without needing any board-specific
functionality.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d2cb7a22 04-Nov-2020 Simon Glass <sjg@chromium.org>

x86: Allow putting some tables in the bloblist

At present all tables are placed starting at address f0000 in memory, and
can be up to 64KB in size. If the tables are very large, this may not
provide enough space.

Also if the tables point to other tables (such as console log or a ramoops
area) then we must allocate other memory anyway.

The bloblist is a nice place to put these tables since it is contiguous,
which makes it easy to reserve this memory for linux using the 820 tables.

Add an option to put some of the tables in the bloblist. For SMBIOS and
ACPI, create suitable pointers from the f0000 region to the new location
of the tables.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
[bmeng: squashed in http://patchwork.ozlabs.org/project/uboot/patch/
20201105062407.1.I8091ad931cbbb5e3b6f6ababdf3f8d5db0d17bb9@changeid/]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# 415eab06 03-Nov-2020 Christian Gmeiner <christian.gmeiner@gmail.com>

smbios: add parsing API

Add a very simple API to be able to access SMBIOS strings
like vendor, model and bios version.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 72eda507 27-Oct-2020 Sean Anderson <seanga2@gmail.com>

lib: Add getopt

Some commands can get very unweildy if they have too many positional
arguments. Adding options makes them easier to read, remember, and
understand.

This implementation of getopt has been taken from barebox, which has had
option support for quite a while. I have made a few modifications to their
version, such as the removal of opterr in favor of a separate getopt_silent
function. In addition, I have moved all global variables into struct
getopt_context.

The getopt from barebox also re-orders the arguments passed to it so that
non-options are placed last. This allows users to specify options anywhere.
For example, `ls -l foo/ -R` would be re-ordered to `ls -l -R foo/` as
getopt parsed the options. However, this feature conflicts with the const
argv in cmd_tbl->cmd. This was originally added in 54841ab50c ("Make sure
that argv[] argument pointers are not modified."). The reason stated in
that commit is that hush requires argv to stay unmodified. Has this
situation changed? Barebox also uses hush, and does not have this problem.
Perhaps we could use their fix?

I have assigned maintenance of getopt to Simon Glass, as it is currently
only used by the log command. I would also be fine maintaining it.

Signed-off-by: Sean Anderson <seanga2@gmail.com>

# 26637e2e 12-Sep-2020 Simon Glass <sjg@chromium.org>

lib: Allow hexdump to be used in SPL

It is sometimes useful to output hex dumps in SPL. Add a config option to
allow this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# e87dfb05 05-Aug-2020 Andrii Anisov <andrii_anisov@epam.com>

lib: sscanf: add sscanf implementation

Port sscanf implementation from mini-os and introduce new
Kconfig option to enable it: CONFIG_SSCANF. Disable by default.

Signed-off-by: Andrii Anisov <andrii_anisov@epam.com>
Signed-off-by: Anastasiia Lukianenko <anastasiia_lukianenko@epam.com>
Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>

# 81014f73 30-Jul-2020 Joao Marcos Costa <joaomarcos.costa@bootlin.com>

include/u-boot, lib/zlib: add sources for zlib decompression

Add zlib (v1.2.11) uncompr() function to U-Boot. SquashFS depends on
this function to decompress data from a raw disk image. The actual
support for zlib into SquashFS sources will be added in a follow-up
commit.

Signed-off-by: Joao Marcos Costa <joaomarcos.costa@bootlin.com>

# 69be8fd1 03-Jun-2020 Marek Szyprowski <m.szyprowski@samsung.com>

powerpc: move ADDR_MAP to Kconfig

Move ADDR_MAP related config options from include/configs/*.h to the
proper place in lib/Kconfig. This has been done using
./tools/moveconfig.py and manual inspection of the generated changes.
This is a preparation to use ADDR_MAP helper on ARM 32bit Raspberry Pi4
board for mapping the PCIe XHCI MMIO, which is above the 4GiB identity
mapping limit.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# d16b38f4 15-Apr-2020 Reuben Dowle <reubendowle0@gmail.com>

Add support for SHA384 and SHA512

The current recommendation for best security practice from the US government
is to use SHA384 for TOP SECRET [1].

This patch adds support for SHA384 and SHA512 in the hash command, and also
allows FIT images to be hashed with these algorithms, and signed with
sha384,rsaXXXX and sha512,rsaXXXX

The SHA implementation is adapted from the linux kernel implementation.

[1] Commercial National Security Algorithm Suite
http://www.iad.gov/iad/programs/iad-initiatives/cnsa-suite.cfm

Signed-off-by: Reuben Dowle <reuben.dowle@4rf.com>

# 43e442a5 26-May-2020 Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

kconfig: fix some typos

Signed-off-by: Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

# eff5a547 22-May-2020 Michael Walle <michael@walle.cc>

cmd: zip: automatically pull in gzip()

Move the CONFIG_GZIP_COMPRESSED from a config.h macro to a Kconfig menu
item. It is not selectable by a user because there is no reason to do
so. Instead it will be automatically selected by the stuff which uses
gzip(), like the zip command.

Remove it from the config_whitelist.txt. Also remove
CONFIG_GZIP_COMPRESS_DEF_SZ as this was never used on any board. The
default seems to be sane, otherwise it should be added as a Kconfig
option.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8239be61 06-May-2020 Simon Glass <sjg@chromium.org>

lib: Allow MD5 to be enabled in SPL

At present the MD5 option cannot be enabled by board configs since it has
no Kconfig name. It is generally enabled, so long as FIT support is
present. But not all boards use FIT, particularly in SPL

Fix this and add an option for SPL as well. This allows board code to call
md5() even if FIT support is not enabled.

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

# 04cb3994 21-Apr-2020 Weijie Gao <weijie.gao@mediatek.com>

lib: enable lzma decompression support for SPL build

This patch enables LZMA decompression support for SPL build

Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>

# 2a2119e1 05-Mar-2020 Atish Patra <atishp@atishpatra.org>

lib: kconfig: Add option to set BZIP2 compression method

There is no way to select BZIP2 compression method.
Add it under library/compression config where all other
compression related configs are present.

Signed-off-by: Atish Patra <atish.patra@wdc.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 805b3cac 12-Feb-2020 Keerthy <j-keerthy@ti.com>

lib: elf: Move the generic elf loading/validating functions to lib

Move the generic elf loading/validating functions to lib/
so that they can be re-used and accessed by code existing
outside cmd.

While at it remove the duplicate static version of load_elf_image_phdr
under arch/arm/mach-imx/imx_bootaux.c.

Signed-off-by: Keerthy <j-keerthy@ti.com>
Suggested-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>

# 1611235b 19-Jan-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: Kconfig dependencies for pseudo-random library

drivers/rng/sandbox_rng.c requires rand() to be defined but configuration
option CONFIG_CONFIG_LIB_RAND selected in drivers/rng/Kconfig does not
exist.

test/lib/test_aes.c requires rand() to be defined.

Fix the selection criteria for choice "Pseudo-random library support type".

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 3c10dc95 06-Dec-2019 Simon Glass <sjg@chromium.org>

binman: Add a library to access binman entries

SPL and TPL can access information about binman entries using link-time
symbols but this is not available in U-Boot proper. Of course it could be
made available, but the intention is to just read the device tree.

Add support for this, so that U-Boot can locate entries.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# b4adf627 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: crypto: add x509 parser

Imported from linux kernel v5.3:
x509.asn1 without changes
x509_akid.asn1 without changes
x509_parser.h without changes
x509_cert_parser.c with changes marked as __UBOOT__
x509_public_key.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# a9b45e6e 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add oid registry utility

Imported from linux kernel v5.3:
build_OID_registry without changes
oid_registry.h without changes
oid_registry.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# ab8a0e06 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add asn1 decoder

Imported from linux kernel v5.3:
lib/asn1_decoder.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 2b12196d 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

cmd: add asn1_compiler

Imported from linux kernel v5.3:
asn1.h without changes
asn1_ber_bytecode.h without changes
asn1_decoder.h without changes
asn1_compiler.c without changes

This host command will be used to create a ASN1 parser, for example,
for pkcs7 messages or x509 certificates. More specifically, it will
generate *byte code* which will be interpreted by asn1 decoder library.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 05429b6c 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

rtc: move date.c from drivers/rtc/ to lib/

In the next commit, rtc_mktime(), for compatibility with linux, will be
implemented using rtc_mktime(), which is no longer drivers/rtc specific.
So move this file under lib/.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 37ef1774 10-Nov-2019 Thomas Hebb <tommyhebb@gmail.com>

Kconfig: disambiguate config names for tiny printf

27084c03d36a ("spl: Allow tiny printf() to be controlled in SPL and
TPL") split this option in two for TPL and SPL, but didn't change the
Kconfig names, making them hard to set quickly.

Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>

# 0d76afc0 27-Oct-2019 Simon Glass <sjg@chromium.org>

fdt: Add Kconfig options to control code size

For better or worse libfdt recent grew a lot of code that checks the
validity of the device tree in great detail. When using unsigned or
unverified data this makes things safer, but it does add to code size.

Add some controls to select the trade-off between safety and code size.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 27084c03 25-Sep-2019 Simon Glass <sjg@chromium.org>

spl: Allow tiny printf() to be controlled in SPL and TPL

At present there is only one control for this and it is used for both SPL
and TPL. But SPL might have a lot more space than TPL so the extra cost of
a full printf() might be acceptable.

Split the option into two, providing separate SPL and TPL controls. The
TPL setting defaults to the same as SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2a51e16b 07-Jun-2019 Tom Rini <trini@konsulko.com>

configs: Make USE_TINY_PRINTF depend on SPL||TPL and be default

The USE_TINY_PRINTF symbol only changes things within SPL and TPL
builds, so make it depend on that support. Next, make it default as
within these cases we should rarely have need of more advanced print
formats outside of the debug context.

To do this, in a few cases we need to correct our Kconfig dependencies
as we had cases of non-SPL targets select'ing this symbol. Finally, in
the case of a few boards we really do need the full printf
functionality.

Signed-off-by: Tom Rini <trini@konsulko.com>

# da0fb5fd 02-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: make call depth limit customizable

Up to now we had hard coded values for the call depth up to which trace
records are created: 200 for early tracing, 15 thereafter. UEFI
applications reach a call depth of 80 or above.

Provide customizing settings for the call trace depth limit and the early
call trace depth limit. Use the old values as defaults.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8509f22a 29-Apr-2019 Marek Behún <marek.behun@nic.cz>

lib: add Zstandard decompression support

Add the zstd library from Linux kernel (only decompression support).
There are minimal changes to build with U-Boot, otherwise the files are
identical to Linux commit dc35da16 from March 2018, the files had not
been touched since in kernel. Also SPDX lincese tags were added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 83a486b6 29-Apr-2019 Marek Behún <marek.behun@nic.cz>

lib: Add xxhash support

This adds the xxhash support from Linux. Files are almost identical to
those added to Linux in commit 5d240522 ("lib: Add xxhash module") (they
haven't been touched since in Linux). The only difference is to add some
includes to be compatible with U-Boot. Also SPDX lincese tags were
added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 5132361a 29-Apr-2019 Heiko Schocher <hs@denx.de>

lib: Kconfig: fix help text for GZIP

commit 95f4bbd581cf ("lib: fdt: Allow LZO and GZIP DT compression in U-Boot")

introduced Kconfig option for gzip in U-Boot, but help text
says gzip for SPL, which is wrong. Fix this.

Signed-off-by: Heiko Schocher <hs@denx.de>
Acked-by: Marek Vasut <marex@denx.de>

# 1c6eb075 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE_BUFFER_SIZE et al to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE_BUFFER_SIZE
CONFIG_TRACE_EARLY_SIZE
CONFIG_TRACE_EARLY
CONFIG_TRACE_EARLY_ADDR

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

# a24a78d7 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE

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

# 54969b40 21-Mar-2019 Thierry Reding <treding@nvidia.com>

fdtdec: Add Kconfig symbol for tests

Runtime tests are provided as a test_fdtdec command implementation. Add
a Kconfig symbol that allows this command to be built so that the tests
can be used.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 95f4bbd5 08-Mar-2019 Marek Vasut <marex@denx.de>

lib: fdt: Allow LZO and GZIP DT compression in U-Boot

Add required Kconfig symbols, Makefile bits and macro fixes in a
few places to support LZO and DT compression in U-Boot. This can
save a lot of space with multi-DTB fitImages.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>

# 6e705114 13-Jan-2019 Chris Packham <judge.packham@gmail.com>

lib: Kconfig: spelling fixes

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 048c6e89 06-Nov-2018 Simon Glass <sjg@chromium.org>

spl: lz4: Allow use of lz4 compression in SPL

In some cases U-Boot is compressed and it is useful to be able to
decompress it in SPL. Add a Kconfig and Makefile change to allow this.
Note that this does not actually implement decompression.

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

# 2895c4b7 15-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

kconfig: Introduce HAVE_ARCH_IOMAP

Introduce a new Kconfig option for architecture codes to control
whether it provides io{read,write}{8,16,32} I/O accessor functions.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5592a633 01-Oct-2018 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt in TPL

In some cases (e.g. sandbox with verified boot) it is useful to support
libfdt in TPL. Update the Kconfig to handle this.

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

# 6307896c 01-Oct-2018 Simon Glass <sjg@chromium.org>

tpm: Add support for SPL and TPL

At present the tpm can only be used in U-Boot proper. Updated it to work
in SPL and TPL also.

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

# ab948cd2 19-Jul-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

fdt_support: make FDT_FIXUP_PARTITIONS depend on CMD_MTDPARTS

fdt_fixup_mtdparts() calls mtdparts_init() and device_find(),
which are defined in cmd/mtdparts.c

The combination of FDT_FIXUP_PARTITIONS=y and CMD_MTDPARTS=n
emits the following link error:

common/fdt_support.c:903: undefined reference to `mtdparts_init'
common/fdt_support.c:914: undefined reference to `device_find'

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 3330584d 03-Jun-2018 Igor Opaniuk <igor.opaniuk@gmail.com>

avb2.0: integrate avb 2.0 into the build system

Integrate libavb into the build system. Introduce CONFIG_LIBAVB
build option.

Signed-off-by: Igor Opaniuk <igor.opaniuk@linaro.org>

# f8c987f8 05-Jun-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

lib: Add hexdump

Often during debugging session it's very interesting to see
what data we were dealing with. For example what we write or read
to/from memory or peripherals.

This change introduces functions that allow to dump binary
data with one simple function invocation like:
------------------->8----------------
print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, buf, len);
------------------->8----------------

which gives us the following:
------------------->8----------------
00000000: f2 b7 c9 88 62 61 75 64 72 61 74 65 3d 31 31 35 ....baudrate=115
00000010: 32 30 30 00 62 6f 6f 74 61 72 67 73 3d 63 6f 6e 200.bootargs=con
00000020: 73 6f 6c 65 3d 74 74 79 53 33 2c 31 31 35 32 30 sole=ttyS3,11520
00000030: 30 6e 38 00 62 6f 6f 74 64 65 6c 61 79 3d 33 00 0n8.bootdelay=3.
00000040: 62 6f 6f 74 66 69 6c 65 3d 75 49 6d 61 67 65 00 bootfile=uImage.
00000050: 66 64 74 63 6f 6e 74 72 6f 6c 61 64 64 72 3d 39 fdtcontroladdr=9
00000060: 66 66 62 31 62 61 30 00 6c 6f 61 64 61 64 64 72 ffb1ba0.loadaddr
00000070: 3d 30 78 38 32 30 30 30 30 30 30 00 73 74 64 65 =0x82000000.stde
00000080: 72 72 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 rr=serial0@e0022
00000090: 30 30 30 00 73 74 64 69 6e 3d 73 65 72 69 61 6c 000.stdin=serial
000000a0: 30 40 65 30 30 32 32 30 30 30 00 73 74 64 6f 75 0@e0022000.stdou
000000b0: 74 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 30 t=serial0@e00220
000000c0: 30 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00..............
...
------------------->8----------------

Source of hexdump.c was copied from Linux kernel v4.7-rc2.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Mario Six <mario.six@gdsys.cc>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Stefan Roese <sr@denx.de>

# c232d14d 29-May-2018 Alex Kiernan <alex.kiernan@gmail.com>

mmc: Separate "mmc swrite" from fastboot

Introduce CONFIG_IMAGE_SPARSE and CONFIG_CMD_MMC_SWRITE so the "mmc
swrite" command is separated from the fastboot code.

Move image-sparse from common to lib so it's clear it's library code.

Rename CONFIG_FASTBOOT_FLASH_FILLBUF_SIZE to CONFIG_IMAGE_SPARSE_FILLBUF_SIZE
and migrate it to Kconfig.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Acked-by: Jassi Brar <jaswinder.singh@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6417572e 08-May-2018 Tom Rini <trini@konsulko.com>

lib/Kconfig: Mark OF_LIBFDT_OVERLAY as depending on OF_LIBFDT

The overlay code is only useful when OF_LIBFDT is set, so mark it as
depending on that first.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 58a46f88 25-Apr-2018 Praneeth Bajjuri <praneeth@ti.com>

configs: TI: Enable FIT Library overlay support

Enable the FDT library overlay support for all TI SOC family.

Without this option, when Loading fdt from FIT image, the
following warning is seen.

"config with overlays but CONFIG_OF_LIBFDT_OVERLAY not set".

Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
Suggested-by: Andrew F.Davis <afd@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>

# 14ad44ab 18-Apr-2018 Alex Kiernan <alex.kiernan@gmail.com>

spl: Split sprintf, strto* from SPL serial in Kconfig

When SPL serial is disabled, callers who need sprintf or strtoul fail
because their inclusion is guarded by CONFIG_SPL_SERIAL_SUPPORT/
CONFIG_TPL_SERIAL_SUPPORT.

Split printf, sprintf and strto into their own entries and then select
all of them if SERIAL_SUPPORT is enabled to match the current behaviour.

Include panic.o unconditionally as it can be called from anywhere which
uses BUG_ON().

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>

# e294ba06 04-Apr-2018 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-sunxi

Signed-off-by: Tom Rini <trini@konsulko.com>


# d14db11d 03-Apr-2018 Andre Przywara <andre.przywara@arm.com>

sunxi: revert disabling of features

In January some commits were introduced to mitigate the U-Boot image
size issues we encountered on sunxi builds.
Now with the MMC environment removed we can bring them back, as we
practically don't have a size limit anymore.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 32ce6179 13-Mar-2018 Bryan O'Donoghue <bryan.odonoghue@linaro.org>

optee: Add lib entries for sharing OPTEE code across ports

This patch adds code to lib to enable sharing of useful OPTEE code between
board-ports and architectures. The code on lib/optee/optee.c comes from the
TI omap2 port. Eventually the OMAP2 code will be patched to include the
shared code. The intention here is to add more useful OPTEE specific code
as more functionality gets added.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Cc: Harinarayan Bhatta <harinarayan@ti.com>
Cc: Andrew F. Davis <afd@ti.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Kever Yang <kever.yang@rock-chips.com>
Cc: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Cc: Peng Fan <peng.fan@nxp.com>
Tested-by: Peng Fan <peng.fan@nxp.com>

# 36c1877c 06-Feb-2018 Faiz Abbas <faiz_abbas@ti.com>

lib: Kconfig: Move DYNAMIC_CRC_TABLE to Kconfig

Add CONFIG prefix to DYNAMIC_CRC_TABLE and implement it in
Kconfig.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>

# a451bc27 05-Feb-2018 Adam Ford <aford173@gmail.com>

Convert LIB_UUID to Kconfig

config_fallback.h has some logic that checks a variety of options
and selects LIB_UUID if it hasn't already been selected. This
will all LIB_UUID in Kconfig and select this option for the list
of options to allow us to remove the logic from fallbacks

Signed-off-by: Adam Ford <aford173@gmail.com>

# a5a37567 06-Feb-2018 Adam Ford <aford173@gmail.com>

Convert CONFIG LIB_HW_RAND to Kconfig

config_fallbacks.h had some logic to automatically select
LIB_RAND if RANDOM_UUID or CMD_UUID were set if LIB_HW_RAND wasn't
already selected. By migrating LIB_HW_RAND to Kconfig, we can
remove this check from config_fallbacks.h and put it into Kconfig

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
[trini: Turn into a choice, add NET_RANDOM_ETHADDR]
Signed-off-by: Tom Rini <trini@konsulko.com>

# acd4d334 16-Jan-2018 Maxime Ripard <maxime.ripard@free-electrons.com>

net: regex: Disable by default on sunXi

The sunXi arm64 build has overflown, leading to the main U-boot binary
overwriting the environment when flashing the new image, or even worse,
overwriting itself when we're calling saveenv.

Disable this option that is not critical until we can adress the issue
properly.

Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 7e3caa81 03-Dec-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

Move CONFIG_PANIC_HANG to Kconfig

Freescale (NXP) boards have lots of defconfig files per board.
I used "imply PANIC_HANG" for them.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# da5337a6 08-Nov-2017 Nandor Han <nandor.han@ge.com>

rtc: add support for s35392a

Add support for S35392A RTC. The driver supports both U-Boot driver
models.

Signed-off-by: Nandor Han <nandor.han@ge.com>
Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
Cc: Heiko Schocher <hs@denx.de>

# f52bdf4b 14-Sep-2017 Jean-Jacques Hiblot <jjhiblot@ti.com>

lib: allow building lzo for the SPL

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 85d8bf57 03-Sep-2017 Marek Behún <marek.behun@nic.cz>

lib: Add CRC32-C

This is needed for BTRFS.

Signed-off-by: Marek Behun <marek.behun@nic.cz>

create mode 100644 lib/crc32c.c

# 7264f292 15-Aug-2017 York Sun <york.sun@nxp.com>

spl: fit: Eanble GZIP support for image decompression

Add Kconfig option SPL_GZIP and SPL_ZLIB to enable gunzip support for
SPL boot, eg. falcon boot compressed kernel image.

Signed-off-by: York Sun <york.sun@nxp.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6ef2f901 11-Aug-2017 Adam Ford <aford173@gmail.com>

Convert CONFIG_BCH to Kconfig

This converts the following to Kconfig:
CONFIG_BCH

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1a7ba1d 18-Aug-2017 Anatolij Gustschin <agust@denx.de>

Fix 'notes' typos

s/notes/nodes

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 96b9082c 03-Aug-2017 Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

rockchip: rk3188: rock: adjust for SPL/TPL split

With the changes to split SPL/TPL for the RK3368, I apparently missed
some needed adjustments to the RK3188 Kconfig and rock_defconfig.

This fixes build-issues for the rock board after applying the RK3368
enablement (and SPL/TPL) set that resulted from TPL_SERIAL_SUPPORT,
TPL_ROCKCHIP_BACK_TO_BROM and TPL_TINY_MEMSET being separate symbols
now.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d56b4b19 22-Jul-2017 Tom Rini <trini@konsulko.com>

configs: Migrate RBTREE, LZO, CMD_MTDPARTS, CMD_UBI and CMD_UBIFS

The above CONFIG options are in Kconfig, and now have correct depends and
inter-dependencies. Migrate these to configs/ from include/configs/. In the
case of CMD_UBIFS also change it to be a default y if CMD_UBI.

Signed-off-by: Tom Rini <trini@konsulko.com>

# aed998aa 17-May-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_LZMA to Kconfig

This converts the following to Kconfig:
CONFIG_LZMA

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

# b1a873df 26-Apr-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_CMD_AES et al to Kconfig

This converts the following to Kconfig:
CONFIG_CMD_AES
CONFIG_AES

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Add select AES to CMD_AES]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 173aafbf 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

cmd: Expose a Kconfig option to enable UBIFS commands

Create a new Kconfig entry to allow CMD_UBIFS selection from Kconfig and
add an hidden LZO option that can be selected by CMD_UBIFS.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>

# aa049152 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

mtd: ubi: Select RBTREE option from MTD_UBI Kconfig entry

Expose the RBTREE feature through Kconfig and select this option from the
MTD_UBI option.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>
[Rebased on master]
Signed-off-by: Jagan Teki <jagan@openedev.com>

# ab4458bd 02-Apr-2017 Simon Glass <sjg@chromium.org>

string: Provide a slimmed-down memset()

Most of the time the optimised memset() is what we want. For extreme
situations such as TPL it may be too large. For example on the 'rock'
board, using a simple loop saves a useful 48 bytes. With gcc 4.9 and
the rodata bug, this patch is enough to reduce the TPL image below the
limit.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>

# bea79d7d 14-Mar-2017 Andre Przywara <andre.przywara@arm.com>

Kconfig: introduce md5sum command selection

So far CONFIG_MD5SUM would need to be set by a board's include file.
Since the command is really generic, move it over to Kconfig to allow
it to be defined by either a board's defconfig, menuconfig or some
config snippet merged via mergeconfig.sh.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e663b350 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

smbios: Expose in efi_loader as table

We can pass SMBIOS easily as EFI configuration table to an EFI payload. This
patch adds enablement for that case.

While at it, we also enable SMBIOS generation for ARM systems, since they support
EFI_LOADER.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4b6dddc2 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

x86: Move smbios generation into arch independent directory

We will need the SMBIOS generation function on ARM as well going forward,
so let's move it into a non arch specific location.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# ebf7fff2 05-Oct-2016 Heiko Schocher <hs@denx.de>

spl: move FDT_FIXUP_PARTITIONS to Kconfig

Move FDT_FIXUP_PARTITIONS to Kconfig and cleanup existing
uses.

Signed-off-by: Heiko Schocher <hs@denx.de>

# ddf67f71 05-Jul-2016 Maxime Ripard <maxime.ripard@free-electrons.com>

libfdt: Add overlay application function

The device tree overlays are a good way to deal with user-modifyable
boards or boards with some kind of an expansion mechanism where we can
easily plug new board in (like the BBB, the Raspberry Pi or the CHIP).

Add a new function to merge overlays with a base device tree.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>

# 91b86e21 26-May-2016 Marek Vasut <marex@denx.de>

lib: Enable private libgcc by default

This patch decouples U-Boot binary from the toolchain on systems where
private libgcc is available. Instead of pulling in functions provided
by the libgcc from the toolchain, U-Boot will use it's own set of libgcc
functions. These functions are usually imported from Linux kernel, which
also uses it's own libgcc functions instead of the ones provided by the
toolchain.

This patch solves a rather common problem. The toolchain can usually
generate code for many variants of target architecture and often even
different endianness. The libgcc on the other hand is usually compiled
for one particular configuration and the functions provided by it may
or may not be suited for use in U-Boot. This can manifest in two ways,
either the U-Boot fails to compile altogether and linker will complain
or, in the much worse case, the resulting U-Boot will build, but will
misbehave in very subtle and hard to debug ways.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 67976306 30-Mar-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

cosmetic: Fix typos "privide"

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# ed980b8c 03-Mar-2016 Alexander Graf <agraf@csgraf.de>

efi_loader: hook up in build environment

Now that we have all the bits and pieces ready for EFI payload loading
support, hook them up in Makefiles and KConfigs so that we can build.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
[trini: Enable only when we of OF_LIBFDT, disable on kwb and colibri_pxa270]
Signed-off-by: Tom Rini <trini@konsulko.com>

# aa34fbc0 22-Feb-2016 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt to be used in SPL

Add an option to enable libfdt in SPL. This can be useful when decoding
FIT files in SPL.

We need to make sure this option is not enabled in SPL by this change.
Also this option needs to be enabled in host builds. Si add a new
IMAGE_USE_LIBFDT #define which can be used in files that are built on the
host but must also build for U-Boot and SPL.

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

# 69e173eb 22-Feb-2016 Simon Glass <sjg@chromium.org>

Move CONFIG_OF_LIBFDT to Kconfig

Move this option to Kconfig and tidy up existing boards.

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

# a187559e 05-Feb-2016 Bin Meng <bmeng.cn@gmail.com>

Use correct spelling of "U-Boot"

Correct spelling of "U-Boot" shall be used in all written text
(documentation, comments in source files etc.).

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Minkyu Kang <mk7.kang@samsung.com>

# 947c626d 14-Jan-2016 Tom Rini <trini@konsulko.com>

vsprintf.c: Always enable CONFIG_SYS_VSNPRINTF

Enabling this function always removes some class of string saftey issues.
The size change here in general is about 400 bytes and this seems a reasonable
trade-off.

Cc: Peng Fan <peng.fan@nxp.com>
Cc: Peter Robinson <pbrobinson@gmail.com>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Adrian Alonso <aalonso@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 7d9cde10 22-Nov-2015 Stefan Roese <sr@denx.de>

lib/tiny-printf.c: Add tiny printf function for space limited environments

This patch adds a small printf() version that supports all basic formats.
Its intented to be used in U-Boot SPL versions on platforms with very
limited internal RAM sizes.

To enable it, just define CONFIG_USE_TINY_PRINTF in your defconfig. This
will result in the SPL using this tiny function and the main U-Boot
still using the full-blown printf() function.

This code was copied from:
http://www.sparetimelabs.com/printfrevisited
With mostly only coding style related changes so that its checkpatch
clean.

The size reduction is about 2.5KiB. Here a comparison for the db-mv784mp-gp
(Marvell AXP) SPL:

Without this patch:
58963 18536 1928 79427 13643 ./spl/u-boot-spl

With this patch:
56542 18536 1956 77034 12cea ./spl/u-boot-spl

Note:
To make it possible to compile tiny-printf.c instead of vsprintf.c when
CONFIG_USE_TINY_PRINTF is defined, the functions printf() and vprintf() are
moved from common/console.c into vsprintf.c in this patch.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>

# 2419cd16 03-Oct-2015 Simon Glass <sjg@chromium.org>

dm: tpm: Drop CONFIG_DM_TPM

Now that all TPM drivers use driver model, we can drop the special driver
model CONFIG option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>

# 027b728d 06-Oct-2015 Julius Werner <jwerner@chromium.org>

Add support for LZ4 decompression algorithm

This patch adds support for LZ4-compressed FIT image contents. This
algorithm has a slightly worse compression ration than LZO while being
nearly twice as fast to decompress. When loading images from a fast
storage medium this usually results in a boot time win.

Sandbox-tested only since I don't have a U-Boot development system set
up right now. The code was imported unchanged from coreboot where it's
proven to work, though. I'm mostly interested in getting this recognized
by mkImage for use in a downstream project.

Signed-off-by: Julius Werner <jwerner@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# a7d660bc 22-Aug-2015 Simon Glass <sjg@chromium.org>

tpm: Add Kconfig options for TPMs

Add new Kconfig options for TPMs in preparation for moving boards to use
Kconfig for TPM configuration.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 867a6ac8 31-Jul-2015 Simon Glass <sjg@chromium.org>

efi: Add start-up library code

When running as an EFI application, U-Boot must request memory from EFI,
and provide access to the boot services U-Boot needs.

Add library code to perform these tasks. This includes efi_main() which is
the entry point from EFI. U-Boot is built as a shared library.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d1389403 23-Jun-2015 Simon Glass <sjg@chromium.org>

Add a dhrystone benchmark command

Drystone provides a convenient sanity check that the CPU is running at full
speed. Add this as a command which can be enabled as needed.

Note: I investigated using Coremark for this but there was a license
agreement and I could not work out if it was GPL-compatible.

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

# f7848d90 22-Jun-2015 Joe Hershberger <joe.hershberger@ni.com>

Allow CONFIG_REGEX to be disabled when CONFIG_NET

Instead of selecting REGEX when NET is enabled, make it the default, but
allow boards that are tiny to disable it and lose functionality on all
but the first Ethernet adapter.

cm-bf548, bf538f-ezkit, and bf533-stamp need this. None appear to have
more than one Ethernet interface.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# 3850dbe8 11-Jun-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

blackfin: fix undefined reference to srand and rand

Commit 9ba9e85f3f1c (net: Fix NET_RANDOM_ETHADDR dependencies)
accidentally dropped CONFIG_LIB_RAND defines for 14 Blackfin boards.

Prior to that commit, those boards defined CONFIG_LIB_RAND, but not
CONFIG_NET_RANDOM_ETHADDR. So, commit 9ba9e85f3f1c should not have
touched them, but in fact it ripped CONFIG_LIB_RAND off from all the
header files, which caused undefined reference to srand and rand.
CONFIG_LIB_RAND=y must be revived for such boards.

BTW, this commit indeed makes it better, but even with this fix,
three boards (bf533-stamp, bf538f-ezkit, cm-bf548) still can not
build due to region 'ram' overflowed error. This was cause by
commit 6eed3786c68c (net: Move the CMD_NET config to defconfigs)
because CMD_NET selects NET, and NET selects REGEX. Eventually,
some boards were newly enabled with CONFIG_REGEX, increasing the
memory footprint. A patch is expected to fix the build error.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 9ba9e85f 25-May-2015 Michal Simek <michal.simek@amd.com>

net: Fix NET_RANDOM_ETHADDR dependencies

NET_RANDOM_ETHADDR depends on lib/rand.c. This patch adds dependency to
Kconfig to ensure that library is also compiled.

Remove the definitions from Blackfin boards' include/configs.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 6501ff62 20-Apr-2015 Przemyslaw Marczak <p.marczak@samsung.com>

lib: Kconfig: add entry for errno_str() function

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1a60650c 21-Apr-2015 Joe Hershberger <joe.hershberger@ni.com>

kconfig: Move REGEX to Kconfig

Having this as a Kconfig allows it to be a dependent feature.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8156345d 06-Mar-2015 Simon Glass <sjg@chromium.org>

sandbox: Move CONFIG_SYS_VSNPRINTF to Kconfig

Move this over to Kconfig and tidy up.

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

# 94e3c8c4 19-Feb-2015 gaurav rana <gaurav.rana@freescale.com>

crypto/fsl - Add progressive hashing support using hardware acceleration.

Currently only normal hashing is supported using hardware acceleration.
Added support for progressive hashing using hardware.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
Signed-off-by: Gaurav Rana <gaurav.rana@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>

# d9f23c7f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

lib/rsa: Add Kconfig for devices supporting RSA Modular Exponentiation

Kconfig option added for devices which support RSA Verification.
1. RSA_SOFTWARE_EXP
Enables driver for supporting RSA Modular Exponentiation in Software
2. RSA_FREESCALE_EXP
Enables driver for supporting RSA Modular Exponentiation using Freescale specific
driver

The above drivers use RSA uclass

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
(Removed duplicate line in Kconfig comment)

Change-Id: I7663c4d5350e2bfc3dfa2696f70ef777d6ccc6f6

# c4beb22f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

FIT: Modify option FIT_SIGNATURE in Kconfig

For FIT signature based approach to work, RSA library needs to be selected.
The FIT_SIGNATURE option in Kconfig is modified to automatically select RSA.
Selecting RSA compiles the RSA library required for image verification.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 45ccec8f 23-Oct-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

kconfig: move CONFIG_USE_PRIVATE_LIBGCC to Kconfig

The private libgcc is supported only on ARM, MIPS, PowerPC, SH, x86.
Those architectures should "select" HAVE_PRIVATE_LIBGCC and
CONFIG_USE_PRIVATE_LIBGCC should depend on it.

Currently, this option is enabled on Tegra boards and x86 architecture.
Move the definition from header files to Kconfig.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Tested-by: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: Tom Warren <twarren@nvidia.com>

# 8c688bc4 23-Oct-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

kconfig: move CONFIG_SYS_HZ to lib/Kconfig

CONFIG_SYS_HZ is always defined as 1000 in config_fallbacks.h
(but some boards still have redundant definitions).

This commit moves the definition and the document in README to
Kconfig. Since lib/Kconfig can assure that CONFIG_SYS_HZ is 1000,
the sanity check in lib/time.c should be removed.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Reviewed-by: Marek Vasut <marex@denx.de>

# b0928da6 16-Sep-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

kconfig: move CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED to Kconfig

If this option is enabled, the objects under lib/ directory
are compiled with speed optimization, not size optimization.
(Currently, only used by some Blackfin boards.)

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# ed36323f 16-Sep-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

kconfig: add blank Kconfig files

This would be useful to start moving various config options.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# d30924f1 01-May-2022 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: fix selection of CONFIG_CHARSET

lib/charset.c is not optional for
EFI_APP || EFI_LOADER || UFS || UT_UNICODE.
These must select CONFIG_CHARSET.

Fixes: 726cd9836db0 ("efi: Make unicode printf available to the app")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>

# 747093dd 30-Apr-2022 Simon Glass <sjg@chromium.org>

vpl: Add Kconfig options for VPL

Add VPL versions of commonly used Kconfig options.

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

# 11232139 06-Apr-2022 Tom Rini <trini@konsulko.com>

nds32: Remove the architecture

As removal of nds32 has been ack'd for the Linux kernel, remove support
here as well.

Cc: Rick Chen <rick@andestech.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Rick Chen <rick@andestech.com>

# fd210fee 28-Mar-2022 Philippe Reynes <philippe.reynes@softathome.com>

lib: allow to build asn1 decoder and oid registry in SPL

This commit adds the options:
- SPL_ASN1_DECODER
- SPL_OID_REGISTRY

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>

# 7d44a985 28-Mar-2022 Philippe Reynes <philippe.reynes@softathome.com>

lib: Kconfig: enhance the help of OID_REGISTRY

Enhance the help for the config OID_REGISTRY.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>

# a0e71d96 28-Mar-2022 Philippe Reynes <philippe.reynes@softathome.com>

lib: Kconfig: enhance help for ASN1

Enhance the help for configs ASN1_COMPILER
and ASN1_decoder.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>

# 761a1786 27-Jan-2022 Tom Rini <trini@konsulko.com>

Merge tag 'dm-pull-26jan22' of https://source.denx.de/u-boot/custodians/u-boot-dm

acpi refactoring to allow non-x86 use
binman support for bintools (binary tools)
minor tools improvements in preparation for FDT signing
various minor fixes and improvements


# 334a9b9d 25-Nov-2021 Loic Poulain <loic.poulain@linaro.org>

lib/circbuf: Make circbuf selectable symbol

It is currenly only used from usbtty driver but make it properly
selectable via Kconfig symbol, for future usage.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>

# e1722fcb 01-Dec-2021 Simon Glass <sjg@chromium.org>

x86: Allow any arch to generate ACPI tables

These have sadly found their way to ARM now. Allow any arch to support
generating ACPI tables.

Disable this for the tools build.

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

# 7c3fd5c2 26-Dec-2021 Qu Wenruo <wqu@suse.com>

lib: add BLAKE2 hash support

The code is cross-ported from BLAKE2 reference implementation
(https://github.com/BLAKE2/BLAKE2).

With minimal change to remove unused macros/features.

Currently there is only one user inside U-boot (btrfs), and since it
only utilize BLAKE2B, all other favors are all removed.

Signed-off-by: Qu Wenruo <wqu@suse.com>
[trini: Rename ROUND to R to avoid clash with <linux/bitops.h>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 97f2a749 04-Jan-2022 Eugen Hristev <eugen.hristev@microchip.com>

lib: Kconfig: fix PHANDLE_CHECK_SEQ position outside of menu

CONFIG_PHANDLE_CHECK_SEQ is outside of the menu 'Library routines'
thus it's invisible in menuconfig and cannot be selected.
Fix this by moving the 'endmenu' after the PHANDLE_CHECK_SEQ definition

Fixes: c589132a1d ("fdt: Use phandle to distinguish DT nodes with same name")
Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
Reviewed-by: Aswath Govindraju <a-govindraju@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 726cd983 29-Dec-2021 Simon Glass <sjg@chromium.org>

efi: Make unicode printf available to the app

This is needed to show unicode strings. Enable this code in the app.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>

# 6405ab7a 24-Nov-2021 Simon Glass <sjg@chromium.org>

Convert CONFIG_PHYSMEM to Kconfig

This converts the following to Kconfig:
CONFIG_PHYSMEM

Signed-off-by: Simon Glass <sjg@chromium.org>
Suggested-by: Sean Anderson <seanga2@gmail.com>

# ac7606af 14-Nov-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

lmb: fix typo 'commun'

%s/commun/common/

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

# e7d285b2 25-Sep-2021 Simon Glass <sjg@chromium.org>

image: Use the correct checks for CRC32

Add a host Kconfig for CRC32. With this we can use CONFIG_IS_ENABLED(CRC32)
directly in the host build, so drop the unnecessary indirection.

Add a few more conditions to SPL_CRC32 to avoid build failures as well as
TPL_CRC32. Also update hash.c to make crc32 optional and to actually take
notice of SPL_CRC32.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# 2c21256b 25-Sep-2021 Simon Glass <sjg@chromium.org>

hash: Use Kconfig to enable hashing in host tools and SPL

At present when building host tools, we force CONFIG_SHAxxx to be enabled
regardless of the board Kconfig setting. This is done in the image.h
header file.

For SPL we currently just assume the algorithm is desired if U-Boot proper
enables it.

Clean this up by adding new Kconfig options to enable hashing on the host,
relying on CONFIG_IS_ENABLED() to deal with the different builds.

Add new SPL Kconfigs for hardware-accelerated hashing, to maintain the
current settings.

This allows us to drop the image.h code and the I_WANT_MD5 hack.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# 603d15a5 25-Sep-2021 Simon Glass <sjg@chromium.org>

spl: cypto: Bring back SPL_ versions of SHA

Unfortunately these were removed by mistake. This means that adding hash
support to SPL brings in all software algorithms, with a substantial
increase in code size.

The origin of the problem was renaming them to SPL_FIT_xxx and then these
were removed altogether in a later commit.

Add them back. This aligns with CONFIG_MD5, for example, which has an SPL
variant.

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: f5bc9c25f31 ("image: Rename SPL_SHAxxx_SUPPORT to SPL_FIT_SHAxxx")
Fixes: eb5171ddec9 ("common: Remove unused CONFIG_FIT_SHAxxx selectors")
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# 6674edaa 16-Sep-2021 Tom Rini <trini@konsulko.com>

Merge tag 'v2021.10-rc4' into next

Prepare v2021.10-rc4

Signed-off-by: Tom Rini <trini@konsulko.com>

# gpg: Signature made Tue 14 Sep 2021 06:58:32 PM EDT
# gpg: using RSA key 1A3C7F70E08FAB1707809BBF147C39FF9634B72C
# gpg: Good signature from "Thomas Rini <trini@konsulko.com>" [ultimate]

# Conflicts:
# board/Arcturus/ucp1020/spl.c
# cmd/mvebu/Kconfig
# common/Kconfig.boot
# common/image-fit.c
# configs/UCP1020_defconfig
# configs/sifive_unmatched_defconfig
# drivers/pci/Kconfig
# include/configs/UCP1020.h
# include/configs/sifive-unmatched.h
# lib/Makefile
# scripts/config_whitelist.txt


# 5145bc73 01-Sep-2021 Oleksandr Suvorov <oleksandr.suvorov@foundries.io>

lib: fix typos in Kconfig

There are trivial typos in the Kconfig file. Fixed them.
Also, fixed grammar in the descriptions with typos.

Fixes: d56b4b1974 ("configs: Migrate RBTREE, LZO, CMD_MTDPARTS, CMD_UBI and CMD_UBIFS")
Fixes: 7264f2928b ("spl: fit: Eanble GZIP support for image decompression")
Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# e60e4499 02-Sep-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

lib: Drop SHA512_ALGO in lieu of SHA512

SHA512_ALGO was used as a "either SHA512 or SHA384", although the
implementations of these two algorithms share a majority of code.

From a Kconfig interface perspective, it makes sense to present two
distinct options. This requires #ifdefing out the SHA512
implementation from sha512.c. The latter doesn't make any sense.

It's reasonable to say in Kconfig that SHA384 depends on SHA512, and
seems to be the more polite way to handle the selection.

Thus, automatically select SHA512 when SHA384 is enabled.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# b4c2c151 27-Aug-2021 Michal Simek <michal.simek@amd.com>

Kconfig: Remove all default n/no options

default n/no doesn't need to be specified. It is default option anyway.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
[trini: Rework FSP_USE_UPD portion]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 928a8be7 29-Jul-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

lib: ecdsa: Implement UCLASS_ECDSA verification on target

Implement the crypto_algo .verify() function for ecdsa256. Because
it backends on UCLASS_ECDSA, this change is focused on parsing the
keys from devicetree and passing this information to the specific
UCLASS driver.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# fa3f1f1d 24-Jul-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: disable CONFIG_SPL_HEXDUMP by default

CONFIG_HEXDUMP is needed to display UEFI variables using 'printenv -e'.

Enabling CONFIG_SPL_HEXDUMP only makes sense for debugging purposes.
Hence CONFIG_SPL_HEXDUMP should not be enabled by default.

The following boards currently have CONFIG_SPL_HEXDUMP=y. This includes
boards that don't use SPL at all.

axm_defconfig
imx8mm-cl-iot-gate_defconfig
imx8mm_venice_defconfig
imxrt1020-evk_defconfig
imxrt1050-evk_defconfig
kontron_sl28_defconfig
kp_imx53_defconfig
lx2160ardb_tfa_stmm_defconfig
mt7622_rfb_defconfig
octeon_ebb7304_defconfig
octeon_nic23_defconfig
qemu_arm64_defconfig
qemu_arm_defconfig
qemu-riscv32_defconfig
qemu-riscv32_smode_defconfig
qemu-riscv64_defconfig
qemu-riscv64_smode_defconfig
qemu-x86_64_defconfig
qemu-x86_defconfig
sandbox64_defconfig
sandbox_defconfig
stm32mp15_basic_defconfig
stm32mp15_trusted_defconfig
synquacer_developerbox_defconfig
taurus_defconfig
xilinx_versal_virt_defconfig

The patch only keeps it enabled on

sandbox_spl_defconfig

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 1a46cb6c 02-Jul-2021 Simon Glass <sjg@chromium.org>

lib: Create a new Kconfig option for charset conversion

Rather than looking at two KConfig options in the Makefile, create a new
Kconfig option for compiling lib/charset.c

Enable it for UFS also, which needs this support.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 26dd9936 08-Jul-2021 Steffen Jaeckel <jaeckel-floss@eyet-services.de>

lib: add crypt subsystem

Add the basic functionality required to support the standard crypt
format.
The files crypt-sha256.c and crypt-sha512.c originate from libxcrypt and
their formatting is therefor retained.
The integration is done via a crypt_compare() function in crypt.c.

```
libxcrypt $ git describe --long --always --all
tags/v4.4.17-0-g6b110bc
```

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 7d0f3fbb 11-Jun-2021 Tero Kristo <t-kristo@ti.com>

lib: rational: copy the rational fraction lib routines from Linux

Copy the best rational approximation calculation routines from Linux.
Typical usecase for these routines is to calculate the M/N divider
values for PLLs to reach a specific clock rate.

This is based on linux kernel commit:
"lib/math/rational.c: fix possible incorrect result from rational
fractions helper"
(sha1: 323dd2c3ed0641f49e89b4e420f9eef5d3d5a881)

Signed-off-by: Tero Kristo <t-kristo@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Tero Kristo <kristo@kernel.org>

# ec0512b1 24-May-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

Revert "lib: introduce HASH_CALCULATE option"

When we think of Kconfig, we usually think of features that we like
to enable or not. Ideally, we wouldn't use Kconfig to fix a build
issue, although sometimes it might make sense. With Kconfig it's hard
to guarantee that the fix is universal. We can only say that it works
for the set of tested configurations. In the majority of cases, it's
preferable to let the linker figure things out for us.

The reverted commit attempted to fix a build issue by adding an
invisible Kconfig option. This is wrong in several ways:

It invents a new Kconfig variable when CONFIG_HASH already
exists for the same purpose.
Second, hash-checksum.c makes use of the hash_progressive_lookup_algo()
symbol, which is only provided with CONFIG_HASH, but this dependency
was not expressed in the reverted patch.

It feels like Kconfig is turning into a listing of all available
source files, and a buffet to 'select' which ones to compile. The
purpose of this revert is to enable the next change to make use of
CONFIG_HASH instead of adding to Kconfig.

This reverts commit 87316da05f2fd49d3709275e64ef0c5980366ade.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Acked-by: Masahisa Kojima <masahisa.kojima@linaro.org>

# 1621d3c4 10-May-2021 Bin Meng <bmeng.cn@gmail.com>

lib: kconfig: Limit BINMAN_FDT for OF_SEPARATE or OF_EMBED

Generally speaking BINMAN_FDT makes sense for OF_SEPARATE or OF_EMBED.
For the other OF_CONTROL methods, it's quite possible binman node is
not available as binman is invoked during the build phase instead of
runtime. Let's only turn it on for OF_SEPARATE or OF_EMBED by default.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 87316da0 13-May-2021 Masahisa Kojima <masahisa.kojima@linaro.org>

lib: introduce HASH_CALCULATE option

Build error occurs when CONFIG_EFI_SECURE_BOOT or
CONFIG_EFI_CAPSULE_AUTHENTICATE is enabled,
because hash-checksum.c is not compiled.

Since hash_calculate() implemented in hash-checksum.c can be
commonly used aside from FIT image signature verification,
this commit itroduces HASH_CALCULATE option to decide
if hash-checksum.c shall be compiled.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# e2ae483c 13-May-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

hash: Kconfig option for SHA512 hardware acceleration

Commit a479f103dc1c ("hash: Allow for SHA512 hardware implementations")
defined function definitions for hardware accelerated SHA384 and SHA512.
If CONFIG_SHA_HW_ACCEL=y, these functions are used.

We already have boards using CONFIG_SHA_HW_ACCEL=y but none implements the
new functions hw_sha384() and hw_sha512().

For implementing the EFI TCG2 protocol we need SHA384 and SHA512. The
missing hardware acceleration functions lead to build errors on boards like
peach-pi_defconfig.

Introduce a new Kconfig symbol CONFIG_SHA512_HW_ACCEL to control if the
functions hw_sha384() and hw_sha512() shall be used to implement the SHA384
and SHA512 algorithms.

Fixes: a479f103dc1c ("hash: Allow for SHA512 hardware implementations")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

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

# 6d66502b 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: Add 2 config to define the max number of regions

Add 2 configs CONFIG_LMB_MEMORY_REGIONS and CONFIG_LMB_RESERVED_REGIONS
to change independently the max number of the regions in lmb
library.

When CONFIG_LMB_USE_MAX_REGIONS=y, move the lmb property arrays to
struct lmb and manage the array size with the element 'max' of struct
lmb_region; their are still allocated in stack.

When CONFIG_LMB_USE_MAX_REGIONS=n, keep the current location in
struct lmb_region to allow compiler optimization.

Increase CONFIG_LMB_RESERVED_REGIONS is useful to avoid lmb errors in
bootm when the number of reserved regions (not adjacent) is reached:
+ 1 region for relocated U-Boot
+ 1 region for initrd
+ 1 region for relocated linux device tree
+ reserved memory regions present in Linux device tree.

The current limit of 8 regions is reached with only 5 reserved regions
in DT.

see Linux kernel commit bf23c51f1f49 ("memblock: Move memblock arrays
to static storage in memblock.c and make their size a variable")

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# 4fa0150d 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: move MAX_LMB_REGIONS value in Kconfig

Move MAX_LMB_REGIONS value in Kconfig, the max number of the regions
in lmb library.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# 77b8cfef 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: move CONFIG_LMB in Kconfig

Migrate CONFIG_LMB in Kconfig.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# a479f103 16-Feb-2021 Joel Stanley <joel@jms.id.au>

hash: Allow for SHA512 hardware implementations

Similar to support for SHA1 and SHA256, allow the use of hardware hashing
engine by enabling the algorithm and setting CONFIG_SHA_HW_ACCEL /
CONFIG_SHA_PROG_HW_ACCEL.

Signed-off-by: Joel Stanley <joel@jms.id.au>

# f2c1442e 14-Mar-2021 Simon Glass <sjg@chromium.org>

bloblist: Make BLOBLIST_TABLES depend on BLOBLIST

Add an extra condition here since we cannot put x86 tables in a bloblist
when bloblists are not supported.

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

# e0103158 25-Feb-2021 Bin Meng <bmeng.cn@gmail.com>

lib: kconfig: Mention CONFIG_ADDR_MAP limitation in the help

Mention that CONFIG_ADDR_MAP only works in the post-relocation phase.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>

# 56e7257c 03-Feb-2021 Bin Meng <bmeng.cn@gmail.com>

lib: Fix BINMAN_FDT dependency

lib/binman.c references the following 3 ofnode APIs:
ofnode_first_subnode(), ofnode_path() and ofnode_read_bool().

These APIs get built only when DM is on. Fix the dependency then.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 59e4e391 18-Jan-2021 Tom Rini <trini@konsulko.com>

Merge https://gitlab.denx.de/u-boot/custodians/u-boot-riscv

- Update qemu-riscv.rst build instructions.
- Add support for SPI on Kendryte K210.
- Add Microchip PolarFire SoC Icicle Kit support.
- Add support for an early timer.
- Select TIMER_EARLY to avoid infinite recursion for Trace.


# a80f8513 17-Jan-2021 Pragnesh Patel <pragnesh.patel@sifive.com>

trace: select TIMER_EARLY to avoid infinite recursion

When tracing functions is enabled this adds calls to
__cyg_profile_func_enter() and __cyg_profile_func_exit() to the traced
functions.

__cyg_profile_func_enter() and __cyg_profile_func_exit() invoke
timer_get_us() to record the entry and exit time.

initr_dm() will make gd->dm_root = NULL and gd->timer = NULL, so
timer_get_us() -> get_ticks() -> dm_timer_init() will lead to an
indefinite recursion.

So select TIMER_EARLY when tracing got enabled.

Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Rick Chen <rick@andestech.com>

# 6205bbb1 04-Jan-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lib: cosmetic update of CONFIG_LIB_ELF description

Change 2 typo error in CONFIG_LIB_ELF description:
- Supoort => Support
- fir => for

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c589132a 02-Dec-2020 Aswath Govindraju <a-govindraju@ti.com>

fdt: Use phandle to distinguish DT nodes with same name

While assigning the sequence number to subsystem instances by reading the
aliases property, only DT nodes names are compared and not the complete
path. This causes a problem when there are two DT nodes with same name but
have different paths.

In arch/arm/dts/k3-am65-main.dtsi there are two USB controllers with the
same device tree node name but different path. When aliases are defined for
these USB controllers then fdtdec_get_alias_seq() fails to pick the correct
instance for a given index.

fdt_path_offset() function is slow and this would effect the U-Boot
startup. To avert the time penalty on all boards, apply this extra check
only when required by using a config option.

Fix it by comparing the phandles of DT nodes after the node names match,
under a config option.

Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Fix whitespace error in Kconfig:
Signed-off-by: Simon Glass <sjg@chromium.org>

# 28cef9ca 19-Nov-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

fs: fat: create correct short names

The current function set_name() used to create short names has the
following deficiencies resolved by this patch:

* Long names (e.g. FOO.TXT) are stored even if a short name is enough.
* Short names with spaces are created, e.g. "A ~1.TXT".
* Short names with illegal characters are created, e.g. "FOO++BAR".
* Debug output does not not consider that the short file name has no
concluding '\0'.

The solution for the following bug is split of into a separate patch:

* Short file names must be unique.

This patch only provides the loop over possible short file names.

Fixes: c30a15e590c ("FAT: Add FAT write feature")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# e4f8e543 05-Nov-2020 Simon Glass <sjg@chromium.org>

smbios: Drop the unused Kconfig options

Now that we can use devicetree to specify this information, drop the old
CONFIG options.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 44c74bdd 05-Nov-2020 Simon Glass <sjg@chromium.org>

sysinfo: Provide a default driver to set SMBIOS values

Some boards want to specify the manufacturer or product name but do not
need to have their own sysinfo driver.

Add a default driver which provides a way to specify this SMBIOS
information in the devicetree, without needing any board-specific
functionality.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d2cb7a22 04-Nov-2020 Simon Glass <sjg@chromium.org>

x86: Allow putting some tables in the bloblist

At present all tables are placed starting at address f0000 in memory, and
can be up to 64KB in size. If the tables are very large, this may not
provide enough space.

Also if the tables point to other tables (such as console log or a ramoops
area) then we must allocate other memory anyway.

The bloblist is a nice place to put these tables since it is contiguous,
which makes it easy to reserve this memory for linux using the 820 tables.

Add an option to put some of the tables in the bloblist. For SMBIOS and
ACPI, create suitable pointers from the f0000 region to the new location
of the tables.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
[bmeng: squashed in http://patchwork.ozlabs.org/project/uboot/patch/
20201105062407.1.I8091ad931cbbb5e3b6f6ababdf3f8d5db0d17bb9@changeid/]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# 415eab06 03-Nov-2020 Christian Gmeiner <christian.gmeiner@gmail.com>

smbios: add parsing API

Add a very simple API to be able to access SMBIOS strings
like vendor, model and bios version.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 72eda507 27-Oct-2020 Sean Anderson <seanga2@gmail.com>

lib: Add getopt

Some commands can get very unweildy if they have too many positional
arguments. Adding options makes them easier to read, remember, and
understand.

This implementation of getopt has been taken from barebox, which has had
option support for quite a while. I have made a few modifications to their
version, such as the removal of opterr in favor of a separate getopt_silent
function. In addition, I have moved all global variables into struct
getopt_context.

The getopt from barebox also re-orders the arguments passed to it so that
non-options are placed last. This allows users to specify options anywhere.
For example, `ls -l foo/ -R` would be re-ordered to `ls -l -R foo/` as
getopt parsed the options. However, this feature conflicts with the const
argv in cmd_tbl->cmd. This was originally added in 54841ab50c ("Make sure
that argv[] argument pointers are not modified."). The reason stated in
that commit is that hush requires argv to stay unmodified. Has this
situation changed? Barebox also uses hush, and does not have this problem.
Perhaps we could use their fix?

I have assigned maintenance of getopt to Simon Glass, as it is currently
only used by the log command. I would also be fine maintaining it.

Signed-off-by: Sean Anderson <seanga2@gmail.com>

# 26637e2e 12-Sep-2020 Simon Glass <sjg@chromium.org>

lib: Allow hexdump to be used in SPL

It is sometimes useful to output hex dumps in SPL. Add a config option to
allow this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# e87dfb05 05-Aug-2020 Andrii Anisov <andrii_anisov@epam.com>

lib: sscanf: add sscanf implementation

Port sscanf implementation from mini-os and introduce new
Kconfig option to enable it: CONFIG_SSCANF. Disable by default.

Signed-off-by: Andrii Anisov <andrii_anisov@epam.com>
Signed-off-by: Anastasiia Lukianenko <anastasiia_lukianenko@epam.com>
Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>

# 81014f73 30-Jul-2020 Joao Marcos Costa <joaomarcos.costa@bootlin.com>

include/u-boot, lib/zlib: add sources for zlib decompression

Add zlib (v1.2.11) uncompr() function to U-Boot. SquashFS depends on
this function to decompress data from a raw disk image. The actual
support for zlib into SquashFS sources will be added in a follow-up
commit.

Signed-off-by: Joao Marcos Costa <joaomarcos.costa@bootlin.com>

# 69be8fd1 03-Jun-2020 Marek Szyprowski <m.szyprowski@samsung.com>

powerpc: move ADDR_MAP to Kconfig

Move ADDR_MAP related config options from include/configs/*.h to the
proper place in lib/Kconfig. This has been done using
./tools/moveconfig.py and manual inspection of the generated changes.
This is a preparation to use ADDR_MAP helper on ARM 32bit Raspberry Pi4
board for mapping the PCIe XHCI MMIO, which is above the 4GiB identity
mapping limit.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# d16b38f4 15-Apr-2020 Reuben Dowle <reubendowle0@gmail.com>

Add support for SHA384 and SHA512

The current recommendation for best security practice from the US government
is to use SHA384 for TOP SECRET [1].

This patch adds support for SHA384 and SHA512 in the hash command, and also
allows FIT images to be hashed with these algorithms, and signed with
sha384,rsaXXXX and sha512,rsaXXXX

The SHA implementation is adapted from the linux kernel implementation.

[1] Commercial National Security Algorithm Suite
http://www.iad.gov/iad/programs/iad-initiatives/cnsa-suite.cfm

Signed-off-by: Reuben Dowle <reuben.dowle@4rf.com>

# 43e442a5 26-May-2020 Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

kconfig: fix some typos

Signed-off-by: Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

# eff5a547 22-May-2020 Michael Walle <michael@walle.cc>

cmd: zip: automatically pull in gzip()

Move the CONFIG_GZIP_COMPRESSED from a config.h macro to a Kconfig menu
item. It is not selectable by a user because there is no reason to do
so. Instead it will be automatically selected by the stuff which uses
gzip(), like the zip command.

Remove it from the config_whitelist.txt. Also remove
CONFIG_GZIP_COMPRESS_DEF_SZ as this was never used on any board. The
default seems to be sane, otherwise it should be added as a Kconfig
option.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8239be61 06-May-2020 Simon Glass <sjg@chromium.org>

lib: Allow MD5 to be enabled in SPL

At present the MD5 option cannot be enabled by board configs since it has
no Kconfig name. It is generally enabled, so long as FIT support is
present. But not all boards use FIT, particularly in SPL

Fix this and add an option for SPL as well. This allows board code to call
md5() even if FIT support is not enabled.

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

# 04cb3994 21-Apr-2020 Weijie Gao <weijie.gao@mediatek.com>

lib: enable lzma decompression support for SPL build

This patch enables LZMA decompression support for SPL build

Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>

# 2a2119e1 05-Mar-2020 Atish Patra <atishp@atishpatra.org>

lib: kconfig: Add option to set BZIP2 compression method

There is no way to select BZIP2 compression method.
Add it under library/compression config where all other
compression related configs are present.

Signed-off-by: Atish Patra <atish.patra@wdc.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 805b3cac 12-Feb-2020 Keerthy <j-keerthy@ti.com>

lib: elf: Move the generic elf loading/validating functions to lib

Move the generic elf loading/validating functions to lib/
so that they can be re-used and accessed by code existing
outside cmd.

While at it remove the duplicate static version of load_elf_image_phdr
under arch/arm/mach-imx/imx_bootaux.c.

Signed-off-by: Keerthy <j-keerthy@ti.com>
Suggested-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>

# 1611235b 19-Jan-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: Kconfig dependencies for pseudo-random library

drivers/rng/sandbox_rng.c requires rand() to be defined but configuration
option CONFIG_CONFIG_LIB_RAND selected in drivers/rng/Kconfig does not
exist.

test/lib/test_aes.c requires rand() to be defined.

Fix the selection criteria for choice "Pseudo-random library support type".

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 3c10dc95 06-Dec-2019 Simon Glass <sjg@chromium.org>

binman: Add a library to access binman entries

SPL and TPL can access information about binman entries using link-time
symbols but this is not available in U-Boot proper. Of course it could be
made available, but the intention is to just read the device tree.

Add support for this, so that U-Boot can locate entries.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# b4adf627 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: crypto: add x509 parser

Imported from linux kernel v5.3:
x509.asn1 without changes
x509_akid.asn1 without changes
x509_parser.h without changes
x509_cert_parser.c with changes marked as __UBOOT__
x509_public_key.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# a9b45e6e 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add oid registry utility

Imported from linux kernel v5.3:
build_OID_registry without changes
oid_registry.h without changes
oid_registry.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# ab8a0e06 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add asn1 decoder

Imported from linux kernel v5.3:
lib/asn1_decoder.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 2b12196d 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

cmd: add asn1_compiler

Imported from linux kernel v5.3:
asn1.h without changes
asn1_ber_bytecode.h without changes
asn1_decoder.h without changes
asn1_compiler.c without changes

This host command will be used to create a ASN1 parser, for example,
for pkcs7 messages or x509 certificates. More specifically, it will
generate *byte code* which will be interpreted by asn1 decoder library.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 05429b6c 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

rtc: move date.c from drivers/rtc/ to lib/

In the next commit, rtc_mktime(), for compatibility with linux, will be
implemented using rtc_mktime(), which is no longer drivers/rtc specific.
So move this file under lib/.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 37ef1774 10-Nov-2019 Thomas Hebb <tommyhebb@gmail.com>

Kconfig: disambiguate config names for tiny printf

27084c03d36a ("spl: Allow tiny printf() to be controlled in SPL and
TPL") split this option in two for TPL and SPL, but didn't change the
Kconfig names, making them hard to set quickly.

Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>

# 0d76afc0 27-Oct-2019 Simon Glass <sjg@chromium.org>

fdt: Add Kconfig options to control code size

For better or worse libfdt recent grew a lot of code that checks the
validity of the device tree in great detail. When using unsigned or
unverified data this makes things safer, but it does add to code size.

Add some controls to select the trade-off between safety and code size.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 27084c03 25-Sep-2019 Simon Glass <sjg@chromium.org>

spl: Allow tiny printf() to be controlled in SPL and TPL

At present there is only one control for this and it is used for both SPL
and TPL. But SPL might have a lot more space than TPL so the extra cost of
a full printf() might be acceptable.

Split the option into two, providing separate SPL and TPL controls. The
TPL setting defaults to the same as SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2a51e16b 07-Jun-2019 Tom Rini <trini@konsulko.com>

configs: Make USE_TINY_PRINTF depend on SPL||TPL and be default

The USE_TINY_PRINTF symbol only changes things within SPL and TPL
builds, so make it depend on that support. Next, make it default as
within these cases we should rarely have need of more advanced print
formats outside of the debug context.

To do this, in a few cases we need to correct our Kconfig dependencies
as we had cases of non-SPL targets select'ing this symbol. Finally, in
the case of a few boards we really do need the full printf
functionality.

Signed-off-by: Tom Rini <trini@konsulko.com>

# da0fb5fd 02-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: make call depth limit customizable

Up to now we had hard coded values for the call depth up to which trace
records are created: 200 for early tracing, 15 thereafter. UEFI
applications reach a call depth of 80 or above.

Provide customizing settings for the call trace depth limit and the early
call trace depth limit. Use the old values as defaults.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8509f22a 29-Apr-2019 Marek Behún <marek.behun@nic.cz>

lib: add Zstandard decompression support

Add the zstd library from Linux kernel (only decompression support).
There are minimal changes to build with U-Boot, otherwise the files are
identical to Linux commit dc35da16 from March 2018, the files had not
been touched since in kernel. Also SPDX lincese tags were added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 83a486b6 29-Apr-2019 Marek Behún <marek.behun@nic.cz>

lib: Add xxhash support

This adds the xxhash support from Linux. Files are almost identical to
those added to Linux in commit 5d240522 ("lib: Add xxhash module") (they
haven't been touched since in Linux). The only difference is to add some
includes to be compatible with U-Boot. Also SPDX lincese tags were
added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 5132361a 29-Apr-2019 Heiko Schocher <hs@denx.de>

lib: Kconfig: fix help text for GZIP

commit 95f4bbd581cf ("lib: fdt: Allow LZO and GZIP DT compression in U-Boot")

introduced Kconfig option for gzip in U-Boot, but help text
says gzip for SPL, which is wrong. Fix this.

Signed-off-by: Heiko Schocher <hs@denx.de>
Acked-by: Marek Vasut <marex@denx.de>

# 1c6eb075 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE_BUFFER_SIZE et al to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE_BUFFER_SIZE
CONFIG_TRACE_EARLY_SIZE
CONFIG_TRACE_EARLY
CONFIG_TRACE_EARLY_ADDR

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

# a24a78d7 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE

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

# 54969b40 21-Mar-2019 Thierry Reding <treding@nvidia.com>

fdtdec: Add Kconfig symbol for tests

Runtime tests are provided as a test_fdtdec command implementation. Add
a Kconfig symbol that allows this command to be built so that the tests
can be used.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 95f4bbd5 08-Mar-2019 Marek Vasut <marex@denx.de>

lib: fdt: Allow LZO and GZIP DT compression in U-Boot

Add required Kconfig symbols, Makefile bits and macro fixes in a
few places to support LZO and DT compression in U-Boot. This can
save a lot of space with multi-DTB fitImages.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>

# 6e705114 13-Jan-2019 Chris Packham <judge.packham@gmail.com>

lib: Kconfig: spelling fixes

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 048c6e89 06-Nov-2018 Simon Glass <sjg@chromium.org>

spl: lz4: Allow use of lz4 compression in SPL

In some cases U-Boot is compressed and it is useful to be able to
decompress it in SPL. Add a Kconfig and Makefile change to allow this.
Note that this does not actually implement decompression.

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

# 2895c4b7 15-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

kconfig: Introduce HAVE_ARCH_IOMAP

Introduce a new Kconfig option for architecture codes to control
whether it provides io{read,write}{8,16,32} I/O accessor functions.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5592a633 01-Oct-2018 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt in TPL

In some cases (e.g. sandbox with verified boot) it is useful to support
libfdt in TPL. Update the Kconfig to handle this.

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

# 6307896c 01-Oct-2018 Simon Glass <sjg@chromium.org>

tpm: Add support for SPL and TPL

At present the tpm can only be used in U-Boot proper. Updated it to work
in SPL and TPL also.

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

# ab948cd2 19-Jul-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

fdt_support: make FDT_FIXUP_PARTITIONS depend on CMD_MTDPARTS

fdt_fixup_mtdparts() calls mtdparts_init() and device_find(),
which are defined in cmd/mtdparts.c

The combination of FDT_FIXUP_PARTITIONS=y and CMD_MTDPARTS=n
emits the following link error:

common/fdt_support.c:903: undefined reference to `mtdparts_init'
common/fdt_support.c:914: undefined reference to `device_find'

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 3330584d 03-Jun-2018 Igor Opaniuk <igor.opaniuk@gmail.com>

avb2.0: integrate avb 2.0 into the build system

Integrate libavb into the build system. Introduce CONFIG_LIBAVB
build option.

Signed-off-by: Igor Opaniuk <igor.opaniuk@linaro.org>

# f8c987f8 05-Jun-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

lib: Add hexdump

Often during debugging session it's very interesting to see
what data we were dealing with. For example what we write or read
to/from memory or peripherals.

This change introduces functions that allow to dump binary
data with one simple function invocation like:
------------------->8----------------
print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, buf, len);
------------------->8----------------

which gives us the following:
------------------->8----------------
00000000: f2 b7 c9 88 62 61 75 64 72 61 74 65 3d 31 31 35 ....baudrate=115
00000010: 32 30 30 00 62 6f 6f 74 61 72 67 73 3d 63 6f 6e 200.bootargs=con
00000020: 73 6f 6c 65 3d 74 74 79 53 33 2c 31 31 35 32 30 sole=ttyS3,11520
00000030: 30 6e 38 00 62 6f 6f 74 64 65 6c 61 79 3d 33 00 0n8.bootdelay=3.
00000040: 62 6f 6f 74 66 69 6c 65 3d 75 49 6d 61 67 65 00 bootfile=uImage.
00000050: 66 64 74 63 6f 6e 74 72 6f 6c 61 64 64 72 3d 39 fdtcontroladdr=9
00000060: 66 66 62 31 62 61 30 00 6c 6f 61 64 61 64 64 72 ffb1ba0.loadaddr
00000070: 3d 30 78 38 32 30 30 30 30 30 30 00 73 74 64 65 =0x82000000.stde
00000080: 72 72 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 rr=serial0@e0022
00000090: 30 30 30 00 73 74 64 69 6e 3d 73 65 72 69 61 6c 000.stdin=serial
000000a0: 30 40 65 30 30 32 32 30 30 30 00 73 74 64 6f 75 0@e0022000.stdou
000000b0: 74 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 30 t=serial0@e00220
000000c0: 30 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00..............
...
------------------->8----------------

Source of hexdump.c was copied from Linux kernel v4.7-rc2.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Mario Six <mario.six@gdsys.cc>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Stefan Roese <sr@denx.de>

# c232d14d 29-May-2018 Alex Kiernan <alex.kiernan@gmail.com>

mmc: Separate "mmc swrite" from fastboot

Introduce CONFIG_IMAGE_SPARSE and CONFIG_CMD_MMC_SWRITE so the "mmc
swrite" command is separated from the fastboot code.

Move image-sparse from common to lib so it's clear it's library code.

Rename CONFIG_FASTBOOT_FLASH_FILLBUF_SIZE to CONFIG_IMAGE_SPARSE_FILLBUF_SIZE
and migrate it to Kconfig.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Acked-by: Jassi Brar <jaswinder.singh@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6417572e 08-May-2018 Tom Rini <trini@konsulko.com>

lib/Kconfig: Mark OF_LIBFDT_OVERLAY as depending on OF_LIBFDT

The overlay code is only useful when OF_LIBFDT is set, so mark it as
depending on that first.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 58a46f88 25-Apr-2018 Praneeth Bajjuri <praneeth@ti.com>

configs: TI: Enable FIT Library overlay support

Enable the FDT library overlay support for all TI SOC family.

Without this option, when Loading fdt from FIT image, the
following warning is seen.

"config with overlays but CONFIG_OF_LIBFDT_OVERLAY not set".

Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
Suggested-by: Andrew F.Davis <afd@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>

# 14ad44ab 18-Apr-2018 Alex Kiernan <alex.kiernan@gmail.com>

spl: Split sprintf, strto* from SPL serial in Kconfig

When SPL serial is disabled, callers who need sprintf or strtoul fail
because their inclusion is guarded by CONFIG_SPL_SERIAL_SUPPORT/
CONFIG_TPL_SERIAL_SUPPORT.

Split printf, sprintf and strto into their own entries and then select
all of them if SERIAL_SUPPORT is enabled to match the current behaviour.

Include panic.o unconditionally as it can be called from anywhere which
uses BUG_ON().

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>

# e294ba06 04-Apr-2018 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-sunxi

Signed-off-by: Tom Rini <trini@konsulko.com>


# d14db11d 03-Apr-2018 Andre Przywara <andre.przywara@arm.com>

sunxi: revert disabling of features

In January some commits were introduced to mitigate the U-Boot image
size issues we encountered on sunxi builds.
Now with the MMC environment removed we can bring them back, as we
practically don't have a size limit anymore.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 32ce6179 13-Mar-2018 Bryan O'Donoghue <bryan.odonoghue@linaro.org>

optee: Add lib entries for sharing OPTEE code across ports

This patch adds code to lib to enable sharing of useful OPTEE code between
board-ports and architectures. The code on lib/optee/optee.c comes from the
TI omap2 port. Eventually the OMAP2 code will be patched to include the
shared code. The intention here is to add more useful OPTEE specific code
as more functionality gets added.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Cc: Harinarayan Bhatta <harinarayan@ti.com>
Cc: Andrew F. Davis <afd@ti.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Kever Yang <kever.yang@rock-chips.com>
Cc: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Cc: Peng Fan <peng.fan@nxp.com>
Tested-by: Peng Fan <peng.fan@nxp.com>

# 36c1877c 06-Feb-2018 Faiz Abbas <faiz_abbas@ti.com>

lib: Kconfig: Move DYNAMIC_CRC_TABLE to Kconfig

Add CONFIG prefix to DYNAMIC_CRC_TABLE and implement it in
Kconfig.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>

# a451bc27 05-Feb-2018 Adam Ford <aford173@gmail.com>

Convert LIB_UUID to Kconfig

config_fallback.h has some logic that checks a variety of options
and selects LIB_UUID if it hasn't already been selected. This
will all LIB_UUID in Kconfig and select this option for the list
of options to allow us to remove the logic from fallbacks

Signed-off-by: Adam Ford <aford173@gmail.com>

# a5a37567 06-Feb-2018 Adam Ford <aford173@gmail.com>

Convert CONFIG LIB_HW_RAND to Kconfig

config_fallbacks.h had some logic to automatically select
LIB_RAND if RANDOM_UUID or CMD_UUID were set if LIB_HW_RAND wasn't
already selected. By migrating LIB_HW_RAND to Kconfig, we can
remove this check from config_fallbacks.h and put it into Kconfig

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
[trini: Turn into a choice, add NET_RANDOM_ETHADDR]
Signed-off-by: Tom Rini <trini@konsulko.com>

# acd4d334 16-Jan-2018 Maxime Ripard <maxime.ripard@free-electrons.com>

net: regex: Disable by default on sunXi

The sunXi arm64 build has overflown, leading to the main U-boot binary
overwriting the environment when flashing the new image, or even worse,
overwriting itself when we're calling saveenv.

Disable this option that is not critical until we can adress the issue
properly.

Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 7e3caa81 03-Dec-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

Move CONFIG_PANIC_HANG to Kconfig

Freescale (NXP) boards have lots of defconfig files per board.
I used "imply PANIC_HANG" for them.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# da5337a6 08-Nov-2017 Nandor Han <nandor.han@ge.com>

rtc: add support for s35392a

Add support for S35392A RTC. The driver supports both U-Boot driver
models.

Signed-off-by: Nandor Han <nandor.han@ge.com>
Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
Cc: Heiko Schocher <hs@denx.de>

# f52bdf4b 14-Sep-2017 Jean-Jacques Hiblot <jjhiblot@ti.com>

lib: allow building lzo for the SPL

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 85d8bf57 03-Sep-2017 Marek Behún <marek.behun@nic.cz>

lib: Add CRC32-C

This is needed for BTRFS.

Signed-off-by: Marek Behun <marek.behun@nic.cz>

create mode 100644 lib/crc32c.c

# 7264f292 15-Aug-2017 York Sun <york.sun@nxp.com>

spl: fit: Eanble GZIP support for image decompression

Add Kconfig option SPL_GZIP and SPL_ZLIB to enable gunzip support for
SPL boot, eg. falcon boot compressed kernel image.

Signed-off-by: York Sun <york.sun@nxp.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6ef2f901 11-Aug-2017 Adam Ford <aford173@gmail.com>

Convert CONFIG_BCH to Kconfig

This converts the following to Kconfig:
CONFIG_BCH

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1a7ba1d 18-Aug-2017 Anatolij Gustschin <agust@denx.de>

Fix 'notes' typos

s/notes/nodes

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 96b9082c 03-Aug-2017 Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

rockchip: rk3188: rock: adjust for SPL/TPL split

With the changes to split SPL/TPL for the RK3368, I apparently missed
some needed adjustments to the RK3188 Kconfig and rock_defconfig.

This fixes build-issues for the rock board after applying the RK3368
enablement (and SPL/TPL) set that resulted from TPL_SERIAL_SUPPORT,
TPL_ROCKCHIP_BACK_TO_BROM and TPL_TINY_MEMSET being separate symbols
now.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d56b4b19 22-Jul-2017 Tom Rini <trini@konsulko.com>

configs: Migrate RBTREE, LZO, CMD_MTDPARTS, CMD_UBI and CMD_UBIFS

The above CONFIG options are in Kconfig, and now have correct depends and
inter-dependencies. Migrate these to configs/ from include/configs/. In the
case of CMD_UBIFS also change it to be a default y if CMD_UBI.

Signed-off-by: Tom Rini <trini@konsulko.com>

# aed998aa 17-May-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_LZMA to Kconfig

This converts the following to Kconfig:
CONFIG_LZMA

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

# b1a873df 26-Apr-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_CMD_AES et al to Kconfig

This converts the following to Kconfig:
CONFIG_CMD_AES
CONFIG_AES

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Add select AES to CMD_AES]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 173aafbf 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

cmd: Expose a Kconfig option to enable UBIFS commands

Create a new Kconfig entry to allow CMD_UBIFS selection from Kconfig and
add an hidden LZO option that can be selected by CMD_UBIFS.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>

# aa049152 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

mtd: ubi: Select RBTREE option from MTD_UBI Kconfig entry

Expose the RBTREE feature through Kconfig and select this option from the
MTD_UBI option.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>
[Rebased on master]
Signed-off-by: Jagan Teki <jagan@openedev.com>

# ab4458bd 02-Apr-2017 Simon Glass <sjg@chromium.org>

string: Provide a slimmed-down memset()

Most of the time the optimised memset() is what we want. For extreme
situations such as TPL it may be too large. For example on the 'rock'
board, using a simple loop saves a useful 48 bytes. With gcc 4.9 and
the rodata bug, this patch is enough to reduce the TPL image below the
limit.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>

# bea79d7d 14-Mar-2017 Andre Przywara <andre.przywara@arm.com>

Kconfig: introduce md5sum command selection

So far CONFIG_MD5SUM would need to be set by a board's include file.
Since the command is really generic, move it over to Kconfig to allow
it to be defined by either a board's defconfig, menuconfig or some
config snippet merged via mergeconfig.sh.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e663b350 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

smbios: Expose in efi_loader as table

We can pass SMBIOS easily as EFI configuration table to an EFI payload. This
patch adds enablement for that case.

While at it, we also enable SMBIOS generation for ARM systems, since they support
EFI_LOADER.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4b6dddc2 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

x86: Move smbios generation into arch independent directory

We will need the SMBIOS generation function on ARM as well going forward,
so let's move it into a non arch specific location.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# ebf7fff2 05-Oct-2016 Heiko Schocher <hs@denx.de>

spl: move FDT_FIXUP_PARTITIONS to Kconfig

Move FDT_FIXUP_PARTITIONS to Kconfig and cleanup existing
uses.

Signed-off-by: Heiko Schocher <hs@denx.de>

# ddf67f71 05-Jul-2016 Maxime Ripard <maxime.ripard@free-electrons.com>

libfdt: Add overlay application function

The device tree overlays are a good way to deal with user-modifyable
boards or boards with some kind of an expansion mechanism where we can
easily plug new board in (like the BBB, the Raspberry Pi or the CHIP).

Add a new function to merge overlays with a base device tree.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>

# 91b86e21 26-May-2016 Marek Vasut <marex@denx.de>

lib: Enable private libgcc by default

This patch decouples U-Boot binary from the toolchain on systems where
private libgcc is available. Instead of pulling in functions provided
by the libgcc from the toolchain, U-Boot will use it's own set of libgcc
functions. These functions are usually imported from Linux kernel, which
also uses it's own libgcc functions instead of the ones provided by the
toolchain.

This patch solves a rather common problem. The toolchain can usually
generate code for many variants of target architecture and often even
different endianness. The libgcc on the other hand is usually compiled
for one particular configuration and the functions provided by it may
or may not be suited for use in U-Boot. This can manifest in two ways,
either the U-Boot fails to compile altogether and linker will complain
or, in the much worse case, the resulting U-Boot will build, but will
misbehave in very subtle and hard to debug ways.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 67976306 30-Mar-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

cosmetic: Fix typos "privide"

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# ed980b8c 03-Mar-2016 Alexander Graf <agraf@csgraf.de>

efi_loader: hook up in build environment

Now that we have all the bits and pieces ready for EFI payload loading
support, hook them up in Makefiles and KConfigs so that we can build.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
[trini: Enable only when we of OF_LIBFDT, disable on kwb and colibri_pxa270]
Signed-off-by: Tom Rini <trini@konsulko.com>

# aa34fbc0 22-Feb-2016 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt to be used in SPL

Add an option to enable libfdt in SPL. This can be useful when decoding
FIT files in SPL.

We need to make sure this option is not enabled in SPL by this change.
Also this option needs to be enabled in host builds. Si add a new
IMAGE_USE_LIBFDT #define which can be used in files that are built on the
host but must also build for U-Boot and SPL.

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

# 69e173eb 22-Feb-2016 Simon Glass <sjg@chromium.org>

Move CONFIG_OF_LIBFDT to Kconfig

Move this option to Kconfig and tidy up existing boards.

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

# a187559e 05-Feb-2016 Bin Meng <bmeng.cn@gmail.com>

Use correct spelling of "U-Boot"

Correct spelling of "U-Boot" shall be used in all written text
(documentation, comments in source files etc.).

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Minkyu Kang <mk7.kang@samsung.com>

# 947c626d 14-Jan-2016 Tom Rini <trini@konsulko.com>

vsprintf.c: Always enable CONFIG_SYS_VSNPRINTF

Enabling this function always removes some class of string saftey issues.
The size change here in general is about 400 bytes and this seems a reasonable
trade-off.

Cc: Peng Fan <peng.fan@nxp.com>
Cc: Peter Robinson <pbrobinson@gmail.com>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Adrian Alonso <aalonso@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 7d9cde10 22-Nov-2015 Stefan Roese <sr@denx.de>

lib/tiny-printf.c: Add tiny printf function for space limited environments

This patch adds a small printf() version that supports all basic formats.
Its intented to be used in U-Boot SPL versions on platforms with very
limited internal RAM sizes.

To enable it, just define CONFIG_USE_TINY_PRINTF in your defconfig. This
will result in the SPL using this tiny function and the main U-Boot
still using the full-blown printf() function.

This code was copied from:
http://www.sparetimelabs.com/printfrevisited
With mostly only coding style related changes so that its checkpatch
clean.

The size reduction is about 2.5KiB. Here a comparison for the db-mv784mp-gp
(Marvell AXP) SPL:

Without this patch:
58963 18536 1928 79427 13643 ./spl/u-boot-spl

With this patch:
56542 18536 1956 77034 12cea ./spl/u-boot-spl

Note:
To make it possible to compile tiny-printf.c instead of vsprintf.c when
CONFIG_USE_TINY_PRINTF is defined, the functions printf() and vprintf() are
moved from common/console.c into vsprintf.c in this patch.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>

# 2419cd16 03-Oct-2015 Simon Glass <sjg@chromium.org>

dm: tpm: Drop CONFIG_DM_TPM

Now that all TPM drivers use driver model, we can drop the special driver
model CONFIG option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>

# 027b728d 06-Oct-2015 Julius Werner <jwerner@chromium.org>

Add support for LZ4 decompression algorithm

This patch adds support for LZ4-compressed FIT image contents. This
algorithm has a slightly worse compression ration than LZO while being
nearly twice as fast to decompress. When loading images from a fast
storage medium this usually results in a boot time win.

Sandbox-tested only since I don't have a U-Boot development system set
up right now. The code was imported unchanged from coreboot where it's
proven to work, though. I'm mostly interested in getting this recognized
by mkImage for use in a downstream project.

Signed-off-by: Julius Werner <jwerner@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# a7d660bc 22-Aug-2015 Simon Glass <sjg@chromium.org>

tpm: Add Kconfig options for TPMs

Add new Kconfig options for TPMs in preparation for moving boards to use
Kconfig for TPM configuration.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 867a6ac8 31-Jul-2015 Simon Glass <sjg@chromium.org>

efi: Add start-up library code

When running as an EFI application, U-Boot must request memory from EFI,
and provide access to the boot services U-Boot needs.

Add library code to perform these tasks. This includes efi_main() which is
the entry point from EFI. U-Boot is built as a shared library.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d1389403 23-Jun-2015 Simon Glass <sjg@chromium.org>

Add a dhrystone benchmark command

Drystone provides a convenient sanity check that the CPU is running at full
speed. Add this as a command which can be enabled as needed.

Note: I investigated using Coremark for this but there was a license
agreement and I could not work out if it was GPL-compatible.

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

# f7848d90 22-Jun-2015 Joe Hershberger <joe.hershberger@ni.com>

Allow CONFIG_REGEX to be disabled when CONFIG_NET

Instead of selecting REGEX when NET is enabled, make it the default, but
allow boards that are tiny to disable it and lose functionality on all
but the first Ethernet adapter.

cm-bf548, bf538f-ezkit, and bf533-stamp need this. None appear to have
more than one Ethernet interface.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# 3850dbe8 11-Jun-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

blackfin: fix undefined reference to srand and rand

Commit 9ba9e85f3f1c (net: Fix NET_RANDOM_ETHADDR dependencies)
accidentally dropped CONFIG_LIB_RAND defines for 14 Blackfin boards.

Prior to that commit, those boards defined CONFIG_LIB_RAND, but not
CONFIG_NET_RANDOM_ETHADDR. So, commit 9ba9e85f3f1c should not have
touched them, but in fact it ripped CONFIG_LIB_RAND off from all the
header files, which caused undefined reference to srand and rand.
CONFIG_LIB_RAND=y must be revived for such boards.

BTW, this commit indeed makes it better, but even with this fix,
three boards (bf533-stamp, bf538f-ezkit, cm-bf548) still can not
build due to region 'ram' overflowed error. This was cause by
commit 6eed3786c68c (net: Move the CMD_NET config to defconfigs)
because CMD_NET selects NET, and NET selects REGEX. Eventually,
some boards were newly enabled with CONFIG_REGEX, increasing the
memory footprint. A patch is expected to fix the build error.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 9ba9e85f 25-May-2015 Michal Simek <michal.simek@amd.com>

net: Fix NET_RANDOM_ETHADDR dependencies

NET_RANDOM_ETHADDR depends on lib/rand.c. This patch adds dependency to
Kconfig to ensure that library is also compiled.

Remove the definitions from Blackfin boards' include/configs.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 6501ff62 20-Apr-2015 Przemyslaw Marczak <p.marczak@samsung.com>

lib: Kconfig: add entry for errno_str() function

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1a60650c 21-Apr-2015 Joe Hershberger <joe.hershberger@ni.com>

kconfig: Move REGEX to Kconfig

Having this as a Kconfig allows it to be a dependent feature.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8156345d 06-Mar-2015 Simon Glass <sjg@chromium.org>

sandbox: Move CONFIG_SYS_VSNPRINTF to Kconfig

Move this over to Kconfig and tidy up.

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

# 94e3c8c4 19-Feb-2015 gaurav rana <gaurav.rana@freescale.com>

crypto/fsl - Add progressive hashing support using hardware acceleration.

Currently only normal hashing is supported using hardware acceleration.
Added support for progressive hashing using hardware.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
Signed-off-by: Gaurav Rana <gaurav.rana@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>

# d9f23c7f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

lib/rsa: Add Kconfig for devices supporting RSA Modular Exponentiation

Kconfig option added for devices which support RSA Verification.
1. RSA_SOFTWARE_EXP
Enables driver for supporting RSA Modular Exponentiation in Software
2. RSA_FREESCALE_EXP
Enables driver for supporting RSA Modular Exponentiation using Freescale specific
driver

The above drivers use RSA uclass

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
(Removed duplicate line in Kconfig comment)

Change-Id: I7663c4d5350e2bfc3dfa2696f70ef777d6ccc6f6

# c4beb22f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

FIT: Modify option FIT_SIGNATURE in Kconfig

For FIT signature based approach to work, RSA library needs to be selected.
The FIT_SIGNATURE option in Kconfig is modified to automatically select RSA.
Selecting RSA compiles the RSA library required for image verification.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 45ccec8f 23-Oct-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

kconfig: move CONFIG_USE_PRIVATE_LIBGCC to Kconfig

The private libgcc is supported only on ARM, MIPS, PowerPC, SH, x86.
Those architectures should "select" HAVE_PRIVATE_LIBGCC and
CONFIG_USE_PRIVATE_LIBGCC should depend on it.

Currently, this option is enabled on Tegra boards and x86 architecture.
Move the definition from header files to Kconfig.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Tested-by: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: Tom Warren <twarren@nvidia.com>

# 8c688bc4 23-Oct-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

kconfig: move CONFIG_SYS_HZ to lib/Kconfig

CONFIG_SYS_HZ is always defined as 1000 in config_fallbacks.h
(but some boards still have redundant definitions).

This commit moves the definition and the document in README to
Kconfig. Since lib/Kconfig can assure that CONFIG_SYS_HZ is 1000,
the sanity check in lib/time.c should be removed.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Reviewed-by: Marek Vasut <marex@denx.de>

# b0928da6 16-Sep-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

kconfig: move CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED to Kconfig

If this option is enabled, the objects under lib/ directory
are compiled with speed optimization, not size optimization.
(Currently, only used by some Blackfin boards.)

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# ed36323f 16-Sep-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

kconfig: add blank Kconfig files

This would be useful to start moving various config options.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# 747093dd 30-Apr-2022 Simon Glass <sjg@chromium.org>

vpl: Add Kconfig options for VPL

Add VPL versions of commonly used Kconfig options.

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

# 11232139 06-Apr-2022 Tom Rini <trini@konsulko.com>

nds32: Remove the architecture

As removal of nds32 has been ack'd for the Linux kernel, remove support
here as well.

Cc: Rick Chen <rick@andestech.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Rick Chen <rick@andestech.com>

# fd210fee 28-Mar-2022 Philippe Reynes <philippe.reynes@softathome.com>

lib: allow to build asn1 decoder and oid registry in SPL

This commit adds the options:
- SPL_ASN1_DECODER
- SPL_OID_REGISTRY

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>

# 7d44a985 28-Mar-2022 Philippe Reynes <philippe.reynes@softathome.com>

lib: Kconfig: enhance the help of OID_REGISTRY

Enhance the help for the config OID_REGISTRY.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>

# a0e71d96 28-Mar-2022 Philippe Reynes <philippe.reynes@softathome.com>

lib: Kconfig: enhance help for ASN1

Enhance the help for configs ASN1_COMPILER
and ASN1_decoder.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>

# 761a1786 27-Jan-2022 Tom Rini <trini@konsulko.com>

Merge tag 'dm-pull-26jan22' of https://source.denx.de/u-boot/custodians/u-boot-dm

acpi refactoring to allow non-x86 use
binman support for bintools (binary tools)
minor tools improvements in preparation for FDT signing
various minor fixes and improvements


# 334a9b9d 25-Nov-2021 Loic Poulain <loic.poulain@linaro.org>

lib/circbuf: Make circbuf selectable symbol

It is currenly only used from usbtty driver but make it properly
selectable via Kconfig symbol, for future usage.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>

# e1722fcb 01-Dec-2021 Simon Glass <sjg@chromium.org>

x86: Allow any arch to generate ACPI tables

These have sadly found their way to ARM now. Allow any arch to support
generating ACPI tables.

Disable this for the tools build.

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

# 7c3fd5c2 26-Dec-2021 Qu Wenruo <wqu@suse.com>

lib: add BLAKE2 hash support

The code is cross-ported from BLAKE2 reference implementation
(https://github.com/BLAKE2/BLAKE2).

With minimal change to remove unused macros/features.

Currently there is only one user inside U-boot (btrfs), and since it
only utilize BLAKE2B, all other favors are all removed.

Signed-off-by: Qu Wenruo <wqu@suse.com>
[trini: Rename ROUND to R to avoid clash with <linux/bitops.h>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 97f2a749 04-Jan-2022 Eugen Hristev <eugen.hristev@microchip.com>

lib: Kconfig: fix PHANDLE_CHECK_SEQ position outside of menu

CONFIG_PHANDLE_CHECK_SEQ is outside of the menu 'Library routines'
thus it's invisible in menuconfig and cannot be selected.
Fix this by moving the 'endmenu' after the PHANDLE_CHECK_SEQ definition

Fixes: c589132a1d ("fdt: Use phandle to distinguish DT nodes with same name")
Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
Reviewed-by: Aswath Govindraju <a-govindraju@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 726cd983 29-Dec-2021 Simon Glass <sjg@chromium.org>

efi: Make unicode printf available to the app

This is needed to show unicode strings. Enable this code in the app.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>

# 6405ab7a 24-Nov-2021 Simon Glass <sjg@chromium.org>

Convert CONFIG_PHYSMEM to Kconfig

This converts the following to Kconfig:
CONFIG_PHYSMEM

Signed-off-by: Simon Glass <sjg@chromium.org>
Suggested-by: Sean Anderson <seanga2@gmail.com>

# ac7606af 14-Nov-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

lmb: fix typo 'commun'

%s/commun/common/

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

# e7d285b2 25-Sep-2021 Simon Glass <sjg@chromium.org>

image: Use the correct checks for CRC32

Add a host Kconfig for CRC32. With this we can use CONFIG_IS_ENABLED(CRC32)
directly in the host build, so drop the unnecessary indirection.

Add a few more conditions to SPL_CRC32 to avoid build failures as well as
TPL_CRC32. Also update hash.c to make crc32 optional and to actually take
notice of SPL_CRC32.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# 2c21256b 25-Sep-2021 Simon Glass <sjg@chromium.org>

hash: Use Kconfig to enable hashing in host tools and SPL

At present when building host tools, we force CONFIG_SHAxxx to be enabled
regardless of the board Kconfig setting. This is done in the image.h
header file.

For SPL we currently just assume the algorithm is desired if U-Boot proper
enables it.

Clean this up by adding new Kconfig options to enable hashing on the host,
relying on CONFIG_IS_ENABLED() to deal with the different builds.

Add new SPL Kconfigs for hardware-accelerated hashing, to maintain the
current settings.

This allows us to drop the image.h code and the I_WANT_MD5 hack.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# 603d15a5 25-Sep-2021 Simon Glass <sjg@chromium.org>

spl: cypto: Bring back SPL_ versions of SHA

Unfortunately these were removed by mistake. This means that adding hash
support to SPL brings in all software algorithms, with a substantial
increase in code size.

The origin of the problem was renaming them to SPL_FIT_xxx and then these
were removed altogether in a later commit.

Add them back. This aligns with CONFIG_MD5, for example, which has an SPL
variant.

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: f5bc9c25f31 ("image: Rename SPL_SHAxxx_SUPPORT to SPL_FIT_SHAxxx")
Fixes: eb5171ddec9 ("common: Remove unused CONFIG_FIT_SHAxxx selectors")
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# 6674edaa 16-Sep-2021 Tom Rini <trini@konsulko.com>

Merge tag 'v2021.10-rc4' into next

Prepare v2021.10-rc4

Signed-off-by: Tom Rini <trini@konsulko.com>

# gpg: Signature made Tue 14 Sep 2021 06:58:32 PM EDT
# gpg: using RSA key 1A3C7F70E08FAB1707809BBF147C39FF9634B72C
# gpg: Good signature from "Thomas Rini <trini@konsulko.com>" [ultimate]

# Conflicts:
# board/Arcturus/ucp1020/spl.c
# cmd/mvebu/Kconfig
# common/Kconfig.boot
# common/image-fit.c
# configs/UCP1020_defconfig
# configs/sifive_unmatched_defconfig
# drivers/pci/Kconfig
# include/configs/UCP1020.h
# include/configs/sifive-unmatched.h
# lib/Makefile
# scripts/config_whitelist.txt


# 5145bc73 01-Sep-2021 Oleksandr Suvorov <oleksandr.suvorov@foundries.io>

lib: fix typos in Kconfig

There are trivial typos in the Kconfig file. Fixed them.
Also, fixed grammar in the descriptions with typos.

Fixes: d56b4b1974 ("configs: Migrate RBTREE, LZO, CMD_MTDPARTS, CMD_UBI and CMD_UBIFS")
Fixes: 7264f2928b ("spl: fit: Eanble GZIP support for image decompression")
Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# e60e4499 02-Sep-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

lib: Drop SHA512_ALGO in lieu of SHA512

SHA512_ALGO was used as a "either SHA512 or SHA384", although the
implementations of these two algorithms share a majority of code.

From a Kconfig interface perspective, it makes sense to present two
distinct options. This requires #ifdefing out the SHA512
implementation from sha512.c. The latter doesn't make any sense.

It's reasonable to say in Kconfig that SHA384 depends on SHA512, and
seems to be the more polite way to handle the selection.

Thus, automatically select SHA512 when SHA384 is enabled.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# b4c2c151 27-Aug-2021 Michal Simek <michal.simek@amd.com>

Kconfig: Remove all default n/no options

default n/no doesn't need to be specified. It is default option anyway.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
[trini: Rework FSP_USE_UPD portion]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 928a8be7 29-Jul-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

lib: ecdsa: Implement UCLASS_ECDSA verification on target

Implement the crypto_algo .verify() function for ecdsa256. Because
it backends on UCLASS_ECDSA, this change is focused on parsing the
keys from devicetree and passing this information to the specific
UCLASS driver.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# fa3f1f1d 24-Jul-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: disable CONFIG_SPL_HEXDUMP by default

CONFIG_HEXDUMP is needed to display UEFI variables using 'printenv -e'.

Enabling CONFIG_SPL_HEXDUMP only makes sense for debugging purposes.
Hence CONFIG_SPL_HEXDUMP should not be enabled by default.

The following boards currently have CONFIG_SPL_HEXDUMP=y. This includes
boards that don't use SPL at all.

axm_defconfig
imx8mm-cl-iot-gate_defconfig
imx8mm_venice_defconfig
imxrt1020-evk_defconfig
imxrt1050-evk_defconfig
kontron_sl28_defconfig
kp_imx53_defconfig
lx2160ardb_tfa_stmm_defconfig
mt7622_rfb_defconfig
octeon_ebb7304_defconfig
octeon_nic23_defconfig
qemu_arm64_defconfig
qemu_arm_defconfig
qemu-riscv32_defconfig
qemu-riscv32_smode_defconfig
qemu-riscv64_defconfig
qemu-riscv64_smode_defconfig
qemu-x86_64_defconfig
qemu-x86_defconfig
sandbox64_defconfig
sandbox_defconfig
stm32mp15_basic_defconfig
stm32mp15_trusted_defconfig
synquacer_developerbox_defconfig
taurus_defconfig
xilinx_versal_virt_defconfig

The patch only keeps it enabled on

sandbox_spl_defconfig

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 1a46cb6c 02-Jul-2021 Simon Glass <sjg@chromium.org>

lib: Create a new Kconfig option for charset conversion

Rather than looking at two KConfig options in the Makefile, create a new
Kconfig option for compiling lib/charset.c

Enable it for UFS also, which needs this support.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 26dd9936 08-Jul-2021 Steffen Jaeckel <jaeckel-floss@eyet-services.de>

lib: add crypt subsystem

Add the basic functionality required to support the standard crypt
format.
The files crypt-sha256.c and crypt-sha512.c originate from libxcrypt and
their formatting is therefor retained.
The integration is done via a crypt_compare() function in crypt.c.

```
libxcrypt $ git describe --long --always --all
tags/v4.4.17-0-g6b110bc
```

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 7d0f3fbb 11-Jun-2021 Tero Kristo <t-kristo@ti.com>

lib: rational: copy the rational fraction lib routines from Linux

Copy the best rational approximation calculation routines from Linux.
Typical usecase for these routines is to calculate the M/N divider
values for PLLs to reach a specific clock rate.

This is based on linux kernel commit:
"lib/math/rational.c: fix possible incorrect result from rational
fractions helper"
(sha1: 323dd2c3ed0641f49e89b4e420f9eef5d3d5a881)

Signed-off-by: Tero Kristo <t-kristo@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Tero Kristo <kristo@kernel.org>

# ec0512b1 24-May-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

Revert "lib: introduce HASH_CALCULATE option"

When we think of Kconfig, we usually think of features that we like
to enable or not. Ideally, we wouldn't use Kconfig to fix a build
issue, although sometimes it might make sense. With Kconfig it's hard
to guarantee that the fix is universal. We can only say that it works
for the set of tested configurations. In the majority of cases, it's
preferable to let the linker figure things out for us.

The reverted commit attempted to fix a build issue by adding an
invisible Kconfig option. This is wrong in several ways:

It invents a new Kconfig variable when CONFIG_HASH already
exists for the same purpose.
Second, hash-checksum.c makes use of the hash_progressive_lookup_algo()
symbol, which is only provided with CONFIG_HASH, but this dependency
was not expressed in the reverted patch.

It feels like Kconfig is turning into a listing of all available
source files, and a buffet to 'select' which ones to compile. The
purpose of this revert is to enable the next change to make use of
CONFIG_HASH instead of adding to Kconfig.

This reverts commit 87316da05f2fd49d3709275e64ef0c5980366ade.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Acked-by: Masahisa Kojima <masahisa.kojima@linaro.org>

# 1621d3c4 10-May-2021 Bin Meng <bmeng.cn@gmail.com>

lib: kconfig: Limit BINMAN_FDT for OF_SEPARATE or OF_EMBED

Generally speaking BINMAN_FDT makes sense for OF_SEPARATE or OF_EMBED.
For the other OF_CONTROL methods, it's quite possible binman node is
not available as binman is invoked during the build phase instead of
runtime. Let's only turn it on for OF_SEPARATE or OF_EMBED by default.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 87316da0 13-May-2021 Masahisa Kojima <masahisa.kojima@linaro.org>

lib: introduce HASH_CALCULATE option

Build error occurs when CONFIG_EFI_SECURE_BOOT or
CONFIG_EFI_CAPSULE_AUTHENTICATE is enabled,
because hash-checksum.c is not compiled.

Since hash_calculate() implemented in hash-checksum.c can be
commonly used aside from FIT image signature verification,
this commit itroduces HASH_CALCULATE option to decide
if hash-checksum.c shall be compiled.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# e2ae483c 13-May-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

hash: Kconfig option for SHA512 hardware acceleration

Commit a479f103dc1c ("hash: Allow for SHA512 hardware implementations")
defined function definitions for hardware accelerated SHA384 and SHA512.
If CONFIG_SHA_HW_ACCEL=y, these functions are used.

We already have boards using CONFIG_SHA_HW_ACCEL=y but none implements the
new functions hw_sha384() and hw_sha512().

For implementing the EFI TCG2 protocol we need SHA384 and SHA512. The
missing hardware acceleration functions lead to build errors on boards like
peach-pi_defconfig.

Introduce a new Kconfig symbol CONFIG_SHA512_HW_ACCEL to control if the
functions hw_sha384() and hw_sha512() shall be used to implement the SHA384
and SHA512 algorithms.

Fixes: a479f103dc1c ("hash: Allow for SHA512 hardware implementations")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

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

# 6d66502b 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: Add 2 config to define the max number of regions

Add 2 configs CONFIG_LMB_MEMORY_REGIONS and CONFIG_LMB_RESERVED_REGIONS
to change independently the max number of the regions in lmb
library.

When CONFIG_LMB_USE_MAX_REGIONS=y, move the lmb property arrays to
struct lmb and manage the array size with the element 'max' of struct
lmb_region; their are still allocated in stack.

When CONFIG_LMB_USE_MAX_REGIONS=n, keep the current location in
struct lmb_region to allow compiler optimization.

Increase CONFIG_LMB_RESERVED_REGIONS is useful to avoid lmb errors in
bootm when the number of reserved regions (not adjacent) is reached:
+ 1 region for relocated U-Boot
+ 1 region for initrd
+ 1 region for relocated linux device tree
+ reserved memory regions present in Linux device tree.

The current limit of 8 regions is reached with only 5 reserved regions
in DT.

see Linux kernel commit bf23c51f1f49 ("memblock: Move memblock arrays
to static storage in memblock.c and make their size a variable")

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# 4fa0150d 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: move MAX_LMB_REGIONS value in Kconfig

Move MAX_LMB_REGIONS value in Kconfig, the max number of the regions
in lmb library.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# 77b8cfef 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: move CONFIG_LMB in Kconfig

Migrate CONFIG_LMB in Kconfig.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# a479f103 16-Feb-2021 Joel Stanley <joel@jms.id.au>

hash: Allow for SHA512 hardware implementations

Similar to support for SHA1 and SHA256, allow the use of hardware hashing
engine by enabling the algorithm and setting CONFIG_SHA_HW_ACCEL /
CONFIG_SHA_PROG_HW_ACCEL.

Signed-off-by: Joel Stanley <joel@jms.id.au>

# f2c1442e 14-Mar-2021 Simon Glass <sjg@chromium.org>

bloblist: Make BLOBLIST_TABLES depend on BLOBLIST

Add an extra condition here since we cannot put x86 tables in a bloblist
when bloblists are not supported.

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

# e0103158 25-Feb-2021 Bin Meng <bmeng.cn@gmail.com>

lib: kconfig: Mention CONFIG_ADDR_MAP limitation in the help

Mention that CONFIG_ADDR_MAP only works in the post-relocation phase.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>

# 56e7257c 03-Feb-2021 Bin Meng <bmeng.cn@gmail.com>

lib: Fix BINMAN_FDT dependency

lib/binman.c references the following 3 ofnode APIs:
ofnode_first_subnode(), ofnode_path() and ofnode_read_bool().

These APIs get built only when DM is on. Fix the dependency then.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 59e4e391 18-Jan-2021 Tom Rini <trini@konsulko.com>

Merge https://gitlab.denx.de/u-boot/custodians/u-boot-riscv

- Update qemu-riscv.rst build instructions.
- Add support for SPI on Kendryte K210.
- Add Microchip PolarFire SoC Icicle Kit support.
- Add support for an early timer.
- Select TIMER_EARLY to avoid infinite recursion for Trace.


# a80f8513 17-Jan-2021 Pragnesh Patel <pragnesh.patel@sifive.com>

trace: select TIMER_EARLY to avoid infinite recursion

When tracing functions is enabled this adds calls to
__cyg_profile_func_enter() and __cyg_profile_func_exit() to the traced
functions.

__cyg_profile_func_enter() and __cyg_profile_func_exit() invoke
timer_get_us() to record the entry and exit time.

initr_dm() will make gd->dm_root = NULL and gd->timer = NULL, so
timer_get_us() -> get_ticks() -> dm_timer_init() will lead to an
indefinite recursion.

So select TIMER_EARLY when tracing got enabled.

Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Rick Chen <rick@andestech.com>

# 6205bbb1 04-Jan-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lib: cosmetic update of CONFIG_LIB_ELF description

Change 2 typo error in CONFIG_LIB_ELF description:
- Supoort => Support
- fir => for

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c589132a 02-Dec-2020 Aswath Govindraju <a-govindraju@ti.com>

fdt: Use phandle to distinguish DT nodes with same name

While assigning the sequence number to subsystem instances by reading the
aliases property, only DT nodes names are compared and not the complete
path. This causes a problem when there are two DT nodes with same name but
have different paths.

In arch/arm/dts/k3-am65-main.dtsi there are two USB controllers with the
same device tree node name but different path. When aliases are defined for
these USB controllers then fdtdec_get_alias_seq() fails to pick the correct
instance for a given index.

fdt_path_offset() function is slow and this would effect the U-Boot
startup. To avert the time penalty on all boards, apply this extra check
only when required by using a config option.

Fix it by comparing the phandles of DT nodes after the node names match,
under a config option.

Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Fix whitespace error in Kconfig:
Signed-off-by: Simon Glass <sjg@chromium.org>

# 28cef9ca 19-Nov-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

fs: fat: create correct short names

The current function set_name() used to create short names has the
following deficiencies resolved by this patch:

* Long names (e.g. FOO.TXT) are stored even if a short name is enough.
* Short names with spaces are created, e.g. "A ~1.TXT".
* Short names with illegal characters are created, e.g. "FOO++BAR".
* Debug output does not not consider that the short file name has no
concluding '\0'.

The solution for the following bug is split of into a separate patch:

* Short file names must be unique.

This patch only provides the loop over possible short file names.

Fixes: c30a15e590c ("FAT: Add FAT write feature")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# e4f8e543 05-Nov-2020 Simon Glass <sjg@chromium.org>

smbios: Drop the unused Kconfig options

Now that we can use devicetree to specify this information, drop the old
CONFIG options.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 44c74bdd 05-Nov-2020 Simon Glass <sjg@chromium.org>

sysinfo: Provide a default driver to set SMBIOS values

Some boards want to specify the manufacturer or product name but do not
need to have their own sysinfo driver.

Add a default driver which provides a way to specify this SMBIOS
information in the devicetree, without needing any board-specific
functionality.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d2cb7a22 04-Nov-2020 Simon Glass <sjg@chromium.org>

x86: Allow putting some tables in the bloblist

At present all tables are placed starting at address f0000 in memory, and
can be up to 64KB in size. If the tables are very large, this may not
provide enough space.

Also if the tables point to other tables (such as console log or a ramoops
area) then we must allocate other memory anyway.

The bloblist is a nice place to put these tables since it is contiguous,
which makes it easy to reserve this memory for linux using the 820 tables.

Add an option to put some of the tables in the bloblist. For SMBIOS and
ACPI, create suitable pointers from the f0000 region to the new location
of the tables.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
[bmeng: squashed in http://patchwork.ozlabs.org/project/uboot/patch/
20201105062407.1.I8091ad931cbbb5e3b6f6ababdf3f8d5db0d17bb9@changeid/]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# 415eab06 03-Nov-2020 Christian Gmeiner <christian.gmeiner@gmail.com>

smbios: add parsing API

Add a very simple API to be able to access SMBIOS strings
like vendor, model and bios version.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 72eda507 27-Oct-2020 Sean Anderson <seanga2@gmail.com>

lib: Add getopt

Some commands can get very unweildy if they have too many positional
arguments. Adding options makes them easier to read, remember, and
understand.

This implementation of getopt has been taken from barebox, which has had
option support for quite a while. I have made a few modifications to their
version, such as the removal of opterr in favor of a separate getopt_silent
function. In addition, I have moved all global variables into struct
getopt_context.

The getopt from barebox also re-orders the arguments passed to it so that
non-options are placed last. This allows users to specify options anywhere.
For example, `ls -l foo/ -R` would be re-ordered to `ls -l -R foo/` as
getopt parsed the options. However, this feature conflicts with the const
argv in cmd_tbl->cmd. This was originally added in 54841ab50c ("Make sure
that argv[] argument pointers are not modified."). The reason stated in
that commit is that hush requires argv to stay unmodified. Has this
situation changed? Barebox also uses hush, and does not have this problem.
Perhaps we could use their fix?

I have assigned maintenance of getopt to Simon Glass, as it is currently
only used by the log command. I would also be fine maintaining it.

Signed-off-by: Sean Anderson <seanga2@gmail.com>

# 26637e2e 12-Sep-2020 Simon Glass <sjg@chromium.org>

lib: Allow hexdump to be used in SPL

It is sometimes useful to output hex dumps in SPL. Add a config option to
allow this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# e87dfb05 05-Aug-2020 Andrii Anisov <andrii_anisov@epam.com>

lib: sscanf: add sscanf implementation

Port sscanf implementation from mini-os and introduce new
Kconfig option to enable it: CONFIG_SSCANF. Disable by default.

Signed-off-by: Andrii Anisov <andrii_anisov@epam.com>
Signed-off-by: Anastasiia Lukianenko <anastasiia_lukianenko@epam.com>
Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>

# 81014f73 30-Jul-2020 Joao Marcos Costa <joaomarcos.costa@bootlin.com>

include/u-boot, lib/zlib: add sources for zlib decompression

Add zlib (v1.2.11) uncompr() function to U-Boot. SquashFS depends on
this function to decompress data from a raw disk image. The actual
support for zlib into SquashFS sources will be added in a follow-up
commit.

Signed-off-by: Joao Marcos Costa <joaomarcos.costa@bootlin.com>

# 69be8fd1 03-Jun-2020 Marek Szyprowski <m.szyprowski@samsung.com>

powerpc: move ADDR_MAP to Kconfig

Move ADDR_MAP related config options from include/configs/*.h to the
proper place in lib/Kconfig. This has been done using
./tools/moveconfig.py and manual inspection of the generated changes.
This is a preparation to use ADDR_MAP helper on ARM 32bit Raspberry Pi4
board for mapping the PCIe XHCI MMIO, which is above the 4GiB identity
mapping limit.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# d16b38f4 15-Apr-2020 Reuben Dowle <reubendowle0@gmail.com>

Add support for SHA384 and SHA512

The current recommendation for best security practice from the US government
is to use SHA384 for TOP SECRET [1].

This patch adds support for SHA384 and SHA512 in the hash command, and also
allows FIT images to be hashed with these algorithms, and signed with
sha384,rsaXXXX and sha512,rsaXXXX

The SHA implementation is adapted from the linux kernel implementation.

[1] Commercial National Security Algorithm Suite
http://www.iad.gov/iad/programs/iad-initiatives/cnsa-suite.cfm

Signed-off-by: Reuben Dowle <reuben.dowle@4rf.com>

# 43e442a5 26-May-2020 Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

kconfig: fix some typos

Signed-off-by: Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

# eff5a547 22-May-2020 Michael Walle <michael@walle.cc>

cmd: zip: automatically pull in gzip()

Move the CONFIG_GZIP_COMPRESSED from a config.h macro to a Kconfig menu
item. It is not selectable by a user because there is no reason to do
so. Instead it will be automatically selected by the stuff which uses
gzip(), like the zip command.

Remove it from the config_whitelist.txt. Also remove
CONFIG_GZIP_COMPRESS_DEF_SZ as this was never used on any board. The
default seems to be sane, otherwise it should be added as a Kconfig
option.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8239be61 06-May-2020 Simon Glass <sjg@chromium.org>

lib: Allow MD5 to be enabled in SPL

At present the MD5 option cannot be enabled by board configs since it has
no Kconfig name. It is generally enabled, so long as FIT support is
present. But not all boards use FIT, particularly in SPL

Fix this and add an option for SPL as well. This allows board code to call
md5() even if FIT support is not enabled.

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

# 04cb3994 21-Apr-2020 Weijie Gao <weijie.gao@mediatek.com>

lib: enable lzma decompression support for SPL build

This patch enables LZMA decompression support for SPL build

Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>

# 2a2119e1 05-Mar-2020 Atish Patra <atishp@atishpatra.org>

lib: kconfig: Add option to set BZIP2 compression method

There is no way to select BZIP2 compression method.
Add it under library/compression config where all other
compression related configs are present.

Signed-off-by: Atish Patra <atish.patra@wdc.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 805b3cac 12-Feb-2020 Keerthy <j-keerthy@ti.com>

lib: elf: Move the generic elf loading/validating functions to lib

Move the generic elf loading/validating functions to lib/
so that they can be re-used and accessed by code existing
outside cmd.

While at it remove the duplicate static version of load_elf_image_phdr
under arch/arm/mach-imx/imx_bootaux.c.

Signed-off-by: Keerthy <j-keerthy@ti.com>
Suggested-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>

# 1611235b 19-Jan-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: Kconfig dependencies for pseudo-random library

drivers/rng/sandbox_rng.c requires rand() to be defined but configuration
option CONFIG_CONFIG_LIB_RAND selected in drivers/rng/Kconfig does not
exist.

test/lib/test_aes.c requires rand() to be defined.

Fix the selection criteria for choice "Pseudo-random library support type".

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 3c10dc95 06-Dec-2019 Simon Glass <sjg@chromium.org>

binman: Add a library to access binman entries

SPL and TPL can access information about binman entries using link-time
symbols but this is not available in U-Boot proper. Of course it could be
made available, but the intention is to just read the device tree.

Add support for this, so that U-Boot can locate entries.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# b4adf627 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: crypto: add x509 parser

Imported from linux kernel v5.3:
x509.asn1 without changes
x509_akid.asn1 without changes
x509_parser.h without changes
x509_cert_parser.c with changes marked as __UBOOT__
x509_public_key.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# a9b45e6e 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add oid registry utility

Imported from linux kernel v5.3:
build_OID_registry without changes
oid_registry.h without changes
oid_registry.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# ab8a0e06 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add asn1 decoder

Imported from linux kernel v5.3:
lib/asn1_decoder.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 2b12196d 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

cmd: add asn1_compiler

Imported from linux kernel v5.3:
asn1.h without changes
asn1_ber_bytecode.h without changes
asn1_decoder.h without changes
asn1_compiler.c without changes

This host command will be used to create a ASN1 parser, for example,
for pkcs7 messages or x509 certificates. More specifically, it will
generate *byte code* which will be interpreted by asn1 decoder library.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 05429b6c 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

rtc: move date.c from drivers/rtc/ to lib/

In the next commit, rtc_mktime(), for compatibility with linux, will be
implemented using rtc_mktime(), which is no longer drivers/rtc specific.
So move this file under lib/.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 37ef1774 10-Nov-2019 Thomas Hebb <tommyhebb@gmail.com>

Kconfig: disambiguate config names for tiny printf

27084c03d36a ("spl: Allow tiny printf() to be controlled in SPL and
TPL") split this option in two for TPL and SPL, but didn't change the
Kconfig names, making them hard to set quickly.

Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>

# 0d76afc0 27-Oct-2019 Simon Glass <sjg@chromium.org>

fdt: Add Kconfig options to control code size

For better or worse libfdt recent grew a lot of code that checks the
validity of the device tree in great detail. When using unsigned or
unverified data this makes things safer, but it does add to code size.

Add some controls to select the trade-off between safety and code size.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 27084c03 25-Sep-2019 Simon Glass <sjg@chromium.org>

spl: Allow tiny printf() to be controlled in SPL and TPL

At present there is only one control for this and it is used for both SPL
and TPL. But SPL might have a lot more space than TPL so the extra cost of
a full printf() might be acceptable.

Split the option into two, providing separate SPL and TPL controls. The
TPL setting defaults to the same as SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2a51e16b 07-Jun-2019 Tom Rini <trini@konsulko.com>

configs: Make USE_TINY_PRINTF depend on SPL||TPL and be default

The USE_TINY_PRINTF symbol only changes things within SPL and TPL
builds, so make it depend on that support. Next, make it default as
within these cases we should rarely have need of more advanced print
formats outside of the debug context.

To do this, in a few cases we need to correct our Kconfig dependencies
as we had cases of non-SPL targets select'ing this symbol. Finally, in
the case of a few boards we really do need the full printf
functionality.

Signed-off-by: Tom Rini <trini@konsulko.com>

# da0fb5fd 02-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: make call depth limit customizable

Up to now we had hard coded values for the call depth up to which trace
records are created: 200 for early tracing, 15 thereafter. UEFI
applications reach a call depth of 80 or above.

Provide customizing settings for the call trace depth limit and the early
call trace depth limit. Use the old values as defaults.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8509f22a 29-Apr-2019 Marek Behún <marek.behun@nic.cz>

lib: add Zstandard decompression support

Add the zstd library from Linux kernel (only decompression support).
There are minimal changes to build with U-Boot, otherwise the files are
identical to Linux commit dc35da16 from March 2018, the files had not
been touched since in kernel. Also SPDX lincese tags were added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 83a486b6 29-Apr-2019 Marek Behún <marek.behun@nic.cz>

lib: Add xxhash support

This adds the xxhash support from Linux. Files are almost identical to
those added to Linux in commit 5d240522 ("lib: Add xxhash module") (they
haven't been touched since in Linux). The only difference is to add some
includes to be compatible with U-Boot. Also SPDX lincese tags were
added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 5132361a 29-Apr-2019 Heiko Schocher <hs@denx.de>

lib: Kconfig: fix help text for GZIP

commit 95f4bbd581cf ("lib: fdt: Allow LZO and GZIP DT compression in U-Boot")

introduced Kconfig option for gzip in U-Boot, but help text
says gzip for SPL, which is wrong. Fix this.

Signed-off-by: Heiko Schocher <hs@denx.de>
Acked-by: Marek Vasut <marex@denx.de>

# 1c6eb075 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE_BUFFER_SIZE et al to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE_BUFFER_SIZE
CONFIG_TRACE_EARLY_SIZE
CONFIG_TRACE_EARLY
CONFIG_TRACE_EARLY_ADDR

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

# a24a78d7 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE

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

# 54969b40 21-Mar-2019 Thierry Reding <treding@nvidia.com>

fdtdec: Add Kconfig symbol for tests

Runtime tests are provided as a test_fdtdec command implementation. Add
a Kconfig symbol that allows this command to be built so that the tests
can be used.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 95f4bbd5 08-Mar-2019 Marek Vasut <marex@denx.de>

lib: fdt: Allow LZO and GZIP DT compression in U-Boot

Add required Kconfig symbols, Makefile bits and macro fixes in a
few places to support LZO and DT compression in U-Boot. This can
save a lot of space with multi-DTB fitImages.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>

# 6e705114 13-Jan-2019 Chris Packham <judge.packham@gmail.com>

lib: Kconfig: spelling fixes

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 048c6e89 06-Nov-2018 Simon Glass <sjg@chromium.org>

spl: lz4: Allow use of lz4 compression in SPL

In some cases U-Boot is compressed and it is useful to be able to
decompress it in SPL. Add a Kconfig and Makefile change to allow this.
Note that this does not actually implement decompression.

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

# 2895c4b7 15-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

kconfig: Introduce HAVE_ARCH_IOMAP

Introduce a new Kconfig option for architecture codes to control
whether it provides io{read,write}{8,16,32} I/O accessor functions.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5592a633 01-Oct-2018 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt in TPL

In some cases (e.g. sandbox with verified boot) it is useful to support
libfdt in TPL. Update the Kconfig to handle this.

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

# 6307896c 01-Oct-2018 Simon Glass <sjg@chromium.org>

tpm: Add support for SPL and TPL

At present the tpm can only be used in U-Boot proper. Updated it to work
in SPL and TPL also.

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

# ab948cd2 19-Jul-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

fdt_support: make FDT_FIXUP_PARTITIONS depend on CMD_MTDPARTS

fdt_fixup_mtdparts() calls mtdparts_init() and device_find(),
which are defined in cmd/mtdparts.c

The combination of FDT_FIXUP_PARTITIONS=y and CMD_MTDPARTS=n
emits the following link error:

common/fdt_support.c:903: undefined reference to `mtdparts_init'
common/fdt_support.c:914: undefined reference to `device_find'

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 3330584d 03-Jun-2018 Igor Opaniuk <igor.opaniuk@gmail.com>

avb2.0: integrate avb 2.0 into the build system

Integrate libavb into the build system. Introduce CONFIG_LIBAVB
build option.

Signed-off-by: Igor Opaniuk <igor.opaniuk@linaro.org>

# f8c987f8 05-Jun-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

lib: Add hexdump

Often during debugging session it's very interesting to see
what data we were dealing with. For example what we write or read
to/from memory or peripherals.

This change introduces functions that allow to dump binary
data with one simple function invocation like:
------------------->8----------------
print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, buf, len);
------------------->8----------------

which gives us the following:
------------------->8----------------
00000000: f2 b7 c9 88 62 61 75 64 72 61 74 65 3d 31 31 35 ....baudrate=115
00000010: 32 30 30 00 62 6f 6f 74 61 72 67 73 3d 63 6f 6e 200.bootargs=con
00000020: 73 6f 6c 65 3d 74 74 79 53 33 2c 31 31 35 32 30 sole=ttyS3,11520
00000030: 30 6e 38 00 62 6f 6f 74 64 65 6c 61 79 3d 33 00 0n8.bootdelay=3.
00000040: 62 6f 6f 74 66 69 6c 65 3d 75 49 6d 61 67 65 00 bootfile=uImage.
00000050: 66 64 74 63 6f 6e 74 72 6f 6c 61 64 64 72 3d 39 fdtcontroladdr=9
00000060: 66 66 62 31 62 61 30 00 6c 6f 61 64 61 64 64 72 ffb1ba0.loadaddr
00000070: 3d 30 78 38 32 30 30 30 30 30 30 00 73 74 64 65 =0x82000000.stde
00000080: 72 72 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 rr=serial0@e0022
00000090: 30 30 30 00 73 74 64 69 6e 3d 73 65 72 69 61 6c 000.stdin=serial
000000a0: 30 40 65 30 30 32 32 30 30 30 00 73 74 64 6f 75 0@e0022000.stdou
000000b0: 74 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 30 t=serial0@e00220
000000c0: 30 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00..............
...
------------------->8----------------

Source of hexdump.c was copied from Linux kernel v4.7-rc2.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Mario Six <mario.six@gdsys.cc>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Stefan Roese <sr@denx.de>

# c232d14d 29-May-2018 Alex Kiernan <alex.kiernan@gmail.com>

mmc: Separate "mmc swrite" from fastboot

Introduce CONFIG_IMAGE_SPARSE and CONFIG_CMD_MMC_SWRITE so the "mmc
swrite" command is separated from the fastboot code.

Move image-sparse from common to lib so it's clear it's library code.

Rename CONFIG_FASTBOOT_FLASH_FILLBUF_SIZE to CONFIG_IMAGE_SPARSE_FILLBUF_SIZE
and migrate it to Kconfig.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Acked-by: Jassi Brar <jaswinder.singh@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6417572e 08-May-2018 Tom Rini <trini@konsulko.com>

lib/Kconfig: Mark OF_LIBFDT_OVERLAY as depending on OF_LIBFDT

The overlay code is only useful when OF_LIBFDT is set, so mark it as
depending on that first.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 58a46f88 25-Apr-2018 Praneeth Bajjuri <praneeth@ti.com>

configs: TI: Enable FIT Library overlay support

Enable the FDT library overlay support for all TI SOC family.

Without this option, when Loading fdt from FIT image, the
following warning is seen.

"config with overlays but CONFIG_OF_LIBFDT_OVERLAY not set".

Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
Suggested-by: Andrew F.Davis <afd@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>

# 14ad44ab 18-Apr-2018 Alex Kiernan <alex.kiernan@gmail.com>

spl: Split sprintf, strto* from SPL serial in Kconfig

When SPL serial is disabled, callers who need sprintf or strtoul fail
because their inclusion is guarded by CONFIG_SPL_SERIAL_SUPPORT/
CONFIG_TPL_SERIAL_SUPPORT.

Split printf, sprintf and strto into their own entries and then select
all of them if SERIAL_SUPPORT is enabled to match the current behaviour.

Include panic.o unconditionally as it can be called from anywhere which
uses BUG_ON().

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>

# e294ba06 04-Apr-2018 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-sunxi

Signed-off-by: Tom Rini <trini@konsulko.com>


# d14db11d 03-Apr-2018 Andre Przywara <andre.przywara@arm.com>

sunxi: revert disabling of features

In January some commits were introduced to mitigate the U-Boot image
size issues we encountered on sunxi builds.
Now with the MMC environment removed we can bring them back, as we
practically don't have a size limit anymore.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 32ce6179 13-Mar-2018 Bryan O'Donoghue <bryan.odonoghue@linaro.org>

optee: Add lib entries for sharing OPTEE code across ports

This patch adds code to lib to enable sharing of useful OPTEE code between
board-ports and architectures. The code on lib/optee/optee.c comes from the
TI omap2 port. Eventually the OMAP2 code will be patched to include the
shared code. The intention here is to add more useful OPTEE specific code
as more functionality gets added.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Cc: Harinarayan Bhatta <harinarayan@ti.com>
Cc: Andrew F. Davis <afd@ti.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Kever Yang <kever.yang@rock-chips.com>
Cc: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Cc: Peng Fan <peng.fan@nxp.com>
Tested-by: Peng Fan <peng.fan@nxp.com>

# 36c1877c 06-Feb-2018 Faiz Abbas <faiz_abbas@ti.com>

lib: Kconfig: Move DYNAMIC_CRC_TABLE to Kconfig

Add CONFIG prefix to DYNAMIC_CRC_TABLE and implement it in
Kconfig.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>

# a451bc27 05-Feb-2018 Adam Ford <aford173@gmail.com>

Convert LIB_UUID to Kconfig

config_fallback.h has some logic that checks a variety of options
and selects LIB_UUID if it hasn't already been selected. This
will all LIB_UUID in Kconfig and select this option for the list
of options to allow us to remove the logic from fallbacks

Signed-off-by: Adam Ford <aford173@gmail.com>

# a5a37567 06-Feb-2018 Adam Ford <aford173@gmail.com>

Convert CONFIG LIB_HW_RAND to Kconfig

config_fallbacks.h had some logic to automatically select
LIB_RAND if RANDOM_UUID or CMD_UUID were set if LIB_HW_RAND wasn't
already selected. By migrating LIB_HW_RAND to Kconfig, we can
remove this check from config_fallbacks.h and put it into Kconfig

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
[trini: Turn into a choice, add NET_RANDOM_ETHADDR]
Signed-off-by: Tom Rini <trini@konsulko.com>

# acd4d334 16-Jan-2018 Maxime Ripard <maxime.ripard@free-electrons.com>

net: regex: Disable by default on sunXi

The sunXi arm64 build has overflown, leading to the main U-boot binary
overwriting the environment when flashing the new image, or even worse,
overwriting itself when we're calling saveenv.

Disable this option that is not critical until we can adress the issue
properly.

Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 7e3caa81 03-Dec-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

Move CONFIG_PANIC_HANG to Kconfig

Freescale (NXP) boards have lots of defconfig files per board.
I used "imply PANIC_HANG" for them.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# da5337a6 08-Nov-2017 Nandor Han <nandor.han@ge.com>

rtc: add support for s35392a

Add support for S35392A RTC. The driver supports both U-Boot driver
models.

Signed-off-by: Nandor Han <nandor.han@ge.com>
Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
Cc: Heiko Schocher <hs@denx.de>

# f52bdf4b 14-Sep-2017 Jean-Jacques Hiblot <jjhiblot@ti.com>

lib: allow building lzo for the SPL

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 85d8bf57 03-Sep-2017 Marek Behún <marek.behun@nic.cz>

lib: Add CRC32-C

This is needed for BTRFS.

Signed-off-by: Marek Behun <marek.behun@nic.cz>

create mode 100644 lib/crc32c.c

# 7264f292 15-Aug-2017 York Sun <york.sun@nxp.com>

spl: fit: Eanble GZIP support for image decompression

Add Kconfig option SPL_GZIP and SPL_ZLIB to enable gunzip support for
SPL boot, eg. falcon boot compressed kernel image.

Signed-off-by: York Sun <york.sun@nxp.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6ef2f901 11-Aug-2017 Adam Ford <aford173@gmail.com>

Convert CONFIG_BCH to Kconfig

This converts the following to Kconfig:
CONFIG_BCH

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1a7ba1d 18-Aug-2017 Anatolij Gustschin <agust@denx.de>

Fix 'notes' typos

s/notes/nodes

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 96b9082c 03-Aug-2017 Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

rockchip: rk3188: rock: adjust for SPL/TPL split

With the changes to split SPL/TPL for the RK3368, I apparently missed
some needed adjustments to the RK3188 Kconfig and rock_defconfig.

This fixes build-issues for the rock board after applying the RK3368
enablement (and SPL/TPL) set that resulted from TPL_SERIAL_SUPPORT,
TPL_ROCKCHIP_BACK_TO_BROM and TPL_TINY_MEMSET being separate symbols
now.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d56b4b19 22-Jul-2017 Tom Rini <trini@konsulko.com>

configs: Migrate RBTREE, LZO, CMD_MTDPARTS, CMD_UBI and CMD_UBIFS

The above CONFIG options are in Kconfig, and now have correct depends and
inter-dependencies. Migrate these to configs/ from include/configs/. In the
case of CMD_UBIFS also change it to be a default y if CMD_UBI.

Signed-off-by: Tom Rini <trini@konsulko.com>

# aed998aa 17-May-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_LZMA to Kconfig

This converts the following to Kconfig:
CONFIG_LZMA

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

# b1a873df 26-Apr-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_CMD_AES et al to Kconfig

This converts the following to Kconfig:
CONFIG_CMD_AES
CONFIG_AES

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Add select AES to CMD_AES]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 173aafbf 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

cmd: Expose a Kconfig option to enable UBIFS commands

Create a new Kconfig entry to allow CMD_UBIFS selection from Kconfig and
add an hidden LZO option that can be selected by CMD_UBIFS.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>

# aa049152 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

mtd: ubi: Select RBTREE option from MTD_UBI Kconfig entry

Expose the RBTREE feature through Kconfig and select this option from the
MTD_UBI option.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>
[Rebased on master]
Signed-off-by: Jagan Teki <jagan@openedev.com>

# ab4458bd 02-Apr-2017 Simon Glass <sjg@chromium.org>

string: Provide a slimmed-down memset()

Most of the time the optimised memset() is what we want. For extreme
situations such as TPL it may be too large. For example on the 'rock'
board, using a simple loop saves a useful 48 bytes. With gcc 4.9 and
the rodata bug, this patch is enough to reduce the TPL image below the
limit.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>

# bea79d7d 14-Mar-2017 Andre Przywara <andre.przywara@arm.com>

Kconfig: introduce md5sum command selection

So far CONFIG_MD5SUM would need to be set by a board's include file.
Since the command is really generic, move it over to Kconfig to allow
it to be defined by either a board's defconfig, menuconfig or some
config snippet merged via mergeconfig.sh.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e663b350 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

smbios: Expose in efi_loader as table

We can pass SMBIOS easily as EFI configuration table to an EFI payload. This
patch adds enablement for that case.

While at it, we also enable SMBIOS generation for ARM systems, since they support
EFI_LOADER.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4b6dddc2 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

x86: Move smbios generation into arch independent directory

We will need the SMBIOS generation function on ARM as well going forward,
so let's move it into a non arch specific location.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# ebf7fff2 05-Oct-2016 Heiko Schocher <hs@denx.de>

spl: move FDT_FIXUP_PARTITIONS to Kconfig

Move FDT_FIXUP_PARTITIONS to Kconfig and cleanup existing
uses.

Signed-off-by: Heiko Schocher <hs@denx.de>

# ddf67f71 05-Jul-2016 Maxime Ripard <maxime.ripard@free-electrons.com>

libfdt: Add overlay application function

The device tree overlays are a good way to deal with user-modifyable
boards or boards with some kind of an expansion mechanism where we can
easily plug new board in (like the BBB, the Raspberry Pi or the CHIP).

Add a new function to merge overlays with a base device tree.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>

# 91b86e21 26-May-2016 Marek Vasut <marex@denx.de>

lib: Enable private libgcc by default

This patch decouples U-Boot binary from the toolchain on systems where
private libgcc is available. Instead of pulling in functions provided
by the libgcc from the toolchain, U-Boot will use it's own set of libgcc
functions. These functions are usually imported from Linux kernel, which
also uses it's own libgcc functions instead of the ones provided by the
toolchain.

This patch solves a rather common problem. The toolchain can usually
generate code for many variants of target architecture and often even
different endianness. The libgcc on the other hand is usually compiled
for one particular configuration and the functions provided by it may
or may not be suited for use in U-Boot. This can manifest in two ways,
either the U-Boot fails to compile altogether and linker will complain
or, in the much worse case, the resulting U-Boot will build, but will
misbehave in very subtle and hard to debug ways.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 67976306 30-Mar-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

cosmetic: Fix typos "privide"

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# ed980b8c 03-Mar-2016 Alexander Graf <agraf@csgraf.de>

efi_loader: hook up in build environment

Now that we have all the bits and pieces ready for EFI payload loading
support, hook them up in Makefiles and KConfigs so that we can build.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
[trini: Enable only when we of OF_LIBFDT, disable on kwb and colibri_pxa270]
Signed-off-by: Tom Rini <trini@konsulko.com>

# aa34fbc0 22-Feb-2016 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt to be used in SPL

Add an option to enable libfdt in SPL. This can be useful when decoding
FIT files in SPL.

We need to make sure this option is not enabled in SPL by this change.
Also this option needs to be enabled in host builds. Si add a new
IMAGE_USE_LIBFDT #define which can be used in files that are built on the
host but must also build for U-Boot and SPL.

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

# 69e173eb 22-Feb-2016 Simon Glass <sjg@chromium.org>

Move CONFIG_OF_LIBFDT to Kconfig

Move this option to Kconfig and tidy up existing boards.

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

# a187559e 05-Feb-2016 Bin Meng <bmeng.cn@gmail.com>

Use correct spelling of "U-Boot"

Correct spelling of "U-Boot" shall be used in all written text
(documentation, comments in source files etc.).

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Minkyu Kang <mk7.kang@samsung.com>

# 947c626d 14-Jan-2016 Tom Rini <trini@konsulko.com>

vsprintf.c: Always enable CONFIG_SYS_VSNPRINTF

Enabling this function always removes some class of string saftey issues.
The size change here in general is about 400 bytes and this seems a reasonable
trade-off.

Cc: Peng Fan <peng.fan@nxp.com>
Cc: Peter Robinson <pbrobinson@gmail.com>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Adrian Alonso <aalonso@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 7d9cde10 22-Nov-2015 Stefan Roese <sr@denx.de>

lib/tiny-printf.c: Add tiny printf function for space limited environments

This patch adds a small printf() version that supports all basic formats.
Its intented to be used in U-Boot SPL versions on platforms with very
limited internal RAM sizes.

To enable it, just define CONFIG_USE_TINY_PRINTF in your defconfig. This
will result in the SPL using this tiny function and the main U-Boot
still using the full-blown printf() function.

This code was copied from:
http://www.sparetimelabs.com/printfrevisited
With mostly only coding style related changes so that its checkpatch
clean.

The size reduction is about 2.5KiB. Here a comparison for the db-mv784mp-gp
(Marvell AXP) SPL:

Without this patch:
58963 18536 1928 79427 13643 ./spl/u-boot-spl

With this patch:
56542 18536 1956 77034 12cea ./spl/u-boot-spl

Note:
To make it possible to compile tiny-printf.c instead of vsprintf.c when
CONFIG_USE_TINY_PRINTF is defined, the functions printf() and vprintf() are
moved from common/console.c into vsprintf.c in this patch.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>

# 2419cd16 03-Oct-2015 Simon Glass <sjg@chromium.org>

dm: tpm: Drop CONFIG_DM_TPM

Now that all TPM drivers use driver model, we can drop the special driver
model CONFIG option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>

# 027b728d 06-Oct-2015 Julius Werner <jwerner@chromium.org>

Add support for LZ4 decompression algorithm

This patch adds support for LZ4-compressed FIT image contents. This
algorithm has a slightly worse compression ration than LZO while being
nearly twice as fast to decompress. When loading images from a fast
storage medium this usually results in a boot time win.

Sandbox-tested only since I don't have a U-Boot development system set
up right now. The code was imported unchanged from coreboot where it's
proven to work, though. I'm mostly interested in getting this recognized
by mkImage for use in a downstream project.

Signed-off-by: Julius Werner <jwerner@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# a7d660bc 22-Aug-2015 Simon Glass <sjg@chromium.org>

tpm: Add Kconfig options for TPMs

Add new Kconfig options for TPMs in preparation for moving boards to use
Kconfig for TPM configuration.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 867a6ac8 31-Jul-2015 Simon Glass <sjg@chromium.org>

efi: Add start-up library code

When running as an EFI application, U-Boot must request memory from EFI,
and provide access to the boot services U-Boot needs.

Add library code to perform these tasks. This includes efi_main() which is
the entry point from EFI. U-Boot is built as a shared library.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d1389403 23-Jun-2015 Simon Glass <sjg@chromium.org>

Add a dhrystone benchmark command

Drystone provides a convenient sanity check that the CPU is running at full
speed. Add this as a command which can be enabled as needed.

Note: I investigated using Coremark for this but there was a license
agreement and I could not work out if it was GPL-compatible.

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

# f7848d90 22-Jun-2015 Joe Hershberger <joe.hershberger@ni.com>

Allow CONFIG_REGEX to be disabled when CONFIG_NET

Instead of selecting REGEX when NET is enabled, make it the default, but
allow boards that are tiny to disable it and lose functionality on all
but the first Ethernet adapter.

cm-bf548, bf538f-ezkit, and bf533-stamp need this. None appear to have
more than one Ethernet interface.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# 3850dbe8 11-Jun-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

blackfin: fix undefined reference to srand and rand

Commit 9ba9e85f3f1c (net: Fix NET_RANDOM_ETHADDR dependencies)
accidentally dropped CONFIG_LIB_RAND defines for 14 Blackfin boards.

Prior to that commit, those boards defined CONFIG_LIB_RAND, but not
CONFIG_NET_RANDOM_ETHADDR. So, commit 9ba9e85f3f1c should not have
touched them, but in fact it ripped CONFIG_LIB_RAND off from all the
header files, which caused undefined reference to srand and rand.
CONFIG_LIB_RAND=y must be revived for such boards.

BTW, this commit indeed makes it better, but even with this fix,
three boards (bf533-stamp, bf538f-ezkit, cm-bf548) still can not
build due to region 'ram' overflowed error. This was cause by
commit 6eed3786c68c (net: Move the CMD_NET config to defconfigs)
because CMD_NET selects NET, and NET selects REGEX. Eventually,
some boards were newly enabled with CONFIG_REGEX, increasing the
memory footprint. A patch is expected to fix the build error.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 9ba9e85f 25-May-2015 Michal Simek <michal.simek@amd.com>

net: Fix NET_RANDOM_ETHADDR dependencies

NET_RANDOM_ETHADDR depends on lib/rand.c. This patch adds dependency to
Kconfig to ensure that library is also compiled.

Remove the definitions from Blackfin boards' include/configs.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 6501ff62 20-Apr-2015 Przemyslaw Marczak <p.marczak@samsung.com>

lib: Kconfig: add entry for errno_str() function

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1a60650c 21-Apr-2015 Joe Hershberger <joe.hershberger@ni.com>

kconfig: Move REGEX to Kconfig

Having this as a Kconfig allows it to be a dependent feature.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8156345d 06-Mar-2015 Simon Glass <sjg@chromium.org>

sandbox: Move CONFIG_SYS_VSNPRINTF to Kconfig

Move this over to Kconfig and tidy up.

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

# 94e3c8c4 19-Feb-2015 gaurav rana <gaurav.rana@freescale.com>

crypto/fsl - Add progressive hashing support using hardware acceleration.

Currently only normal hashing is supported using hardware acceleration.
Added support for progressive hashing using hardware.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
Signed-off-by: Gaurav Rana <gaurav.rana@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>

# d9f23c7f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

lib/rsa: Add Kconfig for devices supporting RSA Modular Exponentiation

Kconfig option added for devices which support RSA Verification.
1. RSA_SOFTWARE_EXP
Enables driver for supporting RSA Modular Exponentiation in Software
2. RSA_FREESCALE_EXP
Enables driver for supporting RSA Modular Exponentiation using Freescale specific
driver

The above drivers use RSA uclass

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
(Removed duplicate line in Kconfig comment)

Change-Id: I7663c4d5350e2bfc3dfa2696f70ef777d6ccc6f6

# c4beb22f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

FIT: Modify option FIT_SIGNATURE in Kconfig

For FIT signature based approach to work, RSA library needs to be selected.
The FIT_SIGNATURE option in Kconfig is modified to automatically select RSA.
Selecting RSA compiles the RSA library required for image verification.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 45ccec8f 23-Oct-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

kconfig: move CONFIG_USE_PRIVATE_LIBGCC to Kconfig

The private libgcc is supported only on ARM, MIPS, PowerPC, SH, x86.
Those architectures should "select" HAVE_PRIVATE_LIBGCC and
CONFIG_USE_PRIVATE_LIBGCC should depend on it.

Currently, this option is enabled on Tegra boards and x86 architecture.
Move the definition from header files to Kconfig.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Tested-by: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: Tom Warren <twarren@nvidia.com>

# 8c688bc4 23-Oct-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

kconfig: move CONFIG_SYS_HZ to lib/Kconfig

CONFIG_SYS_HZ is always defined as 1000 in config_fallbacks.h
(but some boards still have redundant definitions).

This commit moves the definition and the document in README to
Kconfig. Since lib/Kconfig can assure that CONFIG_SYS_HZ is 1000,
the sanity check in lib/time.c should be removed.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Reviewed-by: Marek Vasut <marex@denx.de>

# b0928da6 16-Sep-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

kconfig: move CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED to Kconfig

If this option is enabled, the objects under lib/ directory
are compiled with speed optimization, not size optimization.
(Currently, only used by some Blackfin boards.)

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# ed36323f 16-Sep-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

kconfig: add blank Kconfig files

This would be useful to start moving various config options.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# 11232139 06-Apr-2022 Tom Rini <trini@konsulko.com>

nds32: Remove the architecture

As removal of nds32 has been ack'd for the Linux kernel, remove support
here as well.

Cc: Rick Chen <rick@andestech.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Rick Chen <rick@andestech.com>

# fd210fee 28-Mar-2022 Philippe Reynes <philippe.reynes@softathome.com>

lib: allow to build asn1 decoder and oid registry in SPL

This commit adds the options:
- SPL_ASN1_DECODER
- SPL_OID_REGISTRY

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>

# 7d44a985 28-Mar-2022 Philippe Reynes <philippe.reynes@softathome.com>

lib: Kconfig: enhance the help of OID_REGISTRY

Enhance the help for the config OID_REGISTRY.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>

# a0e71d96 28-Mar-2022 Philippe Reynes <philippe.reynes@softathome.com>

lib: Kconfig: enhance help for ASN1

Enhance the help for configs ASN1_COMPILER
and ASN1_decoder.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>

# 761a1786 27-Jan-2022 Tom Rini <trini@konsulko.com>

Merge tag 'dm-pull-26jan22' of https://source.denx.de/u-boot/custodians/u-boot-dm

acpi refactoring to allow non-x86 use
binman support for bintools (binary tools)
minor tools improvements in preparation for FDT signing
various minor fixes and improvements


# 334a9b9d 25-Nov-2021 Loic Poulain <loic.poulain@linaro.org>

lib/circbuf: Make circbuf selectable symbol

It is currenly only used from usbtty driver but make it properly
selectable via Kconfig symbol, for future usage.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>

# e1722fcb 01-Dec-2021 Simon Glass <sjg@chromium.org>

x86: Allow any arch to generate ACPI tables

These have sadly found their way to ARM now. Allow any arch to support
generating ACPI tables.

Disable this for the tools build.

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

# 7c3fd5c2 26-Dec-2021 Qu Wenruo <wqu@suse.com>

lib: add BLAKE2 hash support

The code is cross-ported from BLAKE2 reference implementation
(https://github.com/BLAKE2/BLAKE2).

With minimal change to remove unused macros/features.

Currently there is only one user inside U-boot (btrfs), and since it
only utilize BLAKE2B, all other favors are all removed.

Signed-off-by: Qu Wenruo <wqu@suse.com>
[trini: Rename ROUND to R to avoid clash with <linux/bitops.h>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 97f2a749 04-Jan-2022 Eugen Hristev <eugen.hristev@microchip.com>

lib: Kconfig: fix PHANDLE_CHECK_SEQ position outside of menu

CONFIG_PHANDLE_CHECK_SEQ is outside of the menu 'Library routines'
thus it's invisible in menuconfig and cannot be selected.
Fix this by moving the 'endmenu' after the PHANDLE_CHECK_SEQ definition

Fixes: c589132a1d ("fdt: Use phandle to distinguish DT nodes with same name")
Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
Reviewed-by: Aswath Govindraju <a-govindraju@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 726cd983 29-Dec-2021 Simon Glass <sjg@chromium.org>

efi: Make unicode printf available to the app

This is needed to show unicode strings. Enable this code in the app.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>

# 6405ab7a 24-Nov-2021 Simon Glass <sjg@chromium.org>

Convert CONFIG_PHYSMEM to Kconfig

This converts the following to Kconfig:
CONFIG_PHYSMEM

Signed-off-by: Simon Glass <sjg@chromium.org>
Suggested-by: Sean Anderson <seanga2@gmail.com>

# ac7606af 14-Nov-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

lmb: fix typo 'commun'

%s/commun/common/

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

# e7d285b2 25-Sep-2021 Simon Glass <sjg@chromium.org>

image: Use the correct checks for CRC32

Add a host Kconfig for CRC32. With this we can use CONFIG_IS_ENABLED(CRC32)
directly in the host build, so drop the unnecessary indirection.

Add a few more conditions to SPL_CRC32 to avoid build failures as well as
TPL_CRC32. Also update hash.c to make crc32 optional and to actually take
notice of SPL_CRC32.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# 2c21256b 25-Sep-2021 Simon Glass <sjg@chromium.org>

hash: Use Kconfig to enable hashing in host tools and SPL

At present when building host tools, we force CONFIG_SHAxxx to be enabled
regardless of the board Kconfig setting. This is done in the image.h
header file.

For SPL we currently just assume the algorithm is desired if U-Boot proper
enables it.

Clean this up by adding new Kconfig options to enable hashing on the host,
relying on CONFIG_IS_ENABLED() to deal with the different builds.

Add new SPL Kconfigs for hardware-accelerated hashing, to maintain the
current settings.

This allows us to drop the image.h code and the I_WANT_MD5 hack.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# 603d15a5 25-Sep-2021 Simon Glass <sjg@chromium.org>

spl: cypto: Bring back SPL_ versions of SHA

Unfortunately these were removed by mistake. This means that adding hash
support to SPL brings in all software algorithms, with a substantial
increase in code size.

The origin of the problem was renaming them to SPL_FIT_xxx and then these
were removed altogether in a later commit.

Add them back. This aligns with CONFIG_MD5, for example, which has an SPL
variant.

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: f5bc9c25f31 ("image: Rename SPL_SHAxxx_SUPPORT to SPL_FIT_SHAxxx")
Fixes: eb5171ddec9 ("common: Remove unused CONFIG_FIT_SHAxxx selectors")
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# 6674edaa 16-Sep-2021 Tom Rini <trini@konsulko.com>

Merge tag 'v2021.10-rc4' into next

Prepare v2021.10-rc4

Signed-off-by: Tom Rini <trini@konsulko.com>

# gpg: Signature made Tue 14 Sep 2021 06:58:32 PM EDT
# gpg: using RSA key 1A3C7F70E08FAB1707809BBF147C39FF9634B72C
# gpg: Good signature from "Thomas Rini <trini@konsulko.com>" [ultimate]

# Conflicts:
# board/Arcturus/ucp1020/spl.c
# cmd/mvebu/Kconfig
# common/Kconfig.boot
# common/image-fit.c
# configs/UCP1020_defconfig
# configs/sifive_unmatched_defconfig
# drivers/pci/Kconfig
# include/configs/UCP1020.h
# include/configs/sifive-unmatched.h
# lib/Makefile
# scripts/config_whitelist.txt


# 5145bc73 01-Sep-2021 Oleksandr Suvorov <oleksandr.suvorov@foundries.io>

lib: fix typos in Kconfig

There are trivial typos in the Kconfig file. Fixed them.
Also, fixed grammar in the descriptions with typos.

Fixes: d56b4b1974 ("configs: Migrate RBTREE, LZO, CMD_MTDPARTS, CMD_UBI and CMD_UBIFS")
Fixes: 7264f2928b ("spl: fit: Eanble GZIP support for image decompression")
Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# e60e4499 02-Sep-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

lib: Drop SHA512_ALGO in lieu of SHA512

SHA512_ALGO was used as a "either SHA512 or SHA384", although the
implementations of these two algorithms share a majority of code.

From a Kconfig interface perspective, it makes sense to present two
distinct options. This requires #ifdefing out the SHA512
implementation from sha512.c. The latter doesn't make any sense.

It's reasonable to say in Kconfig that SHA384 depends on SHA512, and
seems to be the more polite way to handle the selection.

Thus, automatically select SHA512 when SHA384 is enabled.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# b4c2c151 27-Aug-2021 Michal Simek <michal.simek@amd.com>

Kconfig: Remove all default n/no options

default n/no doesn't need to be specified. It is default option anyway.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
[trini: Rework FSP_USE_UPD portion]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 928a8be7 29-Jul-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

lib: ecdsa: Implement UCLASS_ECDSA verification on target

Implement the crypto_algo .verify() function for ecdsa256. Because
it backends on UCLASS_ECDSA, this change is focused on parsing the
keys from devicetree and passing this information to the specific
UCLASS driver.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# fa3f1f1d 24-Jul-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: disable CONFIG_SPL_HEXDUMP by default

CONFIG_HEXDUMP is needed to display UEFI variables using 'printenv -e'.

Enabling CONFIG_SPL_HEXDUMP only makes sense for debugging purposes.
Hence CONFIG_SPL_HEXDUMP should not be enabled by default.

The following boards currently have CONFIG_SPL_HEXDUMP=y. This includes
boards that don't use SPL at all.

axm_defconfig
imx8mm-cl-iot-gate_defconfig
imx8mm_venice_defconfig
imxrt1020-evk_defconfig
imxrt1050-evk_defconfig
kontron_sl28_defconfig
kp_imx53_defconfig
lx2160ardb_tfa_stmm_defconfig
mt7622_rfb_defconfig
octeon_ebb7304_defconfig
octeon_nic23_defconfig
qemu_arm64_defconfig
qemu_arm_defconfig
qemu-riscv32_defconfig
qemu-riscv32_smode_defconfig
qemu-riscv64_defconfig
qemu-riscv64_smode_defconfig
qemu-x86_64_defconfig
qemu-x86_defconfig
sandbox64_defconfig
sandbox_defconfig
stm32mp15_basic_defconfig
stm32mp15_trusted_defconfig
synquacer_developerbox_defconfig
taurus_defconfig
xilinx_versal_virt_defconfig

The patch only keeps it enabled on

sandbox_spl_defconfig

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 1a46cb6c 02-Jul-2021 Simon Glass <sjg@chromium.org>

lib: Create a new Kconfig option for charset conversion

Rather than looking at two KConfig options in the Makefile, create a new
Kconfig option for compiling lib/charset.c

Enable it for UFS also, which needs this support.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 26dd9936 08-Jul-2021 Steffen Jaeckel <jaeckel-floss@eyet-services.de>

lib: add crypt subsystem

Add the basic functionality required to support the standard crypt
format.
The files crypt-sha256.c and crypt-sha512.c originate from libxcrypt and
their formatting is therefor retained.
The integration is done via a crypt_compare() function in crypt.c.

```
libxcrypt $ git describe --long --always --all
tags/v4.4.17-0-g6b110bc
```

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 7d0f3fbb 11-Jun-2021 Tero Kristo <t-kristo@ti.com>

lib: rational: copy the rational fraction lib routines from Linux

Copy the best rational approximation calculation routines from Linux.
Typical usecase for these routines is to calculate the M/N divider
values for PLLs to reach a specific clock rate.

This is based on linux kernel commit:
"lib/math/rational.c: fix possible incorrect result from rational
fractions helper"
(sha1: 323dd2c3ed0641f49e89b4e420f9eef5d3d5a881)

Signed-off-by: Tero Kristo <t-kristo@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Tero Kristo <kristo@kernel.org>

# ec0512b1 24-May-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

Revert "lib: introduce HASH_CALCULATE option"

When we think of Kconfig, we usually think of features that we like
to enable or not. Ideally, we wouldn't use Kconfig to fix a build
issue, although sometimes it might make sense. With Kconfig it's hard
to guarantee that the fix is universal. We can only say that it works
for the set of tested configurations. In the majority of cases, it's
preferable to let the linker figure things out for us.

The reverted commit attempted to fix a build issue by adding an
invisible Kconfig option. This is wrong in several ways:

It invents a new Kconfig variable when CONFIG_HASH already
exists for the same purpose.
Second, hash-checksum.c makes use of the hash_progressive_lookup_algo()
symbol, which is only provided with CONFIG_HASH, but this dependency
was not expressed in the reverted patch.

It feels like Kconfig is turning into a listing of all available
source files, and a buffet to 'select' which ones to compile. The
purpose of this revert is to enable the next change to make use of
CONFIG_HASH instead of adding to Kconfig.

This reverts commit 87316da05f2fd49d3709275e64ef0c5980366ade.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Acked-by: Masahisa Kojima <masahisa.kojima@linaro.org>

# 1621d3c4 10-May-2021 Bin Meng <bmeng.cn@gmail.com>

lib: kconfig: Limit BINMAN_FDT for OF_SEPARATE or OF_EMBED

Generally speaking BINMAN_FDT makes sense for OF_SEPARATE or OF_EMBED.
For the other OF_CONTROL methods, it's quite possible binman node is
not available as binman is invoked during the build phase instead of
runtime. Let's only turn it on for OF_SEPARATE or OF_EMBED by default.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 87316da0 13-May-2021 Masahisa Kojima <masahisa.kojima@linaro.org>

lib: introduce HASH_CALCULATE option

Build error occurs when CONFIG_EFI_SECURE_BOOT or
CONFIG_EFI_CAPSULE_AUTHENTICATE is enabled,
because hash-checksum.c is not compiled.

Since hash_calculate() implemented in hash-checksum.c can be
commonly used aside from FIT image signature verification,
this commit itroduces HASH_CALCULATE option to decide
if hash-checksum.c shall be compiled.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# e2ae483c 13-May-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

hash: Kconfig option for SHA512 hardware acceleration

Commit a479f103dc1c ("hash: Allow for SHA512 hardware implementations")
defined function definitions for hardware accelerated SHA384 and SHA512.
If CONFIG_SHA_HW_ACCEL=y, these functions are used.

We already have boards using CONFIG_SHA_HW_ACCEL=y but none implements the
new functions hw_sha384() and hw_sha512().

For implementing the EFI TCG2 protocol we need SHA384 and SHA512. The
missing hardware acceleration functions lead to build errors on boards like
peach-pi_defconfig.

Introduce a new Kconfig symbol CONFIG_SHA512_HW_ACCEL to control if the
functions hw_sha384() and hw_sha512() shall be used to implement the SHA384
and SHA512 algorithms.

Fixes: a479f103dc1c ("hash: Allow for SHA512 hardware implementations")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

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

# 6d66502b 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: Add 2 config to define the max number of regions

Add 2 configs CONFIG_LMB_MEMORY_REGIONS and CONFIG_LMB_RESERVED_REGIONS
to change independently the max number of the regions in lmb
library.

When CONFIG_LMB_USE_MAX_REGIONS=y, move the lmb property arrays to
struct lmb and manage the array size with the element 'max' of struct
lmb_region; their are still allocated in stack.

When CONFIG_LMB_USE_MAX_REGIONS=n, keep the current location in
struct lmb_region to allow compiler optimization.

Increase CONFIG_LMB_RESERVED_REGIONS is useful to avoid lmb errors in
bootm when the number of reserved regions (not adjacent) is reached:
+ 1 region for relocated U-Boot
+ 1 region for initrd
+ 1 region for relocated linux device tree
+ reserved memory regions present in Linux device tree.

The current limit of 8 regions is reached with only 5 reserved regions
in DT.

see Linux kernel commit bf23c51f1f49 ("memblock: Move memblock arrays
to static storage in memblock.c and make their size a variable")

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# 4fa0150d 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: move MAX_LMB_REGIONS value in Kconfig

Move MAX_LMB_REGIONS value in Kconfig, the max number of the regions
in lmb library.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# 77b8cfef 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: move CONFIG_LMB in Kconfig

Migrate CONFIG_LMB in Kconfig.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# a479f103 16-Feb-2021 Joel Stanley <joel@jms.id.au>

hash: Allow for SHA512 hardware implementations

Similar to support for SHA1 and SHA256, allow the use of hardware hashing
engine by enabling the algorithm and setting CONFIG_SHA_HW_ACCEL /
CONFIG_SHA_PROG_HW_ACCEL.

Signed-off-by: Joel Stanley <joel@jms.id.au>

# f2c1442e 14-Mar-2021 Simon Glass <sjg@chromium.org>

bloblist: Make BLOBLIST_TABLES depend on BLOBLIST

Add an extra condition here since we cannot put x86 tables in a bloblist
when bloblists are not supported.

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

# e0103158 25-Feb-2021 Bin Meng <bmeng.cn@gmail.com>

lib: kconfig: Mention CONFIG_ADDR_MAP limitation in the help

Mention that CONFIG_ADDR_MAP only works in the post-relocation phase.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>

# 56e7257c 03-Feb-2021 Bin Meng <bmeng.cn@gmail.com>

lib: Fix BINMAN_FDT dependency

lib/binman.c references the following 3 ofnode APIs:
ofnode_first_subnode(), ofnode_path() and ofnode_read_bool().

These APIs get built only when DM is on. Fix the dependency then.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 59e4e391 18-Jan-2021 Tom Rini <trini@konsulko.com>

Merge https://gitlab.denx.de/u-boot/custodians/u-boot-riscv

- Update qemu-riscv.rst build instructions.
- Add support for SPI on Kendryte K210.
- Add Microchip PolarFire SoC Icicle Kit support.
- Add support for an early timer.
- Select TIMER_EARLY to avoid infinite recursion for Trace.


# a80f8513 17-Jan-2021 Pragnesh Patel <pragnesh.patel@sifive.com>

trace: select TIMER_EARLY to avoid infinite recursion

When tracing functions is enabled this adds calls to
__cyg_profile_func_enter() and __cyg_profile_func_exit() to the traced
functions.

__cyg_profile_func_enter() and __cyg_profile_func_exit() invoke
timer_get_us() to record the entry and exit time.

initr_dm() will make gd->dm_root = NULL and gd->timer = NULL, so
timer_get_us() -> get_ticks() -> dm_timer_init() will lead to an
indefinite recursion.

So select TIMER_EARLY when tracing got enabled.

Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Rick Chen <rick@andestech.com>

# 6205bbb1 04-Jan-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lib: cosmetic update of CONFIG_LIB_ELF description

Change 2 typo error in CONFIG_LIB_ELF description:
- Supoort => Support
- fir => for

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c589132a 02-Dec-2020 Aswath Govindraju <a-govindraju@ti.com>

fdt: Use phandle to distinguish DT nodes with same name

While assigning the sequence number to subsystem instances by reading the
aliases property, only DT nodes names are compared and not the complete
path. This causes a problem when there are two DT nodes with same name but
have different paths.

In arch/arm/dts/k3-am65-main.dtsi there are two USB controllers with the
same device tree node name but different path. When aliases are defined for
these USB controllers then fdtdec_get_alias_seq() fails to pick the correct
instance for a given index.

fdt_path_offset() function is slow and this would effect the U-Boot
startup. To avert the time penalty on all boards, apply this extra check
only when required by using a config option.

Fix it by comparing the phandles of DT nodes after the node names match,
under a config option.

Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Fix whitespace error in Kconfig:
Signed-off-by: Simon Glass <sjg@chromium.org>

# 28cef9ca 19-Nov-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

fs: fat: create correct short names

The current function set_name() used to create short names has the
following deficiencies resolved by this patch:

* Long names (e.g. FOO.TXT) are stored even if a short name is enough.
* Short names with spaces are created, e.g. "A ~1.TXT".
* Short names with illegal characters are created, e.g. "FOO++BAR".
* Debug output does not not consider that the short file name has no
concluding '\0'.

The solution for the following bug is split of into a separate patch:

* Short file names must be unique.

This patch only provides the loop over possible short file names.

Fixes: c30a15e590c ("FAT: Add FAT write feature")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# e4f8e543 05-Nov-2020 Simon Glass <sjg@chromium.org>

smbios: Drop the unused Kconfig options

Now that we can use devicetree to specify this information, drop the old
CONFIG options.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 44c74bdd 05-Nov-2020 Simon Glass <sjg@chromium.org>

sysinfo: Provide a default driver to set SMBIOS values

Some boards want to specify the manufacturer or product name but do not
need to have their own sysinfo driver.

Add a default driver which provides a way to specify this SMBIOS
information in the devicetree, without needing any board-specific
functionality.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d2cb7a22 04-Nov-2020 Simon Glass <sjg@chromium.org>

x86: Allow putting some tables in the bloblist

At present all tables are placed starting at address f0000 in memory, and
can be up to 64KB in size. If the tables are very large, this may not
provide enough space.

Also if the tables point to other tables (such as console log or a ramoops
area) then we must allocate other memory anyway.

The bloblist is a nice place to put these tables since it is contiguous,
which makes it easy to reserve this memory for linux using the 820 tables.

Add an option to put some of the tables in the bloblist. For SMBIOS and
ACPI, create suitable pointers from the f0000 region to the new location
of the tables.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
[bmeng: squashed in http://patchwork.ozlabs.org/project/uboot/patch/
20201105062407.1.I8091ad931cbbb5e3b6f6ababdf3f8d5db0d17bb9@changeid/]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# 415eab06 03-Nov-2020 Christian Gmeiner <christian.gmeiner@gmail.com>

smbios: add parsing API

Add a very simple API to be able to access SMBIOS strings
like vendor, model and bios version.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 72eda507 27-Oct-2020 Sean Anderson <seanga2@gmail.com>

lib: Add getopt

Some commands can get very unweildy if they have too many positional
arguments. Adding options makes them easier to read, remember, and
understand.

This implementation of getopt has been taken from barebox, which has had
option support for quite a while. I have made a few modifications to their
version, such as the removal of opterr in favor of a separate getopt_silent
function. In addition, I have moved all global variables into struct
getopt_context.

The getopt from barebox also re-orders the arguments passed to it so that
non-options are placed last. This allows users to specify options anywhere.
For example, `ls -l foo/ -R` would be re-ordered to `ls -l -R foo/` as
getopt parsed the options. However, this feature conflicts with the const
argv in cmd_tbl->cmd. This was originally added in 54841ab50c ("Make sure
that argv[] argument pointers are not modified."). The reason stated in
that commit is that hush requires argv to stay unmodified. Has this
situation changed? Barebox also uses hush, and does not have this problem.
Perhaps we could use their fix?

I have assigned maintenance of getopt to Simon Glass, as it is currently
only used by the log command. I would also be fine maintaining it.

Signed-off-by: Sean Anderson <seanga2@gmail.com>

# 26637e2e 12-Sep-2020 Simon Glass <sjg@chromium.org>

lib: Allow hexdump to be used in SPL

It is sometimes useful to output hex dumps in SPL. Add a config option to
allow this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# e87dfb05 05-Aug-2020 Andrii Anisov <andrii_anisov@epam.com>

lib: sscanf: add sscanf implementation

Port sscanf implementation from mini-os and introduce new
Kconfig option to enable it: CONFIG_SSCANF. Disable by default.

Signed-off-by: Andrii Anisov <andrii_anisov@epam.com>
Signed-off-by: Anastasiia Lukianenko <anastasiia_lukianenko@epam.com>
Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>

# 81014f73 30-Jul-2020 Joao Marcos Costa <joaomarcos.costa@bootlin.com>

include/u-boot, lib/zlib: add sources for zlib decompression

Add zlib (v1.2.11) uncompr() function to U-Boot. SquashFS depends on
this function to decompress data from a raw disk image. The actual
support for zlib into SquashFS sources will be added in a follow-up
commit.

Signed-off-by: Joao Marcos Costa <joaomarcos.costa@bootlin.com>

# 69be8fd1 03-Jun-2020 Marek Szyprowski <m.szyprowski@samsung.com>

powerpc: move ADDR_MAP to Kconfig

Move ADDR_MAP related config options from include/configs/*.h to the
proper place in lib/Kconfig. This has been done using
./tools/moveconfig.py and manual inspection of the generated changes.
This is a preparation to use ADDR_MAP helper on ARM 32bit Raspberry Pi4
board for mapping the PCIe XHCI MMIO, which is above the 4GiB identity
mapping limit.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# d16b38f4 15-Apr-2020 Reuben Dowle <reubendowle0@gmail.com>

Add support for SHA384 and SHA512

The current recommendation for best security practice from the US government
is to use SHA384 for TOP SECRET [1].

This patch adds support for SHA384 and SHA512 in the hash command, and also
allows FIT images to be hashed with these algorithms, and signed with
sha384,rsaXXXX and sha512,rsaXXXX

The SHA implementation is adapted from the linux kernel implementation.

[1] Commercial National Security Algorithm Suite
http://www.iad.gov/iad/programs/iad-initiatives/cnsa-suite.cfm

Signed-off-by: Reuben Dowle <reuben.dowle@4rf.com>

# 43e442a5 26-May-2020 Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

kconfig: fix some typos

Signed-off-by: Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

# eff5a547 22-May-2020 Michael Walle <michael@walle.cc>

cmd: zip: automatically pull in gzip()

Move the CONFIG_GZIP_COMPRESSED from a config.h macro to a Kconfig menu
item. It is not selectable by a user because there is no reason to do
so. Instead it will be automatically selected by the stuff which uses
gzip(), like the zip command.

Remove it from the config_whitelist.txt. Also remove
CONFIG_GZIP_COMPRESS_DEF_SZ as this was never used on any board. The
default seems to be sane, otherwise it should be added as a Kconfig
option.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8239be61 06-May-2020 Simon Glass <sjg@chromium.org>

lib: Allow MD5 to be enabled in SPL

At present the MD5 option cannot be enabled by board configs since it has
no Kconfig name. It is generally enabled, so long as FIT support is
present. But not all boards use FIT, particularly in SPL

Fix this and add an option for SPL as well. This allows board code to call
md5() even if FIT support is not enabled.

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

# 04cb3994 21-Apr-2020 Weijie Gao <weijie.gao@mediatek.com>

lib: enable lzma decompression support for SPL build

This patch enables LZMA decompression support for SPL build

Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>

# 2a2119e1 05-Mar-2020 Atish Patra <atishp@atishpatra.org>

lib: kconfig: Add option to set BZIP2 compression method

There is no way to select BZIP2 compression method.
Add it under library/compression config where all other
compression related configs are present.

Signed-off-by: Atish Patra <atish.patra@wdc.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 805b3cac 12-Feb-2020 Keerthy <j-keerthy@ti.com>

lib: elf: Move the generic elf loading/validating functions to lib

Move the generic elf loading/validating functions to lib/
so that they can be re-used and accessed by code existing
outside cmd.

While at it remove the duplicate static version of load_elf_image_phdr
under arch/arm/mach-imx/imx_bootaux.c.

Signed-off-by: Keerthy <j-keerthy@ti.com>
Suggested-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>

# 1611235b 19-Jan-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: Kconfig dependencies for pseudo-random library

drivers/rng/sandbox_rng.c requires rand() to be defined but configuration
option CONFIG_CONFIG_LIB_RAND selected in drivers/rng/Kconfig does not
exist.

test/lib/test_aes.c requires rand() to be defined.

Fix the selection criteria for choice "Pseudo-random library support type".

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 3c10dc95 06-Dec-2019 Simon Glass <sjg@chromium.org>

binman: Add a library to access binman entries

SPL and TPL can access information about binman entries using link-time
symbols but this is not available in U-Boot proper. Of course it could be
made available, but the intention is to just read the device tree.

Add support for this, so that U-Boot can locate entries.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# b4adf627 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: crypto: add x509 parser

Imported from linux kernel v5.3:
x509.asn1 without changes
x509_akid.asn1 without changes
x509_parser.h without changes
x509_cert_parser.c with changes marked as __UBOOT__
x509_public_key.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# a9b45e6e 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add oid registry utility

Imported from linux kernel v5.3:
build_OID_registry without changes
oid_registry.h without changes
oid_registry.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# ab8a0e06 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add asn1 decoder

Imported from linux kernel v5.3:
lib/asn1_decoder.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 2b12196d 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

cmd: add asn1_compiler

Imported from linux kernel v5.3:
asn1.h without changes
asn1_ber_bytecode.h without changes
asn1_decoder.h without changes
asn1_compiler.c without changes

This host command will be used to create a ASN1 parser, for example,
for pkcs7 messages or x509 certificates. More specifically, it will
generate *byte code* which will be interpreted by asn1 decoder library.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 05429b6c 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

rtc: move date.c from drivers/rtc/ to lib/

In the next commit, rtc_mktime(), for compatibility with linux, will be
implemented using rtc_mktime(), which is no longer drivers/rtc specific.
So move this file under lib/.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 37ef1774 10-Nov-2019 Thomas Hebb <tommyhebb@gmail.com>

Kconfig: disambiguate config names for tiny printf

27084c03d36a ("spl: Allow tiny printf() to be controlled in SPL and
TPL") split this option in two for TPL and SPL, but didn't change the
Kconfig names, making them hard to set quickly.

Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>

# 0d76afc0 27-Oct-2019 Simon Glass <sjg@chromium.org>

fdt: Add Kconfig options to control code size

For better or worse libfdt recent grew a lot of code that checks the
validity of the device tree in great detail. When using unsigned or
unverified data this makes things safer, but it does add to code size.

Add some controls to select the trade-off between safety and code size.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 27084c03 25-Sep-2019 Simon Glass <sjg@chromium.org>

spl: Allow tiny printf() to be controlled in SPL and TPL

At present there is only one control for this and it is used for both SPL
and TPL. But SPL might have a lot more space than TPL so the extra cost of
a full printf() might be acceptable.

Split the option into two, providing separate SPL and TPL controls. The
TPL setting defaults to the same as SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2a51e16b 07-Jun-2019 Tom Rini <trini@konsulko.com>

configs: Make USE_TINY_PRINTF depend on SPL||TPL and be default

The USE_TINY_PRINTF symbol only changes things within SPL and TPL
builds, so make it depend on that support. Next, make it default as
within these cases we should rarely have need of more advanced print
formats outside of the debug context.

To do this, in a few cases we need to correct our Kconfig dependencies
as we had cases of non-SPL targets select'ing this symbol. Finally, in
the case of a few boards we really do need the full printf
functionality.

Signed-off-by: Tom Rini <trini@konsulko.com>

# da0fb5fd 02-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: make call depth limit customizable

Up to now we had hard coded values for the call depth up to which trace
records are created: 200 for early tracing, 15 thereafter. UEFI
applications reach a call depth of 80 or above.

Provide customizing settings for the call trace depth limit and the early
call trace depth limit. Use the old values as defaults.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8509f22a 29-Apr-2019 Marek Behún <marek.behun@nic.cz>

lib: add Zstandard decompression support

Add the zstd library from Linux kernel (only decompression support).
There are minimal changes to build with U-Boot, otherwise the files are
identical to Linux commit dc35da16 from March 2018, the files had not
been touched since in kernel. Also SPDX lincese tags were added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 83a486b6 29-Apr-2019 Marek Behún <marek.behun@nic.cz>

lib: Add xxhash support

This adds the xxhash support from Linux. Files are almost identical to
those added to Linux in commit 5d240522 ("lib: Add xxhash module") (they
haven't been touched since in Linux). The only difference is to add some
includes to be compatible with U-Boot. Also SPDX lincese tags were
added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 5132361a 29-Apr-2019 Heiko Schocher <hs@denx.de>

lib: Kconfig: fix help text for GZIP

commit 95f4bbd581cf ("lib: fdt: Allow LZO and GZIP DT compression in U-Boot")

introduced Kconfig option for gzip in U-Boot, but help text
says gzip for SPL, which is wrong. Fix this.

Signed-off-by: Heiko Schocher <hs@denx.de>
Acked-by: Marek Vasut <marex@denx.de>

# 1c6eb075 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE_BUFFER_SIZE et al to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE_BUFFER_SIZE
CONFIG_TRACE_EARLY_SIZE
CONFIG_TRACE_EARLY
CONFIG_TRACE_EARLY_ADDR

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

# a24a78d7 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE

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

# 54969b40 21-Mar-2019 Thierry Reding <treding@nvidia.com>

fdtdec: Add Kconfig symbol for tests

Runtime tests are provided as a test_fdtdec command implementation. Add
a Kconfig symbol that allows this command to be built so that the tests
can be used.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 95f4bbd5 08-Mar-2019 Marek Vasut <marex@denx.de>

lib: fdt: Allow LZO and GZIP DT compression in U-Boot

Add required Kconfig symbols, Makefile bits and macro fixes in a
few places to support LZO and DT compression in U-Boot. This can
save a lot of space with multi-DTB fitImages.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>

# 6e705114 13-Jan-2019 Chris Packham <judge.packham@gmail.com>

lib: Kconfig: spelling fixes

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 048c6e89 06-Nov-2018 Simon Glass <sjg@chromium.org>

spl: lz4: Allow use of lz4 compression in SPL

In some cases U-Boot is compressed and it is useful to be able to
decompress it in SPL. Add a Kconfig and Makefile change to allow this.
Note that this does not actually implement decompression.

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

# 2895c4b7 15-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

kconfig: Introduce HAVE_ARCH_IOMAP

Introduce a new Kconfig option for architecture codes to control
whether it provides io{read,write}{8,16,32} I/O accessor functions.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5592a633 01-Oct-2018 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt in TPL

In some cases (e.g. sandbox with verified boot) it is useful to support
libfdt in TPL. Update the Kconfig to handle this.

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

# 6307896c 01-Oct-2018 Simon Glass <sjg@chromium.org>

tpm: Add support for SPL and TPL

At present the tpm can only be used in U-Boot proper. Updated it to work
in SPL and TPL also.

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

# ab948cd2 19-Jul-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

fdt_support: make FDT_FIXUP_PARTITIONS depend on CMD_MTDPARTS

fdt_fixup_mtdparts() calls mtdparts_init() and device_find(),
which are defined in cmd/mtdparts.c

The combination of FDT_FIXUP_PARTITIONS=y and CMD_MTDPARTS=n
emits the following link error:

common/fdt_support.c:903: undefined reference to `mtdparts_init'
common/fdt_support.c:914: undefined reference to `device_find'

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 3330584d 03-Jun-2018 Igor Opaniuk <igor.opaniuk@gmail.com>

avb2.0: integrate avb 2.0 into the build system

Integrate libavb into the build system. Introduce CONFIG_LIBAVB
build option.

Signed-off-by: Igor Opaniuk <igor.opaniuk@linaro.org>

# f8c987f8 05-Jun-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

lib: Add hexdump

Often during debugging session it's very interesting to see
what data we were dealing with. For example what we write or read
to/from memory or peripherals.

This change introduces functions that allow to dump binary
data with one simple function invocation like:
------------------->8----------------
print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, buf, len);
------------------->8----------------

which gives us the following:
------------------->8----------------
00000000: f2 b7 c9 88 62 61 75 64 72 61 74 65 3d 31 31 35 ....baudrate=115
00000010: 32 30 30 00 62 6f 6f 74 61 72 67 73 3d 63 6f 6e 200.bootargs=con
00000020: 73 6f 6c 65 3d 74 74 79 53 33 2c 31 31 35 32 30 sole=ttyS3,11520
00000030: 30 6e 38 00 62 6f 6f 74 64 65 6c 61 79 3d 33 00 0n8.bootdelay=3.
00000040: 62 6f 6f 74 66 69 6c 65 3d 75 49 6d 61 67 65 00 bootfile=uImage.
00000050: 66 64 74 63 6f 6e 74 72 6f 6c 61 64 64 72 3d 39 fdtcontroladdr=9
00000060: 66 66 62 31 62 61 30 00 6c 6f 61 64 61 64 64 72 ffb1ba0.loadaddr
00000070: 3d 30 78 38 32 30 30 30 30 30 30 00 73 74 64 65 =0x82000000.stde
00000080: 72 72 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 rr=serial0@e0022
00000090: 30 30 30 00 73 74 64 69 6e 3d 73 65 72 69 61 6c 000.stdin=serial
000000a0: 30 40 65 30 30 32 32 30 30 30 00 73 74 64 6f 75 0@e0022000.stdou
000000b0: 74 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 30 t=serial0@e00220
000000c0: 30 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00..............
...
------------------->8----------------

Source of hexdump.c was copied from Linux kernel v4.7-rc2.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Mario Six <mario.six@gdsys.cc>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Stefan Roese <sr@denx.de>

# c232d14d 29-May-2018 Alex Kiernan <alex.kiernan@gmail.com>

mmc: Separate "mmc swrite" from fastboot

Introduce CONFIG_IMAGE_SPARSE and CONFIG_CMD_MMC_SWRITE so the "mmc
swrite" command is separated from the fastboot code.

Move image-sparse from common to lib so it's clear it's library code.

Rename CONFIG_FASTBOOT_FLASH_FILLBUF_SIZE to CONFIG_IMAGE_SPARSE_FILLBUF_SIZE
and migrate it to Kconfig.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Acked-by: Jassi Brar <jaswinder.singh@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6417572e 08-May-2018 Tom Rini <trini@konsulko.com>

lib/Kconfig: Mark OF_LIBFDT_OVERLAY as depending on OF_LIBFDT

The overlay code is only useful when OF_LIBFDT is set, so mark it as
depending on that first.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 58a46f88 25-Apr-2018 Praneeth Bajjuri <praneeth@ti.com>

configs: TI: Enable FIT Library overlay support

Enable the FDT library overlay support for all TI SOC family.

Without this option, when Loading fdt from FIT image, the
following warning is seen.

"config with overlays but CONFIG_OF_LIBFDT_OVERLAY not set".

Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
Suggested-by: Andrew F.Davis <afd@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>

# 14ad44ab 18-Apr-2018 Alex Kiernan <alex.kiernan@gmail.com>

spl: Split sprintf, strto* from SPL serial in Kconfig

When SPL serial is disabled, callers who need sprintf or strtoul fail
because their inclusion is guarded by CONFIG_SPL_SERIAL_SUPPORT/
CONFIG_TPL_SERIAL_SUPPORT.

Split printf, sprintf and strto into their own entries and then select
all of them if SERIAL_SUPPORT is enabled to match the current behaviour.

Include panic.o unconditionally as it can be called from anywhere which
uses BUG_ON().

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>

# e294ba06 04-Apr-2018 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-sunxi

Signed-off-by: Tom Rini <trini@konsulko.com>


# d14db11d 03-Apr-2018 Andre Przywara <andre.przywara@arm.com>

sunxi: revert disabling of features

In January some commits were introduced to mitigate the U-Boot image
size issues we encountered on sunxi builds.
Now with the MMC environment removed we can bring them back, as we
practically don't have a size limit anymore.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 32ce6179 13-Mar-2018 Bryan O'Donoghue <bryan.odonoghue@linaro.org>

optee: Add lib entries for sharing OPTEE code across ports

This patch adds code to lib to enable sharing of useful OPTEE code between
board-ports and architectures. The code on lib/optee/optee.c comes from the
TI omap2 port. Eventually the OMAP2 code will be patched to include the
shared code. The intention here is to add more useful OPTEE specific code
as more functionality gets added.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Cc: Harinarayan Bhatta <harinarayan@ti.com>
Cc: Andrew F. Davis <afd@ti.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Kever Yang <kever.yang@rock-chips.com>
Cc: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Cc: Peng Fan <peng.fan@nxp.com>
Tested-by: Peng Fan <peng.fan@nxp.com>

# 36c1877c 06-Feb-2018 Faiz Abbas <faiz_abbas@ti.com>

lib: Kconfig: Move DYNAMIC_CRC_TABLE to Kconfig

Add CONFIG prefix to DYNAMIC_CRC_TABLE and implement it in
Kconfig.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>

# a451bc27 05-Feb-2018 Adam Ford <aford173@gmail.com>

Convert LIB_UUID to Kconfig

config_fallback.h has some logic that checks a variety of options
and selects LIB_UUID if it hasn't already been selected. This
will all LIB_UUID in Kconfig and select this option for the list
of options to allow us to remove the logic from fallbacks

Signed-off-by: Adam Ford <aford173@gmail.com>

# a5a37567 06-Feb-2018 Adam Ford <aford173@gmail.com>

Convert CONFIG LIB_HW_RAND to Kconfig

config_fallbacks.h had some logic to automatically select
LIB_RAND if RANDOM_UUID or CMD_UUID were set if LIB_HW_RAND wasn't
already selected. By migrating LIB_HW_RAND to Kconfig, we can
remove this check from config_fallbacks.h and put it into Kconfig

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
[trini: Turn into a choice, add NET_RANDOM_ETHADDR]
Signed-off-by: Tom Rini <trini@konsulko.com>

# acd4d334 16-Jan-2018 Maxime Ripard <maxime.ripard@free-electrons.com>

net: regex: Disable by default on sunXi

The sunXi arm64 build has overflown, leading to the main U-boot binary
overwriting the environment when flashing the new image, or even worse,
overwriting itself when we're calling saveenv.

Disable this option that is not critical until we can adress the issue
properly.

Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 7e3caa81 03-Dec-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

Move CONFIG_PANIC_HANG to Kconfig

Freescale (NXP) boards have lots of defconfig files per board.
I used "imply PANIC_HANG" for them.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# da5337a6 08-Nov-2017 Nandor Han <nandor.han@ge.com>

rtc: add support for s35392a

Add support for S35392A RTC. The driver supports both U-Boot driver
models.

Signed-off-by: Nandor Han <nandor.han@ge.com>
Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
Cc: Heiko Schocher <hs@denx.de>

# f52bdf4b 14-Sep-2017 Jean-Jacques Hiblot <jjhiblot@ti.com>

lib: allow building lzo for the SPL

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 85d8bf57 03-Sep-2017 Marek Behún <marek.behun@nic.cz>

lib: Add CRC32-C

This is needed for BTRFS.

Signed-off-by: Marek Behun <marek.behun@nic.cz>

create mode 100644 lib/crc32c.c

# 7264f292 15-Aug-2017 York Sun <york.sun@nxp.com>

spl: fit: Eanble GZIP support for image decompression

Add Kconfig option SPL_GZIP and SPL_ZLIB to enable gunzip support for
SPL boot, eg. falcon boot compressed kernel image.

Signed-off-by: York Sun <york.sun@nxp.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6ef2f901 11-Aug-2017 Adam Ford <aford173@gmail.com>

Convert CONFIG_BCH to Kconfig

This converts the following to Kconfig:
CONFIG_BCH

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1a7ba1d 18-Aug-2017 Anatolij Gustschin <agust@denx.de>

Fix 'notes' typos

s/notes/nodes

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 96b9082c 03-Aug-2017 Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

rockchip: rk3188: rock: adjust for SPL/TPL split

With the changes to split SPL/TPL for the RK3368, I apparently missed
some needed adjustments to the RK3188 Kconfig and rock_defconfig.

This fixes build-issues for the rock board after applying the RK3368
enablement (and SPL/TPL) set that resulted from TPL_SERIAL_SUPPORT,
TPL_ROCKCHIP_BACK_TO_BROM and TPL_TINY_MEMSET being separate symbols
now.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d56b4b19 22-Jul-2017 Tom Rini <trini@konsulko.com>

configs: Migrate RBTREE, LZO, CMD_MTDPARTS, CMD_UBI and CMD_UBIFS

The above CONFIG options are in Kconfig, and now have correct depends and
inter-dependencies. Migrate these to configs/ from include/configs/. In the
case of CMD_UBIFS also change it to be a default y if CMD_UBI.

Signed-off-by: Tom Rini <trini@konsulko.com>

# aed998aa 17-May-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_LZMA to Kconfig

This converts the following to Kconfig:
CONFIG_LZMA

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

# b1a873df 26-Apr-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_CMD_AES et al to Kconfig

This converts the following to Kconfig:
CONFIG_CMD_AES
CONFIG_AES

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Add select AES to CMD_AES]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 173aafbf 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

cmd: Expose a Kconfig option to enable UBIFS commands

Create a new Kconfig entry to allow CMD_UBIFS selection from Kconfig and
add an hidden LZO option that can be selected by CMD_UBIFS.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>

# aa049152 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

mtd: ubi: Select RBTREE option from MTD_UBI Kconfig entry

Expose the RBTREE feature through Kconfig and select this option from the
MTD_UBI option.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>
[Rebased on master]
Signed-off-by: Jagan Teki <jagan@openedev.com>

# ab4458bd 02-Apr-2017 Simon Glass <sjg@chromium.org>

string: Provide a slimmed-down memset()

Most of the time the optimised memset() is what we want. For extreme
situations such as TPL it may be too large. For example on the 'rock'
board, using a simple loop saves a useful 48 bytes. With gcc 4.9 and
the rodata bug, this patch is enough to reduce the TPL image below the
limit.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>

# bea79d7d 14-Mar-2017 Andre Przywara <andre.przywara@arm.com>

Kconfig: introduce md5sum command selection

So far CONFIG_MD5SUM would need to be set by a board's include file.
Since the command is really generic, move it over to Kconfig to allow
it to be defined by either a board's defconfig, menuconfig or some
config snippet merged via mergeconfig.sh.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e663b350 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

smbios: Expose in efi_loader as table

We can pass SMBIOS easily as EFI configuration table to an EFI payload. This
patch adds enablement for that case.

While at it, we also enable SMBIOS generation for ARM systems, since they support
EFI_LOADER.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4b6dddc2 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

x86: Move smbios generation into arch independent directory

We will need the SMBIOS generation function on ARM as well going forward,
so let's move it into a non arch specific location.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# ebf7fff2 05-Oct-2016 Heiko Schocher <hs@denx.de>

spl: move FDT_FIXUP_PARTITIONS to Kconfig

Move FDT_FIXUP_PARTITIONS to Kconfig and cleanup existing
uses.

Signed-off-by: Heiko Schocher <hs@denx.de>

# ddf67f71 05-Jul-2016 Maxime Ripard <maxime.ripard@free-electrons.com>

libfdt: Add overlay application function

The device tree overlays are a good way to deal with user-modifyable
boards or boards with some kind of an expansion mechanism where we can
easily plug new board in (like the BBB, the Raspberry Pi or the CHIP).

Add a new function to merge overlays with a base device tree.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>

# 91b86e21 26-May-2016 Marek Vasut <marex@denx.de>

lib: Enable private libgcc by default

This patch decouples U-Boot binary from the toolchain on systems where
private libgcc is available. Instead of pulling in functions provided
by the libgcc from the toolchain, U-Boot will use it's own set of libgcc
functions. These functions are usually imported from Linux kernel, which
also uses it's own libgcc functions instead of the ones provided by the
toolchain.

This patch solves a rather common problem. The toolchain can usually
generate code for many variants of target architecture and often even
different endianness. The libgcc on the other hand is usually compiled
for one particular configuration and the functions provided by it may
or may not be suited for use in U-Boot. This can manifest in two ways,
either the U-Boot fails to compile altogether and linker will complain
or, in the much worse case, the resulting U-Boot will build, but will
misbehave in very subtle and hard to debug ways.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 67976306 30-Mar-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

cosmetic: Fix typos "privide"

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# ed980b8c 03-Mar-2016 Alexander Graf <agraf@csgraf.de>

efi_loader: hook up in build environment

Now that we have all the bits and pieces ready for EFI payload loading
support, hook them up in Makefiles and KConfigs so that we can build.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
[trini: Enable only when we of OF_LIBFDT, disable on kwb and colibri_pxa270]
Signed-off-by: Tom Rini <trini@konsulko.com>

# aa34fbc0 22-Feb-2016 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt to be used in SPL

Add an option to enable libfdt in SPL. This can be useful when decoding
FIT files in SPL.

We need to make sure this option is not enabled in SPL by this change.
Also this option needs to be enabled in host builds. Si add a new
IMAGE_USE_LIBFDT #define which can be used in files that are built on the
host but must also build for U-Boot and SPL.

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

# 69e173eb 22-Feb-2016 Simon Glass <sjg@chromium.org>

Move CONFIG_OF_LIBFDT to Kconfig

Move this option to Kconfig and tidy up existing boards.

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

# a187559e 05-Feb-2016 Bin Meng <bmeng.cn@gmail.com>

Use correct spelling of "U-Boot"

Correct spelling of "U-Boot" shall be used in all written text
(documentation, comments in source files etc.).

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Minkyu Kang <mk7.kang@samsung.com>

# 947c626d 14-Jan-2016 Tom Rini <trini@konsulko.com>

vsprintf.c: Always enable CONFIG_SYS_VSNPRINTF

Enabling this function always removes some class of string saftey issues.
The size change here in general is about 400 bytes and this seems a reasonable
trade-off.

Cc: Peng Fan <peng.fan@nxp.com>
Cc: Peter Robinson <pbrobinson@gmail.com>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Adrian Alonso <aalonso@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 7d9cde10 22-Nov-2015 Stefan Roese <sr@denx.de>

lib/tiny-printf.c: Add tiny printf function for space limited environments

This patch adds a small printf() version that supports all basic formats.
Its intented to be used in U-Boot SPL versions on platforms with very
limited internal RAM sizes.

To enable it, just define CONFIG_USE_TINY_PRINTF in your defconfig. This
will result in the SPL using this tiny function and the main U-Boot
still using the full-blown printf() function.

This code was copied from:
http://www.sparetimelabs.com/printfrevisited
With mostly only coding style related changes so that its checkpatch
clean.

The size reduction is about 2.5KiB. Here a comparison for the db-mv784mp-gp
(Marvell AXP) SPL:

Without this patch:
58963 18536 1928 79427 13643 ./spl/u-boot-spl

With this patch:
56542 18536 1956 77034 12cea ./spl/u-boot-spl

Note:
To make it possible to compile tiny-printf.c instead of vsprintf.c when
CONFIG_USE_TINY_PRINTF is defined, the functions printf() and vprintf() are
moved from common/console.c into vsprintf.c in this patch.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>

# 2419cd16 03-Oct-2015 Simon Glass <sjg@chromium.org>

dm: tpm: Drop CONFIG_DM_TPM

Now that all TPM drivers use driver model, we can drop the special driver
model CONFIG option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>

# 027b728d 06-Oct-2015 Julius Werner <jwerner@chromium.org>

Add support for LZ4 decompression algorithm

This patch adds support for LZ4-compressed FIT image contents. This
algorithm has a slightly worse compression ration than LZO while being
nearly twice as fast to decompress. When loading images from a fast
storage medium this usually results in a boot time win.

Sandbox-tested only since I don't have a U-Boot development system set
up right now. The code was imported unchanged from coreboot where it's
proven to work, though. I'm mostly interested in getting this recognized
by mkImage for use in a downstream project.

Signed-off-by: Julius Werner <jwerner@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# a7d660bc 22-Aug-2015 Simon Glass <sjg@chromium.org>

tpm: Add Kconfig options for TPMs

Add new Kconfig options for TPMs in preparation for moving boards to use
Kconfig for TPM configuration.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 867a6ac8 31-Jul-2015 Simon Glass <sjg@chromium.org>

efi: Add start-up library code

When running as an EFI application, U-Boot must request memory from EFI,
and provide access to the boot services U-Boot needs.

Add library code to perform these tasks. This includes efi_main() which is
the entry point from EFI. U-Boot is built as a shared library.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d1389403 23-Jun-2015 Simon Glass <sjg@chromium.org>

Add a dhrystone benchmark command

Drystone provides a convenient sanity check that the CPU is running at full
speed. Add this as a command which can be enabled as needed.

Note: I investigated using Coremark for this but there was a license
agreement and I could not work out if it was GPL-compatible.

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

# f7848d90 22-Jun-2015 Joe Hershberger <joe.hershberger@ni.com>

Allow CONFIG_REGEX to be disabled when CONFIG_NET

Instead of selecting REGEX when NET is enabled, make it the default, but
allow boards that are tiny to disable it and lose functionality on all
but the first Ethernet adapter.

cm-bf548, bf538f-ezkit, and bf533-stamp need this. None appear to have
more than one Ethernet interface.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# 3850dbe8 11-Jun-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

blackfin: fix undefined reference to srand and rand

Commit 9ba9e85f3f1c (net: Fix NET_RANDOM_ETHADDR dependencies)
accidentally dropped CONFIG_LIB_RAND defines for 14 Blackfin boards.

Prior to that commit, those boards defined CONFIG_LIB_RAND, but not
CONFIG_NET_RANDOM_ETHADDR. So, commit 9ba9e85f3f1c should not have
touched them, but in fact it ripped CONFIG_LIB_RAND off from all the
header files, which caused undefined reference to srand and rand.
CONFIG_LIB_RAND=y must be revived for such boards.

BTW, this commit indeed makes it better, but even with this fix,
three boards (bf533-stamp, bf538f-ezkit, cm-bf548) still can not
build due to region 'ram' overflowed error. This was cause by
commit 6eed3786c68c (net: Move the CMD_NET config to defconfigs)
because CMD_NET selects NET, and NET selects REGEX. Eventually,
some boards were newly enabled with CONFIG_REGEX, increasing the
memory footprint. A patch is expected to fix the build error.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 9ba9e85f 25-May-2015 Michal Simek <michal.simek@amd.com>

net: Fix NET_RANDOM_ETHADDR dependencies

NET_RANDOM_ETHADDR depends on lib/rand.c. This patch adds dependency to
Kconfig to ensure that library is also compiled.

Remove the definitions from Blackfin boards' include/configs.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 6501ff62 20-Apr-2015 Przemyslaw Marczak <p.marczak@samsung.com>

lib: Kconfig: add entry for errno_str() function

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1a60650c 21-Apr-2015 Joe Hershberger <joe.hershberger@ni.com>

kconfig: Move REGEX to Kconfig

Having this as a Kconfig allows it to be a dependent feature.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8156345d 06-Mar-2015 Simon Glass <sjg@chromium.org>

sandbox: Move CONFIG_SYS_VSNPRINTF to Kconfig

Move this over to Kconfig and tidy up.

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

# 94e3c8c4 19-Feb-2015 gaurav rana <gaurav.rana@freescale.com>

crypto/fsl - Add progressive hashing support using hardware acceleration.

Currently only normal hashing is supported using hardware acceleration.
Added support for progressive hashing using hardware.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
Signed-off-by: Gaurav Rana <gaurav.rana@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>

# d9f23c7f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

lib/rsa: Add Kconfig for devices supporting RSA Modular Exponentiation

Kconfig option added for devices which support RSA Verification.
1. RSA_SOFTWARE_EXP
Enables driver for supporting RSA Modular Exponentiation in Software
2. RSA_FREESCALE_EXP
Enables driver for supporting RSA Modular Exponentiation using Freescale specific
driver

The above drivers use RSA uclass

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
(Removed duplicate line in Kconfig comment)

Change-Id: I7663c4d5350e2bfc3dfa2696f70ef777d6ccc6f6

# c4beb22f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

FIT: Modify option FIT_SIGNATURE in Kconfig

For FIT signature based approach to work, RSA library needs to be selected.
The FIT_SIGNATURE option in Kconfig is modified to automatically select RSA.
Selecting RSA compiles the RSA library required for image verification.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 45ccec8f 23-Oct-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

kconfig: move CONFIG_USE_PRIVATE_LIBGCC to Kconfig

The private libgcc is supported only on ARM, MIPS, PowerPC, SH, x86.
Those architectures should "select" HAVE_PRIVATE_LIBGCC and
CONFIG_USE_PRIVATE_LIBGCC should depend on it.

Currently, this option is enabled on Tegra boards and x86 architecture.
Move the definition from header files to Kconfig.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Tested-by: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: Tom Warren <twarren@nvidia.com>

# 8c688bc4 23-Oct-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

kconfig: move CONFIG_SYS_HZ to lib/Kconfig

CONFIG_SYS_HZ is always defined as 1000 in config_fallbacks.h
(but some boards still have redundant definitions).

This commit moves the definition and the document in README to
Kconfig. Since lib/Kconfig can assure that CONFIG_SYS_HZ is 1000,
the sanity check in lib/time.c should be removed.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Reviewed-by: Marek Vasut <marex@denx.de>

# b0928da6 16-Sep-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

kconfig: move CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED to Kconfig

If this option is enabled, the objects under lib/ directory
are compiled with speed optimization, not size optimization.
(Currently, only used by some Blackfin boards.)

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# ed36323f 16-Sep-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

kconfig: add blank Kconfig files

This would be useful to start moving various config options.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# fd210fee 28-Mar-2022 Philippe Reynes <philippe.reynes@softathome.com>

lib: allow to build asn1 decoder and oid registry in SPL

This commit adds the options:
- SPL_ASN1_DECODER
- SPL_OID_REGISTRY

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>

# 7d44a985 28-Mar-2022 Philippe Reynes <philippe.reynes@softathome.com>

lib: Kconfig: enhance the help of OID_REGISTRY

Enhance the help for the config OID_REGISTRY.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>

# a0e71d96 28-Mar-2022 Philippe Reynes <philippe.reynes@softathome.com>

lib: Kconfig: enhance help for ASN1

Enhance the help for configs ASN1_COMPILER
and ASN1_decoder.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>

# 761a1786 27-Jan-2022 Tom Rini <trini@konsulko.com>

Merge tag 'dm-pull-26jan22' of https://source.denx.de/u-boot/custodians/u-boot-dm

acpi refactoring to allow non-x86 use
binman support for bintools (binary tools)
minor tools improvements in preparation for FDT signing
various minor fixes and improvements


# 334a9b9d 25-Nov-2021 Loic Poulain <loic.poulain@linaro.org>

lib/circbuf: Make circbuf selectable symbol

It is currenly only used from usbtty driver but make it properly
selectable via Kconfig symbol, for future usage.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>

# e1722fcb 01-Dec-2021 Simon Glass <sjg@chromium.org>

x86: Allow any arch to generate ACPI tables

These have sadly found their way to ARM now. Allow any arch to support
generating ACPI tables.

Disable this for the tools build.

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

# 7c3fd5c2 26-Dec-2021 Qu Wenruo <wqu@suse.com>

lib: add BLAKE2 hash support

The code is cross-ported from BLAKE2 reference implementation
(https://github.com/BLAKE2/BLAKE2).

With minimal change to remove unused macros/features.

Currently there is only one user inside U-boot (btrfs), and since it
only utilize BLAKE2B, all other favors are all removed.

Signed-off-by: Qu Wenruo <wqu@suse.com>
[trini: Rename ROUND to R to avoid clash with <linux/bitops.h>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 97f2a749 04-Jan-2022 Eugen Hristev <eugen.hristev@microchip.com>

lib: Kconfig: fix PHANDLE_CHECK_SEQ position outside of menu

CONFIG_PHANDLE_CHECK_SEQ is outside of the menu 'Library routines'
thus it's invisible in menuconfig and cannot be selected.
Fix this by moving the 'endmenu' after the PHANDLE_CHECK_SEQ definition

Fixes: c589132a1d ("fdt: Use phandle to distinguish DT nodes with same name")
Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
Reviewed-by: Aswath Govindraju <a-govindraju@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 726cd983 29-Dec-2021 Simon Glass <sjg@chromium.org>

efi: Make unicode printf available to the app

This is needed to show unicode strings. Enable this code in the app.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>

# 6405ab7a 24-Nov-2021 Simon Glass <sjg@chromium.org>

Convert CONFIG_PHYSMEM to Kconfig

This converts the following to Kconfig:
CONFIG_PHYSMEM

Signed-off-by: Simon Glass <sjg@chromium.org>
Suggested-by: Sean Anderson <seanga2@gmail.com>

# ac7606af 14-Nov-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

lmb: fix typo 'commun'

%s/commun/common/

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

# e7d285b2 25-Sep-2021 Simon Glass <sjg@chromium.org>

image: Use the correct checks for CRC32

Add a host Kconfig for CRC32. With this we can use CONFIG_IS_ENABLED(CRC32)
directly in the host build, so drop the unnecessary indirection.

Add a few more conditions to SPL_CRC32 to avoid build failures as well as
TPL_CRC32. Also update hash.c to make crc32 optional and to actually take
notice of SPL_CRC32.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# 2c21256b 25-Sep-2021 Simon Glass <sjg@chromium.org>

hash: Use Kconfig to enable hashing in host tools and SPL

At present when building host tools, we force CONFIG_SHAxxx to be enabled
regardless of the board Kconfig setting. This is done in the image.h
header file.

For SPL we currently just assume the algorithm is desired if U-Boot proper
enables it.

Clean this up by adding new Kconfig options to enable hashing on the host,
relying on CONFIG_IS_ENABLED() to deal with the different builds.

Add new SPL Kconfigs for hardware-accelerated hashing, to maintain the
current settings.

This allows us to drop the image.h code and the I_WANT_MD5 hack.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# 603d15a5 25-Sep-2021 Simon Glass <sjg@chromium.org>

spl: cypto: Bring back SPL_ versions of SHA

Unfortunately these were removed by mistake. This means that adding hash
support to SPL brings in all software algorithms, with a substantial
increase in code size.

The origin of the problem was renaming them to SPL_FIT_xxx and then these
were removed altogether in a later commit.

Add them back. This aligns with CONFIG_MD5, for example, which has an SPL
variant.

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: f5bc9c25f31 ("image: Rename SPL_SHAxxx_SUPPORT to SPL_FIT_SHAxxx")
Fixes: eb5171ddec9 ("common: Remove unused CONFIG_FIT_SHAxxx selectors")
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# 6674edaa 16-Sep-2021 Tom Rini <trini@konsulko.com>

Merge tag 'v2021.10-rc4' into next

Prepare v2021.10-rc4

Signed-off-by: Tom Rini <trini@konsulko.com>

# gpg: Signature made Tue 14 Sep 2021 06:58:32 PM EDT
# gpg: using RSA key 1A3C7F70E08FAB1707809BBF147C39FF9634B72C
# gpg: Good signature from "Thomas Rini <trini@konsulko.com>" [ultimate]

# Conflicts:
# board/Arcturus/ucp1020/spl.c
# cmd/mvebu/Kconfig
# common/Kconfig.boot
# common/image-fit.c
# configs/UCP1020_defconfig
# configs/sifive_unmatched_defconfig
# drivers/pci/Kconfig
# include/configs/UCP1020.h
# include/configs/sifive-unmatched.h
# lib/Makefile
# scripts/config_whitelist.txt


# 5145bc73 01-Sep-2021 Oleksandr Suvorov <oleksandr.suvorov@foundries.io>

lib: fix typos in Kconfig

There are trivial typos in the Kconfig file. Fixed them.
Also, fixed grammar in the descriptions with typos.

Fixes: d56b4b1974 ("configs: Migrate RBTREE, LZO, CMD_MTDPARTS, CMD_UBI and CMD_UBIFS")
Fixes: 7264f2928b ("spl: fit: Eanble GZIP support for image decompression")
Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# e60e4499 02-Sep-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

lib: Drop SHA512_ALGO in lieu of SHA512

SHA512_ALGO was used as a "either SHA512 or SHA384", although the
implementations of these two algorithms share a majority of code.

From a Kconfig interface perspective, it makes sense to present two
distinct options. This requires #ifdefing out the SHA512
implementation from sha512.c. The latter doesn't make any sense.

It's reasonable to say in Kconfig that SHA384 depends on SHA512, and
seems to be the more polite way to handle the selection.

Thus, automatically select SHA512 when SHA384 is enabled.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# b4c2c151 27-Aug-2021 Michal Simek <michal.simek@xilinx.com>

Kconfig: Remove all default n/no options

default n/no doesn't need to be specified. It is default option anyway.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
[trini: Rework FSP_USE_UPD portion]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 928a8be7 29-Jul-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

lib: ecdsa: Implement UCLASS_ECDSA verification on target

Implement the crypto_algo .verify() function for ecdsa256. Because
it backends on UCLASS_ECDSA, this change is focused on parsing the
keys from devicetree and passing this information to the specific
UCLASS driver.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# fa3f1f1d 24-Jul-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: disable CONFIG_SPL_HEXDUMP by default

CONFIG_HEXDUMP is needed to display UEFI variables using 'printenv -e'.

Enabling CONFIG_SPL_HEXDUMP only makes sense for debugging purposes.
Hence CONFIG_SPL_HEXDUMP should not be enabled by default.

The following boards currently have CONFIG_SPL_HEXDUMP=y. This includes
boards that don't use SPL at all.

axm_defconfig
imx8mm-cl-iot-gate_defconfig
imx8mm_venice_defconfig
imxrt1020-evk_defconfig
imxrt1050-evk_defconfig
kontron_sl28_defconfig
kp_imx53_defconfig
lx2160ardb_tfa_stmm_defconfig
mt7622_rfb_defconfig
octeon_ebb7304_defconfig
octeon_nic23_defconfig
qemu_arm64_defconfig
qemu_arm_defconfig
qemu-riscv32_defconfig
qemu-riscv32_smode_defconfig
qemu-riscv64_defconfig
qemu-riscv64_smode_defconfig
qemu-x86_64_defconfig
qemu-x86_defconfig
sandbox64_defconfig
sandbox_defconfig
stm32mp15_basic_defconfig
stm32mp15_trusted_defconfig
synquacer_developerbox_defconfig
taurus_defconfig
xilinx_versal_virt_defconfig

The patch only keeps it enabled on

sandbox_spl_defconfig

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 1a46cb6c 02-Jul-2021 Simon Glass <sjg@chromium.org>

lib: Create a new Kconfig option for charset conversion

Rather than looking at two KConfig options in the Makefile, create a new
Kconfig option for compiling lib/charset.c

Enable it for UFS also, which needs this support.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 26dd9936 08-Jul-2021 Steffen Jaeckel <jaeckel-floss@eyet-services.de>

lib: add crypt subsystem

Add the basic functionality required to support the standard crypt
format.
The files crypt-sha256.c and crypt-sha512.c originate from libxcrypt and
their formatting is therefor retained.
The integration is done via a crypt_compare() function in crypt.c.

```
libxcrypt $ git describe --long --always --all
tags/v4.4.17-0-g6b110bc
```

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 7d0f3fbb 11-Jun-2021 Tero Kristo <t-kristo@ti.com>

lib: rational: copy the rational fraction lib routines from Linux

Copy the best rational approximation calculation routines from Linux.
Typical usecase for these routines is to calculate the M/N divider
values for PLLs to reach a specific clock rate.

This is based on linux kernel commit:
"lib/math/rational.c: fix possible incorrect result from rational
fractions helper"
(sha1: 323dd2c3ed0641f49e89b4e420f9eef5d3d5a881)

Signed-off-by: Tero Kristo <t-kristo@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Tero Kristo <kristo@kernel.org>

# ec0512b1 24-May-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

Revert "lib: introduce HASH_CALCULATE option"

When we think of Kconfig, we usually think of features that we like
to enable or not. Ideally, we wouldn't use Kconfig to fix a build
issue, although sometimes it might make sense. With Kconfig it's hard
to guarantee that the fix is universal. We can only say that it works
for the set of tested configurations. In the majority of cases, it's
preferable to let the linker figure things out for us.

The reverted commit attempted to fix a build issue by adding an
invisible Kconfig option. This is wrong in several ways:

It invents a new Kconfig variable when CONFIG_HASH already
exists for the same purpose.
Second, hash-checksum.c makes use of the hash_progressive_lookup_algo()
symbol, which is only provided with CONFIG_HASH, but this dependency
was not expressed in the reverted patch.

It feels like Kconfig is turning into a listing of all available
source files, and a buffet to 'select' which ones to compile. The
purpose of this revert is to enable the next change to make use of
CONFIG_HASH instead of adding to Kconfig.

This reverts commit 87316da05f2fd49d3709275e64ef0c5980366ade.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Acked-by: Masahisa Kojima <masahisa.kojima@linaro.org>

# 1621d3c4 10-May-2021 Bin Meng <bmeng.cn@gmail.com>

lib: kconfig: Limit BINMAN_FDT for OF_SEPARATE or OF_EMBED

Generally speaking BINMAN_FDT makes sense for OF_SEPARATE or OF_EMBED.
For the other OF_CONTROL methods, it's quite possible binman node is
not available as binman is invoked during the build phase instead of
runtime. Let's only turn it on for OF_SEPARATE or OF_EMBED by default.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 87316da0 13-May-2021 Masahisa Kojima <masahisa.kojima@linaro.org>

lib: introduce HASH_CALCULATE option

Build error occurs when CONFIG_EFI_SECURE_BOOT or
CONFIG_EFI_CAPSULE_AUTHENTICATE is enabled,
because hash-checksum.c is not compiled.

Since hash_calculate() implemented in hash-checksum.c can be
commonly used aside from FIT image signature verification,
this commit itroduces HASH_CALCULATE option to decide
if hash-checksum.c shall be compiled.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# e2ae483c 13-May-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

hash: Kconfig option for SHA512 hardware acceleration

Commit a479f103dc1c ("hash: Allow for SHA512 hardware implementations")
defined function definitions for hardware accelerated SHA384 and SHA512.
If CONFIG_SHA_HW_ACCEL=y, these functions are used.

We already have boards using CONFIG_SHA_HW_ACCEL=y but none implements the
new functions hw_sha384() and hw_sha512().

For implementing the EFI TCG2 protocol we need SHA384 and SHA512. The
missing hardware acceleration functions lead to build errors on boards like
peach-pi_defconfig.

Introduce a new Kconfig symbol CONFIG_SHA512_HW_ACCEL to control if the
functions hw_sha384() and hw_sha512() shall be used to implement the SHA384
and SHA512 algorithms.

Fixes: a479f103dc1c ("hash: Allow for SHA512 hardware implementations")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

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

# 6d66502b 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: Add 2 config to define the max number of regions

Add 2 configs CONFIG_LMB_MEMORY_REGIONS and CONFIG_LMB_RESERVED_REGIONS
to change independently the max number of the regions in lmb
library.

When CONFIG_LMB_USE_MAX_REGIONS=y, move the lmb property arrays to
struct lmb and manage the array size with the element 'max' of struct
lmb_region; their are still allocated in stack.

When CONFIG_LMB_USE_MAX_REGIONS=n, keep the current location in
struct lmb_region to allow compiler optimization.

Increase CONFIG_LMB_RESERVED_REGIONS is useful to avoid lmb errors in
bootm when the number of reserved regions (not adjacent) is reached:
+ 1 region for relocated U-Boot
+ 1 region for initrd
+ 1 region for relocated linux device tree
+ reserved memory regions present in Linux device tree.

The current limit of 8 regions is reached with only 5 reserved regions
in DT.

see Linux kernel commit bf23c51f1f49 ("memblock: Move memblock arrays
to static storage in memblock.c and make their size a variable")

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# 4fa0150d 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: move MAX_LMB_REGIONS value in Kconfig

Move MAX_LMB_REGIONS value in Kconfig, the max number of the regions
in lmb library.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# 77b8cfef 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: move CONFIG_LMB in Kconfig

Migrate CONFIG_LMB in Kconfig.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# a479f103 16-Feb-2021 Joel Stanley <joel@jms.id.au>

hash: Allow for SHA512 hardware implementations

Similar to support for SHA1 and SHA256, allow the use of hardware hashing
engine by enabling the algorithm and setting CONFIG_SHA_HW_ACCEL /
CONFIG_SHA_PROG_HW_ACCEL.

Signed-off-by: Joel Stanley <joel@jms.id.au>

# f2c1442e 14-Mar-2021 Simon Glass <sjg@chromium.org>

bloblist: Make BLOBLIST_TABLES depend on BLOBLIST

Add an extra condition here since we cannot put x86 tables in a bloblist
when bloblists are not supported.

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

# e0103158 25-Feb-2021 Bin Meng <bmeng.cn@gmail.com>

lib: kconfig: Mention CONFIG_ADDR_MAP limitation in the help

Mention that CONFIG_ADDR_MAP only works in the post-relocation phase.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>

# 56e7257c 03-Feb-2021 Bin Meng <bmeng.cn@gmail.com>

lib: Fix BINMAN_FDT dependency

lib/binman.c references the following 3 ofnode APIs:
ofnode_first_subnode(), ofnode_path() and ofnode_read_bool().

These APIs get built only when DM is on. Fix the dependency then.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 59e4e391 18-Jan-2021 Tom Rini <trini@konsulko.com>

Merge https://gitlab.denx.de/u-boot/custodians/u-boot-riscv

- Update qemu-riscv.rst build instructions.
- Add support for SPI on Kendryte K210.
- Add Microchip PolarFire SoC Icicle Kit support.
- Add support for an early timer.
- Select TIMER_EARLY to avoid infinite recursion for Trace.


# a80f8513 17-Jan-2021 Pragnesh Patel <pragnesh.patel@sifive.com>

trace: select TIMER_EARLY to avoid infinite recursion

When tracing functions is enabled this adds calls to
__cyg_profile_func_enter() and __cyg_profile_func_exit() to the traced
functions.

__cyg_profile_func_enter() and __cyg_profile_func_exit() invoke
timer_get_us() to record the entry and exit time.

initr_dm() will make gd->dm_root = NULL and gd->timer = NULL, so
timer_get_us() -> get_ticks() -> dm_timer_init() will lead to an
indefinite recursion.

So select TIMER_EARLY when tracing got enabled.

Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Rick Chen <rick@andestech.com>

# 6205bbb1 04-Jan-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lib: cosmetic update of CONFIG_LIB_ELF description

Change 2 typo error in CONFIG_LIB_ELF description:
- Supoort => Support
- fir => for

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c589132a 02-Dec-2020 Aswath Govindraju <a-govindraju@ti.com>

fdt: Use phandle to distinguish DT nodes with same name

While assigning the sequence number to subsystem instances by reading the
aliases property, only DT nodes names are compared and not the complete
path. This causes a problem when there are two DT nodes with same name but
have different paths.

In arch/arm/dts/k3-am65-main.dtsi there are two USB controllers with the
same device tree node name but different path. When aliases are defined for
these USB controllers then fdtdec_get_alias_seq() fails to pick the correct
instance for a given index.

fdt_path_offset() function is slow and this would effect the U-Boot
startup. To avert the time penalty on all boards, apply this extra check
only when required by using a config option.

Fix it by comparing the phandles of DT nodes after the node names match,
under a config option.

Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Fix whitespace error in Kconfig:
Signed-off-by: Simon Glass <sjg@chromium.org>

# 28cef9ca 19-Nov-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

fs: fat: create correct short names

The current function set_name() used to create short names has the
following deficiencies resolved by this patch:

* Long names (e.g. FOO.TXT) are stored even if a short name is enough.
* Short names with spaces are created, e.g. "A ~1.TXT".
* Short names with illegal characters are created, e.g. "FOO++BAR".
* Debug output does not not consider that the short file name has no
concluding '\0'.

The solution for the following bug is split of into a separate patch:

* Short file names must be unique.

This patch only provides the loop over possible short file names.

Fixes: c30a15e590c ("FAT: Add FAT write feature")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# e4f8e543 05-Nov-2020 Simon Glass <sjg@chromium.org>

smbios: Drop the unused Kconfig options

Now that we can use devicetree to specify this information, drop the old
CONFIG options.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 44c74bdd 05-Nov-2020 Simon Glass <sjg@chromium.org>

sysinfo: Provide a default driver to set SMBIOS values

Some boards want to specify the manufacturer or product name but do not
need to have their own sysinfo driver.

Add a default driver which provides a way to specify this SMBIOS
information in the devicetree, without needing any board-specific
functionality.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d2cb7a22 04-Nov-2020 Simon Glass <sjg@chromium.org>

x86: Allow putting some tables in the bloblist

At present all tables are placed starting at address f0000 in memory, and
can be up to 64KB in size. If the tables are very large, this may not
provide enough space.

Also if the tables point to other tables (such as console log or a ramoops
area) then we must allocate other memory anyway.

The bloblist is a nice place to put these tables since it is contiguous,
which makes it easy to reserve this memory for linux using the 820 tables.

Add an option to put some of the tables in the bloblist. For SMBIOS and
ACPI, create suitable pointers from the f0000 region to the new location
of the tables.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
[bmeng: squashed in http://patchwork.ozlabs.org/project/uboot/patch/
20201105062407.1.I8091ad931cbbb5e3b6f6ababdf3f8d5db0d17bb9@changeid/]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# 415eab06 03-Nov-2020 Christian Gmeiner <christian.gmeiner@gmail.com>

smbios: add parsing API

Add a very simple API to be able to access SMBIOS strings
like vendor, model and bios version.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 72eda507 27-Oct-2020 Sean Anderson <seanga2@gmail.com>

lib: Add getopt

Some commands can get very unweildy if they have too many positional
arguments. Adding options makes them easier to read, remember, and
understand.

This implementation of getopt has been taken from barebox, which has had
option support for quite a while. I have made a few modifications to their
version, such as the removal of opterr in favor of a separate getopt_silent
function. In addition, I have moved all global variables into struct
getopt_context.

The getopt from barebox also re-orders the arguments passed to it so that
non-options are placed last. This allows users to specify options anywhere.
For example, `ls -l foo/ -R` would be re-ordered to `ls -l -R foo/` as
getopt parsed the options. However, this feature conflicts with the const
argv in cmd_tbl->cmd. This was originally added in 54841ab50c ("Make sure
that argv[] argument pointers are not modified."). The reason stated in
that commit is that hush requires argv to stay unmodified. Has this
situation changed? Barebox also uses hush, and does not have this problem.
Perhaps we could use their fix?

I have assigned maintenance of getopt to Simon Glass, as it is currently
only used by the log command. I would also be fine maintaining it.

Signed-off-by: Sean Anderson <seanga2@gmail.com>

# 26637e2e 12-Sep-2020 Simon Glass <sjg@chromium.org>

lib: Allow hexdump to be used in SPL

It is sometimes useful to output hex dumps in SPL. Add a config option to
allow this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# e87dfb05 05-Aug-2020 Andrii Anisov <andrii_anisov@epam.com>

lib: sscanf: add sscanf implementation

Port sscanf implementation from mini-os and introduce new
Kconfig option to enable it: CONFIG_SSCANF. Disable by default.

Signed-off-by: Andrii Anisov <andrii_anisov@epam.com>
Signed-off-by: Anastasiia Lukianenko <anastasiia_lukianenko@epam.com>
Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>

# 81014f73 30-Jul-2020 Joao Marcos Costa <joaomarcos.costa@bootlin.com>

include/u-boot, lib/zlib: add sources for zlib decompression

Add zlib (v1.2.11) uncompr() function to U-Boot. SquashFS depends on
this function to decompress data from a raw disk image. The actual
support for zlib into SquashFS sources will be added in a follow-up
commit.

Signed-off-by: Joao Marcos Costa <joaomarcos.costa@bootlin.com>

# 69be8fd1 03-Jun-2020 Marek Szyprowski <m.szyprowski@samsung.com>

powerpc: move ADDR_MAP to Kconfig

Move ADDR_MAP related config options from include/configs/*.h to the
proper place in lib/Kconfig. This has been done using
./tools/moveconfig.py and manual inspection of the generated changes.
This is a preparation to use ADDR_MAP helper on ARM 32bit Raspberry Pi4
board for mapping the PCIe XHCI MMIO, which is above the 4GiB identity
mapping limit.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# d16b38f4 15-Apr-2020 Reuben Dowle <reubendowle0@gmail.com>

Add support for SHA384 and SHA512

The current recommendation for best security practice from the US government
is to use SHA384 for TOP SECRET [1].

This patch adds support for SHA384 and SHA512 in the hash command, and also
allows FIT images to be hashed with these algorithms, and signed with
sha384,rsaXXXX and sha512,rsaXXXX

The SHA implementation is adapted from the linux kernel implementation.

[1] Commercial National Security Algorithm Suite
http://www.iad.gov/iad/programs/iad-initiatives/cnsa-suite.cfm

Signed-off-by: Reuben Dowle <reuben.dowle@4rf.com>

# 43e442a5 26-May-2020 Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

kconfig: fix some typos

Signed-off-by: Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

# eff5a547 22-May-2020 Michael Walle <michael@walle.cc>

cmd: zip: automatically pull in gzip()

Move the CONFIG_GZIP_COMPRESSED from a config.h macro to a Kconfig menu
item. It is not selectable by a user because there is no reason to do
so. Instead it will be automatically selected by the stuff which uses
gzip(), like the zip command.

Remove it from the config_whitelist.txt. Also remove
CONFIG_GZIP_COMPRESS_DEF_SZ as this was never used on any board. The
default seems to be sane, otherwise it should be added as a Kconfig
option.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8239be61 06-May-2020 Simon Glass <sjg@chromium.org>

lib: Allow MD5 to be enabled in SPL

At present the MD5 option cannot be enabled by board configs since it has
no Kconfig name. It is generally enabled, so long as FIT support is
present. But not all boards use FIT, particularly in SPL

Fix this and add an option for SPL as well. This allows board code to call
md5() even if FIT support is not enabled.

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

# 04cb3994 21-Apr-2020 Weijie Gao <weijie.gao@mediatek.com>

lib: enable lzma decompression support for SPL build

This patch enables LZMA decompression support for SPL build

Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>

# 2a2119e1 05-Mar-2020 Atish Patra <atishp@atishpatra.org>

lib: kconfig: Add option to set BZIP2 compression method

There is no way to select BZIP2 compression method.
Add it under library/compression config where all other
compression related configs are present.

Signed-off-by: Atish Patra <atish.patra@wdc.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 805b3cac 12-Feb-2020 Keerthy <j-keerthy@ti.com>

lib: elf: Move the generic elf loading/validating functions to lib

Move the generic elf loading/validating functions to lib/
so that they can be re-used and accessed by code existing
outside cmd.

While at it remove the duplicate static version of load_elf_image_phdr
under arch/arm/mach-imx/imx_bootaux.c.

Signed-off-by: Keerthy <j-keerthy@ti.com>
Suggested-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>

# 1611235b 19-Jan-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: Kconfig dependencies for pseudo-random library

drivers/rng/sandbox_rng.c requires rand() to be defined but configuration
option CONFIG_CONFIG_LIB_RAND selected in drivers/rng/Kconfig does not
exist.

test/lib/test_aes.c requires rand() to be defined.

Fix the selection criteria for choice "Pseudo-random library support type".

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 3c10dc95 06-Dec-2019 Simon Glass <sjg@chromium.org>

binman: Add a library to access binman entries

SPL and TPL can access information about binman entries using link-time
symbols but this is not available in U-Boot proper. Of course it could be
made available, but the intention is to just read the device tree.

Add support for this, so that U-Boot can locate entries.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# b4adf627 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: crypto: add x509 parser

Imported from linux kernel v5.3:
x509.asn1 without changes
x509_akid.asn1 without changes
x509_parser.h without changes
x509_cert_parser.c with changes marked as __UBOOT__
x509_public_key.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# a9b45e6e 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add oid registry utility

Imported from linux kernel v5.3:
build_OID_registry without changes
oid_registry.h without changes
oid_registry.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# ab8a0e06 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add asn1 decoder

Imported from linux kernel v5.3:
lib/asn1_decoder.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 2b12196d 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

cmd: add asn1_compiler

Imported from linux kernel v5.3:
asn1.h without changes
asn1_ber_bytecode.h without changes
asn1_decoder.h without changes
asn1_compiler.c without changes

This host command will be used to create a ASN1 parser, for example,
for pkcs7 messages or x509 certificates. More specifically, it will
generate *byte code* which will be interpreted by asn1 decoder library.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 05429b6c 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

rtc: move date.c from drivers/rtc/ to lib/

In the next commit, rtc_mktime(), for compatibility with linux, will be
implemented using rtc_mktime(), which is no longer drivers/rtc specific.
So move this file under lib/.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 37ef1774 10-Nov-2019 Thomas Hebb <tommyhebb@gmail.com>

Kconfig: disambiguate config names for tiny printf

27084c03d36a ("spl: Allow tiny printf() to be controlled in SPL and
TPL") split this option in two for TPL and SPL, but didn't change the
Kconfig names, making them hard to set quickly.

Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>

# 0d76afc0 27-Oct-2019 Simon Glass <sjg@chromium.org>

fdt: Add Kconfig options to control code size

For better or worse libfdt recent grew a lot of code that checks the
validity of the device tree in great detail. When using unsigned or
unverified data this makes things safer, but it does add to code size.

Add some controls to select the trade-off between safety and code size.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 27084c03 25-Sep-2019 Simon Glass <sjg@chromium.org>

spl: Allow tiny printf() to be controlled in SPL and TPL

At present there is only one control for this and it is used for both SPL
and TPL. But SPL might have a lot more space than TPL so the extra cost of
a full printf() might be acceptable.

Split the option into two, providing separate SPL and TPL controls. The
TPL setting defaults to the same as SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2a51e16b 07-Jun-2019 Tom Rini <trini@konsulko.com>

configs: Make USE_TINY_PRINTF depend on SPL||TPL and be default

The USE_TINY_PRINTF symbol only changes things within SPL and TPL
builds, so make it depend on that support. Next, make it default as
within these cases we should rarely have need of more advanced print
formats outside of the debug context.

To do this, in a few cases we need to correct our Kconfig dependencies
as we had cases of non-SPL targets select'ing this symbol. Finally, in
the case of a few boards we really do need the full printf
functionality.

Signed-off-by: Tom Rini <trini@konsulko.com>

# da0fb5fd 02-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: make call depth limit customizable

Up to now we had hard coded values for the call depth up to which trace
records are created: 200 for early tracing, 15 thereafter. UEFI
applications reach a call depth of 80 or above.

Provide customizing settings for the call trace depth limit and the early
call trace depth limit. Use the old values as defaults.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8509f22a 29-Apr-2019 Marek Behún <marek.behun@nic.cz>

lib: add Zstandard decompression support

Add the zstd library from Linux kernel (only decompression support).
There are minimal changes to build with U-Boot, otherwise the files are
identical to Linux commit dc35da16 from March 2018, the files had not
been touched since in kernel. Also SPDX lincese tags were added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 83a486b6 29-Apr-2019 Marek Behún <marek.behun@nic.cz>

lib: Add xxhash support

This adds the xxhash support from Linux. Files are almost identical to
those added to Linux in commit 5d240522 ("lib: Add xxhash module") (they
haven't been touched since in Linux). The only difference is to add some
includes to be compatible with U-Boot. Also SPDX lincese tags were
added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 5132361a 29-Apr-2019 Heiko Schocher <hs@denx.de>

lib: Kconfig: fix help text for GZIP

commit 95f4bbd581cf ("lib: fdt: Allow LZO and GZIP DT compression in U-Boot")

introduced Kconfig option for gzip in U-Boot, but help text
says gzip for SPL, which is wrong. Fix this.

Signed-off-by: Heiko Schocher <hs@denx.de>
Acked-by: Marek Vasut <marex@denx.de>

# 1c6eb075 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE_BUFFER_SIZE et al to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE_BUFFER_SIZE
CONFIG_TRACE_EARLY_SIZE
CONFIG_TRACE_EARLY
CONFIG_TRACE_EARLY_ADDR

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

# a24a78d7 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE

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

# 54969b40 21-Mar-2019 Thierry Reding <treding@nvidia.com>

fdtdec: Add Kconfig symbol for tests

Runtime tests are provided as a test_fdtdec command implementation. Add
a Kconfig symbol that allows this command to be built so that the tests
can be used.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 95f4bbd5 08-Mar-2019 Marek Vasut <marex@denx.de>

lib: fdt: Allow LZO and GZIP DT compression in U-Boot

Add required Kconfig symbols, Makefile bits and macro fixes in a
few places to support LZO and DT compression in U-Boot. This can
save a lot of space with multi-DTB fitImages.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>

# 6e705114 13-Jan-2019 Chris Packham <judge.packham@gmail.com>

lib: Kconfig: spelling fixes

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 048c6e89 06-Nov-2018 Simon Glass <sjg@chromium.org>

spl: lz4: Allow use of lz4 compression in SPL

In some cases U-Boot is compressed and it is useful to be able to
decompress it in SPL. Add a Kconfig and Makefile change to allow this.
Note that this does not actually implement decompression.

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

# 2895c4b7 15-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

kconfig: Introduce HAVE_ARCH_IOMAP

Introduce a new Kconfig option for architecture codes to control
whether it provides io{read,write}{8,16,32} I/O accessor functions.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5592a633 01-Oct-2018 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt in TPL

In some cases (e.g. sandbox with verified boot) it is useful to support
libfdt in TPL. Update the Kconfig to handle this.

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

# 6307896c 01-Oct-2018 Simon Glass <sjg@chromium.org>

tpm: Add support for SPL and TPL

At present the tpm can only be used in U-Boot proper. Updated it to work
in SPL and TPL also.

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

# ab948cd2 19-Jul-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

fdt_support: make FDT_FIXUP_PARTITIONS depend on CMD_MTDPARTS

fdt_fixup_mtdparts() calls mtdparts_init() and device_find(),
which are defined in cmd/mtdparts.c

The combination of FDT_FIXUP_PARTITIONS=y and CMD_MTDPARTS=n
emits the following link error:

common/fdt_support.c:903: undefined reference to `mtdparts_init'
common/fdt_support.c:914: undefined reference to `device_find'

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 3330584d 03-Jun-2018 Igor Opaniuk <igor.opaniuk@gmail.com>

avb2.0: integrate avb 2.0 into the build system

Integrate libavb into the build system. Introduce CONFIG_LIBAVB
build option.

Signed-off-by: Igor Opaniuk <igor.opaniuk@linaro.org>

# f8c987f8 05-Jun-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

lib: Add hexdump

Often during debugging session it's very interesting to see
what data we were dealing with. For example what we write or read
to/from memory or peripherals.

This change introduces functions that allow to dump binary
data with one simple function invocation like:
------------------->8----------------
print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, buf, len);
------------------->8----------------

which gives us the following:
------------------->8----------------
00000000: f2 b7 c9 88 62 61 75 64 72 61 74 65 3d 31 31 35 ....baudrate=115
00000010: 32 30 30 00 62 6f 6f 74 61 72 67 73 3d 63 6f 6e 200.bootargs=con
00000020: 73 6f 6c 65 3d 74 74 79 53 33 2c 31 31 35 32 30 sole=ttyS3,11520
00000030: 30 6e 38 00 62 6f 6f 74 64 65 6c 61 79 3d 33 00 0n8.bootdelay=3.
00000040: 62 6f 6f 74 66 69 6c 65 3d 75 49 6d 61 67 65 00 bootfile=uImage.
00000050: 66 64 74 63 6f 6e 74 72 6f 6c 61 64 64 72 3d 39 fdtcontroladdr=9
00000060: 66 66 62 31 62 61 30 00 6c 6f 61 64 61 64 64 72 ffb1ba0.loadaddr
00000070: 3d 30 78 38 32 30 30 30 30 30 30 00 73 74 64 65 =0x82000000.stde
00000080: 72 72 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 rr=serial0@e0022
00000090: 30 30 30 00 73 74 64 69 6e 3d 73 65 72 69 61 6c 000.stdin=serial
000000a0: 30 40 65 30 30 32 32 30 30 30 00 73 74 64 6f 75 0@e0022000.stdou
000000b0: 74 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 30 t=serial0@e00220
000000c0: 30 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00..............
...
------------------->8----------------

Source of hexdump.c was copied from Linux kernel v4.7-rc2.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Mario Six <mario.six@gdsys.cc>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Stefan Roese <sr@denx.de>

# c232d14d 29-May-2018 Alex Kiernan <alex.kiernan@gmail.com>

mmc: Separate "mmc swrite" from fastboot

Introduce CONFIG_IMAGE_SPARSE and CONFIG_CMD_MMC_SWRITE so the "mmc
swrite" command is separated from the fastboot code.

Move image-sparse from common to lib so it's clear it's library code.

Rename CONFIG_FASTBOOT_FLASH_FILLBUF_SIZE to CONFIG_IMAGE_SPARSE_FILLBUF_SIZE
and migrate it to Kconfig.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Acked-by: Jassi Brar <jaswinder.singh@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6417572e 08-May-2018 Tom Rini <trini@konsulko.com>

lib/Kconfig: Mark OF_LIBFDT_OVERLAY as depending on OF_LIBFDT

The overlay code is only useful when OF_LIBFDT is set, so mark it as
depending on that first.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 58a46f88 25-Apr-2018 Praneeth Bajjuri <praneeth@ti.com>

configs: TI: Enable FIT Library overlay support

Enable the FDT library overlay support for all TI SOC family.

Without this option, when Loading fdt from FIT image, the
following warning is seen.

"config with overlays but CONFIG_OF_LIBFDT_OVERLAY not set".

Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
Suggested-by: Andrew F.Davis <afd@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>

# 14ad44ab 18-Apr-2018 Alex Kiernan <alex.kiernan@gmail.com>

spl: Split sprintf, strto* from SPL serial in Kconfig

When SPL serial is disabled, callers who need sprintf or strtoul fail
because their inclusion is guarded by CONFIG_SPL_SERIAL_SUPPORT/
CONFIG_TPL_SERIAL_SUPPORT.

Split printf, sprintf and strto into their own entries and then select
all of them if SERIAL_SUPPORT is enabled to match the current behaviour.

Include panic.o unconditionally as it can be called from anywhere which
uses BUG_ON().

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>

# e294ba06 04-Apr-2018 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-sunxi

Signed-off-by: Tom Rini <trini@konsulko.com>


# d14db11d 03-Apr-2018 Andre Przywara <andre.przywara@arm.com>

sunxi: revert disabling of features

In January some commits were introduced to mitigate the U-Boot image
size issues we encountered on sunxi builds.
Now with the MMC environment removed we can bring them back, as we
practically don't have a size limit anymore.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 32ce6179 13-Mar-2018 Bryan O'Donoghue <bryan.odonoghue@linaro.org>

optee: Add lib entries for sharing OPTEE code across ports

This patch adds code to lib to enable sharing of useful OPTEE code between
board-ports and architectures. The code on lib/optee/optee.c comes from the
TI omap2 port. Eventually the OMAP2 code will be patched to include the
shared code. The intention here is to add more useful OPTEE specific code
as more functionality gets added.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Cc: Harinarayan Bhatta <harinarayan@ti.com>
Cc: Andrew F. Davis <afd@ti.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Kever Yang <kever.yang@rock-chips.com>
Cc: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Cc: Peng Fan <peng.fan@nxp.com>
Tested-by: Peng Fan <peng.fan@nxp.com>

# 36c1877c 06-Feb-2018 Faiz Abbas <faiz_abbas@ti.com>

lib: Kconfig: Move DYNAMIC_CRC_TABLE to Kconfig

Add CONFIG prefix to DYNAMIC_CRC_TABLE and implement it in
Kconfig.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>

# a451bc27 05-Feb-2018 Adam Ford <aford173@gmail.com>

Convert LIB_UUID to Kconfig

config_fallback.h has some logic that checks a variety of options
and selects LIB_UUID if it hasn't already been selected. This
will all LIB_UUID in Kconfig and select this option for the list
of options to allow us to remove the logic from fallbacks

Signed-off-by: Adam Ford <aford173@gmail.com>

# a5a37567 06-Feb-2018 Adam Ford <aford173@gmail.com>

Convert CONFIG LIB_HW_RAND to Kconfig

config_fallbacks.h had some logic to automatically select
LIB_RAND if RANDOM_UUID or CMD_UUID were set if LIB_HW_RAND wasn't
already selected. By migrating LIB_HW_RAND to Kconfig, we can
remove this check from config_fallbacks.h and put it into Kconfig

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
[trini: Turn into a choice, add NET_RANDOM_ETHADDR]
Signed-off-by: Tom Rini <trini@konsulko.com>

# acd4d334 16-Jan-2018 Maxime Ripard <maxime.ripard@free-electrons.com>

net: regex: Disable by default on sunXi

The sunXi arm64 build has overflown, leading to the main U-boot binary
overwriting the environment when flashing the new image, or even worse,
overwriting itself when we're calling saveenv.

Disable this option that is not critical until we can adress the issue
properly.

Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 7e3caa81 03-Dec-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

Move CONFIG_PANIC_HANG to Kconfig

Freescale (NXP) boards have lots of defconfig files per board.
I used "imply PANIC_HANG" for them.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# da5337a6 08-Nov-2017 Nandor Han <nandor.han@ge.com>

rtc: add support for s35392a

Add support for S35392A RTC. The driver supports both U-Boot driver
models.

Signed-off-by: Nandor Han <nandor.han@ge.com>
Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
Cc: Heiko Schocher <hs@denx.de>

# f52bdf4b 14-Sep-2017 Jean-Jacques Hiblot <jjhiblot@ti.com>

lib: allow building lzo for the SPL

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 85d8bf57 03-Sep-2017 Marek Behún <marek.behun@nic.cz>

lib: Add CRC32-C

This is needed for BTRFS.

Signed-off-by: Marek Behun <marek.behun@nic.cz>

create mode 100644 lib/crc32c.c

# 7264f292 15-Aug-2017 York Sun <york.sun@nxp.com>

spl: fit: Eanble GZIP support for image decompression

Add Kconfig option SPL_GZIP and SPL_ZLIB to enable gunzip support for
SPL boot, eg. falcon boot compressed kernel image.

Signed-off-by: York Sun <york.sun@nxp.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6ef2f901 11-Aug-2017 Adam Ford <aford173@gmail.com>

Convert CONFIG_BCH to Kconfig

This converts the following to Kconfig:
CONFIG_BCH

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1a7ba1d 18-Aug-2017 Anatolij Gustschin <agust@denx.de>

Fix 'notes' typos

s/notes/nodes

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 96b9082c 03-Aug-2017 Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

rockchip: rk3188: rock: adjust for SPL/TPL split

With the changes to split SPL/TPL for the RK3368, I apparently missed
some needed adjustments to the RK3188 Kconfig and rock_defconfig.

This fixes build-issues for the rock board after applying the RK3368
enablement (and SPL/TPL) set that resulted from TPL_SERIAL_SUPPORT,
TPL_ROCKCHIP_BACK_TO_BROM and TPL_TINY_MEMSET being separate symbols
now.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d56b4b19 22-Jul-2017 Tom Rini <trini@konsulko.com>

configs: Migrate RBTREE, LZO, CMD_MTDPARTS, CMD_UBI and CMD_UBIFS

The above CONFIG options are in Kconfig, and now have correct depends and
inter-dependencies. Migrate these to configs/ from include/configs/. In the
case of CMD_UBIFS also change it to be a default y if CMD_UBI.

Signed-off-by: Tom Rini <trini@konsulko.com>

# aed998aa 17-May-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_LZMA to Kconfig

This converts the following to Kconfig:
CONFIG_LZMA

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

# b1a873df 26-Apr-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_CMD_AES et al to Kconfig

This converts the following to Kconfig:
CONFIG_CMD_AES
CONFIG_AES

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Add select AES to CMD_AES]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 173aafbf 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

cmd: Expose a Kconfig option to enable UBIFS commands

Create a new Kconfig entry to allow CMD_UBIFS selection from Kconfig and
add an hidden LZO option that can be selected by CMD_UBIFS.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>

# aa049152 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

mtd: ubi: Select RBTREE option from MTD_UBI Kconfig entry

Expose the RBTREE feature through Kconfig and select this option from the
MTD_UBI option.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>
[Rebased on master]
Signed-off-by: Jagan Teki <jagan@openedev.com>

# ab4458bd 02-Apr-2017 Simon Glass <sjg@chromium.org>

string: Provide a slimmed-down memset()

Most of the time the optimised memset() is what we want. For extreme
situations such as TPL it may be too large. For example on the 'rock'
board, using a simple loop saves a useful 48 bytes. With gcc 4.9 and
the rodata bug, this patch is enough to reduce the TPL image below the
limit.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>

# bea79d7d 14-Mar-2017 Andre Przywara <andre.przywara@arm.com>

Kconfig: introduce md5sum command selection

So far CONFIG_MD5SUM would need to be set by a board's include file.
Since the command is really generic, move it over to Kconfig to allow
it to be defined by either a board's defconfig, menuconfig or some
config snippet merged via mergeconfig.sh.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e663b350 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

smbios: Expose in efi_loader as table

We can pass SMBIOS easily as EFI configuration table to an EFI payload. This
patch adds enablement for that case.

While at it, we also enable SMBIOS generation for ARM systems, since they support
EFI_LOADER.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4b6dddc2 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

x86: Move smbios generation into arch independent directory

We will need the SMBIOS generation function on ARM as well going forward,
so let's move it into a non arch specific location.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# ebf7fff2 05-Oct-2016 Heiko Schocher <hs@denx.de>

spl: move FDT_FIXUP_PARTITIONS to Kconfig

Move FDT_FIXUP_PARTITIONS to Kconfig and cleanup existing
uses.

Signed-off-by: Heiko Schocher <hs@denx.de>

# ddf67f71 05-Jul-2016 Maxime Ripard <maxime.ripard@free-electrons.com>

libfdt: Add overlay application function

The device tree overlays are a good way to deal with user-modifyable
boards or boards with some kind of an expansion mechanism where we can
easily plug new board in (like the BBB, the Raspberry Pi or the CHIP).

Add a new function to merge overlays with a base device tree.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>

# 91b86e21 26-May-2016 Marek Vasut <marex@denx.de>

lib: Enable private libgcc by default

This patch decouples U-Boot binary from the toolchain on systems where
private libgcc is available. Instead of pulling in functions provided
by the libgcc from the toolchain, U-Boot will use it's own set of libgcc
functions. These functions are usually imported from Linux kernel, which
also uses it's own libgcc functions instead of the ones provided by the
toolchain.

This patch solves a rather common problem. The toolchain can usually
generate code for many variants of target architecture and often even
different endianness. The libgcc on the other hand is usually compiled
for one particular configuration and the functions provided by it may
or may not be suited for use in U-Boot. This can manifest in two ways,
either the U-Boot fails to compile altogether and linker will complain
or, in the much worse case, the resulting U-Boot will build, but will
misbehave in very subtle and hard to debug ways.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 67976306 30-Mar-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

cosmetic: Fix typos "privide"

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# ed980b8c 03-Mar-2016 Alexander Graf <agraf@csgraf.de>

efi_loader: hook up in build environment

Now that we have all the bits and pieces ready for EFI payload loading
support, hook them up in Makefiles and KConfigs so that we can build.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
[trini: Enable only when we of OF_LIBFDT, disable on kwb and colibri_pxa270]
Signed-off-by: Tom Rini <trini@konsulko.com>

# aa34fbc0 22-Feb-2016 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt to be used in SPL

Add an option to enable libfdt in SPL. This can be useful when decoding
FIT files in SPL.

We need to make sure this option is not enabled in SPL by this change.
Also this option needs to be enabled in host builds. Si add a new
IMAGE_USE_LIBFDT #define which can be used in files that are built on the
host but must also build for U-Boot and SPL.

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

# 69e173eb 22-Feb-2016 Simon Glass <sjg@chromium.org>

Move CONFIG_OF_LIBFDT to Kconfig

Move this option to Kconfig and tidy up existing boards.

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

# a187559e 05-Feb-2016 Bin Meng <bmeng.cn@gmail.com>

Use correct spelling of "U-Boot"

Correct spelling of "U-Boot" shall be used in all written text
(documentation, comments in source files etc.).

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Minkyu Kang <mk7.kang@samsung.com>

# 947c626d 14-Jan-2016 Tom Rini <trini@konsulko.com>

vsprintf.c: Always enable CONFIG_SYS_VSNPRINTF

Enabling this function always removes some class of string saftey issues.
The size change here in general is about 400 bytes and this seems a reasonable
trade-off.

Cc: Peng Fan <peng.fan@nxp.com>
Cc: Peter Robinson <pbrobinson@gmail.com>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Adrian Alonso <aalonso@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 7d9cde10 22-Nov-2015 Stefan Roese <sr@denx.de>

lib/tiny-printf.c: Add tiny printf function for space limited environments

This patch adds a small printf() version that supports all basic formats.
Its intented to be used in U-Boot SPL versions on platforms with very
limited internal RAM sizes.

To enable it, just define CONFIG_USE_TINY_PRINTF in your defconfig. This
will result in the SPL using this tiny function and the main U-Boot
still using the full-blown printf() function.

This code was copied from:
http://www.sparetimelabs.com/printfrevisited
With mostly only coding style related changes so that its checkpatch
clean.

The size reduction is about 2.5KiB. Here a comparison for the db-mv784mp-gp
(Marvell AXP) SPL:

Without this patch:
58963 18536 1928 79427 13643 ./spl/u-boot-spl

With this patch:
56542 18536 1956 77034 12cea ./spl/u-boot-spl

Note:
To make it possible to compile tiny-printf.c instead of vsprintf.c when
CONFIG_USE_TINY_PRINTF is defined, the functions printf() and vprintf() are
moved from common/console.c into vsprintf.c in this patch.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>

# 2419cd16 03-Oct-2015 Simon Glass <sjg@chromium.org>

dm: tpm: Drop CONFIG_DM_TPM

Now that all TPM drivers use driver model, we can drop the special driver
model CONFIG option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>

# 027b728d 06-Oct-2015 Julius Werner <jwerner@chromium.org>

Add support for LZ4 decompression algorithm

This patch adds support for LZ4-compressed FIT image contents. This
algorithm has a slightly worse compression ration than LZO while being
nearly twice as fast to decompress. When loading images from a fast
storage medium this usually results in a boot time win.

Sandbox-tested only since I don't have a U-Boot development system set
up right now. The code was imported unchanged from coreboot where it's
proven to work, though. I'm mostly interested in getting this recognized
by mkImage for use in a downstream project.

Signed-off-by: Julius Werner <jwerner@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# a7d660bc 22-Aug-2015 Simon Glass <sjg@chromium.org>

tpm: Add Kconfig options for TPMs

Add new Kconfig options for TPMs in preparation for moving boards to use
Kconfig for TPM configuration.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 867a6ac8 31-Jul-2015 Simon Glass <sjg@chromium.org>

efi: Add start-up library code

When running as an EFI application, U-Boot must request memory from EFI,
and provide access to the boot services U-Boot needs.

Add library code to perform these tasks. This includes efi_main() which is
the entry point from EFI. U-Boot is built as a shared library.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d1389403 23-Jun-2015 Simon Glass <sjg@chromium.org>

Add a dhrystone benchmark command

Drystone provides a convenient sanity check that the CPU is running at full
speed. Add this as a command which can be enabled as needed.

Note: I investigated using Coremark for this but there was a license
agreement and I could not work out if it was GPL-compatible.

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

# f7848d90 22-Jun-2015 Joe Hershberger <joe.hershberger@ni.com>

Allow CONFIG_REGEX to be disabled when CONFIG_NET

Instead of selecting REGEX when NET is enabled, make it the default, but
allow boards that are tiny to disable it and lose functionality on all
but the first Ethernet adapter.

cm-bf548, bf538f-ezkit, and bf533-stamp need this. None appear to have
more than one Ethernet interface.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# 3850dbe8 11-Jun-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

blackfin: fix undefined reference to srand and rand

Commit 9ba9e85f3f1c (net: Fix NET_RANDOM_ETHADDR dependencies)
accidentally dropped CONFIG_LIB_RAND defines for 14 Blackfin boards.

Prior to that commit, those boards defined CONFIG_LIB_RAND, but not
CONFIG_NET_RANDOM_ETHADDR. So, commit 9ba9e85f3f1c should not have
touched them, but in fact it ripped CONFIG_LIB_RAND off from all the
header files, which caused undefined reference to srand and rand.
CONFIG_LIB_RAND=y must be revived for such boards.

BTW, this commit indeed makes it better, but even with this fix,
three boards (bf533-stamp, bf538f-ezkit, cm-bf548) still can not
build due to region 'ram' overflowed error. This was cause by
commit 6eed3786c68c (net: Move the CMD_NET config to defconfigs)
because CMD_NET selects NET, and NET selects REGEX. Eventually,
some boards were newly enabled with CONFIG_REGEX, increasing the
memory footprint. A patch is expected to fix the build error.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 9ba9e85f 25-May-2015 Michal Simek <michal.simek@xilinx.com>

net: Fix NET_RANDOM_ETHADDR dependencies

NET_RANDOM_ETHADDR depends on lib/rand.c. This patch adds dependency to
Kconfig to ensure that library is also compiled.

Remove the definitions from Blackfin boards' include/configs.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 6501ff62 20-Apr-2015 Przemyslaw Marczak <p.marczak@samsung.com>

lib: Kconfig: add entry for errno_str() function

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1a60650c 21-Apr-2015 Joe Hershberger <joe.hershberger@ni.com>

kconfig: Move REGEX to Kconfig

Having this as a Kconfig allows it to be a dependent feature.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8156345d 06-Mar-2015 Simon Glass <sjg@chromium.org>

sandbox: Move CONFIG_SYS_VSNPRINTF to Kconfig

Move this over to Kconfig and tidy up.

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

# 94e3c8c4 19-Feb-2015 gaurav rana <gaurav.rana@freescale.com>

crypto/fsl - Add progressive hashing support using hardware acceleration.

Currently only normal hashing is supported using hardware acceleration.
Added support for progressive hashing using hardware.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
Signed-off-by: Gaurav Rana <gaurav.rana@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>

# d9f23c7f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

lib/rsa: Add Kconfig for devices supporting RSA Modular Exponentiation

Kconfig option added for devices which support RSA Verification.
1. RSA_SOFTWARE_EXP
Enables driver for supporting RSA Modular Exponentiation in Software
2. RSA_FREESCALE_EXP
Enables driver for supporting RSA Modular Exponentiation using Freescale specific
driver

The above drivers use RSA uclass

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
(Removed duplicate line in Kconfig comment)

Change-Id: I7663c4d5350e2bfc3dfa2696f70ef777d6ccc6f6

# c4beb22f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

FIT: Modify option FIT_SIGNATURE in Kconfig

For FIT signature based approach to work, RSA library needs to be selected.
The FIT_SIGNATURE option in Kconfig is modified to automatically select RSA.
Selecting RSA compiles the RSA library required for image verification.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 45ccec8f 23-Oct-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

kconfig: move CONFIG_USE_PRIVATE_LIBGCC to Kconfig

The private libgcc is supported only on ARM, MIPS, PowerPC, SH, x86.
Those architectures should "select" HAVE_PRIVATE_LIBGCC and
CONFIG_USE_PRIVATE_LIBGCC should depend on it.

Currently, this option is enabled on Tegra boards and x86 architecture.
Move the definition from header files to Kconfig.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Tested-by: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: Tom Warren <twarren@nvidia.com>

# 8c688bc4 23-Oct-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

kconfig: move CONFIG_SYS_HZ to lib/Kconfig

CONFIG_SYS_HZ is always defined as 1000 in config_fallbacks.h
(but some boards still have redundant definitions).

This commit moves the definition and the document in README to
Kconfig. Since lib/Kconfig can assure that CONFIG_SYS_HZ is 1000,
the sanity check in lib/time.c should be removed.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Reviewed-by: Marek Vasut <marex@denx.de>

# b0928da6 16-Sep-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

kconfig: move CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED to Kconfig

If this option is enabled, the objects under lib/ directory
are compiled with speed optimization, not size optimization.
(Currently, only used by some Blackfin boards.)

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# ed36323f 16-Sep-2014 Masahiro Yamada <yamada.masahiro@socionext.com>

kconfig: add blank Kconfig files

This would be useful to start moving various config options.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# 761a1786 27-Jan-2022 Tom Rini <trini@konsulko.com>

Merge tag 'dm-pull-26jan22' of https://source.denx.de/u-boot/custodians/u-boot-dm

acpi refactoring to allow non-x86 use
binman support for bintools (binary tools)
minor tools improvements in preparation for FDT signing
various minor fixes and improvements


# 334a9b9d 25-Nov-2021 Loic Poulain <loic.poulain@linaro.org>

lib/circbuf: Make circbuf selectable symbol

It is currenly only used from usbtty driver but make it properly
selectable via Kconfig symbol, for future usage.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>

# e1722fcb 01-Dec-2021 Simon Glass <sjg@chromium.org>

x86: Allow any arch to generate ACPI tables

These have sadly found their way to ARM now. Allow any arch to support
generating ACPI tables.

Disable this for the tools build.

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

# 7c3fd5c2 26-Dec-2021 Qu Wenruo <wqu@suse.com>

lib: add BLAKE2 hash support

The code is cross-ported from BLAKE2 reference implementation
(https://github.com/BLAKE2/BLAKE2).

With minimal change to remove unused macros/features.

Currently there is only one user inside U-boot (btrfs), and since it
only utilize BLAKE2B, all other favors are all removed.

Signed-off-by: Qu Wenruo <wqu@suse.com>
[trini: Rename ROUND to R to avoid clash with <linux/bitops.h>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 97f2a749 04-Jan-2022 Eugen Hristev <eugen.hristev@microchip.com>

lib: Kconfig: fix PHANDLE_CHECK_SEQ position outside of menu

CONFIG_PHANDLE_CHECK_SEQ is outside of the menu 'Library routines'
thus it's invisible in menuconfig and cannot be selected.
Fix this by moving the 'endmenu' after the PHANDLE_CHECK_SEQ definition

Fixes: c589132a1d ("fdt: Use phandle to distinguish DT nodes with same name")
Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
Reviewed-by: Aswath Govindraju <a-govindraju@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 726cd983 29-Dec-2021 Simon Glass <sjg@chromium.org>

efi: Make unicode printf available to the app

This is needed to show unicode strings. Enable this code in the app.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>

# 6405ab7a 24-Nov-2021 Simon Glass <sjg@chromium.org>

Convert CONFIG_PHYSMEM to Kconfig

This converts the following to Kconfig:
CONFIG_PHYSMEM

Signed-off-by: Simon Glass <sjg@chromium.org>
Suggested-by: Sean Anderson <seanga2@gmail.com>

# ac7606af 14-Nov-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

lmb: fix typo 'commun'

%s/commun/common/

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

# e7d285b2 25-Sep-2021 Simon Glass <sjg@chromium.org>

image: Use the correct checks for CRC32

Add a host Kconfig for CRC32. With this we can use CONFIG_IS_ENABLED(CRC32)
directly in the host build, so drop the unnecessary indirection.

Add a few more conditions to SPL_CRC32 to avoid build failures as well as
TPL_CRC32. Also update hash.c to make crc32 optional and to actually take
notice of SPL_CRC32.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# 2c21256b 25-Sep-2021 Simon Glass <sjg@chromium.org>

hash: Use Kconfig to enable hashing in host tools and SPL

At present when building host tools, we force CONFIG_SHAxxx to be enabled
regardless of the board Kconfig setting. This is done in the image.h
header file.

For SPL we currently just assume the algorithm is desired if U-Boot proper
enables it.

Clean this up by adding new Kconfig options to enable hashing on the host,
relying on CONFIG_IS_ENABLED() to deal with the different builds.

Add new SPL Kconfigs for hardware-accelerated hashing, to maintain the
current settings.

This allows us to drop the image.h code and the I_WANT_MD5 hack.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# 603d15a5 25-Sep-2021 Simon Glass <sjg@chromium.org>

spl: cypto: Bring back SPL_ versions of SHA

Unfortunately these were removed by mistake. This means that adding hash
support to SPL brings in all software algorithms, with a substantial
increase in code size.

The origin of the problem was renaming them to SPL_FIT_xxx and then these
were removed altogether in a later commit.

Add them back. This aligns with CONFIG_MD5, for example, which has an SPL
variant.

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: f5bc9c25f31 ("image: Rename SPL_SHAxxx_SUPPORT to SPL_FIT_SHAxxx")
Fixes: eb5171ddec9 ("common: Remove unused CONFIG_FIT_SHAxxx selectors")
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# 6674edaa 16-Sep-2021 Tom Rini <trini@konsulko.com>

Merge tag 'v2021.10-rc4' into next

Prepare v2021.10-rc4

Signed-off-by: Tom Rini <trini@konsulko.com>

# gpg: Signature made Tue 14 Sep 2021 06:58:32 PM EDT
# gpg: using RSA key 1A3C7F70E08FAB1707809BBF147C39FF9634B72C
# gpg: Good signature from "Thomas Rini <trini@konsulko.com>" [ultimate]

# Conflicts:
# board/Arcturus/ucp1020/spl.c
# cmd/mvebu/Kconfig
# common/Kconfig.boot
# common/image-fit.c
# configs/UCP1020_defconfig
# configs/sifive_unmatched_defconfig
# drivers/pci/Kconfig
# include/configs/UCP1020.h
# include/configs/sifive-unmatched.h
# lib/Makefile
# scripts/config_whitelist.txt


# 5145bc73 01-Sep-2021 Oleksandr Suvorov <oleksandr.suvorov@foundries.io>

lib: fix typos in Kconfig

There are trivial typos in the Kconfig file. Fixed them.
Also, fixed grammar in the descriptions with typos.

Fixes: d56b4b1974 ("configs: Migrate RBTREE, LZO, CMD_MTDPARTS, CMD_UBI and CMD_UBIFS")
Fixes: 7264f2928b ("spl: fit: Eanble GZIP support for image decompression")
Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# e60e4499 02-Sep-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

lib: Drop SHA512_ALGO in lieu of SHA512

SHA512_ALGO was used as a "either SHA512 or SHA384", although the
implementations of these two algorithms share a majority of code.

From a Kconfig interface perspective, it makes sense to present two
distinct options. This requires #ifdefing out the SHA512
implementation from sha512.c. The latter doesn't make any sense.

It's reasonable to say in Kconfig that SHA384 depends on SHA512, and
seems to be the more polite way to handle the selection.

Thus, automatically select SHA512 when SHA384 is enabled.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# b4c2c151 27-Aug-2021 Michal Simek <michal.simek@xilinx.com>

Kconfig: Remove all default n/no options

default n/no doesn't need to be specified. It is default option anyway.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
[trini: Rework FSP_USE_UPD portion]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 928a8be7 29-Jul-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

lib: ecdsa: Implement UCLASS_ECDSA verification on target

Implement the crypto_algo .verify() function for ecdsa256. Because
it backends on UCLASS_ECDSA, this change is focused on parsing the
keys from devicetree and passing this information to the specific
UCLASS driver.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# fa3f1f1d 24-Jul-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: disable CONFIG_SPL_HEXDUMP by default

CONFIG_HEXDUMP is needed to display UEFI variables using 'printenv -e'.

Enabling CONFIG_SPL_HEXDUMP only makes sense for debugging purposes.
Hence CONFIG_SPL_HEXDUMP should not be enabled by default.

The following boards currently have CONFIG_SPL_HEXDUMP=y. This includes
boards that don't use SPL at all.

axm_defconfig
imx8mm-cl-iot-gate_defconfig
imx8mm_venice_defconfig
imxrt1020-evk_defconfig
imxrt1050-evk_defconfig
kontron_sl28_defconfig
kp_imx53_defconfig
lx2160ardb_tfa_stmm_defconfig
mt7622_rfb_defconfig
octeon_ebb7304_defconfig
octeon_nic23_defconfig
qemu_arm64_defconfig
qemu_arm_defconfig
qemu-riscv32_defconfig
qemu-riscv32_smode_defconfig
qemu-riscv64_defconfig
qemu-riscv64_smode_defconfig
qemu-x86_64_defconfig
qemu-x86_defconfig
sandbox64_defconfig
sandbox_defconfig
stm32mp15_basic_defconfig
stm32mp15_trusted_defconfig
synquacer_developerbox_defconfig
taurus_defconfig
xilinx_versal_virt_defconfig

The patch only keeps it enabled on

sandbox_spl_defconfig

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 1a46cb6c 02-Jul-2021 Simon Glass <sjg@chromium.org>

lib: Create a new Kconfig option for charset conversion

Rather than looking at two KConfig options in the Makefile, create a new
Kconfig option for compiling lib/charset.c

Enable it for UFS also, which needs this support.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 26dd9936 08-Jul-2021 Steffen Jaeckel <jaeckel-floss@eyet-services.de>

lib: add crypt subsystem

Add the basic functionality required to support the standard crypt
format.
The files crypt-sha256.c and crypt-sha512.c originate from libxcrypt and
their formatting is therefor retained.
The integration is done via a crypt_compare() function in crypt.c.

```
libxcrypt $ git describe --long --always --all
tags/v4.4.17-0-g6b110bc
```

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 7d0f3fbb 11-Jun-2021 Tero Kristo <t-kristo@ti.com>

lib: rational: copy the rational fraction lib routines from Linux

Copy the best rational approximation calculation routines from Linux.
Typical usecase for these routines is to calculate the M/N divider
values for PLLs to reach a specific clock rate.

This is based on linux kernel commit:
"lib/math/rational.c: fix possible incorrect result from rational
fractions helper"
(sha1: 323dd2c3ed0641f49e89b4e420f9eef5d3d5a881)

Signed-off-by: Tero Kristo <t-kristo@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Tero Kristo <kristo@kernel.org>

# ec0512b1 24-May-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

Revert "lib: introduce HASH_CALCULATE option"

When we think of Kconfig, we usually think of features that we like
to enable or not. Ideally, we wouldn't use Kconfig to fix a build
issue, although sometimes it might make sense. With Kconfig it's hard
to guarantee that the fix is universal. We can only say that it works
for the set of tested configurations. In the majority of cases, it's
preferable to let the linker figure things out for us.

The reverted commit attempted to fix a build issue by adding an
invisible Kconfig option. This is wrong in several ways:

It invents a new Kconfig variable when CONFIG_HASH already
exists for the same purpose.
Second, hash-checksum.c makes use of the hash_progressive_lookup_algo()
symbol, which is only provided with CONFIG_HASH, but this dependency
was not expressed in the reverted patch.

It feels like Kconfig is turning into a listing of all available
source files, and a buffet to 'select' which ones to compile. The
purpose of this revert is to enable the next change to make use of
CONFIG_HASH instead of adding to Kconfig.

This reverts commit 87316da05f2fd49d3709275e64ef0c5980366ade.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Acked-by: Masahisa Kojima <masahisa.kojima@linaro.org>

# 1621d3c4 10-May-2021 Bin Meng <bmeng.cn@gmail.com>

lib: kconfig: Limit BINMAN_FDT for OF_SEPARATE or OF_EMBED

Generally speaking BINMAN_FDT makes sense for OF_SEPARATE or OF_EMBED.
For the other OF_CONTROL methods, it's quite possible binman node is
not available as binman is invoked during the build phase instead of
runtime. Let's only turn it on for OF_SEPARATE or OF_EMBED by default.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 87316da0 13-May-2021 Masahisa Kojima <masahisa.kojima@linaro.org>

lib: introduce HASH_CALCULATE option

Build error occurs when CONFIG_EFI_SECURE_BOOT or
CONFIG_EFI_CAPSULE_AUTHENTICATE is enabled,
because hash-checksum.c is not compiled.

Since hash_calculate() implemented in hash-checksum.c can be
commonly used aside from FIT image signature verification,
this commit itroduces HASH_CALCULATE option to decide
if hash-checksum.c shall be compiled.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# e2ae483c 13-May-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

hash: Kconfig option for SHA512 hardware acceleration

Commit a479f103dc1c ("hash: Allow for SHA512 hardware implementations")
defined function definitions for hardware accelerated SHA384 and SHA512.
If CONFIG_SHA_HW_ACCEL=y, these functions are used.

We already have boards using CONFIG_SHA_HW_ACCEL=y but none implements the
new functions hw_sha384() and hw_sha512().

For implementing the EFI TCG2 protocol we need SHA384 and SHA512. The
missing hardware acceleration functions lead to build errors on boards like
peach-pi_defconfig.

Introduce a new Kconfig symbol CONFIG_SHA512_HW_ACCEL to control if the
functions hw_sha384() and hw_sha512() shall be used to implement the SHA384
and SHA512 algorithms.

Fixes: a479f103dc1c ("hash: Allow for SHA512 hardware implementations")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

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

# 6d66502b 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: Add 2 config to define the max number of regions

Add 2 configs CONFIG_LMB_MEMORY_REGIONS and CONFIG_LMB_RESERVED_REGIONS
to change independently the max number of the regions in lmb
library.

When CONFIG_LMB_USE_MAX_REGIONS=y, move the lmb property arrays to
struct lmb and manage the array size with the element 'max' of struct
lmb_region; their are still allocated in stack.

When CONFIG_LMB_USE_MAX_REGIONS=n, keep the current location in
struct lmb_region to allow compiler optimization.

Increase CONFIG_LMB_RESERVED_REGIONS is useful to avoid lmb errors in
bootm when the number of reserved regions (not adjacent) is reached:
+ 1 region for relocated U-Boot
+ 1 region for initrd
+ 1 region for relocated linux device tree
+ reserved memory regions present in Linux device tree.

The current limit of 8 regions is reached with only 5 reserved regions
in DT.

see Linux kernel commit bf23c51f1f49 ("memblock: Move memblock arrays
to static storage in memblock.c and make their size a variable")

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# 4fa0150d 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: move MAX_LMB_REGIONS value in Kconfig

Move MAX_LMB_REGIONS value in Kconfig, the max number of the regions
in lmb library.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# 77b8cfef 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: move CONFIG_LMB in Kconfig

Migrate CONFIG_LMB in Kconfig.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# a479f103 16-Feb-2021 Joel Stanley <joel@jms.id.au>

hash: Allow for SHA512 hardware implementations

Similar to support for SHA1 and SHA256, allow the use of hardware hashing
engine by enabling the algorithm and setting CONFIG_SHA_HW_ACCEL /
CONFIG_SHA_PROG_HW_ACCEL.

Signed-off-by: Joel Stanley <joel@jms.id.au>

# f2c1442e 14-Mar-2021 Simon Glass <sjg@chromium.org>

bloblist: Make BLOBLIST_TABLES depend on BLOBLIST

Add an extra condition here since we cannot put x86 tables in a bloblist
when bloblists are not supported.

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

# e0103158 25-Feb-2021 Bin Meng <bmeng.cn@gmail.com>

lib: kconfig: Mention CONFIG_ADDR_MAP limitation in the help

Mention that CONFIG_ADDR_MAP only works in the post-relocation phase.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>

# 56e7257c 03-Feb-2021 Bin Meng <bmeng.cn@gmail.com>

lib: Fix BINMAN_FDT dependency

lib/binman.c references the following 3 ofnode APIs:
ofnode_first_subnode(), ofnode_path() and ofnode_read_bool().

These APIs get built only when DM is on. Fix the dependency then.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 59e4e391 18-Jan-2021 Tom Rini <trini@konsulko.com>

Merge https://gitlab.denx.de/u-boot/custodians/u-boot-riscv

- Update qemu-riscv.rst build instructions.
- Add support for SPI on Kendryte K210.
- Add Microchip PolarFire SoC Icicle Kit support.
- Add support for an early timer.
- Select TIMER_EARLY to avoid infinite recursion for Trace.


# a80f8513 17-Jan-2021 Pragnesh Patel <pragnesh.patel@sifive.com>

trace: select TIMER_EARLY to avoid infinite recursion

When tracing functions is enabled this adds calls to
__cyg_profile_func_enter() and __cyg_profile_func_exit() to the traced
functions.

__cyg_profile_func_enter() and __cyg_profile_func_exit() invoke
timer_get_us() to record the entry and exit time.

initr_dm() will make gd->dm_root = NULL and gd->timer = NULL, so
timer_get_us() -> get_ticks() -> dm_timer_init() will lead to an
indefinite recursion.

So select TIMER_EARLY when tracing got enabled.

Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Rick Chen <rick@andestech.com>

# 6205bbb1 04-Jan-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lib: cosmetic update of CONFIG_LIB_ELF description

Change 2 typo error in CONFIG_LIB_ELF description:
- Supoort => Support
- fir => for

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c589132a 02-Dec-2020 Aswath Govindraju <a-govindraju@ti.com>

fdt: Use phandle to distinguish DT nodes with same name

While assigning the sequence number to subsystem instances by reading the
aliases property, only DT nodes names are compared and not the complete
path. This causes a problem when there are two DT nodes with same name but
have different paths.

In arch/arm/dts/k3-am65-main.dtsi there are two USB controllers with the
same device tree node name but different path. When aliases are defined for
these USB controllers then fdtdec_get_alias_seq() fails to pick the correct
instance for a given index.

fdt_path_offset() function is slow and this would effect the U-Boot
startup. To avert the time penalty on all boards, apply this extra check
only when required by using a config option.

Fix it by comparing the phandles of DT nodes after the node names match,
under a config option.

Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Fix whitespace error in Kconfig:
Signed-off-by: Simon Glass <sjg@chromium.org>

# 28cef9ca 19-Nov-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

fs: fat: create correct short names

The current function set_name() used to create short names has the
following deficiencies resolved by this patch:

* Long names (e.g. FOO.TXT) are stored even if a short name is enough.
* Short names with spaces are created, e.g. "A ~1.TXT".
* Short names with illegal characters are created, e.g. "FOO++BAR".
* Debug output does not not consider that the short file name has no
concluding '\0'.

The solution for the following bug is split of into a separate patch:

* Short file names must be unique.

This patch only provides the loop over possible short file names.

Fixes: c30a15e590c ("FAT: Add FAT write feature")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# e4f8e543 05-Nov-2020 Simon Glass <sjg@chromium.org>

smbios: Drop the unused Kconfig options

Now that we can use devicetree to specify this information, drop the old
CONFIG options.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 44c74bdd 05-Nov-2020 Simon Glass <sjg@chromium.org>

sysinfo: Provide a default driver to set SMBIOS values

Some boards want to specify the manufacturer or product name but do not
need to have their own sysinfo driver.

Add a default driver which provides a way to specify this SMBIOS
information in the devicetree, without needing any board-specific
functionality.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d2cb7a22 04-Nov-2020 Simon Glass <sjg@chromium.org>

x86: Allow putting some tables in the bloblist

At present all tables are placed starting at address f0000 in memory, and
can be up to 64KB in size. If the tables are very large, this may not
provide enough space.

Also if the tables point to other tables (such as console log or a ramoops
area) then we must allocate other memory anyway.

The bloblist is a nice place to put these tables since it is contiguous,
which makes it easy to reserve this memory for linux using the 820 tables.

Add an option to put some of the tables in the bloblist. For SMBIOS and
ACPI, create suitable pointers from the f0000 region to the new location
of the tables.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
[bmeng: squashed in http://patchwork.ozlabs.org/project/uboot/patch/
20201105062407.1.I8091ad931cbbb5e3b6f6ababdf3f8d5db0d17bb9@changeid/]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# 415eab06 03-Nov-2020 Christian Gmeiner <christian.gmeiner@gmail.com>

smbios: add parsing API

Add a very simple API to be able to access SMBIOS strings
like vendor, model and bios version.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 72eda507 27-Oct-2020 Sean Anderson <seanga2@gmail.com>

lib: Add getopt

Some commands can get very unweildy if they have too many positional
arguments. Adding options makes them easier to read, remember, and
understand.

This implementation of getopt has been taken from barebox, which has had
option support for quite a while. I have made a few modifications to their
version, such as the removal of opterr in favor of a separate getopt_silent
function. In addition, I have moved all global variables into struct
getopt_context.

The getopt from barebox also re-orders the arguments passed to it so that
non-options are placed last. This allows users to specify options anywhere.
For example, `ls -l foo/ -R` would be re-ordered to `ls -l -R foo/` as
getopt parsed the options. However, this feature conflicts with the const
argv in cmd_tbl->cmd. This was originally added in 54841ab50c ("Make sure
that argv[] argument pointers are not modified."). The reason stated in
that commit is that hush requires argv to stay unmodified. Has this
situation changed? Barebox also uses hush, and does not have this problem.
Perhaps we could use their fix?

I have assigned maintenance of getopt to Simon Glass, as it is currently
only used by the log command. I would also be fine maintaining it.

Signed-off-by: Sean Anderson <seanga2@gmail.com>

# 26637e2e 12-Sep-2020 Simon Glass <sjg@chromium.org>

lib: Allow hexdump to be used in SPL

It is sometimes useful to output hex dumps in SPL. Add a config option to
allow this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# e87dfb05 05-Aug-2020 Andrii Anisov <andrii_anisov@epam.com>

lib: sscanf: add sscanf implementation

Port sscanf implementation from mini-os and introduce new
Kconfig option to enable it: CONFIG_SSCANF. Disable by default.

Signed-off-by: Andrii Anisov <andrii_anisov@epam.com>
Signed-off-by: Anastasiia Lukianenko <anastasiia_lukianenko@epam.com>
Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>

# 81014f73 30-Jul-2020 Joao Marcos Costa <joaomarcos.costa@bootlin.com>

include/u-boot, lib/zlib: add sources for zlib decompression

Add zlib (v1.2.11) uncompr() function to U-Boot. SquashFS depends on
this function to decompress data from a raw disk image. The actual
support for zlib into SquashFS sources will be added in a follow-up
commit.

Signed-off-by: Joao Marcos Costa <joaomarcos.costa@bootlin.com>

# 69be8fd1 03-Jun-2020 Marek Szyprowski <m.szyprowski@samsung.com>

powerpc: move ADDR_MAP to Kconfig

Move ADDR_MAP related config options from include/configs/*.h to the
proper place in lib/Kconfig. This has been done using
./tools/moveconfig.py and manual inspection of the generated changes.
This is a preparation to use ADDR_MAP helper on ARM 32bit Raspberry Pi4
board for mapping the PCIe XHCI MMIO, which is above the 4GiB identity
mapping limit.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# d16b38f4 15-Apr-2020 Reuben Dowle <reubendowle0@gmail.com>

Add support for SHA384 and SHA512

The current recommendation for best security practice from the US government
is to use SHA384 for TOP SECRET [1].

This patch adds support for SHA384 and SHA512 in the hash command, and also
allows FIT images to be hashed with these algorithms, and signed with
sha384,rsaXXXX and sha512,rsaXXXX

The SHA implementation is adapted from the linux kernel implementation.

[1] Commercial National Security Algorithm Suite
http://www.iad.gov/iad/programs/iad-initiatives/cnsa-suite.cfm

Signed-off-by: Reuben Dowle <reuben.dowle@4rf.com>

# 43e442a5 26-May-2020 Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

kconfig: fix some typos

Signed-off-by: Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

# eff5a547 22-May-2020 Michael Walle <michael@walle.cc>

cmd: zip: automatically pull in gzip()

Move the CONFIG_GZIP_COMPRESSED from a config.h macro to a Kconfig menu
item. It is not selectable by a user because there is no reason to do
so. Instead it will be automatically selected by the stuff which uses
gzip(), like the zip command.

Remove it from the config_whitelist.txt. Also remove
CONFIG_GZIP_COMPRESS_DEF_SZ as this was never used on any board. The
default seems to be sane, otherwise it should be added as a Kconfig
option.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8239be61 06-May-2020 Simon Glass <sjg@chromium.org>

lib: Allow MD5 to be enabled in SPL

At present the MD5 option cannot be enabled by board configs since it has
no Kconfig name. It is generally enabled, so long as FIT support is
present. But not all boards use FIT, particularly in SPL

Fix this and add an option for SPL as well. This allows board code to call
md5() even if FIT support is not enabled.

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

# 04cb3994 21-Apr-2020 Weijie Gao <weijie.gao@mediatek.com>

lib: enable lzma decompression support for SPL build

This patch enables LZMA decompression support for SPL build

Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>

# 2a2119e1 05-Mar-2020 Atish Patra <atishp@atishpatra.org>

lib: kconfig: Add option to set BZIP2 compression method

There is no way to select BZIP2 compression method.
Add it under library/compression config where all other
compression related configs are present.

Signed-off-by: Atish Patra <atish.patra@wdc.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 805b3cac 12-Feb-2020 Keerthy <j-keerthy@ti.com>

lib: elf: Move the generic elf loading/validating functions to lib

Move the generic elf loading/validating functions to lib/
so that they can be re-used and accessed by code existing
outside cmd.

While at it remove the duplicate static version of load_elf_image_phdr
under arch/arm/mach-imx/imx_bootaux.c.

Signed-off-by: Keerthy <j-keerthy@ti.com>
Suggested-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>

# 1611235b 19-Jan-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: Kconfig dependencies for pseudo-random library

drivers/rng/sandbox_rng.c requires rand() to be defined but configuration
option CONFIG_CONFIG_LIB_RAND selected in drivers/rng/Kconfig does not
exist.

test/lib/test_aes.c requires rand() to be defined.

Fix the selection criteria for choice "Pseudo-random library support type".

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 3c10dc95 06-Dec-2019 Simon Glass <sjg@chromium.org>

binman: Add a library to access binman entries

SPL and TPL can access information about binman entries using link-time
symbols but this is not available in U-Boot proper. Of course it could be
made available, but the intention is to just read the device tree.

Add support for this, so that U-Boot can locate entries.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# b4adf627 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: crypto: add x509 parser

Imported from linux kernel v5.3:
x509.asn1 without changes
x509_akid.asn1 without changes
x509_parser.h without changes
x509_cert_parser.c with changes marked as __UBOOT__
x509_public_key.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# a9b45e6e 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add oid registry utility

Imported from linux kernel v5.3:
build_OID_registry without changes
oid_registry.h without changes
oid_registry.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# ab8a0e06 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add asn1 decoder

Imported from linux kernel v5.3:
lib/asn1_decoder.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 2b12196d 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

cmd: add asn1_compiler

Imported from linux kernel v5.3:
asn1.h without changes
asn1_ber_bytecode.h without changes
asn1_decoder.h without changes
asn1_compiler.c without changes

This host command will be used to create a ASN1 parser, for example,
for pkcs7 messages or x509 certificates. More specifically, it will
generate *byte code* which will be interpreted by asn1 decoder library.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 05429b6c 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

rtc: move date.c from drivers/rtc/ to lib/

In the next commit, rtc_mktime(), for compatibility with linux, will be
implemented using rtc_mktime(), which is no longer drivers/rtc specific.
So move this file under lib/.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 37ef1774 10-Nov-2019 Thomas Hebb <tommyhebb@gmail.com>

Kconfig: disambiguate config names for tiny printf

27084c03d36a ("spl: Allow tiny printf() to be controlled in SPL and
TPL") split this option in two for TPL and SPL, but didn't change the
Kconfig names, making them hard to set quickly.

Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>

# 0d76afc0 27-Oct-2019 Simon Glass <sjg@chromium.org>

fdt: Add Kconfig options to control code size

For better or worse libfdt recent grew a lot of code that checks the
validity of the device tree in great detail. When using unsigned or
unverified data this makes things safer, but it does add to code size.

Add some controls to select the trade-off between safety and code size.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 27084c03 25-Sep-2019 Simon Glass <sjg@chromium.org>

spl: Allow tiny printf() to be controlled in SPL and TPL

At present there is only one control for this and it is used for both SPL
and TPL. But SPL might have a lot more space than TPL so the extra cost of
a full printf() might be acceptable.

Split the option into two, providing separate SPL and TPL controls. The
TPL setting defaults to the same as SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2a51e16b 07-Jun-2019 Tom Rini <trini@konsulko.com>

configs: Make USE_TINY_PRINTF depend on SPL||TPL and be default

The USE_TINY_PRINTF symbol only changes things within SPL and TPL
builds, so make it depend on that support. Next, make it default as
within these cases we should rarely have need of more advanced print
formats outside of the debug context.

To do this, in a few cases we need to correct our Kconfig dependencies
as we had cases of non-SPL targets select'ing this symbol. Finally, in
the case of a few boards we really do need the full printf
functionality.

Signed-off-by: Tom Rini <trini@konsulko.com>

# da0fb5fd 02-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: make call depth limit customizable

Up to now we had hard coded values for the call depth up to which trace
records are created: 200 for early tracing, 15 thereafter. UEFI
applications reach a call depth of 80 or above.

Provide customizing settings for the call trace depth limit and the early
call trace depth limit. Use the old values as defaults.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8509f22a 29-Apr-2019 Marek Behún <marek.behun@nic.cz>

lib: add Zstandard decompression support

Add the zstd library from Linux kernel (only decompression support).
There are minimal changes to build with U-Boot, otherwise the files are
identical to Linux commit dc35da16 from March 2018, the files had not
been touched since in kernel. Also SPDX lincese tags were added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 83a486b6 29-Apr-2019 Marek Behún <marek.behun@nic.cz>

lib: Add xxhash support

This adds the xxhash support from Linux. Files are almost identical to
those added to Linux in commit 5d240522 ("lib: Add xxhash module") (they
haven't been touched since in Linux). The only difference is to add some
includes to be compatible with U-Boot. Also SPDX lincese tags were
added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 5132361a 29-Apr-2019 Heiko Schocher <hs@denx.de>

lib: Kconfig: fix help text for GZIP

commit 95f4bbd581cf ("lib: fdt: Allow LZO and GZIP DT compression in U-Boot")

introduced Kconfig option for gzip in U-Boot, but help text
says gzip for SPL, which is wrong. Fix this.

Signed-off-by: Heiko Schocher <hs@denx.de>
Acked-by: Marek Vasut <marex@denx.de>

# 1c6eb075 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE_BUFFER_SIZE et al to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE_BUFFER_SIZE
CONFIG_TRACE_EARLY_SIZE
CONFIG_TRACE_EARLY
CONFIG_TRACE_EARLY_ADDR

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

# a24a78d7 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE

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

# 54969b40 21-Mar-2019 Thierry Reding <treding@nvidia.com>

fdtdec: Add Kconfig symbol for tests

Runtime tests are provided as a test_fdtdec command implementation. Add
a Kconfig symbol that allows this command to be built so that the tests
can be used.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 95f4bbd5 08-Mar-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

lib: fdt: Allow LZO and GZIP DT compression in U-Boot

Add required Kconfig symbols, Makefile bits and macro fixes in a
few places to support LZO and DT compression in U-Boot. This can
save a lot of space with multi-DTB fitImages.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>

# 6e705114 13-Jan-2019 Chris Packham <judge.packham@gmail.com>

lib: Kconfig: spelling fixes

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 048c6e89 06-Nov-2018 Simon Glass <sjg@chromium.org>

spl: lz4: Allow use of lz4 compression in SPL

In some cases U-Boot is compressed and it is useful to be able to
decompress it in SPL. Add a Kconfig and Makefile change to allow this.
Note that this does not actually implement decompression.

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

# 2895c4b7 15-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

kconfig: Introduce HAVE_ARCH_IOMAP

Introduce a new Kconfig option for architecture codes to control
whether it provides io{read,write}{8,16,32} I/O accessor functions.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5592a633 01-Oct-2018 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt in TPL

In some cases (e.g. sandbox with verified boot) it is useful to support
libfdt in TPL. Update the Kconfig to handle this.

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

# 6307896c 01-Oct-2018 Simon Glass <sjg@chromium.org>

tpm: Add support for SPL and TPL

At present the tpm can only be used in U-Boot proper. Updated it to work
in SPL and TPL also.

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

# ab948cd2 19-Jul-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

fdt_support: make FDT_FIXUP_PARTITIONS depend on CMD_MTDPARTS

fdt_fixup_mtdparts() calls mtdparts_init() and device_find(),
which are defined in cmd/mtdparts.c

The combination of FDT_FIXUP_PARTITIONS=y and CMD_MTDPARTS=n
emits the following link error:

common/fdt_support.c:903: undefined reference to `mtdparts_init'
common/fdt_support.c:914: undefined reference to `device_find'

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 3330584d 03-Jun-2018 Igor Opaniuk <igor.opaniuk@gmail.com>

avb2.0: integrate avb 2.0 into the build system

Integrate libavb into the build system. Introduce CONFIG_LIBAVB
build option.

Signed-off-by: Igor Opaniuk <igor.opaniuk@linaro.org>

# f8c987f8 05-Jun-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

lib: Add hexdump

Often during debugging session it's very interesting to see
what data we were dealing with. For example what we write or read
to/from memory or peripherals.

This change introduces functions that allow to dump binary
data with one simple function invocation like:
------------------->8----------------
print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, buf, len);
------------------->8----------------

which gives us the following:
------------------->8----------------
00000000: f2 b7 c9 88 62 61 75 64 72 61 74 65 3d 31 31 35 ....baudrate=115
00000010: 32 30 30 00 62 6f 6f 74 61 72 67 73 3d 63 6f 6e 200.bootargs=con
00000020: 73 6f 6c 65 3d 74 74 79 53 33 2c 31 31 35 32 30 sole=ttyS3,11520
00000030: 30 6e 38 00 62 6f 6f 74 64 65 6c 61 79 3d 33 00 0n8.bootdelay=3.
00000040: 62 6f 6f 74 66 69 6c 65 3d 75 49 6d 61 67 65 00 bootfile=uImage.
00000050: 66 64 74 63 6f 6e 74 72 6f 6c 61 64 64 72 3d 39 fdtcontroladdr=9
00000060: 66 66 62 31 62 61 30 00 6c 6f 61 64 61 64 64 72 ffb1ba0.loadaddr
00000070: 3d 30 78 38 32 30 30 30 30 30 30 00 73 74 64 65 =0x82000000.stde
00000080: 72 72 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 rr=serial0@e0022
00000090: 30 30 30 00 73 74 64 69 6e 3d 73 65 72 69 61 6c 000.stdin=serial
000000a0: 30 40 65 30 30 32 32 30 30 30 00 73 74 64 6f 75 0@e0022000.stdou
000000b0: 74 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 30 t=serial0@e00220
000000c0: 30 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00..............
...
------------------->8----------------

Source of hexdump.c was copied from Linux kernel v4.7-rc2.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Mario Six <mario.six@gdsys.cc>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Stefan Roese <sr@denx.de>

# c232d14d 29-May-2018 Alex Kiernan <alex.kiernan@gmail.com>

mmc: Separate "mmc swrite" from fastboot

Introduce CONFIG_IMAGE_SPARSE and CONFIG_CMD_MMC_SWRITE so the "mmc
swrite" command is separated from the fastboot code.

Move image-sparse from common to lib so it's clear it's library code.

Rename CONFIG_FASTBOOT_FLASH_FILLBUF_SIZE to CONFIG_IMAGE_SPARSE_FILLBUF_SIZE
and migrate it to Kconfig.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Acked-by: Jassi Brar <jaswinder.singh@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6417572e 08-May-2018 Tom Rini <trini@konsulko.com>

lib/Kconfig: Mark OF_LIBFDT_OVERLAY as depending on OF_LIBFDT

The overlay code is only useful when OF_LIBFDT is set, so mark it as
depending on that first.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 58a46f88 25-Apr-2018 Praneeth Bajjuri <praneeth@ti.com>

configs: TI: Enable FIT Library overlay support

Enable the FDT library overlay support for all TI SOC family.

Without this option, when Loading fdt from FIT image, the
following warning is seen.

"config with overlays but CONFIG_OF_LIBFDT_OVERLAY not set".

Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
Suggested-by: Andrew F.Davis <afd@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>

# 14ad44ab 18-Apr-2018 Alex Kiernan <alex.kiernan@gmail.com>

spl: Split sprintf, strto* from SPL serial in Kconfig

When SPL serial is disabled, callers who need sprintf or strtoul fail
because their inclusion is guarded by CONFIG_SPL_SERIAL_SUPPORT/
CONFIG_TPL_SERIAL_SUPPORT.

Split printf, sprintf and strto into their own entries and then select
all of them if SERIAL_SUPPORT is enabled to match the current behaviour.

Include panic.o unconditionally as it can be called from anywhere which
uses BUG_ON().

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>

# e294ba06 04-Apr-2018 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-sunxi

Signed-off-by: Tom Rini <trini@konsulko.com>


# d14db11d 03-Apr-2018 Andre Przywara <andre.przywara@arm.com>

sunxi: revert disabling of features

In January some commits were introduced to mitigate the U-Boot image
size issues we encountered on sunxi builds.
Now with the MMC environment removed we can bring them back, as we
practically don't have a size limit anymore.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 32ce6179 13-Mar-2018 Bryan O'Donoghue <bryan.odonoghue@linaro.org>

optee: Add lib entries for sharing OPTEE code across ports

This patch adds code to lib to enable sharing of useful OPTEE code between
board-ports and architectures. The code on lib/optee/optee.c comes from the
TI omap2 port. Eventually the OMAP2 code will be patched to include the
shared code. The intention here is to add more useful OPTEE specific code
as more functionality gets added.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Cc: Harinarayan Bhatta <harinarayan@ti.com>
Cc: Andrew F. Davis <afd@ti.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Kever Yang <kever.yang@rock-chips.com>
Cc: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Cc: Peng Fan <peng.fan@nxp.com>
Tested-by: Peng Fan <peng.fan@nxp.com>

# 36c1877c 06-Feb-2018 Faiz Abbas <faiz_abbas@ti.com>

lib: Kconfig: Move DYNAMIC_CRC_TABLE to Kconfig

Add CONFIG prefix to DYNAMIC_CRC_TABLE and implement it in
Kconfig.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>

# a451bc27 05-Feb-2018 Adam Ford <aford173@gmail.com>

Convert LIB_UUID to Kconfig

config_fallback.h has some logic that checks a variety of options
and selects LIB_UUID if it hasn't already been selected. This
will all LIB_UUID in Kconfig and select this option for the list
of options to allow us to remove the logic from fallbacks

Signed-off-by: Adam Ford <aford173@gmail.com>

# a5a37567 06-Feb-2018 Adam Ford <aford173@gmail.com>

Convert CONFIG LIB_HW_RAND to Kconfig

config_fallbacks.h had some logic to automatically select
LIB_RAND if RANDOM_UUID or CMD_UUID were set if LIB_HW_RAND wasn't
already selected. By migrating LIB_HW_RAND to Kconfig, we can
remove this check from config_fallbacks.h and put it into Kconfig

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
[trini: Turn into a choice, add NET_RANDOM_ETHADDR]
Signed-off-by: Tom Rini <trini@konsulko.com>

# acd4d334 16-Jan-2018 Maxime Ripard <maxime.ripard@free-electrons.com>

net: regex: Disable by default on sunXi

The sunXi arm64 build has overflown, leading to the main U-boot binary
overwriting the environment when flashing the new image, or even worse,
overwriting itself when we're calling saveenv.

Disable this option that is not critical until we can adress the issue
properly.

Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 7e3caa81 03-Dec-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

Move CONFIG_PANIC_HANG to Kconfig

Freescale (NXP) boards have lots of defconfig files per board.
I used "imply PANIC_HANG" for them.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# da5337a6 08-Nov-2017 Nandor Han <nandor.han@ge.com>

rtc: add support for s35392a

Add support for S35392A RTC. The driver supports both U-Boot driver
models.

Signed-off-by: Nandor Han <nandor.han@ge.com>
Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
Cc: Heiko Schocher <hs@denx.de>

# f52bdf4b 14-Sep-2017 Jean-Jacques Hiblot <jjhiblot@ti.com>

lib: allow building lzo for the SPL

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 85d8bf57 03-Sep-2017 Marek Behún <marek.behun@nic.cz>

lib: Add CRC32-C

This is needed for BTRFS.

Signed-off-by: Marek Behun <marek.behun@nic.cz>

create mode 100644 lib/crc32c.c

# 7264f292 15-Aug-2017 York Sun <york.sun@nxp.com>

spl: fit: Eanble GZIP support for image decompression

Add Kconfig option SPL_GZIP and SPL_ZLIB to enable gunzip support for
SPL boot, eg. falcon boot compressed kernel image.

Signed-off-by: York Sun <york.sun@nxp.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6ef2f901 11-Aug-2017 Adam Ford <aford173@gmail.com>

Convert CONFIG_BCH to Kconfig

This converts the following to Kconfig:
CONFIG_BCH

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1a7ba1d 18-Aug-2017 Anatolij Gustschin <agust@denx.de>

Fix 'notes' typos

s/notes/nodes

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 96b9082c 03-Aug-2017 Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

rockchip: rk3188: rock: adjust for SPL/TPL split

With the changes to split SPL/TPL for the RK3368, I apparently missed
some needed adjustments to the RK3188 Kconfig and rock_defconfig.

This fixes build-issues for the rock board after applying the RK3368
enablement (and SPL/TPL) set that resulted from TPL_SERIAL_SUPPORT,
TPL_ROCKCHIP_BACK_TO_BROM and TPL_TINY_MEMSET being separate symbols
now.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d56b4b19 22-Jul-2017 Tom Rini <trini@konsulko.com>

configs: Migrate RBTREE, LZO, CMD_MTDPARTS, CMD_UBI and CMD_UBIFS

The above CONFIG options are in Kconfig, and now have correct depends and
inter-dependencies. Migrate these to configs/ from include/configs/. In the
case of CMD_UBIFS also change it to be a default y if CMD_UBI.

Signed-off-by: Tom Rini <trini@konsulko.com>

# aed998aa 17-May-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_LZMA to Kconfig

This converts the following to Kconfig:
CONFIG_LZMA

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

# b1a873df 26-Apr-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_CMD_AES et al to Kconfig

This converts the following to Kconfig:
CONFIG_CMD_AES
CONFIG_AES

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Add select AES to CMD_AES]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 173aafbf 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

cmd: Expose a Kconfig option to enable UBIFS commands

Create a new Kconfig entry to allow CMD_UBIFS selection from Kconfig and
add an hidden LZO option that can be selected by CMD_UBIFS.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>

# aa049152 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

mtd: ubi: Select RBTREE option from MTD_UBI Kconfig entry

Expose the RBTREE feature through Kconfig and select this option from the
MTD_UBI option.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>
[Rebased on master]
Signed-off-by: Jagan Teki <jagan@openedev.com>

# ab4458bd 02-Apr-2017 Simon Glass <sjg@chromium.org>

string: Provide a slimmed-down memset()

Most of the time the optimised memset() is what we want. For extreme
situations such as TPL it may be too large. For example on the 'rock'
board, using a simple loop saves a useful 48 bytes. With gcc 4.9 and
the rodata bug, this patch is enough to reduce the TPL image below the
limit.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>

# bea79d7d 14-Mar-2017 Andre Przywara <andre.przywara@arm.com>

Kconfig: introduce md5sum command selection

So far CONFIG_MD5SUM would need to be set by a board's include file.
Since the command is really generic, move it over to Kconfig to allow
it to be defined by either a board's defconfig, menuconfig or some
config snippet merged via mergeconfig.sh.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e663b350 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

smbios: Expose in efi_loader as table

We can pass SMBIOS easily as EFI configuration table to an EFI payload. This
patch adds enablement for that case.

While at it, we also enable SMBIOS generation for ARM systems, since they support
EFI_LOADER.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4b6dddc2 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

x86: Move smbios generation into arch independent directory

We will need the SMBIOS generation function on ARM as well going forward,
so let's move it into a non arch specific location.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# ebf7fff2 05-Oct-2016 Heiko Schocher <hs@denx.de>

spl: move FDT_FIXUP_PARTITIONS to Kconfig

Move FDT_FIXUP_PARTITIONS to Kconfig and cleanup existing
uses.

Signed-off-by: Heiko Schocher <hs@denx.de>

# ddf67f71 05-Jul-2016 Maxime Ripard <maxime.ripard@free-electrons.com>

libfdt: Add overlay application function

The device tree overlays are a good way to deal with user-modifyable
boards or boards with some kind of an expansion mechanism where we can
easily plug new board in (like the BBB, the Raspberry Pi or the CHIP).

Add a new function to merge overlays with a base device tree.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>

# 91b86e21 26-May-2016 Marek Vasut <marex@denx.de>

lib: Enable private libgcc by default

This patch decouples U-Boot binary from the toolchain on systems where
private libgcc is available. Instead of pulling in functions provided
by the libgcc from the toolchain, U-Boot will use it's own set of libgcc
functions. These functions are usually imported from Linux kernel, which
also uses it's own libgcc functions instead of the ones provided by the
toolchain.

This patch solves a rather common problem. The toolchain can usually
generate code for many variants of target architecture and often even
different endianness. The libgcc on the other hand is usually compiled
for one particular configuration and the functions provided by it may
or may not be suited for use in U-Boot. This can manifest in two ways,
either the U-Boot fails to compile altogether and linker will complain
or, in the much worse case, the resulting U-Boot will build, but will
misbehave in very subtle and hard to debug ways.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 67976306 30-Mar-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

cosmetic: Fix typos "privide"

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# ed980b8c 03-Mar-2016 Alexander Graf <agraf@csgraf.de>

efi_loader: hook up in build environment

Now that we have all the bits and pieces ready for EFI payload loading
support, hook them up in Makefiles and KConfigs so that we can build.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
[trini: Enable only when we of OF_LIBFDT, disable on kwb and colibri_pxa270]
Signed-off-by: Tom Rini <trini@konsulko.com>

# aa34fbc0 22-Feb-2016 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt to be used in SPL

Add an option to enable libfdt in SPL. This can be useful when decoding
FIT files in SPL.

We need to make sure this option is not enabled in SPL by this change.
Also this option needs to be enabled in host builds. Si add a new
IMAGE_USE_LIBFDT #define which can be used in files that are built on the
host but must also build for U-Boot and SPL.

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

# 69e173eb 22-Feb-2016 Simon Glass <sjg@chromium.org>

Move CONFIG_OF_LIBFDT to Kconfig

Move this option to Kconfig and tidy up existing boards.

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

# a187559e 05-Feb-2016 Bin Meng <bmeng.cn@gmail.com>

Use correct spelling of "U-Boot"

Correct spelling of "U-Boot" shall be used in all written text
(documentation, comments in source files etc.).

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Minkyu Kang <mk7.kang@samsung.com>

# 947c626d 14-Jan-2016 Tom Rini <trini@konsulko.com>

vsprintf.c: Always enable CONFIG_SYS_VSNPRINTF

Enabling this function always removes some class of string saftey issues.
The size change here in general is about 400 bytes and this seems a reasonable
trade-off.

Cc: Peng Fan <peng.fan@nxp.com>
Cc: Peter Robinson <pbrobinson@gmail.com>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Adrian Alonso <aalonso@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 7d9cde10 22-Nov-2015 Stefan Roese <sr@denx.de>

lib/tiny-printf.c: Add tiny printf function for space limited environments

This patch adds a small printf() version that supports all basic formats.
Its intented to be used in U-Boot SPL versions on platforms with very
limited internal RAM sizes.

To enable it, just define CONFIG_USE_TINY_PRINTF in your defconfig. This
will result in the SPL using this tiny function and the main U-Boot
still using the full-blown printf() function.

This code was copied from:
http://www.sparetimelabs.com/printfrevisited
With mostly only coding style related changes so that its checkpatch
clean.

The size reduction is about 2.5KiB. Here a comparison for the db-mv784mp-gp
(Marvell AXP) SPL:

Without this patch:
58963 18536 1928 79427 13643 ./spl/u-boot-spl

With this patch:
56542 18536 1956 77034 12cea ./spl/u-boot-spl

Note:
To make it possible to compile tiny-printf.c instead of vsprintf.c when
CONFIG_USE_TINY_PRINTF is defined, the functions printf() and vprintf() are
moved from common/console.c into vsprintf.c in this patch.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>

# 2419cd16 03-Oct-2015 Simon Glass <sjg@chromium.org>

dm: tpm: Drop CONFIG_DM_TPM

Now that all TPM drivers use driver model, we can drop the special driver
model CONFIG option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>

# 027b728d 06-Oct-2015 Julius Werner <jwerner@chromium.org>

Add support for LZ4 decompression algorithm

This patch adds support for LZ4-compressed FIT image contents. This
algorithm has a slightly worse compression ration than LZO while being
nearly twice as fast to decompress. When loading images from a fast
storage medium this usually results in a boot time win.

Sandbox-tested only since I don't have a U-Boot development system set
up right now. The code was imported unchanged from coreboot where it's
proven to work, though. I'm mostly interested in getting this recognized
by mkImage for use in a downstream project.

Signed-off-by: Julius Werner <jwerner@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# a7d660bc 22-Aug-2015 Simon Glass <sjg@chromium.org>

tpm: Add Kconfig options for TPMs

Add new Kconfig options for TPMs in preparation for moving boards to use
Kconfig for TPM configuration.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 867a6ac8 31-Jul-2015 Simon Glass <sjg@chromium.org>

efi: Add start-up library code

When running as an EFI application, U-Boot must request memory from EFI,
and provide access to the boot services U-Boot needs.

Add library code to perform these tasks. This includes efi_main() which is
the entry point from EFI. U-Boot is built as a shared library.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d1389403 23-Jun-2015 Simon Glass <sjg@chromium.org>

Add a dhrystone benchmark command

Drystone provides a convenient sanity check that the CPU is running at full
speed. Add this as a command which can be enabled as needed.

Note: I investigated using Coremark for this but there was a license
agreement and I could not work out if it was GPL-compatible.

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

# f7848d90 22-Jun-2015 Joe Hershberger <joe.hershberger@ni.com>

Allow CONFIG_REGEX to be disabled when CONFIG_NET

Instead of selecting REGEX when NET is enabled, make it the default, but
allow boards that are tiny to disable it and lose functionality on all
but the first Ethernet adapter.

cm-bf548, bf538f-ezkit, and bf533-stamp need this. None appear to have
more than one Ethernet interface.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# 3850dbe8 11-Jun-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

blackfin: fix undefined reference to srand and rand

Commit 9ba9e85f3f1c (net: Fix NET_RANDOM_ETHADDR dependencies)
accidentally dropped CONFIG_LIB_RAND defines for 14 Blackfin boards.

Prior to that commit, those boards defined CONFIG_LIB_RAND, but not
CONFIG_NET_RANDOM_ETHADDR. So, commit 9ba9e85f3f1c should not have
touched them, but in fact it ripped CONFIG_LIB_RAND off from all the
header files, which caused undefined reference to srand and rand.
CONFIG_LIB_RAND=y must be revived for such boards.

BTW, this commit indeed makes it better, but even with this fix,
three boards (bf533-stamp, bf538f-ezkit, cm-bf548) still can not
build due to region 'ram' overflowed error. This was cause by
commit 6eed3786c68c (net: Move the CMD_NET config to defconfigs)
because CMD_NET selects NET, and NET selects REGEX. Eventually,
some boards were newly enabled with CONFIG_REGEX, increasing the
memory footprint. A patch is expected to fix the build error.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 9ba9e85f 25-May-2015 Michal Simek <michal.simek@xilinx.com>

net: Fix NET_RANDOM_ETHADDR dependencies

NET_RANDOM_ETHADDR depends on lib/rand.c. This patch adds dependency to
Kconfig to ensure that library is also compiled.

Remove the definitions from Blackfin boards' include/configs.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 6501ff62 20-Apr-2015 Przemyslaw Marczak <p.marczak@samsung.com>

lib: Kconfig: add entry for errno_str() function

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1a60650c 21-Apr-2015 Joe Hershberger <joe.hershberger@ni.com>

kconfig: Move REGEX to Kconfig

Having this as a Kconfig allows it to be a dependent feature.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8156345d 06-Mar-2015 Simon Glass <sjg@chromium.org>

sandbox: Move CONFIG_SYS_VSNPRINTF to Kconfig

Move this over to Kconfig and tidy up.

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

# 94e3c8c4 19-Feb-2015 gaurav rana <gaurav.rana@freescale.com>

crypto/fsl - Add progressive hashing support using hardware acceleration.

Currently only normal hashing is supported using hardware acceleration.
Added support for progressive hashing using hardware.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
Signed-off-by: Gaurav Rana <gaurav.rana@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>

# d9f23c7f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

lib/rsa: Add Kconfig for devices supporting RSA Modular Exponentiation

Kconfig option added for devices which support RSA Verification.
1. RSA_SOFTWARE_EXP
Enables driver for supporting RSA Modular Exponentiation in Software
2. RSA_FREESCALE_EXP
Enables driver for supporting RSA Modular Exponentiation using Freescale specific
driver

The above drivers use RSA uclass

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
(Removed duplicate line in Kconfig comment)

Change-Id: I7663c4d5350e2bfc3dfa2696f70ef777d6ccc6f6

# c4beb22f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

FIT: Modify option FIT_SIGNATURE in Kconfig

For FIT signature based approach to work, RSA library needs to be selected.
The FIT_SIGNATURE option in Kconfig is modified to automatically select RSA.
Selecting RSA compiles the RSA library required for image verification.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 45ccec8f 23-Oct-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_USE_PRIVATE_LIBGCC to Kconfig

The private libgcc is supported only on ARM, MIPS, PowerPC, SH, x86.
Those architectures should "select" HAVE_PRIVATE_LIBGCC and
CONFIG_USE_PRIVATE_LIBGCC should depend on it.

Currently, this option is enabled on Tegra boards and x86 architecture.
Move the definition from header files to Kconfig.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Tested-by: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: Tom Warren <twarren@nvidia.com>

# 8c688bc4 23-Oct-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_SYS_HZ to lib/Kconfig

CONFIG_SYS_HZ is always defined as 1000 in config_fallbacks.h
(but some boards still have redundant definitions).

This commit moves the definition and the document in README to
Kconfig. Since lib/Kconfig can assure that CONFIG_SYS_HZ is 1000,
the sanity check in lib/time.c should be removed.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Reviewed-by: Marek Vasut <marex@denx.de>

# b0928da6 16-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED to Kconfig

If this option is enabled, the objects under lib/ directory
are compiled with speed optimization, not size optimization.
(Currently, only used by some Blackfin boards.)

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# ed36323f 16-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: add blank Kconfig files

This would be useful to start moving various config options.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# 334a9b9d 25-Nov-2021 Loic Poulain <loic.poulain@linaro.org>

lib/circbuf: Make circbuf selectable symbol

It is currenly only used from usbtty driver but make it properly
selectable via Kconfig symbol, for future usage.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>

# 7c3fd5c2 26-Dec-2021 Qu Wenruo <wqu@suse.com>

lib: add BLAKE2 hash support

The code is cross-ported from BLAKE2 reference implementation
(https://github.com/BLAKE2/BLAKE2).

With minimal change to remove unused macros/features.

Currently there is only one user inside U-boot (btrfs), and since it
only utilize BLAKE2B, all other favors are all removed.

Signed-off-by: Qu Wenruo <wqu@suse.com>
[trini: Rename ROUND to R to avoid clash with <linux/bitops.h>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 97f2a749 04-Jan-2022 Eugen Hristev <eugen.hristev@microchip.com>

lib: Kconfig: fix PHANDLE_CHECK_SEQ position outside of menu

CONFIG_PHANDLE_CHECK_SEQ is outside of the menu 'Library routines'
thus it's invisible in menuconfig and cannot be selected.
Fix this by moving the 'endmenu' after the PHANDLE_CHECK_SEQ definition

Fixes: c589132a1d ("fdt: Use phandle to distinguish DT nodes with same name")
Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
Reviewed-by: Aswath Govindraju <a-govindraju@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 726cd983 29-Dec-2021 Simon Glass <sjg@chromium.org>

efi: Make unicode printf available to the app

This is needed to show unicode strings. Enable this code in the app.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>

# 6405ab7a 24-Nov-2021 Simon Glass <sjg@chromium.org>

Convert CONFIG_PHYSMEM to Kconfig

This converts the following to Kconfig:
CONFIG_PHYSMEM

Signed-off-by: Simon Glass <sjg@chromium.org>
Suggested-by: Sean Anderson <seanga2@gmail.com>

# ac7606af 14-Nov-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

lmb: fix typo 'commun'

%s/commun/common/

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

# e7d285b2 25-Sep-2021 Simon Glass <sjg@chromium.org>

image: Use the correct checks for CRC32

Add a host Kconfig for CRC32. With this we can use CONFIG_IS_ENABLED(CRC32)
directly in the host build, so drop the unnecessary indirection.

Add a few more conditions to SPL_CRC32 to avoid build failures as well as
TPL_CRC32. Also update hash.c to make crc32 optional and to actually take
notice of SPL_CRC32.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# 2c21256b 25-Sep-2021 Simon Glass <sjg@chromium.org>

hash: Use Kconfig to enable hashing in host tools and SPL

At present when building host tools, we force CONFIG_SHAxxx to be enabled
regardless of the board Kconfig setting. This is done in the image.h
header file.

For SPL we currently just assume the algorithm is desired if U-Boot proper
enables it.

Clean this up by adding new Kconfig options to enable hashing on the host,
relying on CONFIG_IS_ENABLED() to deal with the different builds.

Add new SPL Kconfigs for hardware-accelerated hashing, to maintain the
current settings.

This allows us to drop the image.h code and the I_WANT_MD5 hack.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# 603d15a5 25-Sep-2021 Simon Glass <sjg@chromium.org>

spl: cypto: Bring back SPL_ versions of SHA

Unfortunately these were removed by mistake. This means that adding hash
support to SPL brings in all software algorithms, with a substantial
increase in code size.

The origin of the problem was renaming them to SPL_FIT_xxx and then these
were removed altogether in a later commit.

Add them back. This aligns with CONFIG_MD5, for example, which has an SPL
variant.

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: f5bc9c25f31 ("image: Rename SPL_SHAxxx_SUPPORT to SPL_FIT_SHAxxx")
Fixes: eb5171ddec9 ("common: Remove unused CONFIG_FIT_SHAxxx selectors")
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# 6674edaa 16-Sep-2021 Tom Rini <trini@konsulko.com>

Merge tag 'v2021.10-rc4' into next

Prepare v2021.10-rc4

Signed-off-by: Tom Rini <trini@konsulko.com>

# gpg: Signature made Tue 14 Sep 2021 06:58:32 PM EDT
# gpg: using RSA key 1A3C7F70E08FAB1707809BBF147C39FF9634B72C
# gpg: Good signature from "Thomas Rini <trini@konsulko.com>" [ultimate]

# Conflicts:
# board/Arcturus/ucp1020/spl.c
# cmd/mvebu/Kconfig
# common/Kconfig.boot
# common/image-fit.c
# configs/UCP1020_defconfig
# configs/sifive_unmatched_defconfig
# drivers/pci/Kconfig
# include/configs/UCP1020.h
# include/configs/sifive-unmatched.h
# lib/Makefile
# scripts/config_whitelist.txt


# 5145bc73 01-Sep-2021 Oleksandr Suvorov <oleksandr.suvorov@foundries.io>

lib: fix typos in Kconfig

There are trivial typos in the Kconfig file. Fixed them.
Also, fixed grammar in the descriptions with typos.

Fixes: d56b4b1974 ("configs: Migrate RBTREE, LZO, CMD_MTDPARTS, CMD_UBI and CMD_UBIFS")
Fixes: 7264f2928b ("spl: fit: Eanble GZIP support for image decompression")
Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# e60e4499 02-Sep-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

lib: Drop SHA512_ALGO in lieu of SHA512

SHA512_ALGO was used as a "either SHA512 or SHA384", although the
implementations of these two algorithms share a majority of code.

From a Kconfig interface perspective, it makes sense to present two
distinct options. This requires #ifdefing out the SHA512
implementation from sha512.c. The latter doesn't make any sense.

It's reasonable to say in Kconfig that SHA384 depends on SHA512, and
seems to be the more polite way to handle the selection.

Thus, automatically select SHA512 when SHA384 is enabled.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# b4c2c151 27-Aug-2021 Michal Simek <michal.simek@xilinx.com>

Kconfig: Remove all default n/no options

default n/no doesn't need to be specified. It is default option anyway.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
[trini: Rework FSP_USE_UPD portion]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 928a8be7 29-Jul-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

lib: ecdsa: Implement UCLASS_ECDSA verification on target

Implement the crypto_algo .verify() function for ecdsa256. Because
it backends on UCLASS_ECDSA, this change is focused on parsing the
keys from devicetree and passing this information to the specific
UCLASS driver.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# fa3f1f1d 24-Jul-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: disable CONFIG_SPL_HEXDUMP by default

CONFIG_HEXDUMP is needed to display UEFI variables using 'printenv -e'.

Enabling CONFIG_SPL_HEXDUMP only makes sense for debugging purposes.
Hence CONFIG_SPL_HEXDUMP should not be enabled by default.

The following boards currently have CONFIG_SPL_HEXDUMP=y. This includes
boards that don't use SPL at all.

axm_defconfig
imx8mm-cl-iot-gate_defconfig
imx8mm_venice_defconfig
imxrt1020-evk_defconfig
imxrt1050-evk_defconfig
kontron_sl28_defconfig
kp_imx53_defconfig
lx2160ardb_tfa_stmm_defconfig
mt7622_rfb_defconfig
octeon_ebb7304_defconfig
octeon_nic23_defconfig
qemu_arm64_defconfig
qemu_arm_defconfig
qemu-riscv32_defconfig
qemu-riscv32_smode_defconfig
qemu-riscv64_defconfig
qemu-riscv64_smode_defconfig
qemu-x86_64_defconfig
qemu-x86_defconfig
sandbox64_defconfig
sandbox_defconfig
stm32mp15_basic_defconfig
stm32mp15_trusted_defconfig
synquacer_developerbox_defconfig
taurus_defconfig
xilinx_versal_virt_defconfig

The patch only keeps it enabled on

sandbox_spl_defconfig

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 1a46cb6c 02-Jul-2021 Simon Glass <sjg@chromium.org>

lib: Create a new Kconfig option for charset conversion

Rather than looking at two KConfig options in the Makefile, create a new
Kconfig option for compiling lib/charset.c

Enable it for UFS also, which needs this support.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 26dd9936 08-Jul-2021 Steffen Jaeckel <jaeckel-floss@eyet-services.de>

lib: add crypt subsystem

Add the basic functionality required to support the standard crypt
format.
The files crypt-sha256.c and crypt-sha512.c originate from libxcrypt and
their formatting is therefor retained.
The integration is done via a crypt_compare() function in crypt.c.

```
libxcrypt $ git describe --long --always --all
tags/v4.4.17-0-g6b110bc
```

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 7d0f3fbb 11-Jun-2021 Tero Kristo <t-kristo@ti.com>

lib: rational: copy the rational fraction lib routines from Linux

Copy the best rational approximation calculation routines from Linux.
Typical usecase for these routines is to calculate the M/N divider
values for PLLs to reach a specific clock rate.

This is based on linux kernel commit:
"lib/math/rational.c: fix possible incorrect result from rational
fractions helper"
(sha1: 323dd2c3ed0641f49e89b4e420f9eef5d3d5a881)

Signed-off-by: Tero Kristo <t-kristo@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Tero Kristo <kristo@kernel.org>

# ec0512b1 24-May-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

Revert "lib: introduce HASH_CALCULATE option"

When we think of Kconfig, we usually think of features that we like
to enable or not. Ideally, we wouldn't use Kconfig to fix a build
issue, although sometimes it might make sense. With Kconfig it's hard
to guarantee that the fix is universal. We can only say that it works
for the set of tested configurations. In the majority of cases, it's
preferable to let the linker figure things out for us.

The reverted commit attempted to fix a build issue by adding an
invisible Kconfig option. This is wrong in several ways:

It invents a new Kconfig variable when CONFIG_HASH already
exists for the same purpose.
Second, hash-checksum.c makes use of the hash_progressive_lookup_algo()
symbol, which is only provided with CONFIG_HASH, but this dependency
was not expressed in the reverted patch.

It feels like Kconfig is turning into a listing of all available
source files, and a buffet to 'select' which ones to compile. The
purpose of this revert is to enable the next change to make use of
CONFIG_HASH instead of adding to Kconfig.

This reverts commit 87316da05f2fd49d3709275e64ef0c5980366ade.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Acked-by: Masahisa Kojima <masahisa.kojima@linaro.org>

# 1621d3c4 10-May-2021 Bin Meng <bmeng.cn@gmail.com>

lib: kconfig: Limit BINMAN_FDT for OF_SEPARATE or OF_EMBED

Generally speaking BINMAN_FDT makes sense for OF_SEPARATE or OF_EMBED.
For the other OF_CONTROL methods, it's quite possible binman node is
not available as binman is invoked during the build phase instead of
runtime. Let's only turn it on for OF_SEPARATE or OF_EMBED by default.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 87316da0 13-May-2021 Masahisa Kojima <masahisa.kojima@linaro.org>

lib: introduce HASH_CALCULATE option

Build error occurs when CONFIG_EFI_SECURE_BOOT or
CONFIG_EFI_CAPSULE_AUTHENTICATE is enabled,
because hash-checksum.c is not compiled.

Since hash_calculate() implemented in hash-checksum.c can be
commonly used aside from FIT image signature verification,
this commit itroduces HASH_CALCULATE option to decide
if hash-checksum.c shall be compiled.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# e2ae483c 13-May-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

hash: Kconfig option for SHA512 hardware acceleration

Commit a479f103dc1c ("hash: Allow for SHA512 hardware implementations")
defined function definitions for hardware accelerated SHA384 and SHA512.
If CONFIG_SHA_HW_ACCEL=y, these functions are used.

We already have boards using CONFIG_SHA_HW_ACCEL=y but none implements the
new functions hw_sha384() and hw_sha512().

For implementing the EFI TCG2 protocol we need SHA384 and SHA512. The
missing hardware acceleration functions lead to build errors on boards like
peach-pi_defconfig.

Introduce a new Kconfig symbol CONFIG_SHA512_HW_ACCEL to control if the
functions hw_sha384() and hw_sha512() shall be used to implement the SHA384
and SHA512 algorithms.

Fixes: a479f103dc1c ("hash: Allow for SHA512 hardware implementations")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

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

# 6d66502b 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: Add 2 config to define the max number of regions

Add 2 configs CONFIG_LMB_MEMORY_REGIONS and CONFIG_LMB_RESERVED_REGIONS
to change independently the max number of the regions in lmb
library.

When CONFIG_LMB_USE_MAX_REGIONS=y, move the lmb property arrays to
struct lmb and manage the array size with the element 'max' of struct
lmb_region; their are still allocated in stack.

When CONFIG_LMB_USE_MAX_REGIONS=n, keep the current location in
struct lmb_region to allow compiler optimization.

Increase CONFIG_LMB_RESERVED_REGIONS is useful to avoid lmb errors in
bootm when the number of reserved regions (not adjacent) is reached:
+ 1 region for relocated U-Boot
+ 1 region for initrd
+ 1 region for relocated linux device tree
+ reserved memory regions present in Linux device tree.

The current limit of 8 regions is reached with only 5 reserved regions
in DT.

see Linux kernel commit bf23c51f1f49 ("memblock: Move memblock arrays
to static storage in memblock.c and make their size a variable")

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# 4fa0150d 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: move MAX_LMB_REGIONS value in Kconfig

Move MAX_LMB_REGIONS value in Kconfig, the max number of the regions
in lmb library.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# 77b8cfef 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: move CONFIG_LMB in Kconfig

Migrate CONFIG_LMB in Kconfig.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# a479f103 16-Feb-2021 Joel Stanley <joel@jms.id.au>

hash: Allow for SHA512 hardware implementations

Similar to support for SHA1 and SHA256, allow the use of hardware hashing
engine by enabling the algorithm and setting CONFIG_SHA_HW_ACCEL /
CONFIG_SHA_PROG_HW_ACCEL.

Signed-off-by: Joel Stanley <joel@jms.id.au>

# f2c1442e 14-Mar-2021 Simon Glass <sjg@chromium.org>

bloblist: Make BLOBLIST_TABLES depend on BLOBLIST

Add an extra condition here since we cannot put x86 tables in a bloblist
when bloblists are not supported.

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

# e0103158 25-Feb-2021 Bin Meng <bmeng.cn@gmail.com>

lib: kconfig: Mention CONFIG_ADDR_MAP limitation in the help

Mention that CONFIG_ADDR_MAP only works in the post-relocation phase.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>

# 56e7257c 03-Feb-2021 Bin Meng <bmeng.cn@gmail.com>

lib: Fix BINMAN_FDT dependency

lib/binman.c references the following 3 ofnode APIs:
ofnode_first_subnode(), ofnode_path() and ofnode_read_bool().

These APIs get built only when DM is on. Fix the dependency then.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 59e4e391 18-Jan-2021 Tom Rini <trini@konsulko.com>

Merge https://gitlab.denx.de/u-boot/custodians/u-boot-riscv

- Update qemu-riscv.rst build instructions.
- Add support for SPI on Kendryte K210.
- Add Microchip PolarFire SoC Icicle Kit support.
- Add support for an early timer.
- Select TIMER_EARLY to avoid infinite recursion for Trace.


# a80f8513 17-Jan-2021 Pragnesh Patel <pragnesh.patel@sifive.com>

trace: select TIMER_EARLY to avoid infinite recursion

When tracing functions is enabled this adds calls to
__cyg_profile_func_enter() and __cyg_profile_func_exit() to the traced
functions.

__cyg_profile_func_enter() and __cyg_profile_func_exit() invoke
timer_get_us() to record the entry and exit time.

initr_dm() will make gd->dm_root = NULL and gd->timer = NULL, so
timer_get_us() -> get_ticks() -> dm_timer_init() will lead to an
indefinite recursion.

So select TIMER_EARLY when tracing got enabled.

Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Rick Chen <rick@andestech.com>

# 6205bbb1 04-Jan-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lib: cosmetic update of CONFIG_LIB_ELF description

Change 2 typo error in CONFIG_LIB_ELF description:
- Supoort => Support
- fir => for

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c589132a 02-Dec-2020 Aswath Govindraju <a-govindraju@ti.com>

fdt: Use phandle to distinguish DT nodes with same name

While assigning the sequence number to subsystem instances by reading the
aliases property, only DT nodes names are compared and not the complete
path. This causes a problem when there are two DT nodes with same name but
have different paths.

In arch/arm/dts/k3-am65-main.dtsi there are two USB controllers with the
same device tree node name but different path. When aliases are defined for
these USB controllers then fdtdec_get_alias_seq() fails to pick the correct
instance for a given index.

fdt_path_offset() function is slow and this would effect the U-Boot
startup. To avert the time penalty on all boards, apply this extra check
only when required by using a config option.

Fix it by comparing the phandles of DT nodes after the node names match,
under a config option.

Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Fix whitespace error in Kconfig:
Signed-off-by: Simon Glass <sjg@chromium.org>

# 28cef9ca 19-Nov-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

fs: fat: create correct short names

The current function set_name() used to create short names has the
following deficiencies resolved by this patch:

* Long names (e.g. FOO.TXT) are stored even if a short name is enough.
* Short names with spaces are created, e.g. "A ~1.TXT".
* Short names with illegal characters are created, e.g. "FOO++BAR".
* Debug output does not not consider that the short file name has no
concluding '\0'.

The solution for the following bug is split of into a separate patch:

* Short file names must be unique.

This patch only provides the loop over possible short file names.

Fixes: c30a15e590c ("FAT: Add FAT write feature")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# e4f8e543 05-Nov-2020 Simon Glass <sjg@chromium.org>

smbios: Drop the unused Kconfig options

Now that we can use devicetree to specify this information, drop the old
CONFIG options.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 44c74bdd 05-Nov-2020 Simon Glass <sjg@chromium.org>

sysinfo: Provide a default driver to set SMBIOS values

Some boards want to specify the manufacturer or product name but do not
need to have their own sysinfo driver.

Add a default driver which provides a way to specify this SMBIOS
information in the devicetree, without needing any board-specific
functionality.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d2cb7a22 04-Nov-2020 Simon Glass <sjg@chromium.org>

x86: Allow putting some tables in the bloblist

At present all tables are placed starting at address f0000 in memory, and
can be up to 64KB in size. If the tables are very large, this may not
provide enough space.

Also if the tables point to other tables (such as console log or a ramoops
area) then we must allocate other memory anyway.

The bloblist is a nice place to put these tables since it is contiguous,
which makes it easy to reserve this memory for linux using the 820 tables.

Add an option to put some of the tables in the bloblist. For SMBIOS and
ACPI, create suitable pointers from the f0000 region to the new location
of the tables.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
[bmeng: squashed in http://patchwork.ozlabs.org/project/uboot/patch/
20201105062407.1.I8091ad931cbbb5e3b6f6ababdf3f8d5db0d17bb9@changeid/]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# 415eab06 03-Nov-2020 Christian Gmeiner <christian.gmeiner@gmail.com>

smbios: add parsing API

Add a very simple API to be able to access SMBIOS strings
like vendor, model and bios version.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 72eda507 27-Oct-2020 Sean Anderson <seanga2@gmail.com>

lib: Add getopt

Some commands can get very unweildy if they have too many positional
arguments. Adding options makes them easier to read, remember, and
understand.

This implementation of getopt has been taken from barebox, which has had
option support for quite a while. I have made a few modifications to their
version, such as the removal of opterr in favor of a separate getopt_silent
function. In addition, I have moved all global variables into struct
getopt_context.

The getopt from barebox also re-orders the arguments passed to it so that
non-options are placed last. This allows users to specify options anywhere.
For example, `ls -l foo/ -R` would be re-ordered to `ls -l -R foo/` as
getopt parsed the options. However, this feature conflicts with the const
argv in cmd_tbl->cmd. This was originally added in 54841ab50c ("Make sure
that argv[] argument pointers are not modified."). The reason stated in
that commit is that hush requires argv to stay unmodified. Has this
situation changed? Barebox also uses hush, and does not have this problem.
Perhaps we could use their fix?

I have assigned maintenance of getopt to Simon Glass, as it is currently
only used by the log command. I would also be fine maintaining it.

Signed-off-by: Sean Anderson <seanga2@gmail.com>

# 26637e2e 12-Sep-2020 Simon Glass <sjg@chromium.org>

lib: Allow hexdump to be used in SPL

It is sometimes useful to output hex dumps in SPL. Add a config option to
allow this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# e87dfb05 05-Aug-2020 Andrii Anisov <andrii_anisov@epam.com>

lib: sscanf: add sscanf implementation

Port sscanf implementation from mini-os and introduce new
Kconfig option to enable it: CONFIG_SSCANF. Disable by default.

Signed-off-by: Andrii Anisov <andrii_anisov@epam.com>
Signed-off-by: Anastasiia Lukianenko <anastasiia_lukianenko@epam.com>
Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>

# 81014f73 30-Jul-2020 Joao Marcos Costa <joaomarcos.costa@bootlin.com>

include/u-boot, lib/zlib: add sources for zlib decompression

Add zlib (v1.2.11) uncompr() function to U-Boot. SquashFS depends on
this function to decompress data from a raw disk image. The actual
support for zlib into SquashFS sources will be added in a follow-up
commit.

Signed-off-by: Joao Marcos Costa <joaomarcos.costa@bootlin.com>

# 69be8fd1 03-Jun-2020 Marek Szyprowski <m.szyprowski@samsung.com>

powerpc: move ADDR_MAP to Kconfig

Move ADDR_MAP related config options from include/configs/*.h to the
proper place in lib/Kconfig. This has been done using
./tools/moveconfig.py and manual inspection of the generated changes.
This is a preparation to use ADDR_MAP helper on ARM 32bit Raspberry Pi4
board for mapping the PCIe XHCI MMIO, which is above the 4GiB identity
mapping limit.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# d16b38f4 15-Apr-2020 Reuben Dowle <reubendowle0@gmail.com>

Add support for SHA384 and SHA512

The current recommendation for best security practice from the US government
is to use SHA384 for TOP SECRET [1].

This patch adds support for SHA384 and SHA512 in the hash command, and also
allows FIT images to be hashed with these algorithms, and signed with
sha384,rsaXXXX and sha512,rsaXXXX

The SHA implementation is adapted from the linux kernel implementation.

[1] Commercial National Security Algorithm Suite
http://www.iad.gov/iad/programs/iad-initiatives/cnsa-suite.cfm

Signed-off-by: Reuben Dowle <reuben.dowle@4rf.com>

# 43e442a5 26-May-2020 Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

kconfig: fix some typos

Signed-off-by: Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

# eff5a547 22-May-2020 Michael Walle <michael@walle.cc>

cmd: zip: automatically pull in gzip()

Move the CONFIG_GZIP_COMPRESSED from a config.h macro to a Kconfig menu
item. It is not selectable by a user because there is no reason to do
so. Instead it will be automatically selected by the stuff which uses
gzip(), like the zip command.

Remove it from the config_whitelist.txt. Also remove
CONFIG_GZIP_COMPRESS_DEF_SZ as this was never used on any board. The
default seems to be sane, otherwise it should be added as a Kconfig
option.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8239be61 06-May-2020 Simon Glass <sjg@chromium.org>

lib: Allow MD5 to be enabled in SPL

At present the MD5 option cannot be enabled by board configs since it has
no Kconfig name. It is generally enabled, so long as FIT support is
present. But not all boards use FIT, particularly in SPL

Fix this and add an option for SPL as well. This allows board code to call
md5() even if FIT support is not enabled.

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

# 04cb3994 21-Apr-2020 Weijie Gao <weijie.gao@mediatek.com>

lib: enable lzma decompression support for SPL build

This patch enables LZMA decompression support for SPL build

Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>

# 2a2119e1 05-Mar-2020 Atish Patra <atishp@atishpatra.org>

lib: kconfig: Add option to set BZIP2 compression method

There is no way to select BZIP2 compression method.
Add it under library/compression config where all other
compression related configs are present.

Signed-off-by: Atish Patra <atish.patra@wdc.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 805b3cac 12-Feb-2020 Keerthy <j-keerthy@ti.com>

lib: elf: Move the generic elf loading/validating functions to lib

Move the generic elf loading/validating functions to lib/
so that they can be re-used and accessed by code existing
outside cmd.

While at it remove the duplicate static version of load_elf_image_phdr
under arch/arm/mach-imx/imx_bootaux.c.

Signed-off-by: Keerthy <j-keerthy@ti.com>
Suggested-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>

# 1611235b 19-Jan-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: Kconfig dependencies for pseudo-random library

drivers/rng/sandbox_rng.c requires rand() to be defined but configuration
option CONFIG_CONFIG_LIB_RAND selected in drivers/rng/Kconfig does not
exist.

test/lib/test_aes.c requires rand() to be defined.

Fix the selection criteria for choice "Pseudo-random library support type".

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 3c10dc95 06-Dec-2019 Simon Glass <sjg@chromium.org>

binman: Add a library to access binman entries

SPL and TPL can access information about binman entries using link-time
symbols but this is not available in U-Boot proper. Of course it could be
made available, but the intention is to just read the device tree.

Add support for this, so that U-Boot can locate entries.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# b4adf627 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: crypto: add x509 parser

Imported from linux kernel v5.3:
x509.asn1 without changes
x509_akid.asn1 without changes
x509_parser.h without changes
x509_cert_parser.c with changes marked as __UBOOT__
x509_public_key.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# a9b45e6e 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add oid registry utility

Imported from linux kernel v5.3:
build_OID_registry without changes
oid_registry.h without changes
oid_registry.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# ab8a0e06 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add asn1 decoder

Imported from linux kernel v5.3:
lib/asn1_decoder.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 2b12196d 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

cmd: add asn1_compiler

Imported from linux kernel v5.3:
asn1.h without changes
asn1_ber_bytecode.h without changes
asn1_decoder.h without changes
asn1_compiler.c without changes

This host command will be used to create a ASN1 parser, for example,
for pkcs7 messages or x509 certificates. More specifically, it will
generate *byte code* which will be interpreted by asn1 decoder library.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 05429b6c 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

rtc: move date.c from drivers/rtc/ to lib/

In the next commit, rtc_mktime(), for compatibility with linux, will be
implemented using rtc_mktime(), which is no longer drivers/rtc specific.
So move this file under lib/.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 37ef1774 10-Nov-2019 Thomas Hebb <tommyhebb@gmail.com>

Kconfig: disambiguate config names for tiny printf

27084c03d36a ("spl: Allow tiny printf() to be controlled in SPL and
TPL") split this option in two for TPL and SPL, but didn't change the
Kconfig names, making them hard to set quickly.

Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>

# 0d76afc0 27-Oct-2019 Simon Glass <sjg@chromium.org>

fdt: Add Kconfig options to control code size

For better or worse libfdt recent grew a lot of code that checks the
validity of the device tree in great detail. When using unsigned or
unverified data this makes things safer, but it does add to code size.

Add some controls to select the trade-off between safety and code size.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 27084c03 25-Sep-2019 Simon Glass <sjg@chromium.org>

spl: Allow tiny printf() to be controlled in SPL and TPL

At present there is only one control for this and it is used for both SPL
and TPL. But SPL might have a lot more space than TPL so the extra cost of
a full printf() might be acceptable.

Split the option into two, providing separate SPL and TPL controls. The
TPL setting defaults to the same as SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2a51e16b 07-Jun-2019 Tom Rini <trini@konsulko.com>

configs: Make USE_TINY_PRINTF depend on SPL||TPL and be default

The USE_TINY_PRINTF symbol only changes things within SPL and TPL
builds, so make it depend on that support. Next, make it default as
within these cases we should rarely have need of more advanced print
formats outside of the debug context.

To do this, in a few cases we need to correct our Kconfig dependencies
as we had cases of non-SPL targets select'ing this symbol. Finally, in
the case of a few boards we really do need the full printf
functionality.

Signed-off-by: Tom Rini <trini@konsulko.com>

# da0fb5fd 02-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: make call depth limit customizable

Up to now we had hard coded values for the call depth up to which trace
records are created: 200 for early tracing, 15 thereafter. UEFI
applications reach a call depth of 80 or above.

Provide customizing settings for the call trace depth limit and the early
call trace depth limit. Use the old values as defaults.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8509f22a 29-Apr-2019 Marek Behún <marek.behun@nic.cz>

lib: add Zstandard decompression support

Add the zstd library from Linux kernel (only decompression support).
There are minimal changes to build with U-Boot, otherwise the files are
identical to Linux commit dc35da16 from March 2018, the files had not
been touched since in kernel. Also SPDX lincese tags were added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 83a486b6 29-Apr-2019 Marek Behún <marek.behun@nic.cz>

lib: Add xxhash support

This adds the xxhash support from Linux. Files are almost identical to
those added to Linux in commit 5d240522 ("lib: Add xxhash module") (they
haven't been touched since in Linux). The only difference is to add some
includes to be compatible with U-Boot. Also SPDX lincese tags were
added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 5132361a 29-Apr-2019 Heiko Schocher <hs@denx.de>

lib: Kconfig: fix help text for GZIP

commit 95f4bbd581cf ("lib: fdt: Allow LZO and GZIP DT compression in U-Boot")

introduced Kconfig option for gzip in U-Boot, but help text
says gzip for SPL, which is wrong. Fix this.

Signed-off-by: Heiko Schocher <hs@denx.de>
Acked-by: Marek Vasut <marex@denx.de>

# 1c6eb075 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE_BUFFER_SIZE et al to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE_BUFFER_SIZE
CONFIG_TRACE_EARLY_SIZE
CONFIG_TRACE_EARLY
CONFIG_TRACE_EARLY_ADDR

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

# a24a78d7 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE

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

# 54969b40 21-Mar-2019 Thierry Reding <treding@nvidia.com>

fdtdec: Add Kconfig symbol for tests

Runtime tests are provided as a test_fdtdec command implementation. Add
a Kconfig symbol that allows this command to be built so that the tests
can be used.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 95f4bbd5 08-Mar-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

lib: fdt: Allow LZO and GZIP DT compression in U-Boot

Add required Kconfig symbols, Makefile bits and macro fixes in a
few places to support LZO and DT compression in U-Boot. This can
save a lot of space with multi-DTB fitImages.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>

# 6e705114 13-Jan-2019 Chris Packham <judge.packham@gmail.com>

lib: Kconfig: spelling fixes

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 048c6e89 06-Nov-2018 Simon Glass <sjg@chromium.org>

spl: lz4: Allow use of lz4 compression in SPL

In some cases U-Boot is compressed and it is useful to be able to
decompress it in SPL. Add a Kconfig and Makefile change to allow this.
Note that this does not actually implement decompression.

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

# 2895c4b7 15-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

kconfig: Introduce HAVE_ARCH_IOMAP

Introduce a new Kconfig option for architecture codes to control
whether it provides io{read,write}{8,16,32} I/O accessor functions.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5592a633 01-Oct-2018 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt in TPL

In some cases (e.g. sandbox with verified boot) it is useful to support
libfdt in TPL. Update the Kconfig to handle this.

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

# 6307896c 01-Oct-2018 Simon Glass <sjg@chromium.org>

tpm: Add support for SPL and TPL

At present the tpm can only be used in U-Boot proper. Updated it to work
in SPL and TPL also.

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

# ab948cd2 19-Jul-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

fdt_support: make FDT_FIXUP_PARTITIONS depend on CMD_MTDPARTS

fdt_fixup_mtdparts() calls mtdparts_init() and device_find(),
which are defined in cmd/mtdparts.c

The combination of FDT_FIXUP_PARTITIONS=y and CMD_MTDPARTS=n
emits the following link error:

common/fdt_support.c:903: undefined reference to `mtdparts_init'
common/fdt_support.c:914: undefined reference to `device_find'

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 3330584d 03-Jun-2018 Igor Opaniuk <igor.opaniuk@gmail.com>

avb2.0: integrate avb 2.0 into the build system

Integrate libavb into the build system. Introduce CONFIG_LIBAVB
build option.

Signed-off-by: Igor Opaniuk <igor.opaniuk@linaro.org>

# f8c987f8 05-Jun-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

lib: Add hexdump

Often during debugging session it's very interesting to see
what data we were dealing with. For example what we write or read
to/from memory or peripherals.

This change introduces functions that allow to dump binary
data with one simple function invocation like:
------------------->8----------------
print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, buf, len);
------------------->8----------------

which gives us the following:
------------------->8----------------
00000000: f2 b7 c9 88 62 61 75 64 72 61 74 65 3d 31 31 35 ....baudrate=115
00000010: 32 30 30 00 62 6f 6f 74 61 72 67 73 3d 63 6f 6e 200.bootargs=con
00000020: 73 6f 6c 65 3d 74 74 79 53 33 2c 31 31 35 32 30 sole=ttyS3,11520
00000030: 30 6e 38 00 62 6f 6f 74 64 65 6c 61 79 3d 33 00 0n8.bootdelay=3.
00000040: 62 6f 6f 74 66 69 6c 65 3d 75 49 6d 61 67 65 00 bootfile=uImage.
00000050: 66 64 74 63 6f 6e 74 72 6f 6c 61 64 64 72 3d 39 fdtcontroladdr=9
00000060: 66 66 62 31 62 61 30 00 6c 6f 61 64 61 64 64 72 ffb1ba0.loadaddr
00000070: 3d 30 78 38 32 30 30 30 30 30 30 00 73 74 64 65 =0x82000000.stde
00000080: 72 72 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 rr=serial0@e0022
00000090: 30 30 30 00 73 74 64 69 6e 3d 73 65 72 69 61 6c 000.stdin=serial
000000a0: 30 40 65 30 30 32 32 30 30 30 00 73 74 64 6f 75 0@e0022000.stdou
000000b0: 74 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 30 t=serial0@e00220
000000c0: 30 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00..............
...
------------------->8----------------

Source of hexdump.c was copied from Linux kernel v4.7-rc2.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Mario Six <mario.six@gdsys.cc>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Stefan Roese <sr@denx.de>

# c232d14d 29-May-2018 Alex Kiernan <alex.kiernan@gmail.com>

mmc: Separate "mmc swrite" from fastboot

Introduce CONFIG_IMAGE_SPARSE and CONFIG_CMD_MMC_SWRITE so the "mmc
swrite" command is separated from the fastboot code.

Move image-sparse from common to lib so it's clear it's library code.

Rename CONFIG_FASTBOOT_FLASH_FILLBUF_SIZE to CONFIG_IMAGE_SPARSE_FILLBUF_SIZE
and migrate it to Kconfig.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Acked-by: Jassi Brar <jaswinder.singh@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6417572e 08-May-2018 Tom Rini <trini@konsulko.com>

lib/Kconfig: Mark OF_LIBFDT_OVERLAY as depending on OF_LIBFDT

The overlay code is only useful when OF_LIBFDT is set, so mark it as
depending on that first.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 58a46f88 25-Apr-2018 Praneeth Bajjuri <praneeth@ti.com>

configs: TI: Enable FIT Library overlay support

Enable the FDT library overlay support for all TI SOC family.

Without this option, when Loading fdt from FIT image, the
following warning is seen.

"config with overlays but CONFIG_OF_LIBFDT_OVERLAY not set".

Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
Suggested-by: Andrew F.Davis <afd@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>

# 14ad44ab 18-Apr-2018 Alex Kiernan <alex.kiernan@gmail.com>

spl: Split sprintf, strto* from SPL serial in Kconfig

When SPL serial is disabled, callers who need sprintf or strtoul fail
because their inclusion is guarded by CONFIG_SPL_SERIAL_SUPPORT/
CONFIG_TPL_SERIAL_SUPPORT.

Split printf, sprintf and strto into their own entries and then select
all of them if SERIAL_SUPPORT is enabled to match the current behaviour.

Include panic.o unconditionally as it can be called from anywhere which
uses BUG_ON().

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>

# e294ba06 04-Apr-2018 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-sunxi

Signed-off-by: Tom Rini <trini@konsulko.com>


# d14db11d 03-Apr-2018 Andre Przywara <andre.przywara@arm.com>

sunxi: revert disabling of features

In January some commits were introduced to mitigate the U-Boot image
size issues we encountered on sunxi builds.
Now with the MMC environment removed we can bring them back, as we
practically don't have a size limit anymore.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 32ce6179 13-Mar-2018 Bryan O'Donoghue <bryan.odonoghue@linaro.org>

optee: Add lib entries for sharing OPTEE code across ports

This patch adds code to lib to enable sharing of useful OPTEE code between
board-ports and architectures. The code on lib/optee/optee.c comes from the
TI omap2 port. Eventually the OMAP2 code will be patched to include the
shared code. The intention here is to add more useful OPTEE specific code
as more functionality gets added.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Cc: Harinarayan Bhatta <harinarayan@ti.com>
Cc: Andrew F. Davis <afd@ti.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Kever Yang <kever.yang@rock-chips.com>
Cc: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Cc: Peng Fan <peng.fan@nxp.com>
Tested-by: Peng Fan <peng.fan@nxp.com>

# 36c1877c 06-Feb-2018 Faiz Abbas <faiz_abbas@ti.com>

lib: Kconfig: Move DYNAMIC_CRC_TABLE to Kconfig

Add CONFIG prefix to DYNAMIC_CRC_TABLE and implement it in
Kconfig.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>

# a451bc27 05-Feb-2018 Adam Ford <aford173@gmail.com>

Convert LIB_UUID to Kconfig

config_fallback.h has some logic that checks a variety of options
and selects LIB_UUID if it hasn't already been selected. This
will all LIB_UUID in Kconfig and select this option for the list
of options to allow us to remove the logic from fallbacks

Signed-off-by: Adam Ford <aford173@gmail.com>

# a5a37567 06-Feb-2018 Adam Ford <aford173@gmail.com>

Convert CONFIG LIB_HW_RAND to Kconfig

config_fallbacks.h had some logic to automatically select
LIB_RAND if RANDOM_UUID or CMD_UUID were set if LIB_HW_RAND wasn't
already selected. By migrating LIB_HW_RAND to Kconfig, we can
remove this check from config_fallbacks.h and put it into Kconfig

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
[trini: Turn into a choice, add NET_RANDOM_ETHADDR]
Signed-off-by: Tom Rini <trini@konsulko.com>

# acd4d334 16-Jan-2018 Maxime Ripard <maxime.ripard@free-electrons.com>

net: regex: Disable by default on sunXi

The sunXi arm64 build has overflown, leading to the main U-boot binary
overwriting the environment when flashing the new image, or even worse,
overwriting itself when we're calling saveenv.

Disable this option that is not critical until we can adress the issue
properly.

Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 7e3caa81 03-Dec-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

Move CONFIG_PANIC_HANG to Kconfig

Freescale (NXP) boards have lots of defconfig files per board.
I used "imply PANIC_HANG" for them.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# da5337a6 08-Nov-2017 Nandor Han <nandor.han@ge.com>

rtc: add support for s35392a

Add support for S35392A RTC. The driver supports both U-Boot driver
models.

Signed-off-by: Nandor Han <nandor.han@ge.com>
Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
Cc: Heiko Schocher <hs@denx.de>

# f52bdf4b 14-Sep-2017 Jean-Jacques Hiblot <jjhiblot@ti.com>

lib: allow building lzo for the SPL

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 85d8bf57 03-Sep-2017 Marek Behún <marek.behun@nic.cz>

lib: Add CRC32-C

This is needed for BTRFS.

Signed-off-by: Marek Behun <marek.behun@nic.cz>

create mode 100644 lib/crc32c.c

# 7264f292 15-Aug-2017 York Sun <york.sun@nxp.com>

spl: fit: Eanble GZIP support for image decompression

Add Kconfig option SPL_GZIP and SPL_ZLIB to enable gunzip support for
SPL boot, eg. falcon boot compressed kernel image.

Signed-off-by: York Sun <york.sun@nxp.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6ef2f901 11-Aug-2017 Adam Ford <aford173@gmail.com>

Convert CONFIG_BCH to Kconfig

This converts the following to Kconfig:
CONFIG_BCH

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1a7ba1d 18-Aug-2017 Anatolij Gustschin <agust@denx.de>

Fix 'notes' typos

s/notes/nodes

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 96b9082c 03-Aug-2017 Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

rockchip: rk3188: rock: adjust for SPL/TPL split

With the changes to split SPL/TPL for the RK3368, I apparently missed
some needed adjustments to the RK3188 Kconfig and rock_defconfig.

This fixes build-issues for the rock board after applying the RK3368
enablement (and SPL/TPL) set that resulted from TPL_SERIAL_SUPPORT,
TPL_ROCKCHIP_BACK_TO_BROM and TPL_TINY_MEMSET being separate symbols
now.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d56b4b19 22-Jul-2017 Tom Rini <trini@konsulko.com>

configs: Migrate RBTREE, LZO, CMD_MTDPARTS, CMD_UBI and CMD_UBIFS

The above CONFIG options are in Kconfig, and now have correct depends and
inter-dependencies. Migrate these to configs/ from include/configs/. In the
case of CMD_UBIFS also change it to be a default y if CMD_UBI.

Signed-off-by: Tom Rini <trini@konsulko.com>

# aed998aa 17-May-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_LZMA to Kconfig

This converts the following to Kconfig:
CONFIG_LZMA

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

# b1a873df 26-Apr-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_CMD_AES et al to Kconfig

This converts the following to Kconfig:
CONFIG_CMD_AES
CONFIG_AES

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Add select AES to CMD_AES]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 173aafbf 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

cmd: Expose a Kconfig option to enable UBIFS commands

Create a new Kconfig entry to allow CMD_UBIFS selection from Kconfig and
add an hidden LZO option that can be selected by CMD_UBIFS.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>

# aa049152 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

mtd: ubi: Select RBTREE option from MTD_UBI Kconfig entry

Expose the RBTREE feature through Kconfig and select this option from the
MTD_UBI option.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>
[Rebased on master]
Signed-off-by: Jagan Teki <jagan@openedev.com>

# ab4458bd 02-Apr-2017 Simon Glass <sjg@chromium.org>

string: Provide a slimmed-down memset()

Most of the time the optimised memset() is what we want. For extreme
situations such as TPL it may be too large. For example on the 'rock'
board, using a simple loop saves a useful 48 bytes. With gcc 4.9 and
the rodata bug, this patch is enough to reduce the TPL image below the
limit.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>

# bea79d7d 14-Mar-2017 Andre Przywara <andre.przywara@arm.com>

Kconfig: introduce md5sum command selection

So far CONFIG_MD5SUM would need to be set by a board's include file.
Since the command is really generic, move it over to Kconfig to allow
it to be defined by either a board's defconfig, menuconfig or some
config snippet merged via mergeconfig.sh.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e663b350 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

smbios: Expose in efi_loader as table

We can pass SMBIOS easily as EFI configuration table to an EFI payload. This
patch adds enablement for that case.

While at it, we also enable SMBIOS generation for ARM systems, since they support
EFI_LOADER.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4b6dddc2 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

x86: Move smbios generation into arch independent directory

We will need the SMBIOS generation function on ARM as well going forward,
so let's move it into a non arch specific location.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# ebf7fff2 05-Oct-2016 Heiko Schocher <hs@denx.de>

spl: move FDT_FIXUP_PARTITIONS to Kconfig

Move FDT_FIXUP_PARTITIONS to Kconfig and cleanup existing
uses.

Signed-off-by: Heiko Schocher <hs@denx.de>

# ddf67f71 05-Jul-2016 Maxime Ripard <maxime.ripard@free-electrons.com>

libfdt: Add overlay application function

The device tree overlays are a good way to deal with user-modifyable
boards or boards with some kind of an expansion mechanism where we can
easily plug new board in (like the BBB, the Raspberry Pi or the CHIP).

Add a new function to merge overlays with a base device tree.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>

# 91b86e21 26-May-2016 Marek Vasut <marex@denx.de>

lib: Enable private libgcc by default

This patch decouples U-Boot binary from the toolchain on systems where
private libgcc is available. Instead of pulling in functions provided
by the libgcc from the toolchain, U-Boot will use it's own set of libgcc
functions. These functions are usually imported from Linux kernel, which
also uses it's own libgcc functions instead of the ones provided by the
toolchain.

This patch solves a rather common problem. The toolchain can usually
generate code for many variants of target architecture and often even
different endianness. The libgcc on the other hand is usually compiled
for one particular configuration and the functions provided by it may
or may not be suited for use in U-Boot. This can manifest in two ways,
either the U-Boot fails to compile altogether and linker will complain
or, in the much worse case, the resulting U-Boot will build, but will
misbehave in very subtle and hard to debug ways.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 67976306 30-Mar-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

cosmetic: Fix typos "privide"

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# ed980b8c 03-Mar-2016 Alexander Graf <agraf@csgraf.de>

efi_loader: hook up in build environment

Now that we have all the bits and pieces ready for EFI payload loading
support, hook them up in Makefiles and KConfigs so that we can build.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
[trini: Enable only when we of OF_LIBFDT, disable on kwb and colibri_pxa270]
Signed-off-by: Tom Rini <trini@konsulko.com>

# aa34fbc0 22-Feb-2016 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt to be used in SPL

Add an option to enable libfdt in SPL. This can be useful when decoding
FIT files in SPL.

We need to make sure this option is not enabled in SPL by this change.
Also this option needs to be enabled in host builds. Si add a new
IMAGE_USE_LIBFDT #define which can be used in files that are built on the
host but must also build for U-Boot and SPL.

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

# 69e173eb 22-Feb-2016 Simon Glass <sjg@chromium.org>

Move CONFIG_OF_LIBFDT to Kconfig

Move this option to Kconfig and tidy up existing boards.

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

# a187559e 05-Feb-2016 Bin Meng <bmeng.cn@gmail.com>

Use correct spelling of "U-Boot"

Correct spelling of "U-Boot" shall be used in all written text
(documentation, comments in source files etc.).

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Minkyu Kang <mk7.kang@samsung.com>

# 947c626d 14-Jan-2016 Tom Rini <trini@konsulko.com>

vsprintf.c: Always enable CONFIG_SYS_VSNPRINTF

Enabling this function always removes some class of string saftey issues.
The size change here in general is about 400 bytes and this seems a reasonable
trade-off.

Cc: Peng Fan <peng.fan@nxp.com>
Cc: Peter Robinson <pbrobinson@gmail.com>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Adrian Alonso <aalonso@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 7d9cde10 22-Nov-2015 Stefan Roese <sr@denx.de>

lib/tiny-printf.c: Add tiny printf function for space limited environments

This patch adds a small printf() version that supports all basic formats.
Its intented to be used in U-Boot SPL versions on platforms with very
limited internal RAM sizes.

To enable it, just define CONFIG_USE_TINY_PRINTF in your defconfig. This
will result in the SPL using this tiny function and the main U-Boot
still using the full-blown printf() function.

This code was copied from:
http://www.sparetimelabs.com/printfrevisited
With mostly only coding style related changes so that its checkpatch
clean.

The size reduction is about 2.5KiB. Here a comparison for the db-mv784mp-gp
(Marvell AXP) SPL:

Without this patch:
58963 18536 1928 79427 13643 ./spl/u-boot-spl

With this patch:
56542 18536 1956 77034 12cea ./spl/u-boot-spl

Note:
To make it possible to compile tiny-printf.c instead of vsprintf.c when
CONFIG_USE_TINY_PRINTF is defined, the functions printf() and vprintf() are
moved from common/console.c into vsprintf.c in this patch.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>

# 2419cd16 03-Oct-2015 Simon Glass <sjg@chromium.org>

dm: tpm: Drop CONFIG_DM_TPM

Now that all TPM drivers use driver model, we can drop the special driver
model CONFIG option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>

# 027b728d 06-Oct-2015 Julius Werner <jwerner@chromium.org>

Add support for LZ4 decompression algorithm

This patch adds support for LZ4-compressed FIT image contents. This
algorithm has a slightly worse compression ration than LZO while being
nearly twice as fast to decompress. When loading images from a fast
storage medium this usually results in a boot time win.

Sandbox-tested only since I don't have a U-Boot development system set
up right now. The code was imported unchanged from coreboot where it's
proven to work, though. I'm mostly interested in getting this recognized
by mkImage for use in a downstream project.

Signed-off-by: Julius Werner <jwerner@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# a7d660bc 22-Aug-2015 Simon Glass <sjg@chromium.org>

tpm: Add Kconfig options for TPMs

Add new Kconfig options for TPMs in preparation for moving boards to use
Kconfig for TPM configuration.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 867a6ac8 31-Jul-2015 Simon Glass <sjg@chromium.org>

efi: Add start-up library code

When running as an EFI application, U-Boot must request memory from EFI,
and provide access to the boot services U-Boot needs.

Add library code to perform these tasks. This includes efi_main() which is
the entry point from EFI. U-Boot is built as a shared library.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d1389403 23-Jun-2015 Simon Glass <sjg@chromium.org>

Add a dhrystone benchmark command

Drystone provides a convenient sanity check that the CPU is running at full
speed. Add this as a command which can be enabled as needed.

Note: I investigated using Coremark for this but there was a license
agreement and I could not work out if it was GPL-compatible.

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

# f7848d90 22-Jun-2015 Joe Hershberger <joe.hershberger@ni.com>

Allow CONFIG_REGEX to be disabled when CONFIG_NET

Instead of selecting REGEX when NET is enabled, make it the default, but
allow boards that are tiny to disable it and lose functionality on all
but the first Ethernet adapter.

cm-bf548, bf538f-ezkit, and bf533-stamp need this. None appear to have
more than one Ethernet interface.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# 3850dbe8 11-Jun-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

blackfin: fix undefined reference to srand and rand

Commit 9ba9e85f3f1c (net: Fix NET_RANDOM_ETHADDR dependencies)
accidentally dropped CONFIG_LIB_RAND defines for 14 Blackfin boards.

Prior to that commit, those boards defined CONFIG_LIB_RAND, but not
CONFIG_NET_RANDOM_ETHADDR. So, commit 9ba9e85f3f1c should not have
touched them, but in fact it ripped CONFIG_LIB_RAND off from all the
header files, which caused undefined reference to srand and rand.
CONFIG_LIB_RAND=y must be revived for such boards.

BTW, this commit indeed makes it better, but even with this fix,
three boards (bf533-stamp, bf538f-ezkit, cm-bf548) still can not
build due to region 'ram' overflowed error. This was cause by
commit 6eed3786c68c (net: Move the CMD_NET config to defconfigs)
because CMD_NET selects NET, and NET selects REGEX. Eventually,
some boards were newly enabled with CONFIG_REGEX, increasing the
memory footprint. A patch is expected to fix the build error.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 9ba9e85f 25-May-2015 Michal Simek <michal.simek@xilinx.com>

net: Fix NET_RANDOM_ETHADDR dependencies

NET_RANDOM_ETHADDR depends on lib/rand.c. This patch adds dependency to
Kconfig to ensure that library is also compiled.

Remove the definitions from Blackfin boards' include/configs.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 6501ff62 20-Apr-2015 Przemyslaw Marczak <p.marczak@samsung.com>

lib: Kconfig: add entry for errno_str() function

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1a60650c 21-Apr-2015 Joe Hershberger <joe.hershberger@ni.com>

kconfig: Move REGEX to Kconfig

Having this as a Kconfig allows it to be a dependent feature.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8156345d 06-Mar-2015 Simon Glass <sjg@chromium.org>

sandbox: Move CONFIG_SYS_VSNPRINTF to Kconfig

Move this over to Kconfig and tidy up.

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

# 94e3c8c4 19-Feb-2015 gaurav rana <gaurav.rana@freescale.com>

crypto/fsl - Add progressive hashing support using hardware acceleration.

Currently only normal hashing is supported using hardware acceleration.
Added support for progressive hashing using hardware.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
Signed-off-by: Gaurav Rana <gaurav.rana@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>

# d9f23c7f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

lib/rsa: Add Kconfig for devices supporting RSA Modular Exponentiation

Kconfig option added for devices which support RSA Verification.
1. RSA_SOFTWARE_EXP
Enables driver for supporting RSA Modular Exponentiation in Software
2. RSA_FREESCALE_EXP
Enables driver for supporting RSA Modular Exponentiation using Freescale specific
driver

The above drivers use RSA uclass

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
(Removed duplicate line in Kconfig comment)

Change-Id: I7663c4d5350e2bfc3dfa2696f70ef777d6ccc6f6

# c4beb22f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

FIT: Modify option FIT_SIGNATURE in Kconfig

For FIT signature based approach to work, RSA library needs to be selected.
The FIT_SIGNATURE option in Kconfig is modified to automatically select RSA.
Selecting RSA compiles the RSA library required for image verification.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 45ccec8f 23-Oct-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_USE_PRIVATE_LIBGCC to Kconfig

The private libgcc is supported only on ARM, MIPS, PowerPC, SH, x86.
Those architectures should "select" HAVE_PRIVATE_LIBGCC and
CONFIG_USE_PRIVATE_LIBGCC should depend on it.

Currently, this option is enabled on Tegra boards and x86 architecture.
Move the definition from header files to Kconfig.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Tested-by: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: Tom Warren <twarren@nvidia.com>

# 8c688bc4 23-Oct-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_SYS_HZ to lib/Kconfig

CONFIG_SYS_HZ is always defined as 1000 in config_fallbacks.h
(but some boards still have redundant definitions).

This commit moves the definition and the document in README to
Kconfig. Since lib/Kconfig can assure that CONFIG_SYS_HZ is 1000,
the sanity check in lib/time.c should be removed.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Reviewed-by: Marek Vasut <marex@denx.de>

# b0928da6 16-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED to Kconfig

If this option is enabled, the objects under lib/ directory
are compiled with speed optimization, not size optimization.
(Currently, only used by some Blackfin boards.)

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# ed36323f 16-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: add blank Kconfig files

This would be useful to start moving various config options.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# 7c3fd5c2 26-Dec-2021 Qu Wenruo <wqu@suse.com>

lib: add BLAKE2 hash support

The code is cross-ported from BLAKE2 reference implementation
(https://github.com/BLAKE2/BLAKE2).

With minimal change to remove unused macros/features.

Currently there is only one user inside U-boot (btrfs), and since it
only utilize BLAKE2B, all other favors are all removed.

Signed-off-by: Qu Wenruo <wqu@suse.com>
[trini: Rename ROUND to R to avoid clash with <linux/bitops.h>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 97f2a749 04-Jan-2022 Eugen Hristev <eugen.hristev@microchip.com>

lib: Kconfig: fix PHANDLE_CHECK_SEQ position outside of menu

CONFIG_PHANDLE_CHECK_SEQ is outside of the menu 'Library routines'
thus it's invisible in menuconfig and cannot be selected.
Fix this by moving the 'endmenu' after the PHANDLE_CHECK_SEQ definition

Fixes: c589132a1d ("fdt: Use phandle to distinguish DT nodes with same name")
Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
Reviewed-by: Aswath Govindraju <a-govindraju@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 726cd983 29-Dec-2021 Simon Glass <sjg@chromium.org>

efi: Make unicode printf available to the app

This is needed to show unicode strings. Enable this code in the app.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>

# 6405ab7a 24-Nov-2021 Simon Glass <sjg@chromium.org>

Convert CONFIG_PHYSMEM to Kconfig

This converts the following to Kconfig:
CONFIG_PHYSMEM

Signed-off-by: Simon Glass <sjg@chromium.org>
Suggested-by: Sean Anderson <seanga2@gmail.com>

# ac7606af 14-Nov-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

lmb: fix typo 'commun'

%s/commun/common/

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

# e7d285b2 25-Sep-2021 Simon Glass <sjg@chromium.org>

image: Use the correct checks for CRC32

Add a host Kconfig for CRC32. With this we can use CONFIG_IS_ENABLED(CRC32)
directly in the host build, so drop the unnecessary indirection.

Add a few more conditions to SPL_CRC32 to avoid build failures as well as
TPL_CRC32. Also update hash.c to make crc32 optional and to actually take
notice of SPL_CRC32.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# 2c21256b 25-Sep-2021 Simon Glass <sjg@chromium.org>

hash: Use Kconfig to enable hashing in host tools and SPL

At present when building host tools, we force CONFIG_SHAxxx to be enabled
regardless of the board Kconfig setting. This is done in the image.h
header file.

For SPL we currently just assume the algorithm is desired if U-Boot proper
enables it.

Clean this up by adding new Kconfig options to enable hashing on the host,
relying on CONFIG_IS_ENABLED() to deal with the different builds.

Add new SPL Kconfigs for hardware-accelerated hashing, to maintain the
current settings.

This allows us to drop the image.h code and the I_WANT_MD5 hack.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# 603d15a5 25-Sep-2021 Simon Glass <sjg@chromium.org>

spl: cypto: Bring back SPL_ versions of SHA

Unfortunately these were removed by mistake. This means that adding hash
support to SPL brings in all software algorithms, with a substantial
increase in code size.

The origin of the problem was renaming them to SPL_FIT_xxx and then these
were removed altogether in a later commit.

Add them back. This aligns with CONFIG_MD5, for example, which has an SPL
variant.

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: f5bc9c25f31 ("image: Rename SPL_SHAxxx_SUPPORT to SPL_FIT_SHAxxx")
Fixes: eb5171ddec9 ("common: Remove unused CONFIG_FIT_SHAxxx selectors")
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# 6674edaa 16-Sep-2021 Tom Rini <trini@konsulko.com>

Merge tag 'v2021.10-rc4' into next

Prepare v2021.10-rc4

Signed-off-by: Tom Rini <trini@konsulko.com>

# gpg: Signature made Tue 14 Sep 2021 06:58:32 PM EDT
# gpg: using RSA key 1A3C7F70E08FAB1707809BBF147C39FF9634B72C
# gpg: Good signature from "Thomas Rini <trini@konsulko.com>" [ultimate]

# Conflicts:
# board/Arcturus/ucp1020/spl.c
# cmd/mvebu/Kconfig
# common/Kconfig.boot
# common/image-fit.c
# configs/UCP1020_defconfig
# configs/sifive_unmatched_defconfig
# drivers/pci/Kconfig
# include/configs/UCP1020.h
# include/configs/sifive-unmatched.h
# lib/Makefile
# scripts/config_whitelist.txt


# 5145bc73 01-Sep-2021 Oleksandr Suvorov <oleksandr.suvorov@foundries.io>

lib: fix typos in Kconfig

There are trivial typos in the Kconfig file. Fixed them.
Also, fixed grammar in the descriptions with typos.

Fixes: d56b4b1974 ("configs: Migrate RBTREE, LZO, CMD_MTDPARTS, CMD_UBI and CMD_UBIFS")
Fixes: 7264f2928b ("spl: fit: Eanble GZIP support for image decompression")
Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# e60e4499 02-Sep-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

lib: Drop SHA512_ALGO in lieu of SHA512

SHA512_ALGO was used as a "either SHA512 or SHA384", although the
implementations of these two algorithms share a majority of code.

From a Kconfig interface perspective, it makes sense to present two
distinct options. This requires #ifdefing out the SHA512
implementation from sha512.c. The latter doesn't make any sense.

It's reasonable to say in Kconfig that SHA384 depends on SHA512, and
seems to be the more polite way to handle the selection.

Thus, automatically select SHA512 when SHA384 is enabled.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# b4c2c151 27-Aug-2021 Michal Simek <michal.simek@xilinx.com>

Kconfig: Remove all default n/no options

default n/no doesn't need to be specified. It is default option anyway.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
[trini: Rework FSP_USE_UPD portion]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 928a8be7 29-Jul-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

lib: ecdsa: Implement UCLASS_ECDSA verification on target

Implement the crypto_algo .verify() function for ecdsa256. Because
it backends on UCLASS_ECDSA, this change is focused on parsing the
keys from devicetree and passing this information to the specific
UCLASS driver.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# fa3f1f1d 24-Jul-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: disable CONFIG_SPL_HEXDUMP by default

CONFIG_HEXDUMP is needed to display UEFI variables using 'printenv -e'.

Enabling CONFIG_SPL_HEXDUMP only makes sense for debugging purposes.
Hence CONFIG_SPL_HEXDUMP should not be enabled by default.

The following boards currently have CONFIG_SPL_HEXDUMP=y. This includes
boards that don't use SPL at all.

axm_defconfig
imx8mm-cl-iot-gate_defconfig
imx8mm_venice_defconfig
imxrt1020-evk_defconfig
imxrt1050-evk_defconfig
kontron_sl28_defconfig
kp_imx53_defconfig
lx2160ardb_tfa_stmm_defconfig
mt7622_rfb_defconfig
octeon_ebb7304_defconfig
octeon_nic23_defconfig
qemu_arm64_defconfig
qemu_arm_defconfig
qemu-riscv32_defconfig
qemu-riscv32_smode_defconfig
qemu-riscv64_defconfig
qemu-riscv64_smode_defconfig
qemu-x86_64_defconfig
qemu-x86_defconfig
sandbox64_defconfig
sandbox_defconfig
stm32mp15_basic_defconfig
stm32mp15_trusted_defconfig
synquacer_developerbox_defconfig
taurus_defconfig
xilinx_versal_virt_defconfig

The patch only keeps it enabled on

sandbox_spl_defconfig

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 1a46cb6c 02-Jul-2021 Simon Glass <sjg@chromium.org>

lib: Create a new Kconfig option for charset conversion

Rather than looking at two KConfig options in the Makefile, create a new
Kconfig option for compiling lib/charset.c

Enable it for UFS also, which needs this support.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 26dd9936 08-Jul-2021 Steffen Jaeckel <jaeckel-floss@eyet-services.de>

lib: add crypt subsystem

Add the basic functionality required to support the standard crypt
format.
The files crypt-sha256.c and crypt-sha512.c originate from libxcrypt and
their formatting is therefor retained.
The integration is done via a crypt_compare() function in crypt.c.

```
libxcrypt $ git describe --long --always --all
tags/v4.4.17-0-g6b110bc
```

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 7d0f3fbb 11-Jun-2021 Tero Kristo <t-kristo@ti.com>

lib: rational: copy the rational fraction lib routines from Linux

Copy the best rational approximation calculation routines from Linux.
Typical usecase for these routines is to calculate the M/N divider
values for PLLs to reach a specific clock rate.

This is based on linux kernel commit:
"lib/math/rational.c: fix possible incorrect result from rational
fractions helper"
(sha1: 323dd2c3ed0641f49e89b4e420f9eef5d3d5a881)

Signed-off-by: Tero Kristo <t-kristo@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Tero Kristo <kristo@kernel.org>

# ec0512b1 24-May-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

Revert "lib: introduce HASH_CALCULATE option"

When we think of Kconfig, we usually think of features that we like
to enable or not. Ideally, we wouldn't use Kconfig to fix a build
issue, although sometimes it might make sense. With Kconfig it's hard
to guarantee that the fix is universal. We can only say that it works
for the set of tested configurations. In the majority of cases, it's
preferable to let the linker figure things out for us.

The reverted commit attempted to fix a build issue by adding an
invisible Kconfig option. This is wrong in several ways:

It invents a new Kconfig variable when CONFIG_HASH already
exists for the same purpose.
Second, hash-checksum.c makes use of the hash_progressive_lookup_algo()
symbol, which is only provided with CONFIG_HASH, but this dependency
was not expressed in the reverted patch.

It feels like Kconfig is turning into a listing of all available
source files, and a buffet to 'select' which ones to compile. The
purpose of this revert is to enable the next change to make use of
CONFIG_HASH instead of adding to Kconfig.

This reverts commit 87316da05f2fd49d3709275e64ef0c5980366ade.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Acked-by: Masahisa Kojima <masahisa.kojima@linaro.org>

# 1621d3c4 10-May-2021 Bin Meng <bmeng.cn@gmail.com>

lib: kconfig: Limit BINMAN_FDT for OF_SEPARATE or OF_EMBED

Generally speaking BINMAN_FDT makes sense for OF_SEPARATE or OF_EMBED.
For the other OF_CONTROL methods, it's quite possible binman node is
not available as binman is invoked during the build phase instead of
runtime. Let's only turn it on for OF_SEPARATE or OF_EMBED by default.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 87316da0 13-May-2021 Masahisa Kojima <masahisa.kojima@linaro.org>

lib: introduce HASH_CALCULATE option

Build error occurs when CONFIG_EFI_SECURE_BOOT or
CONFIG_EFI_CAPSULE_AUTHENTICATE is enabled,
because hash-checksum.c is not compiled.

Since hash_calculate() implemented in hash-checksum.c can be
commonly used aside from FIT image signature verification,
this commit itroduces HASH_CALCULATE option to decide
if hash-checksum.c shall be compiled.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# e2ae483c 13-May-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

hash: Kconfig option for SHA512 hardware acceleration

Commit a479f103dc1c ("hash: Allow for SHA512 hardware implementations")
defined function definitions for hardware accelerated SHA384 and SHA512.
If CONFIG_SHA_HW_ACCEL=y, these functions are used.

We already have boards using CONFIG_SHA_HW_ACCEL=y but none implements the
new functions hw_sha384() and hw_sha512().

For implementing the EFI TCG2 protocol we need SHA384 and SHA512. The
missing hardware acceleration functions lead to build errors on boards like
peach-pi_defconfig.

Introduce a new Kconfig symbol CONFIG_SHA512_HW_ACCEL to control if the
functions hw_sha384() and hw_sha512() shall be used to implement the SHA384
and SHA512 algorithms.

Fixes: a479f103dc1c ("hash: Allow for SHA512 hardware implementations")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

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

# 6d66502b 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: Add 2 config to define the max number of regions

Add 2 configs CONFIG_LMB_MEMORY_REGIONS and CONFIG_LMB_RESERVED_REGIONS
to change independently the max number of the regions in lmb
library.

When CONFIG_LMB_USE_MAX_REGIONS=y, move the lmb property arrays to
struct lmb and manage the array size with the element 'max' of struct
lmb_region; their are still allocated in stack.

When CONFIG_LMB_USE_MAX_REGIONS=n, keep the current location in
struct lmb_region to allow compiler optimization.

Increase CONFIG_LMB_RESERVED_REGIONS is useful to avoid lmb errors in
bootm when the number of reserved regions (not adjacent) is reached:
+ 1 region for relocated U-Boot
+ 1 region for initrd
+ 1 region for relocated linux device tree
+ reserved memory regions present in Linux device tree.

The current limit of 8 regions is reached with only 5 reserved regions
in DT.

see Linux kernel commit bf23c51f1f49 ("memblock: Move memblock arrays
to static storage in memblock.c and make their size a variable")

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# 4fa0150d 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: move MAX_LMB_REGIONS value in Kconfig

Move MAX_LMB_REGIONS value in Kconfig, the max number of the regions
in lmb library.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# 77b8cfef 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: move CONFIG_LMB in Kconfig

Migrate CONFIG_LMB in Kconfig.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# a479f103 16-Feb-2021 Joel Stanley <joel@jms.id.au>

hash: Allow for SHA512 hardware implementations

Similar to support for SHA1 and SHA256, allow the use of hardware hashing
engine by enabling the algorithm and setting CONFIG_SHA_HW_ACCEL /
CONFIG_SHA_PROG_HW_ACCEL.

Signed-off-by: Joel Stanley <joel@jms.id.au>

# f2c1442e 14-Mar-2021 Simon Glass <sjg@chromium.org>

bloblist: Make BLOBLIST_TABLES depend on BLOBLIST

Add an extra condition here since we cannot put x86 tables in a bloblist
when bloblists are not supported.

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

# e0103158 25-Feb-2021 Bin Meng <bmeng.cn@gmail.com>

lib: kconfig: Mention CONFIG_ADDR_MAP limitation in the help

Mention that CONFIG_ADDR_MAP only works in the post-relocation phase.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>

# 56e7257c 03-Feb-2021 Bin Meng <bmeng.cn@gmail.com>

lib: Fix BINMAN_FDT dependency

lib/binman.c references the following 3 ofnode APIs:
ofnode_first_subnode(), ofnode_path() and ofnode_read_bool().

These APIs get built only when DM is on. Fix the dependency then.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 59e4e391 18-Jan-2021 Tom Rini <trini@konsulko.com>

Merge https://gitlab.denx.de/u-boot/custodians/u-boot-riscv

- Update qemu-riscv.rst build instructions.
- Add support for SPI on Kendryte K210.
- Add Microchip PolarFire SoC Icicle Kit support.
- Add support for an early timer.
- Select TIMER_EARLY to avoid infinite recursion for Trace.


# a80f8513 17-Jan-2021 Pragnesh Patel <pragnesh.patel@sifive.com>

trace: select TIMER_EARLY to avoid infinite recursion

When tracing functions is enabled this adds calls to
__cyg_profile_func_enter() and __cyg_profile_func_exit() to the traced
functions.

__cyg_profile_func_enter() and __cyg_profile_func_exit() invoke
timer_get_us() to record the entry and exit time.

initr_dm() will make gd->dm_root = NULL and gd->timer = NULL, so
timer_get_us() -> get_ticks() -> dm_timer_init() will lead to an
indefinite recursion.

So select TIMER_EARLY when tracing got enabled.

Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Rick Chen <rick@andestech.com>

# 6205bbb1 04-Jan-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lib: cosmetic update of CONFIG_LIB_ELF description

Change 2 typo error in CONFIG_LIB_ELF description:
- Supoort => Support
- fir => for

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c589132a 02-Dec-2020 Aswath Govindraju <a-govindraju@ti.com>

fdt: Use phandle to distinguish DT nodes with same name

While assigning the sequence number to subsystem instances by reading the
aliases property, only DT nodes names are compared and not the complete
path. This causes a problem when there are two DT nodes with same name but
have different paths.

In arch/arm/dts/k3-am65-main.dtsi there are two USB controllers with the
same device tree node name but different path. When aliases are defined for
these USB controllers then fdtdec_get_alias_seq() fails to pick the correct
instance for a given index.

fdt_path_offset() function is slow and this would effect the U-Boot
startup. To avert the time penalty on all boards, apply this extra check
only when required by using a config option.

Fix it by comparing the phandles of DT nodes after the node names match,
under a config option.

Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Fix whitespace error in Kconfig:
Signed-off-by: Simon Glass <sjg@chromium.org>

# 28cef9ca 19-Nov-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

fs: fat: create correct short names

The current function set_name() used to create short names has the
following deficiencies resolved by this patch:

* Long names (e.g. FOO.TXT) are stored even if a short name is enough.
* Short names with spaces are created, e.g. "A ~1.TXT".
* Short names with illegal characters are created, e.g. "FOO++BAR".
* Debug output does not not consider that the short file name has no
concluding '\0'.

The solution for the following bug is split of into a separate patch:

* Short file names must be unique.

This patch only provides the loop over possible short file names.

Fixes: c30a15e590c ("FAT: Add FAT write feature")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# e4f8e543 05-Nov-2020 Simon Glass <sjg@chromium.org>

smbios: Drop the unused Kconfig options

Now that we can use devicetree to specify this information, drop the old
CONFIG options.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 44c74bdd 05-Nov-2020 Simon Glass <sjg@chromium.org>

sysinfo: Provide a default driver to set SMBIOS values

Some boards want to specify the manufacturer or product name but do not
need to have their own sysinfo driver.

Add a default driver which provides a way to specify this SMBIOS
information in the devicetree, without needing any board-specific
functionality.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d2cb7a22 04-Nov-2020 Simon Glass <sjg@chromium.org>

x86: Allow putting some tables in the bloblist

At present all tables are placed starting at address f0000 in memory, and
can be up to 64KB in size. If the tables are very large, this may not
provide enough space.

Also if the tables point to other tables (such as console log or a ramoops
area) then we must allocate other memory anyway.

The bloblist is a nice place to put these tables since it is contiguous,
which makes it easy to reserve this memory for linux using the 820 tables.

Add an option to put some of the tables in the bloblist. For SMBIOS and
ACPI, create suitable pointers from the f0000 region to the new location
of the tables.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
[bmeng: squashed in http://patchwork.ozlabs.org/project/uboot/patch/
20201105062407.1.I8091ad931cbbb5e3b6f6ababdf3f8d5db0d17bb9@changeid/]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# 415eab06 03-Nov-2020 Christian Gmeiner <christian.gmeiner@gmail.com>

smbios: add parsing API

Add a very simple API to be able to access SMBIOS strings
like vendor, model and bios version.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 72eda507 27-Oct-2020 Sean Anderson <seanga2@gmail.com>

lib: Add getopt

Some commands can get very unweildy if they have too many positional
arguments. Adding options makes them easier to read, remember, and
understand.

This implementation of getopt has been taken from barebox, which has had
option support for quite a while. I have made a few modifications to their
version, such as the removal of opterr in favor of a separate getopt_silent
function. In addition, I have moved all global variables into struct
getopt_context.

The getopt from barebox also re-orders the arguments passed to it so that
non-options are placed last. This allows users to specify options anywhere.
For example, `ls -l foo/ -R` would be re-ordered to `ls -l -R foo/` as
getopt parsed the options. However, this feature conflicts with the const
argv in cmd_tbl->cmd. This was originally added in 54841ab50c ("Make sure
that argv[] argument pointers are not modified."). The reason stated in
that commit is that hush requires argv to stay unmodified. Has this
situation changed? Barebox also uses hush, and does not have this problem.
Perhaps we could use their fix?

I have assigned maintenance of getopt to Simon Glass, as it is currently
only used by the log command. I would also be fine maintaining it.

Signed-off-by: Sean Anderson <seanga2@gmail.com>

# 26637e2e 12-Sep-2020 Simon Glass <sjg@chromium.org>

lib: Allow hexdump to be used in SPL

It is sometimes useful to output hex dumps in SPL. Add a config option to
allow this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# e87dfb05 05-Aug-2020 Andrii Anisov <andrii_anisov@epam.com>

lib: sscanf: add sscanf implementation

Port sscanf implementation from mini-os and introduce new
Kconfig option to enable it: CONFIG_SSCANF. Disable by default.

Signed-off-by: Andrii Anisov <andrii_anisov@epam.com>
Signed-off-by: Anastasiia Lukianenko <anastasiia_lukianenko@epam.com>
Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>

# 81014f73 30-Jul-2020 Joao Marcos Costa <joaomarcos.costa@bootlin.com>

include/u-boot, lib/zlib: add sources for zlib decompression

Add zlib (v1.2.11) uncompr() function to U-Boot. SquashFS depends on
this function to decompress data from a raw disk image. The actual
support for zlib into SquashFS sources will be added in a follow-up
commit.

Signed-off-by: Joao Marcos Costa <joaomarcos.costa@bootlin.com>

# 69be8fd1 03-Jun-2020 Marek Szyprowski <m.szyprowski@samsung.com>

powerpc: move ADDR_MAP to Kconfig

Move ADDR_MAP related config options from include/configs/*.h to the
proper place in lib/Kconfig. This has been done using
./tools/moveconfig.py and manual inspection of the generated changes.
This is a preparation to use ADDR_MAP helper on ARM 32bit Raspberry Pi4
board for mapping the PCIe XHCI MMIO, which is above the 4GiB identity
mapping limit.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# d16b38f4 15-Apr-2020 Reuben Dowle <reubendowle0@gmail.com>

Add support for SHA384 and SHA512

The current recommendation for best security practice from the US government
is to use SHA384 for TOP SECRET [1].

This patch adds support for SHA384 and SHA512 in the hash command, and also
allows FIT images to be hashed with these algorithms, and signed with
sha384,rsaXXXX and sha512,rsaXXXX

The SHA implementation is adapted from the linux kernel implementation.

[1] Commercial National Security Algorithm Suite
http://www.iad.gov/iad/programs/iad-initiatives/cnsa-suite.cfm

Signed-off-by: Reuben Dowle <reuben.dowle@4rf.com>

# 43e442a5 26-May-2020 Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

kconfig: fix some typos

Signed-off-by: Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

# eff5a547 22-May-2020 Michael Walle <michael@walle.cc>

cmd: zip: automatically pull in gzip()

Move the CONFIG_GZIP_COMPRESSED from a config.h macro to a Kconfig menu
item. It is not selectable by a user because there is no reason to do
so. Instead it will be automatically selected by the stuff which uses
gzip(), like the zip command.

Remove it from the config_whitelist.txt. Also remove
CONFIG_GZIP_COMPRESS_DEF_SZ as this was never used on any board. The
default seems to be sane, otherwise it should be added as a Kconfig
option.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8239be61 06-May-2020 Simon Glass <sjg@chromium.org>

lib: Allow MD5 to be enabled in SPL

At present the MD5 option cannot be enabled by board configs since it has
no Kconfig name. It is generally enabled, so long as FIT support is
present. But not all boards use FIT, particularly in SPL

Fix this and add an option for SPL as well. This allows board code to call
md5() even if FIT support is not enabled.

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

# 04cb3994 21-Apr-2020 Weijie Gao <weijie.gao@mediatek.com>

lib: enable lzma decompression support for SPL build

This patch enables LZMA decompression support for SPL build

Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>

# 2a2119e1 05-Mar-2020 Atish Patra <atishp@atishpatra.org>

lib: kconfig: Add option to set BZIP2 compression method

There is no way to select BZIP2 compression method.
Add it under library/compression config where all other
compression related configs are present.

Signed-off-by: Atish Patra <atish.patra@wdc.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 805b3cac 12-Feb-2020 Keerthy <j-keerthy@ti.com>

lib: elf: Move the generic elf loading/validating functions to lib

Move the generic elf loading/validating functions to lib/
so that they can be re-used and accessed by code existing
outside cmd.

While at it remove the duplicate static version of load_elf_image_phdr
under arch/arm/mach-imx/imx_bootaux.c.

Signed-off-by: Keerthy <j-keerthy@ti.com>
Suggested-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>

# 1611235b 19-Jan-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: Kconfig dependencies for pseudo-random library

drivers/rng/sandbox_rng.c requires rand() to be defined but configuration
option CONFIG_CONFIG_LIB_RAND selected in drivers/rng/Kconfig does not
exist.

test/lib/test_aes.c requires rand() to be defined.

Fix the selection criteria for choice "Pseudo-random library support type".

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 3c10dc95 06-Dec-2019 Simon Glass <sjg@chromium.org>

binman: Add a library to access binman entries

SPL and TPL can access information about binman entries using link-time
symbols but this is not available in U-Boot proper. Of course it could be
made available, but the intention is to just read the device tree.

Add support for this, so that U-Boot can locate entries.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# b4adf627 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: crypto: add x509 parser

Imported from linux kernel v5.3:
x509.asn1 without changes
x509_akid.asn1 without changes
x509_parser.h without changes
x509_cert_parser.c with changes marked as __UBOOT__
x509_public_key.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# a9b45e6e 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add oid registry utility

Imported from linux kernel v5.3:
build_OID_registry without changes
oid_registry.h without changes
oid_registry.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# ab8a0e06 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add asn1 decoder

Imported from linux kernel v5.3:
lib/asn1_decoder.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 2b12196d 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

cmd: add asn1_compiler

Imported from linux kernel v5.3:
asn1.h without changes
asn1_ber_bytecode.h without changes
asn1_decoder.h without changes
asn1_compiler.c without changes

This host command will be used to create a ASN1 parser, for example,
for pkcs7 messages or x509 certificates. More specifically, it will
generate *byte code* which will be interpreted by asn1 decoder library.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 05429b6c 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

rtc: move date.c from drivers/rtc/ to lib/

In the next commit, rtc_mktime(), for compatibility with linux, will be
implemented using rtc_mktime(), which is no longer drivers/rtc specific.
So move this file under lib/.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 37ef1774 10-Nov-2019 Thomas Hebb <tommyhebb@gmail.com>

Kconfig: disambiguate config names for tiny printf

27084c03d36a ("spl: Allow tiny printf() to be controlled in SPL and
TPL") split this option in two for TPL and SPL, but didn't change the
Kconfig names, making them hard to set quickly.

Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>

# 0d76afc0 27-Oct-2019 Simon Glass <sjg@chromium.org>

fdt: Add Kconfig options to control code size

For better or worse libfdt recent grew a lot of code that checks the
validity of the device tree in great detail. When using unsigned or
unverified data this makes things safer, but it does add to code size.

Add some controls to select the trade-off between safety and code size.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 27084c03 25-Sep-2019 Simon Glass <sjg@chromium.org>

spl: Allow tiny printf() to be controlled in SPL and TPL

At present there is only one control for this and it is used for both SPL
and TPL. But SPL might have a lot more space than TPL so the extra cost of
a full printf() might be acceptable.

Split the option into two, providing separate SPL and TPL controls. The
TPL setting defaults to the same as SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2a51e16b 07-Jun-2019 Tom Rini <trini@konsulko.com>

configs: Make USE_TINY_PRINTF depend on SPL||TPL and be default

The USE_TINY_PRINTF symbol only changes things within SPL and TPL
builds, so make it depend on that support. Next, make it default as
within these cases we should rarely have need of more advanced print
formats outside of the debug context.

To do this, in a few cases we need to correct our Kconfig dependencies
as we had cases of non-SPL targets select'ing this symbol. Finally, in
the case of a few boards we really do need the full printf
functionality.

Signed-off-by: Tom Rini <trini@konsulko.com>

# da0fb5fd 02-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: make call depth limit customizable

Up to now we had hard coded values for the call depth up to which trace
records are created: 200 for early tracing, 15 thereafter. UEFI
applications reach a call depth of 80 or above.

Provide customizing settings for the call trace depth limit and the early
call trace depth limit. Use the old values as defaults.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8509f22a 29-Apr-2019 Marek Behún <marek.behun@nic.cz>

lib: add Zstandard decompression support

Add the zstd library from Linux kernel (only decompression support).
There are minimal changes to build with U-Boot, otherwise the files are
identical to Linux commit dc35da16 from March 2018, the files had not
been touched since in kernel. Also SPDX lincese tags were added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 83a486b6 29-Apr-2019 Marek Behún <marek.behun@nic.cz>

lib: Add xxhash support

This adds the xxhash support from Linux. Files are almost identical to
those added to Linux in commit 5d240522 ("lib: Add xxhash module") (they
haven't been touched since in Linux). The only difference is to add some
includes to be compatible with U-Boot. Also SPDX lincese tags were
added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 5132361a 29-Apr-2019 Heiko Schocher <hs@denx.de>

lib: Kconfig: fix help text for GZIP

commit 95f4bbd581cf ("lib: fdt: Allow LZO and GZIP DT compression in U-Boot")

introduced Kconfig option for gzip in U-Boot, but help text
says gzip for SPL, which is wrong. Fix this.

Signed-off-by: Heiko Schocher <hs@denx.de>
Acked-by: Marek Vasut <marex@denx.de>

# 1c6eb075 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE_BUFFER_SIZE et al to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE_BUFFER_SIZE
CONFIG_TRACE_EARLY_SIZE
CONFIG_TRACE_EARLY
CONFIG_TRACE_EARLY_ADDR

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

# a24a78d7 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE

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

# 54969b40 21-Mar-2019 Thierry Reding <treding@nvidia.com>

fdtdec: Add Kconfig symbol for tests

Runtime tests are provided as a test_fdtdec command implementation. Add
a Kconfig symbol that allows this command to be built so that the tests
can be used.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 95f4bbd5 08-Mar-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

lib: fdt: Allow LZO and GZIP DT compression in U-Boot

Add required Kconfig symbols, Makefile bits and macro fixes in a
few places to support LZO and DT compression in U-Boot. This can
save a lot of space with multi-DTB fitImages.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>

# 6e705114 13-Jan-2019 Chris Packham <judge.packham@gmail.com>

lib: Kconfig: spelling fixes

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 048c6e89 06-Nov-2018 Simon Glass <sjg@chromium.org>

spl: lz4: Allow use of lz4 compression in SPL

In some cases U-Boot is compressed and it is useful to be able to
decompress it in SPL. Add a Kconfig and Makefile change to allow this.
Note that this does not actually implement decompression.

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

# 2895c4b7 15-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

kconfig: Introduce HAVE_ARCH_IOMAP

Introduce a new Kconfig option for architecture codes to control
whether it provides io{read,write}{8,16,32} I/O accessor functions.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5592a633 01-Oct-2018 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt in TPL

In some cases (e.g. sandbox with verified boot) it is useful to support
libfdt in TPL. Update the Kconfig to handle this.

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

# 6307896c 01-Oct-2018 Simon Glass <sjg@chromium.org>

tpm: Add support for SPL and TPL

At present the tpm can only be used in U-Boot proper. Updated it to work
in SPL and TPL also.

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

# ab948cd2 19-Jul-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

fdt_support: make FDT_FIXUP_PARTITIONS depend on CMD_MTDPARTS

fdt_fixup_mtdparts() calls mtdparts_init() and device_find(),
which are defined in cmd/mtdparts.c

The combination of FDT_FIXUP_PARTITIONS=y and CMD_MTDPARTS=n
emits the following link error:

common/fdt_support.c:903: undefined reference to `mtdparts_init'
common/fdt_support.c:914: undefined reference to `device_find'

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 3330584d 03-Jun-2018 Igor Opaniuk <igor.opaniuk@gmail.com>

avb2.0: integrate avb 2.0 into the build system

Integrate libavb into the build system. Introduce CONFIG_LIBAVB
build option.

Signed-off-by: Igor Opaniuk <igor.opaniuk@linaro.org>

# f8c987f8 05-Jun-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

lib: Add hexdump

Often during debugging session it's very interesting to see
what data we were dealing with. For example what we write or read
to/from memory or peripherals.

This change introduces functions that allow to dump binary
data with one simple function invocation like:
------------------->8----------------
print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, buf, len);
------------------->8----------------

which gives us the following:
------------------->8----------------
00000000: f2 b7 c9 88 62 61 75 64 72 61 74 65 3d 31 31 35 ....baudrate=115
00000010: 32 30 30 00 62 6f 6f 74 61 72 67 73 3d 63 6f 6e 200.bootargs=con
00000020: 73 6f 6c 65 3d 74 74 79 53 33 2c 31 31 35 32 30 sole=ttyS3,11520
00000030: 30 6e 38 00 62 6f 6f 74 64 65 6c 61 79 3d 33 00 0n8.bootdelay=3.
00000040: 62 6f 6f 74 66 69 6c 65 3d 75 49 6d 61 67 65 00 bootfile=uImage.
00000050: 66 64 74 63 6f 6e 74 72 6f 6c 61 64 64 72 3d 39 fdtcontroladdr=9
00000060: 66 66 62 31 62 61 30 00 6c 6f 61 64 61 64 64 72 ffb1ba0.loadaddr
00000070: 3d 30 78 38 32 30 30 30 30 30 30 00 73 74 64 65 =0x82000000.stde
00000080: 72 72 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 rr=serial0@e0022
00000090: 30 30 30 00 73 74 64 69 6e 3d 73 65 72 69 61 6c 000.stdin=serial
000000a0: 30 40 65 30 30 32 32 30 30 30 00 73 74 64 6f 75 0@e0022000.stdou
000000b0: 74 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 30 t=serial0@e00220
000000c0: 30 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00..............
...
------------------->8----------------

Source of hexdump.c was copied from Linux kernel v4.7-rc2.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Mario Six <mario.six@gdsys.cc>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Stefan Roese <sr@denx.de>

# c232d14d 29-May-2018 Alex Kiernan <alex.kiernan@gmail.com>

mmc: Separate "mmc swrite" from fastboot

Introduce CONFIG_IMAGE_SPARSE and CONFIG_CMD_MMC_SWRITE so the "mmc
swrite" command is separated from the fastboot code.

Move image-sparse from common to lib so it's clear it's library code.

Rename CONFIG_FASTBOOT_FLASH_FILLBUF_SIZE to CONFIG_IMAGE_SPARSE_FILLBUF_SIZE
and migrate it to Kconfig.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Acked-by: Jassi Brar <jaswinder.singh@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6417572e 08-May-2018 Tom Rini <trini@konsulko.com>

lib/Kconfig: Mark OF_LIBFDT_OVERLAY as depending on OF_LIBFDT

The overlay code is only useful when OF_LIBFDT is set, so mark it as
depending on that first.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 58a46f88 25-Apr-2018 Praneeth Bajjuri <praneeth@ti.com>

configs: TI: Enable FIT Library overlay support

Enable the FDT library overlay support for all TI SOC family.

Without this option, when Loading fdt from FIT image, the
following warning is seen.

"config with overlays but CONFIG_OF_LIBFDT_OVERLAY not set".

Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
Suggested-by: Andrew F.Davis <afd@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>

# 14ad44ab 18-Apr-2018 Alex Kiernan <alex.kiernan@gmail.com>

spl: Split sprintf, strto* from SPL serial in Kconfig

When SPL serial is disabled, callers who need sprintf or strtoul fail
because their inclusion is guarded by CONFIG_SPL_SERIAL_SUPPORT/
CONFIG_TPL_SERIAL_SUPPORT.

Split printf, sprintf and strto into their own entries and then select
all of them if SERIAL_SUPPORT is enabled to match the current behaviour.

Include panic.o unconditionally as it can be called from anywhere which
uses BUG_ON().

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>

# e294ba06 04-Apr-2018 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-sunxi

Signed-off-by: Tom Rini <trini@konsulko.com>


# d14db11d 03-Apr-2018 Andre Przywara <andre.przywara@arm.com>

sunxi: revert disabling of features

In January some commits were introduced to mitigate the U-Boot image
size issues we encountered on sunxi builds.
Now with the MMC environment removed we can bring them back, as we
practically don't have a size limit anymore.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 32ce6179 13-Mar-2018 Bryan O'Donoghue <bryan.odonoghue@linaro.org>

optee: Add lib entries for sharing OPTEE code across ports

This patch adds code to lib to enable sharing of useful OPTEE code between
board-ports and architectures. The code on lib/optee/optee.c comes from the
TI omap2 port. Eventually the OMAP2 code will be patched to include the
shared code. The intention here is to add more useful OPTEE specific code
as more functionality gets added.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Cc: Harinarayan Bhatta <harinarayan@ti.com>
Cc: Andrew F. Davis <afd@ti.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Kever Yang <kever.yang@rock-chips.com>
Cc: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Cc: Peng Fan <peng.fan@nxp.com>
Tested-by: Peng Fan <peng.fan@nxp.com>

# 36c1877c 06-Feb-2018 Faiz Abbas <faiz_abbas@ti.com>

lib: Kconfig: Move DYNAMIC_CRC_TABLE to Kconfig

Add CONFIG prefix to DYNAMIC_CRC_TABLE and implement it in
Kconfig.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>

# a451bc27 05-Feb-2018 Adam Ford <aford173@gmail.com>

Convert LIB_UUID to Kconfig

config_fallback.h has some logic that checks a variety of options
and selects LIB_UUID if it hasn't already been selected. This
will all LIB_UUID in Kconfig and select this option for the list
of options to allow us to remove the logic from fallbacks

Signed-off-by: Adam Ford <aford173@gmail.com>

# a5a37567 06-Feb-2018 Adam Ford <aford173@gmail.com>

Convert CONFIG LIB_HW_RAND to Kconfig

config_fallbacks.h had some logic to automatically select
LIB_RAND if RANDOM_UUID or CMD_UUID were set if LIB_HW_RAND wasn't
already selected. By migrating LIB_HW_RAND to Kconfig, we can
remove this check from config_fallbacks.h and put it into Kconfig

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
[trini: Turn into a choice, add NET_RANDOM_ETHADDR]
Signed-off-by: Tom Rini <trini@konsulko.com>

# acd4d334 16-Jan-2018 Maxime Ripard <maxime.ripard@free-electrons.com>

net: regex: Disable by default on sunXi

The sunXi arm64 build has overflown, leading to the main U-boot binary
overwriting the environment when flashing the new image, or even worse,
overwriting itself when we're calling saveenv.

Disable this option that is not critical until we can adress the issue
properly.

Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 7e3caa81 03-Dec-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

Move CONFIG_PANIC_HANG to Kconfig

Freescale (NXP) boards have lots of defconfig files per board.
I used "imply PANIC_HANG" for them.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# da5337a6 08-Nov-2017 Nandor Han <nandor.han@ge.com>

rtc: add support for s35392a

Add support for S35392A RTC. The driver supports both U-Boot driver
models.

Signed-off-by: Nandor Han <nandor.han@ge.com>
Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
Cc: Heiko Schocher <hs@denx.de>

# f52bdf4b 14-Sep-2017 Jean-Jacques Hiblot <jjhiblot@ti.com>

lib: allow building lzo for the SPL

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 85d8bf57 03-Sep-2017 Marek Behún <marek.behun@nic.cz>

lib: Add CRC32-C

This is needed for BTRFS.

Signed-off-by: Marek Behun <marek.behun@nic.cz>

create mode 100644 lib/crc32c.c

# 7264f292 15-Aug-2017 York Sun <york.sun@nxp.com>

spl: fit: Eanble GZIP support for image decompression

Add Kconfig option SPL_GZIP and SPL_ZLIB to enable gunzip support for
SPL boot, eg. falcon boot compressed kernel image.

Signed-off-by: York Sun <york.sun@nxp.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6ef2f901 11-Aug-2017 Adam Ford <aford173@gmail.com>

Convert CONFIG_BCH to Kconfig

This converts the following to Kconfig:
CONFIG_BCH

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1a7ba1d 18-Aug-2017 Anatolij Gustschin <agust@denx.de>

Fix 'notes' typos

s/notes/nodes

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 96b9082c 03-Aug-2017 Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

rockchip: rk3188: rock: adjust for SPL/TPL split

With the changes to split SPL/TPL for the RK3368, I apparently missed
some needed adjustments to the RK3188 Kconfig and rock_defconfig.

This fixes build-issues for the rock board after applying the RK3368
enablement (and SPL/TPL) set that resulted from TPL_SERIAL_SUPPORT,
TPL_ROCKCHIP_BACK_TO_BROM and TPL_TINY_MEMSET being separate symbols
now.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d56b4b19 22-Jul-2017 Tom Rini <trini@konsulko.com>

configs: Migrate RBTREE, LZO, CMD_MTDPARTS, CMD_UBI and CMD_UBIFS

The above CONFIG options are in Kconfig, and now have correct depends and
inter-dependencies. Migrate these to configs/ from include/configs/. In the
case of CMD_UBIFS also change it to be a default y if CMD_UBI.

Signed-off-by: Tom Rini <trini@konsulko.com>

# aed998aa 17-May-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_LZMA to Kconfig

This converts the following to Kconfig:
CONFIG_LZMA

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

# b1a873df 26-Apr-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_CMD_AES et al to Kconfig

This converts the following to Kconfig:
CONFIG_CMD_AES
CONFIG_AES

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Add select AES to CMD_AES]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 173aafbf 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

cmd: Expose a Kconfig option to enable UBIFS commands

Create a new Kconfig entry to allow CMD_UBIFS selection from Kconfig and
add an hidden LZO option that can be selected by CMD_UBIFS.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>

# aa049152 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

mtd: ubi: Select RBTREE option from MTD_UBI Kconfig entry

Expose the RBTREE feature through Kconfig and select this option from the
MTD_UBI option.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>
[Rebased on master]
Signed-off-by: Jagan Teki <jagan@openedev.com>

# ab4458bd 02-Apr-2017 Simon Glass <sjg@chromium.org>

string: Provide a slimmed-down memset()

Most of the time the optimised memset() is what we want. For extreme
situations such as TPL it may be too large. For example on the 'rock'
board, using a simple loop saves a useful 48 bytes. With gcc 4.9 and
the rodata bug, this patch is enough to reduce the TPL image below the
limit.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>

# bea79d7d 14-Mar-2017 Andre Przywara <andre.przywara@arm.com>

Kconfig: introduce md5sum command selection

So far CONFIG_MD5SUM would need to be set by a board's include file.
Since the command is really generic, move it over to Kconfig to allow
it to be defined by either a board's defconfig, menuconfig or some
config snippet merged via mergeconfig.sh.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e663b350 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

smbios: Expose in efi_loader as table

We can pass SMBIOS easily as EFI configuration table to an EFI payload. This
patch adds enablement for that case.

While at it, we also enable SMBIOS generation for ARM systems, since they support
EFI_LOADER.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4b6dddc2 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

x86: Move smbios generation into arch independent directory

We will need the SMBIOS generation function on ARM as well going forward,
so let's move it into a non arch specific location.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# ebf7fff2 05-Oct-2016 Heiko Schocher <hs@denx.de>

spl: move FDT_FIXUP_PARTITIONS to Kconfig

Move FDT_FIXUP_PARTITIONS to Kconfig and cleanup existing
uses.

Signed-off-by: Heiko Schocher <hs@denx.de>

# ddf67f71 05-Jul-2016 Maxime Ripard <maxime.ripard@free-electrons.com>

libfdt: Add overlay application function

The device tree overlays are a good way to deal with user-modifyable
boards or boards with some kind of an expansion mechanism where we can
easily plug new board in (like the BBB, the Raspberry Pi or the CHIP).

Add a new function to merge overlays with a base device tree.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>

# 91b86e21 26-May-2016 Marek Vasut <marex@denx.de>

lib: Enable private libgcc by default

This patch decouples U-Boot binary from the toolchain on systems where
private libgcc is available. Instead of pulling in functions provided
by the libgcc from the toolchain, U-Boot will use it's own set of libgcc
functions. These functions are usually imported from Linux kernel, which
also uses it's own libgcc functions instead of the ones provided by the
toolchain.

This patch solves a rather common problem. The toolchain can usually
generate code for many variants of target architecture and often even
different endianness. The libgcc on the other hand is usually compiled
for one particular configuration and the functions provided by it may
or may not be suited for use in U-Boot. This can manifest in two ways,
either the U-Boot fails to compile altogether and linker will complain
or, in the much worse case, the resulting U-Boot will build, but will
misbehave in very subtle and hard to debug ways.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 67976306 30-Mar-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

cosmetic: Fix typos "privide"

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# ed980b8c 03-Mar-2016 Alexander Graf <agraf@csgraf.de>

efi_loader: hook up in build environment

Now that we have all the bits and pieces ready for EFI payload loading
support, hook them up in Makefiles and KConfigs so that we can build.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
[trini: Enable only when we of OF_LIBFDT, disable on kwb and colibri_pxa270]
Signed-off-by: Tom Rini <trini@konsulko.com>

# aa34fbc0 22-Feb-2016 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt to be used in SPL

Add an option to enable libfdt in SPL. This can be useful when decoding
FIT files in SPL.

We need to make sure this option is not enabled in SPL by this change.
Also this option needs to be enabled in host builds. Si add a new
IMAGE_USE_LIBFDT #define which can be used in files that are built on the
host but must also build for U-Boot and SPL.

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

# 69e173eb 22-Feb-2016 Simon Glass <sjg@chromium.org>

Move CONFIG_OF_LIBFDT to Kconfig

Move this option to Kconfig and tidy up existing boards.

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

# a187559e 05-Feb-2016 Bin Meng <bmeng.cn@gmail.com>

Use correct spelling of "U-Boot"

Correct spelling of "U-Boot" shall be used in all written text
(documentation, comments in source files etc.).

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Minkyu Kang <mk7.kang@samsung.com>

# 947c626d 14-Jan-2016 Tom Rini <trini@konsulko.com>

vsprintf.c: Always enable CONFIG_SYS_VSNPRINTF

Enabling this function always removes some class of string saftey issues.
The size change here in general is about 400 bytes and this seems a reasonable
trade-off.

Cc: Peng Fan <peng.fan@nxp.com>
Cc: Peter Robinson <pbrobinson@gmail.com>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Adrian Alonso <aalonso@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 7d9cde10 22-Nov-2015 Stefan Roese <sr@denx.de>

lib/tiny-printf.c: Add tiny printf function for space limited environments

This patch adds a small printf() version that supports all basic formats.
Its intented to be used in U-Boot SPL versions on platforms with very
limited internal RAM sizes.

To enable it, just define CONFIG_USE_TINY_PRINTF in your defconfig. This
will result in the SPL using this tiny function and the main U-Boot
still using the full-blown printf() function.

This code was copied from:
http://www.sparetimelabs.com/printfrevisited
With mostly only coding style related changes so that its checkpatch
clean.

The size reduction is about 2.5KiB. Here a comparison for the db-mv784mp-gp
(Marvell AXP) SPL:

Without this patch:
58963 18536 1928 79427 13643 ./spl/u-boot-spl

With this patch:
56542 18536 1956 77034 12cea ./spl/u-boot-spl

Note:
To make it possible to compile tiny-printf.c instead of vsprintf.c when
CONFIG_USE_TINY_PRINTF is defined, the functions printf() and vprintf() are
moved from common/console.c into vsprintf.c in this patch.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>

# 2419cd16 03-Oct-2015 Simon Glass <sjg@chromium.org>

dm: tpm: Drop CONFIG_DM_TPM

Now that all TPM drivers use driver model, we can drop the special driver
model CONFIG option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>

# 027b728d 06-Oct-2015 Julius Werner <jwerner@chromium.org>

Add support for LZ4 decompression algorithm

This patch adds support for LZ4-compressed FIT image contents. This
algorithm has a slightly worse compression ration than LZO while being
nearly twice as fast to decompress. When loading images from a fast
storage medium this usually results in a boot time win.

Sandbox-tested only since I don't have a U-Boot development system set
up right now. The code was imported unchanged from coreboot where it's
proven to work, though. I'm mostly interested in getting this recognized
by mkImage for use in a downstream project.

Signed-off-by: Julius Werner <jwerner@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# a7d660bc 22-Aug-2015 Simon Glass <sjg@chromium.org>

tpm: Add Kconfig options for TPMs

Add new Kconfig options for TPMs in preparation for moving boards to use
Kconfig for TPM configuration.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 867a6ac8 31-Jul-2015 Simon Glass <sjg@chromium.org>

efi: Add start-up library code

When running as an EFI application, U-Boot must request memory from EFI,
and provide access to the boot services U-Boot needs.

Add library code to perform these tasks. This includes efi_main() which is
the entry point from EFI. U-Boot is built as a shared library.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d1389403 23-Jun-2015 Simon Glass <sjg@chromium.org>

Add a dhrystone benchmark command

Drystone provides a convenient sanity check that the CPU is running at full
speed. Add this as a command which can be enabled as needed.

Note: I investigated using Coremark for this but there was a license
agreement and I could not work out if it was GPL-compatible.

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

# f7848d90 22-Jun-2015 Joe Hershberger <joe.hershberger@ni.com>

Allow CONFIG_REGEX to be disabled when CONFIG_NET

Instead of selecting REGEX when NET is enabled, make it the default, but
allow boards that are tiny to disable it and lose functionality on all
but the first Ethernet adapter.

cm-bf548, bf538f-ezkit, and bf533-stamp need this. None appear to have
more than one Ethernet interface.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# 3850dbe8 11-Jun-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

blackfin: fix undefined reference to srand and rand

Commit 9ba9e85f3f1c (net: Fix NET_RANDOM_ETHADDR dependencies)
accidentally dropped CONFIG_LIB_RAND defines for 14 Blackfin boards.

Prior to that commit, those boards defined CONFIG_LIB_RAND, but not
CONFIG_NET_RANDOM_ETHADDR. So, commit 9ba9e85f3f1c should not have
touched them, but in fact it ripped CONFIG_LIB_RAND off from all the
header files, which caused undefined reference to srand and rand.
CONFIG_LIB_RAND=y must be revived for such boards.

BTW, this commit indeed makes it better, but even with this fix,
three boards (bf533-stamp, bf538f-ezkit, cm-bf548) still can not
build due to region 'ram' overflowed error. This was cause by
commit 6eed3786c68c (net: Move the CMD_NET config to defconfigs)
because CMD_NET selects NET, and NET selects REGEX. Eventually,
some boards were newly enabled with CONFIG_REGEX, increasing the
memory footprint. A patch is expected to fix the build error.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 9ba9e85f 25-May-2015 Michal Simek <michal.simek@xilinx.com>

net: Fix NET_RANDOM_ETHADDR dependencies

NET_RANDOM_ETHADDR depends on lib/rand.c. This patch adds dependency to
Kconfig to ensure that library is also compiled.

Remove the definitions from Blackfin boards' include/configs.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 6501ff62 20-Apr-2015 Przemyslaw Marczak <p.marczak@samsung.com>

lib: Kconfig: add entry for errno_str() function

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1a60650c 21-Apr-2015 Joe Hershberger <joe.hershberger@ni.com>

kconfig: Move REGEX to Kconfig

Having this as a Kconfig allows it to be a dependent feature.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8156345d 06-Mar-2015 Simon Glass <sjg@chromium.org>

sandbox: Move CONFIG_SYS_VSNPRINTF to Kconfig

Move this over to Kconfig and tidy up.

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

# 94e3c8c4 19-Feb-2015 gaurav rana <gaurav.rana@freescale.com>

crypto/fsl - Add progressive hashing support using hardware acceleration.

Currently only normal hashing is supported using hardware acceleration.
Added support for progressive hashing using hardware.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
Signed-off-by: Gaurav Rana <gaurav.rana@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>

# d9f23c7f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

lib/rsa: Add Kconfig for devices supporting RSA Modular Exponentiation

Kconfig option added for devices which support RSA Verification.
1. RSA_SOFTWARE_EXP
Enables driver for supporting RSA Modular Exponentiation in Software
2. RSA_FREESCALE_EXP
Enables driver for supporting RSA Modular Exponentiation using Freescale specific
driver

The above drivers use RSA uclass

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
(Removed duplicate line in Kconfig comment)

Change-Id: I7663c4d5350e2bfc3dfa2696f70ef777d6ccc6f6

# c4beb22f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

FIT: Modify option FIT_SIGNATURE in Kconfig

For FIT signature based approach to work, RSA library needs to be selected.
The FIT_SIGNATURE option in Kconfig is modified to automatically select RSA.
Selecting RSA compiles the RSA library required for image verification.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 45ccec8f 23-Oct-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_USE_PRIVATE_LIBGCC to Kconfig

The private libgcc is supported only on ARM, MIPS, PowerPC, SH, x86.
Those architectures should "select" HAVE_PRIVATE_LIBGCC and
CONFIG_USE_PRIVATE_LIBGCC should depend on it.

Currently, this option is enabled on Tegra boards and x86 architecture.
Move the definition from header files to Kconfig.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Tested-by: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: Tom Warren <twarren@nvidia.com>

# 8c688bc4 23-Oct-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_SYS_HZ to lib/Kconfig

CONFIG_SYS_HZ is always defined as 1000 in config_fallbacks.h
(but some boards still have redundant definitions).

This commit moves the definition and the document in README to
Kconfig. Since lib/Kconfig can assure that CONFIG_SYS_HZ is 1000,
the sanity check in lib/time.c should be removed.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Reviewed-by: Marek Vasut <marex@denx.de>

# b0928da6 16-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED to Kconfig

If this option is enabled, the objects under lib/ directory
are compiled with speed optimization, not size optimization.
(Currently, only used by some Blackfin boards.)

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# ed36323f 16-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: add blank Kconfig files

This would be useful to start moving various config options.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# 97f2a749 04-Jan-2022 Eugen Hristev <eugen.hristev@microchip.com>

lib: Kconfig: fix PHANDLE_CHECK_SEQ position outside of menu

CONFIG_PHANDLE_CHECK_SEQ is outside of the menu 'Library routines'
thus it's invisible in menuconfig and cannot be selected.
Fix this by moving the 'endmenu' after the PHANDLE_CHECK_SEQ definition

Fixes: c589132a1d ("fdt: Use phandle to distinguish DT nodes with same name")
Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
Reviewed-by: Aswath Govindraju <a-govindraju@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 726cd983 29-Dec-2021 Simon Glass <sjg@chromium.org>

efi: Make unicode printf available to the app

This is needed to show unicode strings. Enable this code in the app.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>

# 6405ab7a 24-Nov-2021 Simon Glass <sjg@chromium.org>

Convert CONFIG_PHYSMEM to Kconfig

This converts the following to Kconfig:
CONFIG_PHYSMEM

Signed-off-by: Simon Glass <sjg@chromium.org>
Suggested-by: Sean Anderson <seanga2@gmail.com>

# ac7606af 14-Nov-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

lmb: fix typo 'commun'

%s/commun/common/

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

# e7d285b2 25-Sep-2021 Simon Glass <sjg@chromium.org>

image: Use the correct checks for CRC32

Add a host Kconfig for CRC32. With this we can use CONFIG_IS_ENABLED(CRC32)
directly in the host build, so drop the unnecessary indirection.

Add a few more conditions to SPL_CRC32 to avoid build failures as well as
TPL_CRC32. Also update hash.c to make crc32 optional and to actually take
notice of SPL_CRC32.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# 2c21256b 25-Sep-2021 Simon Glass <sjg@chromium.org>

hash: Use Kconfig to enable hashing in host tools and SPL

At present when building host tools, we force CONFIG_SHAxxx to be enabled
regardless of the board Kconfig setting. This is done in the image.h
header file.

For SPL we currently just assume the algorithm is desired if U-Boot proper
enables it.

Clean this up by adding new Kconfig options to enable hashing on the host,
relying on CONFIG_IS_ENABLED() to deal with the different builds.

Add new SPL Kconfigs for hardware-accelerated hashing, to maintain the
current settings.

This allows us to drop the image.h code and the I_WANT_MD5 hack.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# 603d15a5 25-Sep-2021 Simon Glass <sjg@chromium.org>

spl: cypto: Bring back SPL_ versions of SHA

Unfortunately these were removed by mistake. This means that adding hash
support to SPL brings in all software algorithms, with a substantial
increase in code size.

The origin of the problem was renaming them to SPL_FIT_xxx and then these
were removed altogether in a later commit.

Add them back. This aligns with CONFIG_MD5, for example, which has an SPL
variant.

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: f5bc9c25f31 ("image: Rename SPL_SHAxxx_SUPPORT to SPL_FIT_SHAxxx")
Fixes: eb5171ddec9 ("common: Remove unused CONFIG_FIT_SHAxxx selectors")
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# 6674edaa 16-Sep-2021 Tom Rini <trini@konsulko.com>

Merge tag 'v2021.10-rc4' into next

Prepare v2021.10-rc4

Signed-off-by: Tom Rini <trini@konsulko.com>

# gpg: Signature made Tue 14 Sep 2021 06:58:32 PM EDT
# gpg: using RSA key 1A3C7F70E08FAB1707809BBF147C39FF9634B72C
# gpg: Good signature from "Thomas Rini <trini@konsulko.com>" [ultimate]

# Conflicts:
# board/Arcturus/ucp1020/spl.c
# cmd/mvebu/Kconfig
# common/Kconfig.boot
# common/image-fit.c
# configs/UCP1020_defconfig
# configs/sifive_unmatched_defconfig
# drivers/pci/Kconfig
# include/configs/UCP1020.h
# include/configs/sifive-unmatched.h
# lib/Makefile
# scripts/config_whitelist.txt


# 5145bc73 01-Sep-2021 Oleksandr Suvorov <oleksandr.suvorov@foundries.io>

lib: fix typos in Kconfig

There are trivial typos in the Kconfig file. Fixed them.
Also, fixed grammar in the descriptions with typos.

Fixes: d56b4b1974 ("configs: Migrate RBTREE, LZO, CMD_MTDPARTS, CMD_UBI and CMD_UBIFS")
Fixes: 7264f2928b ("spl: fit: Eanble GZIP support for image decompression")
Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# e60e4499 02-Sep-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

lib: Drop SHA512_ALGO in lieu of SHA512

SHA512_ALGO was used as a "either SHA512 or SHA384", although the
implementations of these two algorithms share a majority of code.

From a Kconfig interface perspective, it makes sense to present two
distinct options. This requires #ifdefing out the SHA512
implementation from sha512.c. The latter doesn't make any sense.

It's reasonable to say in Kconfig that SHA384 depends on SHA512, and
seems to be the more polite way to handle the selection.

Thus, automatically select SHA512 when SHA384 is enabled.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# b4c2c151 27-Aug-2021 Michal Simek <michal.simek@xilinx.com>

Kconfig: Remove all default n/no options

default n/no doesn't need to be specified. It is default option anyway.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
[trini: Rework FSP_USE_UPD portion]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 928a8be7 29-Jul-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

lib: ecdsa: Implement UCLASS_ECDSA verification on target

Implement the crypto_algo .verify() function for ecdsa256. Because
it backends on UCLASS_ECDSA, this change is focused on parsing the
keys from devicetree and passing this information to the specific
UCLASS driver.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# fa3f1f1d 24-Jul-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: disable CONFIG_SPL_HEXDUMP by default

CONFIG_HEXDUMP is needed to display UEFI variables using 'printenv -e'.

Enabling CONFIG_SPL_HEXDUMP only makes sense for debugging purposes.
Hence CONFIG_SPL_HEXDUMP should not be enabled by default.

The following boards currently have CONFIG_SPL_HEXDUMP=y. This includes
boards that don't use SPL at all.

axm_defconfig
imx8mm-cl-iot-gate_defconfig
imx8mm_venice_defconfig
imxrt1020-evk_defconfig
imxrt1050-evk_defconfig
kontron_sl28_defconfig
kp_imx53_defconfig
lx2160ardb_tfa_stmm_defconfig
mt7622_rfb_defconfig
octeon_ebb7304_defconfig
octeon_nic23_defconfig
qemu_arm64_defconfig
qemu_arm_defconfig
qemu-riscv32_defconfig
qemu-riscv32_smode_defconfig
qemu-riscv64_defconfig
qemu-riscv64_smode_defconfig
qemu-x86_64_defconfig
qemu-x86_defconfig
sandbox64_defconfig
sandbox_defconfig
stm32mp15_basic_defconfig
stm32mp15_trusted_defconfig
synquacer_developerbox_defconfig
taurus_defconfig
xilinx_versal_virt_defconfig

The patch only keeps it enabled on

sandbox_spl_defconfig

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 1a46cb6c 02-Jul-2021 Simon Glass <sjg@chromium.org>

lib: Create a new Kconfig option for charset conversion

Rather than looking at two KConfig options in the Makefile, create a new
Kconfig option for compiling lib/charset.c

Enable it for UFS also, which needs this support.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 26dd9936 08-Jul-2021 Steffen Jaeckel <jaeckel-floss@eyet-services.de>

lib: add crypt subsystem

Add the basic functionality required to support the standard crypt
format.
The files crypt-sha256.c and crypt-sha512.c originate from libxcrypt and
their formatting is therefor retained.
The integration is done via a crypt_compare() function in crypt.c.

```
libxcrypt $ git describe --long --always --all
tags/v4.4.17-0-g6b110bc
```

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 7d0f3fbb 11-Jun-2021 Tero Kristo <t-kristo@ti.com>

lib: rational: copy the rational fraction lib routines from Linux

Copy the best rational approximation calculation routines from Linux.
Typical usecase for these routines is to calculate the M/N divider
values for PLLs to reach a specific clock rate.

This is based on linux kernel commit:
"lib/math/rational.c: fix possible incorrect result from rational
fractions helper"
(sha1: 323dd2c3ed0641f49e89b4e420f9eef5d3d5a881)

Signed-off-by: Tero Kristo <t-kristo@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Tero Kristo <kristo@kernel.org>

# ec0512b1 24-May-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

Revert "lib: introduce HASH_CALCULATE option"

When we think of Kconfig, we usually think of features that we like
to enable or not. Ideally, we wouldn't use Kconfig to fix a build
issue, although sometimes it might make sense. With Kconfig it's hard
to guarantee that the fix is universal. We can only say that it works
for the set of tested configurations. In the majority of cases, it's
preferable to let the linker figure things out for us.

The reverted commit attempted to fix a build issue by adding an
invisible Kconfig option. This is wrong in several ways:

It invents a new Kconfig variable when CONFIG_HASH already
exists for the same purpose.
Second, hash-checksum.c makes use of the hash_progressive_lookup_algo()
symbol, which is only provided with CONFIG_HASH, but this dependency
was not expressed in the reverted patch.

It feels like Kconfig is turning into a listing of all available
source files, and a buffet to 'select' which ones to compile. The
purpose of this revert is to enable the next change to make use of
CONFIG_HASH instead of adding to Kconfig.

This reverts commit 87316da05f2fd49d3709275e64ef0c5980366ade.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Acked-by: Masahisa Kojima <masahisa.kojima@linaro.org>

# 1621d3c4 10-May-2021 Bin Meng <bmeng.cn@gmail.com>

lib: kconfig: Limit BINMAN_FDT for OF_SEPARATE or OF_EMBED

Generally speaking BINMAN_FDT makes sense for OF_SEPARATE or OF_EMBED.
For the other OF_CONTROL methods, it's quite possible binman node is
not available as binman is invoked during the build phase instead of
runtime. Let's only turn it on for OF_SEPARATE or OF_EMBED by default.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 87316da0 13-May-2021 Masahisa Kojima <masahisa.kojima@linaro.org>

lib: introduce HASH_CALCULATE option

Build error occurs when CONFIG_EFI_SECURE_BOOT or
CONFIG_EFI_CAPSULE_AUTHENTICATE is enabled,
because hash-checksum.c is not compiled.

Since hash_calculate() implemented in hash-checksum.c can be
commonly used aside from FIT image signature verification,
this commit itroduces HASH_CALCULATE option to decide
if hash-checksum.c shall be compiled.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# e2ae483c 13-May-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

hash: Kconfig option for SHA512 hardware acceleration

Commit a479f103dc1c ("hash: Allow for SHA512 hardware implementations")
defined function definitions for hardware accelerated SHA384 and SHA512.
If CONFIG_SHA_HW_ACCEL=y, these functions are used.

We already have boards using CONFIG_SHA_HW_ACCEL=y but none implements the
new functions hw_sha384() and hw_sha512().

For implementing the EFI TCG2 protocol we need SHA384 and SHA512. The
missing hardware acceleration functions lead to build errors on boards like
peach-pi_defconfig.

Introduce a new Kconfig symbol CONFIG_SHA512_HW_ACCEL to control if the
functions hw_sha384() and hw_sha512() shall be used to implement the SHA384
and SHA512 algorithms.

Fixes: a479f103dc1c ("hash: Allow for SHA512 hardware implementations")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

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

# 6d66502b 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: Add 2 config to define the max number of regions

Add 2 configs CONFIG_LMB_MEMORY_REGIONS and CONFIG_LMB_RESERVED_REGIONS
to change independently the max number of the regions in lmb
library.

When CONFIG_LMB_USE_MAX_REGIONS=y, move the lmb property arrays to
struct lmb and manage the array size with the element 'max' of struct
lmb_region; their are still allocated in stack.

When CONFIG_LMB_USE_MAX_REGIONS=n, keep the current location in
struct lmb_region to allow compiler optimization.

Increase CONFIG_LMB_RESERVED_REGIONS is useful to avoid lmb errors in
bootm when the number of reserved regions (not adjacent) is reached:
+ 1 region for relocated U-Boot
+ 1 region for initrd
+ 1 region for relocated linux device tree
+ reserved memory regions present in Linux device tree.

The current limit of 8 regions is reached with only 5 reserved regions
in DT.

see Linux kernel commit bf23c51f1f49 ("memblock: Move memblock arrays
to static storage in memblock.c and make their size a variable")

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# 4fa0150d 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: move MAX_LMB_REGIONS value in Kconfig

Move MAX_LMB_REGIONS value in Kconfig, the max number of the regions
in lmb library.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# 77b8cfef 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: move CONFIG_LMB in Kconfig

Migrate CONFIG_LMB in Kconfig.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# a479f103 16-Feb-2021 Joel Stanley <joel@jms.id.au>

hash: Allow for SHA512 hardware implementations

Similar to support for SHA1 and SHA256, allow the use of hardware hashing
engine by enabling the algorithm and setting CONFIG_SHA_HW_ACCEL /
CONFIG_SHA_PROG_HW_ACCEL.

Signed-off-by: Joel Stanley <joel@jms.id.au>

# f2c1442e 14-Mar-2021 Simon Glass <sjg@chromium.org>

bloblist: Make BLOBLIST_TABLES depend on BLOBLIST

Add an extra condition here since we cannot put x86 tables in a bloblist
when bloblists are not supported.

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

# e0103158 25-Feb-2021 Bin Meng <bmeng.cn@gmail.com>

lib: kconfig: Mention CONFIG_ADDR_MAP limitation in the help

Mention that CONFIG_ADDR_MAP only works in the post-relocation phase.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>

# 56e7257c 03-Feb-2021 Bin Meng <bmeng.cn@gmail.com>

lib: Fix BINMAN_FDT dependency

lib/binman.c references the following 3 ofnode APIs:
ofnode_first_subnode(), ofnode_path() and ofnode_read_bool().

These APIs get built only when DM is on. Fix the dependency then.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 59e4e391 18-Jan-2021 Tom Rini <trini@konsulko.com>

Merge https://gitlab.denx.de/u-boot/custodians/u-boot-riscv

- Update qemu-riscv.rst build instructions.
- Add support for SPI on Kendryte K210.
- Add Microchip PolarFire SoC Icicle Kit support.
- Add support for an early timer.
- Select TIMER_EARLY to avoid infinite recursion for Trace.


# a80f8513 17-Jan-2021 Pragnesh Patel <pragnesh.patel@sifive.com>

trace: select TIMER_EARLY to avoid infinite recursion

When tracing functions is enabled this adds calls to
__cyg_profile_func_enter() and __cyg_profile_func_exit() to the traced
functions.

__cyg_profile_func_enter() and __cyg_profile_func_exit() invoke
timer_get_us() to record the entry and exit time.

initr_dm() will make gd->dm_root = NULL and gd->timer = NULL, so
timer_get_us() -> get_ticks() -> dm_timer_init() will lead to an
indefinite recursion.

So select TIMER_EARLY when tracing got enabled.

Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Rick Chen <rick@andestech.com>

# 6205bbb1 04-Jan-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lib: cosmetic update of CONFIG_LIB_ELF description

Change 2 typo error in CONFIG_LIB_ELF description:
- Supoort => Support
- fir => for

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c589132a 02-Dec-2020 Aswath Govindraju <a-govindraju@ti.com>

fdt: Use phandle to distinguish DT nodes with same name

While assigning the sequence number to subsystem instances by reading the
aliases property, only DT nodes names are compared and not the complete
path. This causes a problem when there are two DT nodes with same name but
have different paths.

In arch/arm/dts/k3-am65-main.dtsi there are two USB controllers with the
same device tree node name but different path. When aliases are defined for
these USB controllers then fdtdec_get_alias_seq() fails to pick the correct
instance for a given index.

fdt_path_offset() function is slow and this would effect the U-Boot
startup. To avert the time penalty on all boards, apply this extra check
only when required by using a config option.

Fix it by comparing the phandles of DT nodes after the node names match,
under a config option.

Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Fix whitespace error in Kconfig:
Signed-off-by: Simon Glass <sjg@chromium.org>

# 28cef9ca 19-Nov-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

fs: fat: create correct short names

The current function set_name() used to create short names has the
following deficiencies resolved by this patch:

* Long names (e.g. FOO.TXT) are stored even if a short name is enough.
* Short names with spaces are created, e.g. "A ~1.TXT".
* Short names with illegal characters are created, e.g. "FOO++BAR".
* Debug output does not not consider that the short file name has no
concluding '\0'.

The solution for the following bug is split of into a separate patch:

* Short file names must be unique.

This patch only provides the loop over possible short file names.

Fixes: c30a15e590c ("FAT: Add FAT write feature")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# e4f8e543 05-Nov-2020 Simon Glass <sjg@chromium.org>

smbios: Drop the unused Kconfig options

Now that we can use devicetree to specify this information, drop the old
CONFIG options.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 44c74bdd 05-Nov-2020 Simon Glass <sjg@chromium.org>

sysinfo: Provide a default driver to set SMBIOS values

Some boards want to specify the manufacturer or product name but do not
need to have their own sysinfo driver.

Add a default driver which provides a way to specify this SMBIOS
information in the devicetree, without needing any board-specific
functionality.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d2cb7a22 04-Nov-2020 Simon Glass <sjg@chromium.org>

x86: Allow putting some tables in the bloblist

At present all tables are placed starting at address f0000 in memory, and
can be up to 64KB in size. If the tables are very large, this may not
provide enough space.

Also if the tables point to other tables (such as console log or a ramoops
area) then we must allocate other memory anyway.

The bloblist is a nice place to put these tables since it is contiguous,
which makes it easy to reserve this memory for linux using the 820 tables.

Add an option to put some of the tables in the bloblist. For SMBIOS and
ACPI, create suitable pointers from the f0000 region to the new location
of the tables.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
[bmeng: squashed in http://patchwork.ozlabs.org/project/uboot/patch/
20201105062407.1.I8091ad931cbbb5e3b6f6ababdf3f8d5db0d17bb9@changeid/]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# 415eab06 03-Nov-2020 Christian Gmeiner <christian.gmeiner@gmail.com>

smbios: add parsing API

Add a very simple API to be able to access SMBIOS strings
like vendor, model and bios version.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 72eda507 27-Oct-2020 Sean Anderson <seanga2@gmail.com>

lib: Add getopt

Some commands can get very unweildy if they have too many positional
arguments. Adding options makes them easier to read, remember, and
understand.

This implementation of getopt has been taken from barebox, which has had
option support for quite a while. I have made a few modifications to their
version, such as the removal of opterr in favor of a separate getopt_silent
function. In addition, I have moved all global variables into struct
getopt_context.

The getopt from barebox also re-orders the arguments passed to it so that
non-options are placed last. This allows users to specify options anywhere.
For example, `ls -l foo/ -R` would be re-ordered to `ls -l -R foo/` as
getopt parsed the options. However, this feature conflicts with the const
argv in cmd_tbl->cmd. This was originally added in 54841ab50c ("Make sure
that argv[] argument pointers are not modified."). The reason stated in
that commit is that hush requires argv to stay unmodified. Has this
situation changed? Barebox also uses hush, and does not have this problem.
Perhaps we could use their fix?

I have assigned maintenance of getopt to Simon Glass, as it is currently
only used by the log command. I would also be fine maintaining it.

Signed-off-by: Sean Anderson <seanga2@gmail.com>

# 26637e2e 12-Sep-2020 Simon Glass <sjg@chromium.org>

lib: Allow hexdump to be used in SPL

It is sometimes useful to output hex dumps in SPL. Add a config option to
allow this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# e87dfb05 05-Aug-2020 Andrii Anisov <andrii_anisov@epam.com>

lib: sscanf: add sscanf implementation

Port sscanf implementation from mini-os and introduce new
Kconfig option to enable it: CONFIG_SSCANF. Disable by default.

Signed-off-by: Andrii Anisov <andrii_anisov@epam.com>
Signed-off-by: Anastasiia Lukianenko <anastasiia_lukianenko@epam.com>
Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>

# 81014f73 30-Jul-2020 Joao Marcos Costa <joaomarcos.costa@bootlin.com>

include/u-boot, lib/zlib: add sources for zlib decompression

Add zlib (v1.2.11) uncompr() function to U-Boot. SquashFS depends on
this function to decompress data from a raw disk image. The actual
support for zlib into SquashFS sources will be added in a follow-up
commit.

Signed-off-by: Joao Marcos Costa <joaomarcos.costa@bootlin.com>

# 69be8fd1 03-Jun-2020 Marek Szyprowski <m.szyprowski@samsung.com>

powerpc: move ADDR_MAP to Kconfig

Move ADDR_MAP related config options from include/configs/*.h to the
proper place in lib/Kconfig. This has been done using
./tools/moveconfig.py and manual inspection of the generated changes.
This is a preparation to use ADDR_MAP helper on ARM 32bit Raspberry Pi4
board for mapping the PCIe XHCI MMIO, which is above the 4GiB identity
mapping limit.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# d16b38f4 15-Apr-2020 Reuben Dowle <reubendowle0@gmail.com>

Add support for SHA384 and SHA512

The current recommendation for best security practice from the US government
is to use SHA384 for TOP SECRET [1].

This patch adds support for SHA384 and SHA512 in the hash command, and also
allows FIT images to be hashed with these algorithms, and signed with
sha384,rsaXXXX and sha512,rsaXXXX

The SHA implementation is adapted from the linux kernel implementation.

[1] Commercial National Security Algorithm Suite
http://www.iad.gov/iad/programs/iad-initiatives/cnsa-suite.cfm

Signed-off-by: Reuben Dowle <reuben.dowle@4rf.com>

# 43e442a5 26-May-2020 Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

kconfig: fix some typos

Signed-off-by: Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

# eff5a547 22-May-2020 Michael Walle <michael@walle.cc>

cmd: zip: automatically pull in gzip()

Move the CONFIG_GZIP_COMPRESSED from a config.h macro to a Kconfig menu
item. It is not selectable by a user because there is no reason to do
so. Instead it will be automatically selected by the stuff which uses
gzip(), like the zip command.

Remove it from the config_whitelist.txt. Also remove
CONFIG_GZIP_COMPRESS_DEF_SZ as this was never used on any board. The
default seems to be sane, otherwise it should be added as a Kconfig
option.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8239be61 06-May-2020 Simon Glass <sjg@chromium.org>

lib: Allow MD5 to be enabled in SPL

At present the MD5 option cannot be enabled by board configs since it has
no Kconfig name. It is generally enabled, so long as FIT support is
present. But not all boards use FIT, particularly in SPL

Fix this and add an option for SPL as well. This allows board code to call
md5() even if FIT support is not enabled.

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

# 04cb3994 21-Apr-2020 Weijie Gao <weijie.gao@mediatek.com>

lib: enable lzma decompression support for SPL build

This patch enables LZMA decompression support for SPL build

Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>

# 2a2119e1 05-Mar-2020 Atish Patra <atishp@atishpatra.org>

lib: kconfig: Add option to set BZIP2 compression method

There is no way to select BZIP2 compression method.
Add it under library/compression config where all other
compression related configs are present.

Signed-off-by: Atish Patra <atish.patra@wdc.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 805b3cac 12-Feb-2020 Keerthy <j-keerthy@ti.com>

lib: elf: Move the generic elf loading/validating functions to lib

Move the generic elf loading/validating functions to lib/
so that they can be re-used and accessed by code existing
outside cmd.

While at it remove the duplicate static version of load_elf_image_phdr
under arch/arm/mach-imx/imx_bootaux.c.

Signed-off-by: Keerthy <j-keerthy@ti.com>
Suggested-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>

# 1611235b 19-Jan-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: Kconfig dependencies for pseudo-random library

drivers/rng/sandbox_rng.c requires rand() to be defined but configuration
option CONFIG_CONFIG_LIB_RAND selected in drivers/rng/Kconfig does not
exist.

test/lib/test_aes.c requires rand() to be defined.

Fix the selection criteria for choice "Pseudo-random library support type".

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 3c10dc95 06-Dec-2019 Simon Glass <sjg@chromium.org>

binman: Add a library to access binman entries

SPL and TPL can access information about binman entries using link-time
symbols but this is not available in U-Boot proper. Of course it could be
made available, but the intention is to just read the device tree.

Add support for this, so that U-Boot can locate entries.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# b4adf627 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: crypto: add x509 parser

Imported from linux kernel v5.3:
x509.asn1 without changes
x509_akid.asn1 without changes
x509_parser.h without changes
x509_cert_parser.c with changes marked as __UBOOT__
x509_public_key.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# a9b45e6e 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add oid registry utility

Imported from linux kernel v5.3:
build_OID_registry without changes
oid_registry.h without changes
oid_registry.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# ab8a0e06 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add asn1 decoder

Imported from linux kernel v5.3:
lib/asn1_decoder.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 2b12196d 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

cmd: add asn1_compiler

Imported from linux kernel v5.3:
asn1.h without changes
asn1_ber_bytecode.h without changes
asn1_decoder.h without changes
asn1_compiler.c without changes

This host command will be used to create a ASN1 parser, for example,
for pkcs7 messages or x509 certificates. More specifically, it will
generate *byte code* which will be interpreted by asn1 decoder library.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 05429b6c 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

rtc: move date.c from drivers/rtc/ to lib/

In the next commit, rtc_mktime(), for compatibility with linux, will be
implemented using rtc_mktime(), which is no longer drivers/rtc specific.
So move this file under lib/.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 37ef1774 10-Nov-2019 Thomas Hebb <tommyhebb@gmail.com>

Kconfig: disambiguate config names for tiny printf

27084c03d36a ("spl: Allow tiny printf() to be controlled in SPL and
TPL") split this option in two for TPL and SPL, but didn't change the
Kconfig names, making them hard to set quickly.

Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>

# 0d76afc0 27-Oct-2019 Simon Glass <sjg@chromium.org>

fdt: Add Kconfig options to control code size

For better or worse libfdt recent grew a lot of code that checks the
validity of the device tree in great detail. When using unsigned or
unverified data this makes things safer, but it does add to code size.

Add some controls to select the trade-off between safety and code size.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 27084c03 25-Sep-2019 Simon Glass <sjg@chromium.org>

spl: Allow tiny printf() to be controlled in SPL and TPL

At present there is only one control for this and it is used for both SPL
and TPL. But SPL might have a lot more space than TPL so the extra cost of
a full printf() might be acceptable.

Split the option into two, providing separate SPL and TPL controls. The
TPL setting defaults to the same as SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2a51e16b 07-Jun-2019 Tom Rini <trini@konsulko.com>

configs: Make USE_TINY_PRINTF depend on SPL||TPL and be default

The USE_TINY_PRINTF symbol only changes things within SPL and TPL
builds, so make it depend on that support. Next, make it default as
within these cases we should rarely have need of more advanced print
formats outside of the debug context.

To do this, in a few cases we need to correct our Kconfig dependencies
as we had cases of non-SPL targets select'ing this symbol. Finally, in
the case of a few boards we really do need the full printf
functionality.

Signed-off-by: Tom Rini <trini@konsulko.com>

# da0fb5fd 02-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: make call depth limit customizable

Up to now we had hard coded values for the call depth up to which trace
records are created: 200 for early tracing, 15 thereafter. UEFI
applications reach a call depth of 80 or above.

Provide customizing settings for the call trace depth limit and the early
call trace depth limit. Use the old values as defaults.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8509f22a 29-Apr-2019 Marek Behún <marek.behun@nic.cz>

lib: add Zstandard decompression support

Add the zstd library from Linux kernel (only decompression support).
There are minimal changes to build with U-Boot, otherwise the files are
identical to Linux commit dc35da16 from March 2018, the files had not
been touched since in kernel. Also SPDX lincese tags were added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 83a486b6 29-Apr-2019 Marek Behún <marek.behun@nic.cz>

lib: Add xxhash support

This adds the xxhash support from Linux. Files are almost identical to
those added to Linux in commit 5d240522 ("lib: Add xxhash module") (they
haven't been touched since in Linux). The only difference is to add some
includes to be compatible with U-Boot. Also SPDX lincese tags were
added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 5132361a 29-Apr-2019 Heiko Schocher <hs@denx.de>

lib: Kconfig: fix help text for GZIP

commit 95f4bbd581cf ("lib: fdt: Allow LZO and GZIP DT compression in U-Boot")

introduced Kconfig option for gzip in U-Boot, but help text
says gzip for SPL, which is wrong. Fix this.

Signed-off-by: Heiko Schocher <hs@denx.de>
Acked-by: Marek Vasut <marex@denx.de>

# 1c6eb075 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE_BUFFER_SIZE et al to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE_BUFFER_SIZE
CONFIG_TRACE_EARLY_SIZE
CONFIG_TRACE_EARLY
CONFIG_TRACE_EARLY_ADDR

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

# a24a78d7 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE

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

# 54969b40 21-Mar-2019 Thierry Reding <treding@nvidia.com>

fdtdec: Add Kconfig symbol for tests

Runtime tests are provided as a test_fdtdec command implementation. Add
a Kconfig symbol that allows this command to be built so that the tests
can be used.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 95f4bbd5 08-Mar-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

lib: fdt: Allow LZO and GZIP DT compression in U-Boot

Add required Kconfig symbols, Makefile bits and macro fixes in a
few places to support LZO and DT compression in U-Boot. This can
save a lot of space with multi-DTB fitImages.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>

# 6e705114 13-Jan-2019 Chris Packham <judge.packham@gmail.com>

lib: Kconfig: spelling fixes

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 048c6e89 06-Nov-2018 Simon Glass <sjg@chromium.org>

spl: lz4: Allow use of lz4 compression in SPL

In some cases U-Boot is compressed and it is useful to be able to
decompress it in SPL. Add a Kconfig and Makefile change to allow this.
Note that this does not actually implement decompression.

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

# 2895c4b7 15-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

kconfig: Introduce HAVE_ARCH_IOMAP

Introduce a new Kconfig option for architecture codes to control
whether it provides io{read,write}{8,16,32} I/O accessor functions.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5592a633 01-Oct-2018 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt in TPL

In some cases (e.g. sandbox with verified boot) it is useful to support
libfdt in TPL. Update the Kconfig to handle this.

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

# 6307896c 01-Oct-2018 Simon Glass <sjg@chromium.org>

tpm: Add support for SPL and TPL

At present the tpm can only be used in U-Boot proper. Updated it to work
in SPL and TPL also.

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

# ab948cd2 19-Jul-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

fdt_support: make FDT_FIXUP_PARTITIONS depend on CMD_MTDPARTS

fdt_fixup_mtdparts() calls mtdparts_init() and device_find(),
which are defined in cmd/mtdparts.c

The combination of FDT_FIXUP_PARTITIONS=y and CMD_MTDPARTS=n
emits the following link error:

common/fdt_support.c:903: undefined reference to `mtdparts_init'
common/fdt_support.c:914: undefined reference to `device_find'

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 3330584d 03-Jun-2018 Igor Opaniuk <igor.opaniuk@gmail.com>

avb2.0: integrate avb 2.0 into the build system

Integrate libavb into the build system. Introduce CONFIG_LIBAVB
build option.

Signed-off-by: Igor Opaniuk <igor.opaniuk@linaro.org>

# f8c987f8 05-Jun-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

lib: Add hexdump

Often during debugging session it's very interesting to see
what data we were dealing with. For example what we write or read
to/from memory or peripherals.

This change introduces functions that allow to dump binary
data with one simple function invocation like:
------------------->8----------------
print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, buf, len);
------------------->8----------------

which gives us the following:
------------------->8----------------
00000000: f2 b7 c9 88 62 61 75 64 72 61 74 65 3d 31 31 35 ....baudrate=115
00000010: 32 30 30 00 62 6f 6f 74 61 72 67 73 3d 63 6f 6e 200.bootargs=con
00000020: 73 6f 6c 65 3d 74 74 79 53 33 2c 31 31 35 32 30 sole=ttyS3,11520
00000030: 30 6e 38 00 62 6f 6f 74 64 65 6c 61 79 3d 33 00 0n8.bootdelay=3.
00000040: 62 6f 6f 74 66 69 6c 65 3d 75 49 6d 61 67 65 00 bootfile=uImage.
00000050: 66 64 74 63 6f 6e 74 72 6f 6c 61 64 64 72 3d 39 fdtcontroladdr=9
00000060: 66 66 62 31 62 61 30 00 6c 6f 61 64 61 64 64 72 ffb1ba0.loadaddr
00000070: 3d 30 78 38 32 30 30 30 30 30 30 00 73 74 64 65 =0x82000000.stde
00000080: 72 72 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 rr=serial0@e0022
00000090: 30 30 30 00 73 74 64 69 6e 3d 73 65 72 69 61 6c 000.stdin=serial
000000a0: 30 40 65 30 30 32 32 30 30 30 00 73 74 64 6f 75 0@e0022000.stdou
000000b0: 74 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 30 t=serial0@e00220
000000c0: 30 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00..............
...
------------------->8----------------

Source of hexdump.c was copied from Linux kernel v4.7-rc2.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Mario Six <mario.six@gdsys.cc>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Stefan Roese <sr@denx.de>

# c232d14d 29-May-2018 Alex Kiernan <alex.kiernan@gmail.com>

mmc: Separate "mmc swrite" from fastboot

Introduce CONFIG_IMAGE_SPARSE and CONFIG_CMD_MMC_SWRITE so the "mmc
swrite" command is separated from the fastboot code.

Move image-sparse from common to lib so it's clear it's library code.

Rename CONFIG_FASTBOOT_FLASH_FILLBUF_SIZE to CONFIG_IMAGE_SPARSE_FILLBUF_SIZE
and migrate it to Kconfig.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Acked-by: Jassi Brar <jaswinder.singh@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6417572e 08-May-2018 Tom Rini <trini@konsulko.com>

lib/Kconfig: Mark OF_LIBFDT_OVERLAY as depending on OF_LIBFDT

The overlay code is only useful when OF_LIBFDT is set, so mark it as
depending on that first.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 58a46f88 25-Apr-2018 Praneeth Bajjuri <praneeth@ti.com>

configs: TI: Enable FIT Library overlay support

Enable the FDT library overlay support for all TI SOC family.

Without this option, when Loading fdt from FIT image, the
following warning is seen.

"config with overlays but CONFIG_OF_LIBFDT_OVERLAY not set".

Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
Suggested-by: Andrew F.Davis <afd@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>

# 14ad44ab 18-Apr-2018 Alex Kiernan <alex.kiernan@gmail.com>

spl: Split sprintf, strto* from SPL serial in Kconfig

When SPL serial is disabled, callers who need sprintf or strtoul fail
because their inclusion is guarded by CONFIG_SPL_SERIAL_SUPPORT/
CONFIG_TPL_SERIAL_SUPPORT.

Split printf, sprintf and strto into their own entries and then select
all of them if SERIAL_SUPPORT is enabled to match the current behaviour.

Include panic.o unconditionally as it can be called from anywhere which
uses BUG_ON().

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>

# e294ba06 04-Apr-2018 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-sunxi

Signed-off-by: Tom Rini <trini@konsulko.com>


# d14db11d 03-Apr-2018 Andre Przywara <andre.przywara@arm.com>

sunxi: revert disabling of features

In January some commits were introduced to mitigate the U-Boot image
size issues we encountered on sunxi builds.
Now with the MMC environment removed we can bring them back, as we
practically don't have a size limit anymore.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 32ce6179 13-Mar-2018 Bryan O'Donoghue <bryan.odonoghue@linaro.org>

optee: Add lib entries for sharing OPTEE code across ports

This patch adds code to lib to enable sharing of useful OPTEE code between
board-ports and architectures. The code on lib/optee/optee.c comes from the
TI omap2 port. Eventually the OMAP2 code will be patched to include the
shared code. The intention here is to add more useful OPTEE specific code
as more functionality gets added.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Cc: Harinarayan Bhatta <harinarayan@ti.com>
Cc: Andrew F. Davis <afd@ti.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Kever Yang <kever.yang@rock-chips.com>
Cc: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Cc: Peng Fan <peng.fan@nxp.com>
Tested-by: Peng Fan <peng.fan@nxp.com>

# 36c1877c 06-Feb-2018 Faiz Abbas <faiz_abbas@ti.com>

lib: Kconfig: Move DYNAMIC_CRC_TABLE to Kconfig

Add CONFIG prefix to DYNAMIC_CRC_TABLE and implement it in
Kconfig.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>

# a451bc27 05-Feb-2018 Adam Ford <aford173@gmail.com>

Convert LIB_UUID to Kconfig

config_fallback.h has some logic that checks a variety of options
and selects LIB_UUID if it hasn't already been selected. This
will all LIB_UUID in Kconfig and select this option for the list
of options to allow us to remove the logic from fallbacks

Signed-off-by: Adam Ford <aford173@gmail.com>

# a5a37567 06-Feb-2018 Adam Ford <aford173@gmail.com>

Convert CONFIG LIB_HW_RAND to Kconfig

config_fallbacks.h had some logic to automatically select
LIB_RAND if RANDOM_UUID or CMD_UUID were set if LIB_HW_RAND wasn't
already selected. By migrating LIB_HW_RAND to Kconfig, we can
remove this check from config_fallbacks.h and put it into Kconfig

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
[trini: Turn into a choice, add NET_RANDOM_ETHADDR]
Signed-off-by: Tom Rini <trini@konsulko.com>

# acd4d334 16-Jan-2018 Maxime Ripard <maxime.ripard@free-electrons.com>

net: regex: Disable by default on sunXi

The sunXi arm64 build has overflown, leading to the main U-boot binary
overwriting the environment when flashing the new image, or even worse,
overwriting itself when we're calling saveenv.

Disable this option that is not critical until we can adress the issue
properly.

Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 7e3caa81 03-Dec-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

Move CONFIG_PANIC_HANG to Kconfig

Freescale (NXP) boards have lots of defconfig files per board.
I used "imply PANIC_HANG" for them.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# da5337a6 08-Nov-2017 Nandor Han <nandor.han@ge.com>

rtc: add support for s35392a

Add support for S35392A RTC. The driver supports both U-Boot driver
models.

Signed-off-by: Nandor Han <nandor.han@ge.com>
Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
Cc: Heiko Schocher <hs@denx.de>

# f52bdf4b 14-Sep-2017 Jean-Jacques Hiblot <jjhiblot@ti.com>

lib: allow building lzo for the SPL

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 85d8bf57 03-Sep-2017 Marek Behún <marek.behun@nic.cz>

lib: Add CRC32-C

This is needed for BTRFS.

Signed-off-by: Marek Behun <marek.behun@nic.cz>

create mode 100644 lib/crc32c.c

# 7264f292 15-Aug-2017 York Sun <york.sun@nxp.com>

spl: fit: Eanble GZIP support for image decompression

Add Kconfig option SPL_GZIP and SPL_ZLIB to enable gunzip support for
SPL boot, eg. falcon boot compressed kernel image.

Signed-off-by: York Sun <york.sun@nxp.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6ef2f901 11-Aug-2017 Adam Ford <aford173@gmail.com>

Convert CONFIG_BCH to Kconfig

This converts the following to Kconfig:
CONFIG_BCH

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1a7ba1d 18-Aug-2017 Anatolij Gustschin <agust@denx.de>

Fix 'notes' typos

s/notes/nodes

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 96b9082c 03-Aug-2017 Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

rockchip: rk3188: rock: adjust for SPL/TPL split

With the changes to split SPL/TPL for the RK3368, I apparently missed
some needed adjustments to the RK3188 Kconfig and rock_defconfig.

This fixes build-issues for the rock board after applying the RK3368
enablement (and SPL/TPL) set that resulted from TPL_SERIAL_SUPPORT,
TPL_ROCKCHIP_BACK_TO_BROM and TPL_TINY_MEMSET being separate symbols
now.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d56b4b19 22-Jul-2017 Tom Rini <trini@konsulko.com>

configs: Migrate RBTREE, LZO, CMD_MTDPARTS, CMD_UBI and CMD_UBIFS

The above CONFIG options are in Kconfig, and now have correct depends and
inter-dependencies. Migrate these to configs/ from include/configs/. In the
case of CMD_UBIFS also change it to be a default y if CMD_UBI.

Signed-off-by: Tom Rini <trini@konsulko.com>

# aed998aa 17-May-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_LZMA to Kconfig

This converts the following to Kconfig:
CONFIG_LZMA

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

# b1a873df 26-Apr-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_CMD_AES et al to Kconfig

This converts the following to Kconfig:
CONFIG_CMD_AES
CONFIG_AES

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Add select AES to CMD_AES]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 173aafbf 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

cmd: Expose a Kconfig option to enable UBIFS commands

Create a new Kconfig entry to allow CMD_UBIFS selection from Kconfig and
add an hidden LZO option that can be selected by CMD_UBIFS.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>

# aa049152 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

mtd: ubi: Select RBTREE option from MTD_UBI Kconfig entry

Expose the RBTREE feature through Kconfig and select this option from the
MTD_UBI option.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>
[Rebased on master]
Signed-off-by: Jagan Teki <jagan@openedev.com>

# ab4458bd 02-Apr-2017 Simon Glass <sjg@chromium.org>

string: Provide a slimmed-down memset()

Most of the time the optimised memset() is what we want. For extreme
situations such as TPL it may be too large. For example on the 'rock'
board, using a simple loop saves a useful 48 bytes. With gcc 4.9 and
the rodata bug, this patch is enough to reduce the TPL image below the
limit.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>

# bea79d7d 14-Mar-2017 Andre Przywara <andre.przywara@arm.com>

Kconfig: introduce md5sum command selection

So far CONFIG_MD5SUM would need to be set by a board's include file.
Since the command is really generic, move it over to Kconfig to allow
it to be defined by either a board's defconfig, menuconfig or some
config snippet merged via mergeconfig.sh.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e663b350 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

smbios: Expose in efi_loader as table

We can pass SMBIOS easily as EFI configuration table to an EFI payload. This
patch adds enablement for that case.

While at it, we also enable SMBIOS generation for ARM systems, since they support
EFI_LOADER.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4b6dddc2 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

x86: Move smbios generation into arch independent directory

We will need the SMBIOS generation function on ARM as well going forward,
so let's move it into a non arch specific location.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# ebf7fff2 05-Oct-2016 Heiko Schocher <hs@denx.de>

spl: move FDT_FIXUP_PARTITIONS to Kconfig

Move FDT_FIXUP_PARTITIONS to Kconfig and cleanup existing
uses.

Signed-off-by: Heiko Schocher <hs@denx.de>

# ddf67f71 05-Jul-2016 Maxime Ripard <maxime.ripard@free-electrons.com>

libfdt: Add overlay application function

The device tree overlays are a good way to deal with user-modifyable
boards or boards with some kind of an expansion mechanism where we can
easily plug new board in (like the BBB, the Raspberry Pi or the CHIP).

Add a new function to merge overlays with a base device tree.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>

# 91b86e21 26-May-2016 Marek Vasut <marex@denx.de>

lib: Enable private libgcc by default

This patch decouples U-Boot binary from the toolchain on systems where
private libgcc is available. Instead of pulling in functions provided
by the libgcc from the toolchain, U-Boot will use it's own set of libgcc
functions. These functions are usually imported from Linux kernel, which
also uses it's own libgcc functions instead of the ones provided by the
toolchain.

This patch solves a rather common problem. The toolchain can usually
generate code for many variants of target architecture and often even
different endianness. The libgcc on the other hand is usually compiled
for one particular configuration and the functions provided by it may
or may not be suited for use in U-Boot. This can manifest in two ways,
either the U-Boot fails to compile altogether and linker will complain
or, in the much worse case, the resulting U-Boot will build, but will
misbehave in very subtle and hard to debug ways.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 67976306 30-Mar-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

cosmetic: Fix typos "privide"

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# ed980b8c 03-Mar-2016 Alexander Graf <agraf@csgraf.de>

efi_loader: hook up in build environment

Now that we have all the bits and pieces ready for EFI payload loading
support, hook them up in Makefiles and KConfigs so that we can build.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
[trini: Enable only when we of OF_LIBFDT, disable on kwb and colibri_pxa270]
Signed-off-by: Tom Rini <trini@konsulko.com>

# aa34fbc0 22-Feb-2016 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt to be used in SPL

Add an option to enable libfdt in SPL. This can be useful when decoding
FIT files in SPL.

We need to make sure this option is not enabled in SPL by this change.
Also this option needs to be enabled in host builds. Si add a new
IMAGE_USE_LIBFDT #define which can be used in files that are built on the
host but must also build for U-Boot and SPL.

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

# 69e173eb 22-Feb-2016 Simon Glass <sjg@chromium.org>

Move CONFIG_OF_LIBFDT to Kconfig

Move this option to Kconfig and tidy up existing boards.

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

# a187559e 05-Feb-2016 Bin Meng <bmeng.cn@gmail.com>

Use correct spelling of "U-Boot"

Correct spelling of "U-Boot" shall be used in all written text
(documentation, comments in source files etc.).

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Minkyu Kang <mk7.kang@samsung.com>

# 947c626d 14-Jan-2016 Tom Rini <trini@konsulko.com>

vsprintf.c: Always enable CONFIG_SYS_VSNPRINTF

Enabling this function always removes some class of string saftey issues.
The size change here in general is about 400 bytes and this seems a reasonable
trade-off.

Cc: Peng Fan <peng.fan@nxp.com>
Cc: Peter Robinson <pbrobinson@gmail.com>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Adrian Alonso <aalonso@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 7d9cde10 22-Nov-2015 Stefan Roese <sr@denx.de>

lib/tiny-printf.c: Add tiny printf function for space limited environments

This patch adds a small printf() version that supports all basic formats.
Its intented to be used in U-Boot SPL versions on platforms with very
limited internal RAM sizes.

To enable it, just define CONFIG_USE_TINY_PRINTF in your defconfig. This
will result in the SPL using this tiny function and the main U-Boot
still using the full-blown printf() function.

This code was copied from:
http://www.sparetimelabs.com/printfrevisited
With mostly only coding style related changes so that its checkpatch
clean.

The size reduction is about 2.5KiB. Here a comparison for the db-mv784mp-gp
(Marvell AXP) SPL:

Without this patch:
58963 18536 1928 79427 13643 ./spl/u-boot-spl

With this patch:
56542 18536 1956 77034 12cea ./spl/u-boot-spl

Note:
To make it possible to compile tiny-printf.c instead of vsprintf.c when
CONFIG_USE_TINY_PRINTF is defined, the functions printf() and vprintf() are
moved from common/console.c into vsprintf.c in this patch.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>

# 2419cd16 03-Oct-2015 Simon Glass <sjg@chromium.org>

dm: tpm: Drop CONFIG_DM_TPM

Now that all TPM drivers use driver model, we can drop the special driver
model CONFIG option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>

# 027b728d 06-Oct-2015 Julius Werner <jwerner@chromium.org>

Add support for LZ4 decompression algorithm

This patch adds support for LZ4-compressed FIT image contents. This
algorithm has a slightly worse compression ration than LZO while being
nearly twice as fast to decompress. When loading images from a fast
storage medium this usually results in a boot time win.

Sandbox-tested only since I don't have a U-Boot development system set
up right now. The code was imported unchanged from coreboot where it's
proven to work, though. I'm mostly interested in getting this recognized
by mkImage for use in a downstream project.

Signed-off-by: Julius Werner <jwerner@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# a7d660bc 22-Aug-2015 Simon Glass <sjg@chromium.org>

tpm: Add Kconfig options for TPMs

Add new Kconfig options for TPMs in preparation for moving boards to use
Kconfig for TPM configuration.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 867a6ac8 31-Jul-2015 Simon Glass <sjg@chromium.org>

efi: Add start-up library code

When running as an EFI application, U-Boot must request memory from EFI,
and provide access to the boot services U-Boot needs.

Add library code to perform these tasks. This includes efi_main() which is
the entry point from EFI. U-Boot is built as a shared library.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d1389403 23-Jun-2015 Simon Glass <sjg@chromium.org>

Add a dhrystone benchmark command

Drystone provides a convenient sanity check that the CPU is running at full
speed. Add this as a command which can be enabled as needed.

Note: I investigated using Coremark for this but there was a license
agreement and I could not work out if it was GPL-compatible.

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

# f7848d90 22-Jun-2015 Joe Hershberger <joe.hershberger@ni.com>

Allow CONFIG_REGEX to be disabled when CONFIG_NET

Instead of selecting REGEX when NET is enabled, make it the default, but
allow boards that are tiny to disable it and lose functionality on all
but the first Ethernet adapter.

cm-bf548, bf538f-ezkit, and bf533-stamp need this. None appear to have
more than one Ethernet interface.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# 3850dbe8 11-Jun-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

blackfin: fix undefined reference to srand and rand

Commit 9ba9e85f3f1c (net: Fix NET_RANDOM_ETHADDR dependencies)
accidentally dropped CONFIG_LIB_RAND defines for 14 Blackfin boards.

Prior to that commit, those boards defined CONFIG_LIB_RAND, but not
CONFIG_NET_RANDOM_ETHADDR. So, commit 9ba9e85f3f1c should not have
touched them, but in fact it ripped CONFIG_LIB_RAND off from all the
header files, which caused undefined reference to srand and rand.
CONFIG_LIB_RAND=y must be revived for such boards.

BTW, this commit indeed makes it better, but even with this fix,
three boards (bf533-stamp, bf538f-ezkit, cm-bf548) still can not
build due to region 'ram' overflowed error. This was cause by
commit 6eed3786c68c (net: Move the CMD_NET config to defconfigs)
because CMD_NET selects NET, and NET selects REGEX. Eventually,
some boards were newly enabled with CONFIG_REGEX, increasing the
memory footprint. A patch is expected to fix the build error.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 9ba9e85f 25-May-2015 Michal Simek <michal.simek@xilinx.com>

net: Fix NET_RANDOM_ETHADDR dependencies

NET_RANDOM_ETHADDR depends on lib/rand.c. This patch adds dependency to
Kconfig to ensure that library is also compiled.

Remove the definitions from Blackfin boards' include/configs.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 6501ff62 20-Apr-2015 Przemyslaw Marczak <p.marczak@samsung.com>

lib: Kconfig: add entry for errno_str() function

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1a60650c 21-Apr-2015 Joe Hershberger <joe.hershberger@ni.com>

kconfig: Move REGEX to Kconfig

Having this as a Kconfig allows it to be a dependent feature.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8156345d 06-Mar-2015 Simon Glass <sjg@chromium.org>

sandbox: Move CONFIG_SYS_VSNPRINTF to Kconfig

Move this over to Kconfig and tidy up.

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

# 94e3c8c4 19-Feb-2015 gaurav rana <gaurav.rana@freescale.com>

crypto/fsl - Add progressive hashing support using hardware acceleration.

Currently only normal hashing is supported using hardware acceleration.
Added support for progressive hashing using hardware.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
Signed-off-by: Gaurav Rana <gaurav.rana@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>

# d9f23c7f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

lib/rsa: Add Kconfig for devices supporting RSA Modular Exponentiation

Kconfig option added for devices which support RSA Verification.
1. RSA_SOFTWARE_EXP
Enables driver for supporting RSA Modular Exponentiation in Software
2. RSA_FREESCALE_EXP
Enables driver for supporting RSA Modular Exponentiation using Freescale specific
driver

The above drivers use RSA uclass

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
(Removed duplicate line in Kconfig comment)

Change-Id: I7663c4d5350e2bfc3dfa2696f70ef777d6ccc6f6

# c4beb22f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

FIT: Modify option FIT_SIGNATURE in Kconfig

For FIT signature based approach to work, RSA library needs to be selected.
The FIT_SIGNATURE option in Kconfig is modified to automatically select RSA.
Selecting RSA compiles the RSA library required for image verification.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 45ccec8f 23-Oct-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_USE_PRIVATE_LIBGCC to Kconfig

The private libgcc is supported only on ARM, MIPS, PowerPC, SH, x86.
Those architectures should "select" HAVE_PRIVATE_LIBGCC and
CONFIG_USE_PRIVATE_LIBGCC should depend on it.

Currently, this option is enabled on Tegra boards and x86 architecture.
Move the definition from header files to Kconfig.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Tested-by: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: Tom Warren <twarren@nvidia.com>

# 8c688bc4 23-Oct-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_SYS_HZ to lib/Kconfig

CONFIG_SYS_HZ is always defined as 1000 in config_fallbacks.h
(but some boards still have redundant definitions).

This commit moves the definition and the document in README to
Kconfig. Since lib/Kconfig can assure that CONFIG_SYS_HZ is 1000,
the sanity check in lib/time.c should be removed.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Reviewed-by: Marek Vasut <marex@denx.de>

# b0928da6 16-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED to Kconfig

If this option is enabled, the objects under lib/ directory
are compiled with speed optimization, not size optimization.
(Currently, only used by some Blackfin boards.)

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# ed36323f 16-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: add blank Kconfig files

This would be useful to start moving various config options.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# 726cd983 29-Dec-2021 Simon Glass <sjg@chromium.org>

efi: Make unicode printf available to the app

This is needed to show unicode strings. Enable this code in the app.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>

# 6405ab7a 24-Nov-2021 Simon Glass <sjg@chromium.org>

Convert CONFIG_PHYSMEM to Kconfig

This converts the following to Kconfig:
CONFIG_PHYSMEM

Signed-off-by: Simon Glass <sjg@chromium.org>
Suggested-by: Sean Anderson <seanga2@gmail.com>

# ac7606af 14-Nov-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

lmb: fix typo 'commun'

%s/commun/common/

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

# e7d285b2 25-Sep-2021 Simon Glass <sjg@chromium.org>

image: Use the correct checks for CRC32

Add a host Kconfig for CRC32. With this we can use CONFIG_IS_ENABLED(CRC32)
directly in the host build, so drop the unnecessary indirection.

Add a few more conditions to SPL_CRC32 to avoid build failures as well as
TPL_CRC32. Also update hash.c to make crc32 optional and to actually take
notice of SPL_CRC32.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# 2c21256b 25-Sep-2021 Simon Glass <sjg@chromium.org>

hash: Use Kconfig to enable hashing in host tools and SPL

At present when building host tools, we force CONFIG_SHAxxx to be enabled
regardless of the board Kconfig setting. This is done in the image.h
header file.

For SPL we currently just assume the algorithm is desired if U-Boot proper
enables it.

Clean this up by adding new Kconfig options to enable hashing on the host,
relying on CONFIG_IS_ENABLED() to deal with the different builds.

Add new SPL Kconfigs for hardware-accelerated hashing, to maintain the
current settings.

This allows us to drop the image.h code and the I_WANT_MD5 hack.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# 603d15a5 25-Sep-2021 Simon Glass <sjg@chromium.org>

spl: cypto: Bring back SPL_ versions of SHA

Unfortunately these were removed by mistake. This means that adding hash
support to SPL brings in all software algorithms, with a substantial
increase in code size.

The origin of the problem was renaming them to SPL_FIT_xxx and then these
were removed altogether in a later commit.

Add them back. This aligns with CONFIG_MD5, for example, which has an SPL
variant.

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: f5bc9c25f31 ("image: Rename SPL_SHAxxx_SUPPORT to SPL_FIT_SHAxxx")
Fixes: eb5171ddec9 ("common: Remove unused CONFIG_FIT_SHAxxx selectors")
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# 6674edaa 16-Sep-2021 Tom Rini <trini@konsulko.com>

Merge tag 'v2021.10-rc4' into next

Prepare v2021.10-rc4

Signed-off-by: Tom Rini <trini@konsulko.com>

# gpg: Signature made Tue 14 Sep 2021 06:58:32 PM EDT
# gpg: using RSA key 1A3C7F70E08FAB1707809BBF147C39FF9634B72C
# gpg: Good signature from "Thomas Rini <trini@konsulko.com>" [ultimate]

# Conflicts:
# board/Arcturus/ucp1020/spl.c
# cmd/mvebu/Kconfig
# common/Kconfig.boot
# common/image-fit.c
# configs/UCP1020_defconfig
# configs/sifive_unmatched_defconfig
# drivers/pci/Kconfig
# include/configs/UCP1020.h
# include/configs/sifive-unmatched.h
# lib/Makefile
# scripts/config_whitelist.txt


# 5145bc73 01-Sep-2021 Oleksandr Suvorov <oleksandr.suvorov@foundries.io>

lib: fix typos in Kconfig

There are trivial typos in the Kconfig file. Fixed them.
Also, fixed grammar in the descriptions with typos.

Fixes: d56b4b1974 ("configs: Migrate RBTREE, LZO, CMD_MTDPARTS, CMD_UBI and CMD_UBIFS")
Fixes: 7264f2928b ("spl: fit: Eanble GZIP support for image decompression")
Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# e60e4499 02-Sep-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

lib: Drop SHA512_ALGO in lieu of SHA512

SHA512_ALGO was used as a "either SHA512 or SHA384", although the
implementations of these two algorithms share a majority of code.

From a Kconfig interface perspective, it makes sense to present two
distinct options. This requires #ifdefing out the SHA512
implementation from sha512.c. The latter doesn't make any sense.

It's reasonable to say in Kconfig that SHA384 depends on SHA512, and
seems to be the more polite way to handle the selection.

Thus, automatically select SHA512 when SHA384 is enabled.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# b4c2c151 27-Aug-2021 Michal Simek <michal.simek@xilinx.com>

Kconfig: Remove all default n/no options

default n/no doesn't need to be specified. It is default option anyway.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
[trini: Rework FSP_USE_UPD portion]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 928a8be7 29-Jul-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

lib: ecdsa: Implement UCLASS_ECDSA verification on target

Implement the crypto_algo .verify() function for ecdsa256. Because
it backends on UCLASS_ECDSA, this change is focused on parsing the
keys from devicetree and passing this information to the specific
UCLASS driver.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# fa3f1f1d 24-Jul-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: disable CONFIG_SPL_HEXDUMP by default

CONFIG_HEXDUMP is needed to display UEFI variables using 'printenv -e'.

Enabling CONFIG_SPL_HEXDUMP only makes sense for debugging purposes.
Hence CONFIG_SPL_HEXDUMP should not be enabled by default.

The following boards currently have CONFIG_SPL_HEXDUMP=y. This includes
boards that don't use SPL at all.

axm_defconfig
imx8mm-cl-iot-gate_defconfig
imx8mm_venice_defconfig
imxrt1020-evk_defconfig
imxrt1050-evk_defconfig
kontron_sl28_defconfig
kp_imx53_defconfig
lx2160ardb_tfa_stmm_defconfig
mt7622_rfb_defconfig
octeon_ebb7304_defconfig
octeon_nic23_defconfig
qemu_arm64_defconfig
qemu_arm_defconfig
qemu-riscv32_defconfig
qemu-riscv32_smode_defconfig
qemu-riscv64_defconfig
qemu-riscv64_smode_defconfig
qemu-x86_64_defconfig
qemu-x86_defconfig
sandbox64_defconfig
sandbox_defconfig
stm32mp15_basic_defconfig
stm32mp15_trusted_defconfig
synquacer_developerbox_defconfig
taurus_defconfig
xilinx_versal_virt_defconfig

The patch only keeps it enabled on

sandbox_spl_defconfig

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 1a46cb6c 02-Jul-2021 Simon Glass <sjg@chromium.org>

lib: Create a new Kconfig option for charset conversion

Rather than looking at two KConfig options in the Makefile, create a new
Kconfig option for compiling lib/charset.c

Enable it for UFS also, which needs this support.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 26dd9936 08-Jul-2021 Steffen Jaeckel <jaeckel-floss@eyet-services.de>

lib: add crypt subsystem

Add the basic functionality required to support the standard crypt
format.
The files crypt-sha256.c and crypt-sha512.c originate from libxcrypt and
their formatting is therefor retained.
The integration is done via a crypt_compare() function in crypt.c.

```
libxcrypt $ git describe --long --always --all
tags/v4.4.17-0-g6b110bc
```

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 7d0f3fbb 11-Jun-2021 Tero Kristo <t-kristo@ti.com>

lib: rational: copy the rational fraction lib routines from Linux

Copy the best rational approximation calculation routines from Linux.
Typical usecase for these routines is to calculate the M/N divider
values for PLLs to reach a specific clock rate.

This is based on linux kernel commit:
"lib/math/rational.c: fix possible incorrect result from rational
fractions helper"
(sha1: 323dd2c3ed0641f49e89b4e420f9eef5d3d5a881)

Signed-off-by: Tero Kristo <t-kristo@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Tero Kristo <kristo@kernel.org>

# ec0512b1 24-May-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

Revert "lib: introduce HASH_CALCULATE option"

When we think of Kconfig, we usually think of features that we like
to enable or not. Ideally, we wouldn't use Kconfig to fix a build
issue, although sometimes it might make sense. With Kconfig it's hard
to guarantee that the fix is universal. We can only say that it works
for the set of tested configurations. In the majority of cases, it's
preferable to let the linker figure things out for us.

The reverted commit attempted to fix a build issue by adding an
invisible Kconfig option. This is wrong in several ways:

It invents a new Kconfig variable when CONFIG_HASH already
exists for the same purpose.
Second, hash-checksum.c makes use of the hash_progressive_lookup_algo()
symbol, which is only provided with CONFIG_HASH, but this dependency
was not expressed in the reverted patch.

It feels like Kconfig is turning into a listing of all available
source files, and a buffet to 'select' which ones to compile. The
purpose of this revert is to enable the next change to make use of
CONFIG_HASH instead of adding to Kconfig.

This reverts commit 87316da05f2fd49d3709275e64ef0c5980366ade.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Acked-by: Masahisa Kojima <masahisa.kojima@linaro.org>

# 1621d3c4 10-May-2021 Bin Meng <bmeng.cn@gmail.com>

lib: kconfig: Limit BINMAN_FDT for OF_SEPARATE or OF_EMBED

Generally speaking BINMAN_FDT makes sense for OF_SEPARATE or OF_EMBED.
For the other OF_CONTROL methods, it's quite possible binman node is
not available as binman is invoked during the build phase instead of
runtime. Let's only turn it on for OF_SEPARATE or OF_EMBED by default.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 87316da0 13-May-2021 Masahisa Kojima <masahisa.kojima@linaro.org>

lib: introduce HASH_CALCULATE option

Build error occurs when CONFIG_EFI_SECURE_BOOT or
CONFIG_EFI_CAPSULE_AUTHENTICATE is enabled,
because hash-checksum.c is not compiled.

Since hash_calculate() implemented in hash-checksum.c can be
commonly used aside from FIT image signature verification,
this commit itroduces HASH_CALCULATE option to decide
if hash-checksum.c shall be compiled.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# e2ae483c 13-May-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

hash: Kconfig option for SHA512 hardware acceleration

Commit a479f103dc1c ("hash: Allow for SHA512 hardware implementations")
defined function definitions for hardware accelerated SHA384 and SHA512.
If CONFIG_SHA_HW_ACCEL=y, these functions are used.

We already have boards using CONFIG_SHA_HW_ACCEL=y but none implements the
new functions hw_sha384() and hw_sha512().

For implementing the EFI TCG2 protocol we need SHA384 and SHA512. The
missing hardware acceleration functions lead to build errors on boards like
peach-pi_defconfig.

Introduce a new Kconfig symbol CONFIG_SHA512_HW_ACCEL to control if the
functions hw_sha384() and hw_sha512() shall be used to implement the SHA384
and SHA512 algorithms.

Fixes: a479f103dc1c ("hash: Allow for SHA512 hardware implementations")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

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

# 6d66502b 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: Add 2 config to define the max number of regions

Add 2 configs CONFIG_LMB_MEMORY_REGIONS and CONFIG_LMB_RESERVED_REGIONS
to change independently the max number of the regions in lmb
library.

When CONFIG_LMB_USE_MAX_REGIONS=y, move the lmb property arrays to
struct lmb and manage the array size with the element 'max' of struct
lmb_region; their are still allocated in stack.

When CONFIG_LMB_USE_MAX_REGIONS=n, keep the current location in
struct lmb_region to allow compiler optimization.

Increase CONFIG_LMB_RESERVED_REGIONS is useful to avoid lmb errors in
bootm when the number of reserved regions (not adjacent) is reached:
+ 1 region for relocated U-Boot
+ 1 region for initrd
+ 1 region for relocated linux device tree
+ reserved memory regions present in Linux device tree.

The current limit of 8 regions is reached with only 5 reserved regions
in DT.

see Linux kernel commit bf23c51f1f49 ("memblock: Move memblock arrays
to static storage in memblock.c and make their size a variable")

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# 4fa0150d 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: move MAX_LMB_REGIONS value in Kconfig

Move MAX_LMB_REGIONS value in Kconfig, the max number of the regions
in lmb library.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# 77b8cfef 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: move CONFIG_LMB in Kconfig

Migrate CONFIG_LMB in Kconfig.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# a479f103 16-Feb-2021 Joel Stanley <joel@jms.id.au>

hash: Allow for SHA512 hardware implementations

Similar to support for SHA1 and SHA256, allow the use of hardware hashing
engine by enabling the algorithm and setting CONFIG_SHA_HW_ACCEL /
CONFIG_SHA_PROG_HW_ACCEL.

Signed-off-by: Joel Stanley <joel@jms.id.au>

# f2c1442e 14-Mar-2021 Simon Glass <sjg@chromium.org>

bloblist: Make BLOBLIST_TABLES depend on BLOBLIST

Add an extra condition here since we cannot put x86 tables in a bloblist
when bloblists are not supported.

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

# e0103158 25-Feb-2021 Bin Meng <bmeng.cn@gmail.com>

lib: kconfig: Mention CONFIG_ADDR_MAP limitation in the help

Mention that CONFIG_ADDR_MAP only works in the post-relocation phase.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>

# 56e7257c 03-Feb-2021 Bin Meng <bmeng.cn@gmail.com>

lib: Fix BINMAN_FDT dependency

lib/binman.c references the following 3 ofnode APIs:
ofnode_first_subnode(), ofnode_path() and ofnode_read_bool().

These APIs get built only when DM is on. Fix the dependency then.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 59e4e391 18-Jan-2021 Tom Rini <trini@konsulko.com>

Merge https://gitlab.denx.de/u-boot/custodians/u-boot-riscv

- Update qemu-riscv.rst build instructions.
- Add support for SPI on Kendryte K210.
- Add Microchip PolarFire SoC Icicle Kit support.
- Add support for an early timer.
- Select TIMER_EARLY to avoid infinite recursion for Trace.


# a80f8513 17-Jan-2021 Pragnesh Patel <pragnesh.patel@sifive.com>

trace: select TIMER_EARLY to avoid infinite recursion

When tracing functions is enabled this adds calls to
__cyg_profile_func_enter() and __cyg_profile_func_exit() to the traced
functions.

__cyg_profile_func_enter() and __cyg_profile_func_exit() invoke
timer_get_us() to record the entry and exit time.

initr_dm() will make gd->dm_root = NULL and gd->timer = NULL, so
timer_get_us() -> get_ticks() -> dm_timer_init() will lead to an
indefinite recursion.

So select TIMER_EARLY when tracing got enabled.

Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Rick Chen <rick@andestech.com>

# 6205bbb1 04-Jan-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lib: cosmetic update of CONFIG_LIB_ELF description

Change 2 typo error in CONFIG_LIB_ELF description:
- Supoort => Support
- fir => for

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c589132a 02-Dec-2020 Aswath Govindraju <a-govindraju@ti.com>

fdt: Use phandle to distinguish DT nodes with same name

While assigning the sequence number to subsystem instances by reading the
aliases property, only DT nodes names are compared and not the complete
path. This causes a problem when there are two DT nodes with same name but
have different paths.

In arch/arm/dts/k3-am65-main.dtsi there are two USB controllers with the
same device tree node name but different path. When aliases are defined for
these USB controllers then fdtdec_get_alias_seq() fails to pick the correct
instance for a given index.

fdt_path_offset() function is slow and this would effect the U-Boot
startup. To avert the time penalty on all boards, apply this extra check
only when required by using a config option.

Fix it by comparing the phandles of DT nodes after the node names match,
under a config option.

Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Fix whitespace error in Kconfig:
Signed-off-by: Simon Glass <sjg@chromium.org>

# 28cef9ca 19-Nov-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

fs: fat: create correct short names

The current function set_name() used to create short names has the
following deficiencies resolved by this patch:

* Long names (e.g. FOO.TXT) are stored even if a short name is enough.
* Short names with spaces are created, e.g. "A ~1.TXT".
* Short names with illegal characters are created, e.g. "FOO++BAR".
* Debug output does not not consider that the short file name has no
concluding '\0'.

The solution for the following bug is split of into a separate patch:

* Short file names must be unique.

This patch only provides the loop over possible short file names.

Fixes: c30a15e590c ("FAT: Add FAT write feature")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# e4f8e543 05-Nov-2020 Simon Glass <sjg@chromium.org>

smbios: Drop the unused Kconfig options

Now that we can use devicetree to specify this information, drop the old
CONFIG options.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 44c74bdd 05-Nov-2020 Simon Glass <sjg@chromium.org>

sysinfo: Provide a default driver to set SMBIOS values

Some boards want to specify the manufacturer or product name but do not
need to have their own sysinfo driver.

Add a default driver which provides a way to specify this SMBIOS
information in the devicetree, without needing any board-specific
functionality.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d2cb7a22 04-Nov-2020 Simon Glass <sjg@chromium.org>

x86: Allow putting some tables in the bloblist

At present all tables are placed starting at address f0000 in memory, and
can be up to 64KB in size. If the tables are very large, this may not
provide enough space.

Also if the tables point to other tables (such as console log or a ramoops
area) then we must allocate other memory anyway.

The bloblist is a nice place to put these tables since it is contiguous,
which makes it easy to reserve this memory for linux using the 820 tables.

Add an option to put some of the tables in the bloblist. For SMBIOS and
ACPI, create suitable pointers from the f0000 region to the new location
of the tables.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
[bmeng: squashed in http://patchwork.ozlabs.org/project/uboot/patch/
20201105062407.1.I8091ad931cbbb5e3b6f6ababdf3f8d5db0d17bb9@changeid/]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# 415eab06 03-Nov-2020 Christian Gmeiner <christian.gmeiner@gmail.com>

smbios: add parsing API

Add a very simple API to be able to access SMBIOS strings
like vendor, model and bios version.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 72eda507 27-Oct-2020 Sean Anderson <seanga2@gmail.com>

lib: Add getopt

Some commands can get very unweildy if they have too many positional
arguments. Adding options makes them easier to read, remember, and
understand.

This implementation of getopt has been taken from barebox, which has had
option support for quite a while. I have made a few modifications to their
version, such as the removal of opterr in favor of a separate getopt_silent
function. In addition, I have moved all global variables into struct
getopt_context.

The getopt from barebox also re-orders the arguments passed to it so that
non-options are placed last. This allows users to specify options anywhere.
For example, `ls -l foo/ -R` would be re-ordered to `ls -l -R foo/` as
getopt parsed the options. However, this feature conflicts with the const
argv in cmd_tbl->cmd. This was originally added in 54841ab50c ("Make sure
that argv[] argument pointers are not modified."). The reason stated in
that commit is that hush requires argv to stay unmodified. Has this
situation changed? Barebox also uses hush, and does not have this problem.
Perhaps we could use their fix?

I have assigned maintenance of getopt to Simon Glass, as it is currently
only used by the log command. I would also be fine maintaining it.

Signed-off-by: Sean Anderson <seanga2@gmail.com>

# 26637e2e 12-Sep-2020 Simon Glass <sjg@chromium.org>

lib: Allow hexdump to be used in SPL

It is sometimes useful to output hex dumps in SPL. Add a config option to
allow this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# e87dfb05 05-Aug-2020 Andrii Anisov <andrii_anisov@epam.com>

lib: sscanf: add sscanf implementation

Port sscanf implementation from mini-os and introduce new
Kconfig option to enable it: CONFIG_SSCANF. Disable by default.

Signed-off-by: Andrii Anisov <andrii_anisov@epam.com>
Signed-off-by: Anastasiia Lukianenko <anastasiia_lukianenko@epam.com>
Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>

# 81014f73 30-Jul-2020 Joao Marcos Costa <joaomarcos.costa@bootlin.com>

include/u-boot, lib/zlib: add sources for zlib decompression

Add zlib (v1.2.11) uncompr() function to U-Boot. SquashFS depends on
this function to decompress data from a raw disk image. The actual
support for zlib into SquashFS sources will be added in a follow-up
commit.

Signed-off-by: Joao Marcos Costa <joaomarcos.costa@bootlin.com>

# 69be8fd1 03-Jun-2020 Marek Szyprowski <m.szyprowski@samsung.com>

powerpc: move ADDR_MAP to Kconfig

Move ADDR_MAP related config options from include/configs/*.h to the
proper place in lib/Kconfig. This has been done using
./tools/moveconfig.py and manual inspection of the generated changes.
This is a preparation to use ADDR_MAP helper on ARM 32bit Raspberry Pi4
board for mapping the PCIe XHCI MMIO, which is above the 4GiB identity
mapping limit.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# d16b38f4 15-Apr-2020 Reuben Dowle <reubendowle0@gmail.com>

Add support for SHA384 and SHA512

The current recommendation for best security practice from the US government
is to use SHA384 for TOP SECRET [1].

This patch adds support for SHA384 and SHA512 in the hash command, and also
allows FIT images to be hashed with these algorithms, and signed with
sha384,rsaXXXX and sha512,rsaXXXX

The SHA implementation is adapted from the linux kernel implementation.

[1] Commercial National Security Algorithm Suite
http://www.iad.gov/iad/programs/iad-initiatives/cnsa-suite.cfm

Signed-off-by: Reuben Dowle <reuben.dowle@4rf.com>

# 43e442a5 26-May-2020 Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

kconfig: fix some typos

Signed-off-by: Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

# eff5a547 22-May-2020 Michael Walle <michael@walle.cc>

cmd: zip: automatically pull in gzip()

Move the CONFIG_GZIP_COMPRESSED from a config.h macro to a Kconfig menu
item. It is not selectable by a user because there is no reason to do
so. Instead it will be automatically selected by the stuff which uses
gzip(), like the zip command.

Remove it from the config_whitelist.txt. Also remove
CONFIG_GZIP_COMPRESS_DEF_SZ as this was never used on any board. The
default seems to be sane, otherwise it should be added as a Kconfig
option.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8239be61 06-May-2020 Simon Glass <sjg@chromium.org>

lib: Allow MD5 to be enabled in SPL

At present the MD5 option cannot be enabled by board configs since it has
no Kconfig name. It is generally enabled, so long as FIT support is
present. But not all boards use FIT, particularly in SPL

Fix this and add an option for SPL as well. This allows board code to call
md5() even if FIT support is not enabled.

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

# 04cb3994 21-Apr-2020 Weijie Gao <weijie.gao@mediatek.com>

lib: enable lzma decompression support for SPL build

This patch enables LZMA decompression support for SPL build

Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>

# 2a2119e1 05-Mar-2020 Atish Patra <atishp@atishpatra.org>

lib: kconfig: Add option to set BZIP2 compression method

There is no way to select BZIP2 compression method.
Add it under library/compression config where all other
compression related configs are present.

Signed-off-by: Atish Patra <atish.patra@wdc.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 805b3cac 12-Feb-2020 Keerthy <j-keerthy@ti.com>

lib: elf: Move the generic elf loading/validating functions to lib

Move the generic elf loading/validating functions to lib/
so that they can be re-used and accessed by code existing
outside cmd.

While at it remove the duplicate static version of load_elf_image_phdr
under arch/arm/mach-imx/imx_bootaux.c.

Signed-off-by: Keerthy <j-keerthy@ti.com>
Suggested-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>

# 1611235b 19-Jan-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: Kconfig dependencies for pseudo-random library

drivers/rng/sandbox_rng.c requires rand() to be defined but configuration
option CONFIG_CONFIG_LIB_RAND selected in drivers/rng/Kconfig does not
exist.

test/lib/test_aes.c requires rand() to be defined.

Fix the selection criteria for choice "Pseudo-random library support type".

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 3c10dc95 06-Dec-2019 Simon Glass <sjg@chromium.org>

binman: Add a library to access binman entries

SPL and TPL can access information about binman entries using link-time
symbols but this is not available in U-Boot proper. Of course it could be
made available, but the intention is to just read the device tree.

Add support for this, so that U-Boot can locate entries.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# b4adf627 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: crypto: add x509 parser

Imported from linux kernel v5.3:
x509.asn1 without changes
x509_akid.asn1 without changes
x509_parser.h without changes
x509_cert_parser.c with changes marked as __UBOOT__
x509_public_key.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# a9b45e6e 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add oid registry utility

Imported from linux kernel v5.3:
build_OID_registry without changes
oid_registry.h without changes
oid_registry.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# ab8a0e06 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add asn1 decoder

Imported from linux kernel v5.3:
lib/asn1_decoder.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 2b12196d 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

cmd: add asn1_compiler

Imported from linux kernel v5.3:
asn1.h without changes
asn1_ber_bytecode.h without changes
asn1_decoder.h without changes
asn1_compiler.c without changes

This host command will be used to create a ASN1 parser, for example,
for pkcs7 messages or x509 certificates. More specifically, it will
generate *byte code* which will be interpreted by asn1 decoder library.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 05429b6c 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

rtc: move date.c from drivers/rtc/ to lib/

In the next commit, rtc_mktime(), for compatibility with linux, will be
implemented using rtc_mktime(), which is no longer drivers/rtc specific.
So move this file under lib/.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 37ef1774 10-Nov-2019 Thomas Hebb <tommyhebb@gmail.com>

Kconfig: disambiguate config names for tiny printf

27084c03d36a ("spl: Allow tiny printf() to be controlled in SPL and
TPL") split this option in two for TPL and SPL, but didn't change the
Kconfig names, making them hard to set quickly.

Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>

# 0d76afc0 27-Oct-2019 Simon Glass <sjg@chromium.org>

fdt: Add Kconfig options to control code size

For better or worse libfdt recent grew a lot of code that checks the
validity of the device tree in great detail. When using unsigned or
unverified data this makes things safer, but it does add to code size.

Add some controls to select the trade-off between safety and code size.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 27084c03 25-Sep-2019 Simon Glass <sjg@chromium.org>

spl: Allow tiny printf() to be controlled in SPL and TPL

At present there is only one control for this and it is used for both SPL
and TPL. But SPL might have a lot more space than TPL so the extra cost of
a full printf() might be acceptable.

Split the option into two, providing separate SPL and TPL controls. The
TPL setting defaults to the same as SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2a51e16b 07-Jun-2019 Tom Rini <trini@konsulko.com>

configs: Make USE_TINY_PRINTF depend on SPL||TPL and be default

The USE_TINY_PRINTF symbol only changes things within SPL and TPL
builds, so make it depend on that support. Next, make it default as
within these cases we should rarely have need of more advanced print
formats outside of the debug context.

To do this, in a few cases we need to correct our Kconfig dependencies
as we had cases of non-SPL targets select'ing this symbol. Finally, in
the case of a few boards we really do need the full printf
functionality.

Signed-off-by: Tom Rini <trini@konsulko.com>

# da0fb5fd 02-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: make call depth limit customizable

Up to now we had hard coded values for the call depth up to which trace
records are created: 200 for early tracing, 15 thereafter. UEFI
applications reach a call depth of 80 or above.

Provide customizing settings for the call trace depth limit and the early
call trace depth limit. Use the old values as defaults.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8509f22a 29-Apr-2019 Marek Behún <marek.behun@nic.cz>

lib: add Zstandard decompression support

Add the zstd library from Linux kernel (only decompression support).
There are minimal changes to build with U-Boot, otherwise the files are
identical to Linux commit dc35da16 from March 2018, the files had not
been touched since in kernel. Also SPDX lincese tags were added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 83a486b6 29-Apr-2019 Marek Behún <marek.behun@nic.cz>

lib: Add xxhash support

This adds the xxhash support from Linux. Files are almost identical to
those added to Linux in commit 5d240522 ("lib: Add xxhash module") (they
haven't been touched since in Linux). The only difference is to add some
includes to be compatible with U-Boot. Also SPDX lincese tags were
added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 5132361a 29-Apr-2019 Heiko Schocher <hs@denx.de>

lib: Kconfig: fix help text for GZIP

commit 95f4bbd581cf ("lib: fdt: Allow LZO and GZIP DT compression in U-Boot")

introduced Kconfig option for gzip in U-Boot, but help text
says gzip for SPL, which is wrong. Fix this.

Signed-off-by: Heiko Schocher <hs@denx.de>
Acked-by: Marek Vasut <marex@denx.de>

# 1c6eb075 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE_BUFFER_SIZE et al to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE_BUFFER_SIZE
CONFIG_TRACE_EARLY_SIZE
CONFIG_TRACE_EARLY
CONFIG_TRACE_EARLY_ADDR

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

# a24a78d7 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE

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

# 54969b40 21-Mar-2019 Thierry Reding <treding@nvidia.com>

fdtdec: Add Kconfig symbol for tests

Runtime tests are provided as a test_fdtdec command implementation. Add
a Kconfig symbol that allows this command to be built so that the tests
can be used.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 95f4bbd5 08-Mar-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

lib: fdt: Allow LZO and GZIP DT compression in U-Boot

Add required Kconfig symbols, Makefile bits and macro fixes in a
few places to support LZO and DT compression in U-Boot. This can
save a lot of space with multi-DTB fitImages.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>

# 6e705114 13-Jan-2019 Chris Packham <judge.packham@gmail.com>

lib: Kconfig: spelling fixes

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 048c6e89 06-Nov-2018 Simon Glass <sjg@chromium.org>

spl: lz4: Allow use of lz4 compression in SPL

In some cases U-Boot is compressed and it is useful to be able to
decompress it in SPL. Add a Kconfig and Makefile change to allow this.
Note that this does not actually implement decompression.

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

# 2895c4b7 15-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

kconfig: Introduce HAVE_ARCH_IOMAP

Introduce a new Kconfig option for architecture codes to control
whether it provides io{read,write}{8,16,32} I/O accessor functions.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5592a633 01-Oct-2018 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt in TPL

In some cases (e.g. sandbox with verified boot) it is useful to support
libfdt in TPL. Update the Kconfig to handle this.

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

# 6307896c 01-Oct-2018 Simon Glass <sjg@chromium.org>

tpm: Add support for SPL and TPL

At present the tpm can only be used in U-Boot proper. Updated it to work
in SPL and TPL also.

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

# ab948cd2 19-Jul-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

fdt_support: make FDT_FIXUP_PARTITIONS depend on CMD_MTDPARTS

fdt_fixup_mtdparts() calls mtdparts_init() and device_find(),
which are defined in cmd/mtdparts.c

The combination of FDT_FIXUP_PARTITIONS=y and CMD_MTDPARTS=n
emits the following link error:

common/fdt_support.c:903: undefined reference to `mtdparts_init'
common/fdt_support.c:914: undefined reference to `device_find'

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 3330584d 03-Jun-2018 Igor Opaniuk <igor.opaniuk@gmail.com>

avb2.0: integrate avb 2.0 into the build system

Integrate libavb into the build system. Introduce CONFIG_LIBAVB
build option.

Signed-off-by: Igor Opaniuk <igor.opaniuk@linaro.org>

# f8c987f8 05-Jun-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

lib: Add hexdump

Often during debugging session it's very interesting to see
what data we were dealing with. For example what we write or read
to/from memory or peripherals.

This change introduces functions that allow to dump binary
data with one simple function invocation like:
------------------->8----------------
print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, buf, len);
------------------->8----------------

which gives us the following:
------------------->8----------------
00000000: f2 b7 c9 88 62 61 75 64 72 61 74 65 3d 31 31 35 ....baudrate=115
00000010: 32 30 30 00 62 6f 6f 74 61 72 67 73 3d 63 6f 6e 200.bootargs=con
00000020: 73 6f 6c 65 3d 74 74 79 53 33 2c 31 31 35 32 30 sole=ttyS3,11520
00000030: 30 6e 38 00 62 6f 6f 74 64 65 6c 61 79 3d 33 00 0n8.bootdelay=3.
00000040: 62 6f 6f 74 66 69 6c 65 3d 75 49 6d 61 67 65 00 bootfile=uImage.
00000050: 66 64 74 63 6f 6e 74 72 6f 6c 61 64 64 72 3d 39 fdtcontroladdr=9
00000060: 66 66 62 31 62 61 30 00 6c 6f 61 64 61 64 64 72 ffb1ba0.loadaddr
00000070: 3d 30 78 38 32 30 30 30 30 30 30 00 73 74 64 65 =0x82000000.stde
00000080: 72 72 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 rr=serial0@e0022
00000090: 30 30 30 00 73 74 64 69 6e 3d 73 65 72 69 61 6c 000.stdin=serial
000000a0: 30 40 65 30 30 32 32 30 30 30 00 73 74 64 6f 75 0@e0022000.stdou
000000b0: 74 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 30 t=serial0@e00220
000000c0: 30 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00..............
...
------------------->8----------------

Source of hexdump.c was copied from Linux kernel v4.7-rc2.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Mario Six <mario.six@gdsys.cc>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Stefan Roese <sr@denx.de>

# c232d14d 29-May-2018 Alex Kiernan <alex.kiernan@gmail.com>

mmc: Separate "mmc swrite" from fastboot

Introduce CONFIG_IMAGE_SPARSE and CONFIG_CMD_MMC_SWRITE so the "mmc
swrite" command is separated from the fastboot code.

Move image-sparse from common to lib so it's clear it's library code.

Rename CONFIG_FASTBOOT_FLASH_FILLBUF_SIZE to CONFIG_IMAGE_SPARSE_FILLBUF_SIZE
and migrate it to Kconfig.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Acked-by: Jassi Brar <jaswinder.singh@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6417572e 08-May-2018 Tom Rini <trini@konsulko.com>

lib/Kconfig: Mark OF_LIBFDT_OVERLAY as depending on OF_LIBFDT

The overlay code is only useful when OF_LIBFDT is set, so mark it as
depending on that first.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 58a46f88 25-Apr-2018 Praneeth Bajjuri <praneeth@ti.com>

configs: TI: Enable FIT Library overlay support

Enable the FDT library overlay support for all TI SOC family.

Without this option, when Loading fdt from FIT image, the
following warning is seen.

"config with overlays but CONFIG_OF_LIBFDT_OVERLAY not set".

Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
Suggested-by: Andrew F.Davis <afd@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>

# 14ad44ab 18-Apr-2018 Alex Kiernan <alex.kiernan@gmail.com>

spl: Split sprintf, strto* from SPL serial in Kconfig

When SPL serial is disabled, callers who need sprintf or strtoul fail
because their inclusion is guarded by CONFIG_SPL_SERIAL_SUPPORT/
CONFIG_TPL_SERIAL_SUPPORT.

Split printf, sprintf and strto into their own entries and then select
all of them if SERIAL_SUPPORT is enabled to match the current behaviour.

Include panic.o unconditionally as it can be called from anywhere which
uses BUG_ON().

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>

# e294ba06 04-Apr-2018 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-sunxi

Signed-off-by: Tom Rini <trini@konsulko.com>


# d14db11d 03-Apr-2018 Andre Przywara <andre.przywara@arm.com>

sunxi: revert disabling of features

In January some commits were introduced to mitigate the U-Boot image
size issues we encountered on sunxi builds.
Now with the MMC environment removed we can bring them back, as we
practically don't have a size limit anymore.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 32ce6179 13-Mar-2018 Bryan O'Donoghue <bryan.odonoghue@linaro.org>

optee: Add lib entries for sharing OPTEE code across ports

This patch adds code to lib to enable sharing of useful OPTEE code between
board-ports and architectures. The code on lib/optee/optee.c comes from the
TI omap2 port. Eventually the OMAP2 code will be patched to include the
shared code. The intention here is to add more useful OPTEE specific code
as more functionality gets added.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Cc: Harinarayan Bhatta <harinarayan@ti.com>
Cc: Andrew F. Davis <afd@ti.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Kever Yang <kever.yang@rock-chips.com>
Cc: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Cc: Peng Fan <peng.fan@nxp.com>
Tested-by: Peng Fan <peng.fan@nxp.com>

# 36c1877c 06-Feb-2018 Faiz Abbas <faiz_abbas@ti.com>

lib: Kconfig: Move DYNAMIC_CRC_TABLE to Kconfig

Add CONFIG prefix to DYNAMIC_CRC_TABLE and implement it in
Kconfig.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>

# a451bc27 05-Feb-2018 Adam Ford <aford173@gmail.com>

Convert LIB_UUID to Kconfig

config_fallback.h has some logic that checks a variety of options
and selects LIB_UUID if it hasn't already been selected. This
will all LIB_UUID in Kconfig and select this option for the list
of options to allow us to remove the logic from fallbacks

Signed-off-by: Adam Ford <aford173@gmail.com>

# a5a37567 06-Feb-2018 Adam Ford <aford173@gmail.com>

Convert CONFIG LIB_HW_RAND to Kconfig

config_fallbacks.h had some logic to automatically select
LIB_RAND if RANDOM_UUID or CMD_UUID were set if LIB_HW_RAND wasn't
already selected. By migrating LIB_HW_RAND to Kconfig, we can
remove this check from config_fallbacks.h and put it into Kconfig

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
[trini: Turn into a choice, add NET_RANDOM_ETHADDR]
Signed-off-by: Tom Rini <trini@konsulko.com>

# acd4d334 16-Jan-2018 Maxime Ripard <maxime.ripard@free-electrons.com>

net: regex: Disable by default on sunXi

The sunXi arm64 build has overflown, leading to the main U-boot binary
overwriting the environment when flashing the new image, or even worse,
overwriting itself when we're calling saveenv.

Disable this option that is not critical until we can adress the issue
properly.

Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 7e3caa81 03-Dec-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

Move CONFIG_PANIC_HANG to Kconfig

Freescale (NXP) boards have lots of defconfig files per board.
I used "imply PANIC_HANG" for them.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# da5337a6 08-Nov-2017 Nandor Han <nandor.han@ge.com>

rtc: add support for s35392a

Add support for S35392A RTC. The driver supports both U-Boot driver
models.

Signed-off-by: Nandor Han <nandor.han@ge.com>
Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
Cc: Heiko Schocher <hs@denx.de>

# f52bdf4b 14-Sep-2017 Jean-Jacques Hiblot <jjhiblot@ti.com>

lib: allow building lzo for the SPL

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 85d8bf57 03-Sep-2017 Marek Behún <marek.behun@nic.cz>

lib: Add CRC32-C

This is needed for BTRFS.

Signed-off-by: Marek Behun <marek.behun@nic.cz>

create mode 100644 lib/crc32c.c

# 7264f292 15-Aug-2017 York Sun <york.sun@nxp.com>

spl: fit: Eanble GZIP support for image decompression

Add Kconfig option SPL_GZIP and SPL_ZLIB to enable gunzip support for
SPL boot, eg. falcon boot compressed kernel image.

Signed-off-by: York Sun <york.sun@nxp.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6ef2f901 11-Aug-2017 Adam Ford <aford173@gmail.com>

Convert CONFIG_BCH to Kconfig

This converts the following to Kconfig:
CONFIG_BCH

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1a7ba1d 18-Aug-2017 Anatolij Gustschin <agust@denx.de>

Fix 'notes' typos

s/notes/nodes

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 96b9082c 03-Aug-2017 Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

rockchip: rk3188: rock: adjust for SPL/TPL split

With the changes to split SPL/TPL for the RK3368, I apparently missed
some needed adjustments to the RK3188 Kconfig and rock_defconfig.

This fixes build-issues for the rock board after applying the RK3368
enablement (and SPL/TPL) set that resulted from TPL_SERIAL_SUPPORT,
TPL_ROCKCHIP_BACK_TO_BROM and TPL_TINY_MEMSET being separate symbols
now.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d56b4b19 22-Jul-2017 Tom Rini <trini@konsulko.com>

configs: Migrate RBTREE, LZO, CMD_MTDPARTS, CMD_UBI and CMD_UBIFS

The above CONFIG options are in Kconfig, and now have correct depends and
inter-dependencies. Migrate these to configs/ from include/configs/. In the
case of CMD_UBIFS also change it to be a default y if CMD_UBI.

Signed-off-by: Tom Rini <trini@konsulko.com>

# aed998aa 17-May-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_LZMA to Kconfig

This converts the following to Kconfig:
CONFIG_LZMA

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

# b1a873df 26-Apr-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_CMD_AES et al to Kconfig

This converts the following to Kconfig:
CONFIG_CMD_AES
CONFIG_AES

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Add select AES to CMD_AES]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 173aafbf 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

cmd: Expose a Kconfig option to enable UBIFS commands

Create a new Kconfig entry to allow CMD_UBIFS selection from Kconfig and
add an hidden LZO option that can be selected by CMD_UBIFS.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>

# aa049152 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

mtd: ubi: Select RBTREE option from MTD_UBI Kconfig entry

Expose the RBTREE feature through Kconfig and select this option from the
MTD_UBI option.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>
[Rebased on master]
Signed-off-by: Jagan Teki <jagan@openedev.com>

# ab4458bd 02-Apr-2017 Simon Glass <sjg@chromium.org>

string: Provide a slimmed-down memset()

Most of the time the optimised memset() is what we want. For extreme
situations such as TPL it may be too large. For example on the 'rock'
board, using a simple loop saves a useful 48 bytes. With gcc 4.9 and
the rodata bug, this patch is enough to reduce the TPL image below the
limit.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>

# bea79d7d 14-Mar-2017 Andre Przywara <andre.przywara@arm.com>

Kconfig: introduce md5sum command selection

So far CONFIG_MD5SUM would need to be set by a board's include file.
Since the command is really generic, move it over to Kconfig to allow
it to be defined by either a board's defconfig, menuconfig or some
config snippet merged via mergeconfig.sh.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e663b350 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

smbios: Expose in efi_loader as table

We can pass SMBIOS easily as EFI configuration table to an EFI payload. This
patch adds enablement for that case.

While at it, we also enable SMBIOS generation for ARM systems, since they support
EFI_LOADER.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4b6dddc2 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

x86: Move smbios generation into arch independent directory

We will need the SMBIOS generation function on ARM as well going forward,
so let's move it into a non arch specific location.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# ebf7fff2 05-Oct-2016 Heiko Schocher <hs@denx.de>

spl: move FDT_FIXUP_PARTITIONS to Kconfig

Move FDT_FIXUP_PARTITIONS to Kconfig and cleanup existing
uses.

Signed-off-by: Heiko Schocher <hs@denx.de>

# ddf67f71 05-Jul-2016 Maxime Ripard <maxime.ripard@free-electrons.com>

libfdt: Add overlay application function

The device tree overlays are a good way to deal with user-modifyable
boards or boards with some kind of an expansion mechanism where we can
easily plug new board in (like the BBB, the Raspberry Pi or the CHIP).

Add a new function to merge overlays with a base device tree.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>

# 91b86e21 26-May-2016 Marek Vasut <marex@denx.de>

lib: Enable private libgcc by default

This patch decouples U-Boot binary from the toolchain on systems where
private libgcc is available. Instead of pulling in functions provided
by the libgcc from the toolchain, U-Boot will use it's own set of libgcc
functions. These functions are usually imported from Linux kernel, which
also uses it's own libgcc functions instead of the ones provided by the
toolchain.

This patch solves a rather common problem. The toolchain can usually
generate code for many variants of target architecture and often even
different endianness. The libgcc on the other hand is usually compiled
for one particular configuration and the functions provided by it may
or may not be suited for use in U-Boot. This can manifest in two ways,
either the U-Boot fails to compile altogether and linker will complain
or, in the much worse case, the resulting U-Boot will build, but will
misbehave in very subtle and hard to debug ways.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 67976306 30-Mar-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

cosmetic: Fix typos "privide"

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# ed980b8c 03-Mar-2016 Alexander Graf <agraf@csgraf.de>

efi_loader: hook up in build environment

Now that we have all the bits and pieces ready for EFI payload loading
support, hook them up in Makefiles and KConfigs so that we can build.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
[trini: Enable only when we of OF_LIBFDT, disable on kwb and colibri_pxa270]
Signed-off-by: Tom Rini <trini@konsulko.com>

# aa34fbc0 22-Feb-2016 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt to be used in SPL

Add an option to enable libfdt in SPL. This can be useful when decoding
FIT files in SPL.

We need to make sure this option is not enabled in SPL by this change.
Also this option needs to be enabled in host builds. Si add a new
IMAGE_USE_LIBFDT #define which can be used in files that are built on the
host but must also build for U-Boot and SPL.

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

# 69e173eb 22-Feb-2016 Simon Glass <sjg@chromium.org>

Move CONFIG_OF_LIBFDT to Kconfig

Move this option to Kconfig and tidy up existing boards.

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

# a187559e 05-Feb-2016 Bin Meng <bmeng.cn@gmail.com>

Use correct spelling of "U-Boot"

Correct spelling of "U-Boot" shall be used in all written text
(documentation, comments in source files etc.).

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Minkyu Kang <mk7.kang@samsung.com>

# 947c626d 14-Jan-2016 Tom Rini <trini@konsulko.com>

vsprintf.c: Always enable CONFIG_SYS_VSNPRINTF

Enabling this function always removes some class of string saftey issues.
The size change here in general is about 400 bytes and this seems a reasonable
trade-off.

Cc: Peng Fan <peng.fan@nxp.com>
Cc: Peter Robinson <pbrobinson@gmail.com>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Adrian Alonso <aalonso@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 7d9cde10 22-Nov-2015 Stefan Roese <sr@denx.de>

lib/tiny-printf.c: Add tiny printf function for space limited environments

This patch adds a small printf() version that supports all basic formats.
Its intented to be used in U-Boot SPL versions on platforms with very
limited internal RAM sizes.

To enable it, just define CONFIG_USE_TINY_PRINTF in your defconfig. This
will result in the SPL using this tiny function and the main U-Boot
still using the full-blown printf() function.

This code was copied from:
http://www.sparetimelabs.com/printfrevisited
With mostly only coding style related changes so that its checkpatch
clean.

The size reduction is about 2.5KiB. Here a comparison for the db-mv784mp-gp
(Marvell AXP) SPL:

Without this patch:
58963 18536 1928 79427 13643 ./spl/u-boot-spl

With this patch:
56542 18536 1956 77034 12cea ./spl/u-boot-spl

Note:
To make it possible to compile tiny-printf.c instead of vsprintf.c when
CONFIG_USE_TINY_PRINTF is defined, the functions printf() and vprintf() are
moved from common/console.c into vsprintf.c in this patch.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>

# 2419cd16 03-Oct-2015 Simon Glass <sjg@chromium.org>

dm: tpm: Drop CONFIG_DM_TPM

Now that all TPM drivers use driver model, we can drop the special driver
model CONFIG option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>

# 027b728d 06-Oct-2015 Julius Werner <jwerner@chromium.org>

Add support for LZ4 decompression algorithm

This patch adds support for LZ4-compressed FIT image contents. This
algorithm has a slightly worse compression ration than LZO while being
nearly twice as fast to decompress. When loading images from a fast
storage medium this usually results in a boot time win.

Sandbox-tested only since I don't have a U-Boot development system set
up right now. The code was imported unchanged from coreboot where it's
proven to work, though. I'm mostly interested in getting this recognized
by mkImage for use in a downstream project.

Signed-off-by: Julius Werner <jwerner@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# a7d660bc 22-Aug-2015 Simon Glass <sjg@chromium.org>

tpm: Add Kconfig options for TPMs

Add new Kconfig options for TPMs in preparation for moving boards to use
Kconfig for TPM configuration.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 867a6ac8 31-Jul-2015 Simon Glass <sjg@chromium.org>

efi: Add start-up library code

When running as an EFI application, U-Boot must request memory from EFI,
and provide access to the boot services U-Boot needs.

Add library code to perform these tasks. This includes efi_main() which is
the entry point from EFI. U-Boot is built as a shared library.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d1389403 23-Jun-2015 Simon Glass <sjg@chromium.org>

Add a dhrystone benchmark command

Drystone provides a convenient sanity check that the CPU is running at full
speed. Add this as a command which can be enabled as needed.

Note: I investigated using Coremark for this but there was a license
agreement and I could not work out if it was GPL-compatible.

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

# f7848d90 22-Jun-2015 Joe Hershberger <joe.hershberger@ni.com>

Allow CONFIG_REGEX to be disabled when CONFIG_NET

Instead of selecting REGEX when NET is enabled, make it the default, but
allow boards that are tiny to disable it and lose functionality on all
but the first Ethernet adapter.

cm-bf548, bf538f-ezkit, and bf533-stamp need this. None appear to have
more than one Ethernet interface.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# 3850dbe8 11-Jun-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

blackfin: fix undefined reference to srand and rand

Commit 9ba9e85f3f1c (net: Fix NET_RANDOM_ETHADDR dependencies)
accidentally dropped CONFIG_LIB_RAND defines for 14 Blackfin boards.

Prior to that commit, those boards defined CONFIG_LIB_RAND, but not
CONFIG_NET_RANDOM_ETHADDR. So, commit 9ba9e85f3f1c should not have
touched them, but in fact it ripped CONFIG_LIB_RAND off from all the
header files, which caused undefined reference to srand and rand.
CONFIG_LIB_RAND=y must be revived for such boards.

BTW, this commit indeed makes it better, but even with this fix,
three boards (bf533-stamp, bf538f-ezkit, cm-bf548) still can not
build due to region 'ram' overflowed error. This was cause by
commit 6eed3786c68c (net: Move the CMD_NET config to defconfigs)
because CMD_NET selects NET, and NET selects REGEX. Eventually,
some boards were newly enabled with CONFIG_REGEX, increasing the
memory footprint. A patch is expected to fix the build error.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 9ba9e85f 25-May-2015 Michal Simek <michal.simek@xilinx.com>

net: Fix NET_RANDOM_ETHADDR dependencies

NET_RANDOM_ETHADDR depends on lib/rand.c. This patch adds dependency to
Kconfig to ensure that library is also compiled.

Remove the definitions from Blackfin boards' include/configs.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 6501ff62 20-Apr-2015 Przemyslaw Marczak <p.marczak@samsung.com>

lib: Kconfig: add entry for errno_str() function

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1a60650c 21-Apr-2015 Joe Hershberger <joe.hershberger@ni.com>

kconfig: Move REGEX to Kconfig

Having this as a Kconfig allows it to be a dependent feature.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8156345d 06-Mar-2015 Simon Glass <sjg@chromium.org>

sandbox: Move CONFIG_SYS_VSNPRINTF to Kconfig

Move this over to Kconfig and tidy up.

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

# 94e3c8c4 19-Feb-2015 gaurav rana <gaurav.rana@freescale.com>

crypto/fsl - Add progressive hashing support using hardware acceleration.

Currently only normal hashing is supported using hardware acceleration.
Added support for progressive hashing using hardware.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
Signed-off-by: Gaurav Rana <gaurav.rana@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>

# d9f23c7f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

lib/rsa: Add Kconfig for devices supporting RSA Modular Exponentiation

Kconfig option added for devices which support RSA Verification.
1. RSA_SOFTWARE_EXP
Enables driver for supporting RSA Modular Exponentiation in Software
2. RSA_FREESCALE_EXP
Enables driver for supporting RSA Modular Exponentiation using Freescale specific
driver

The above drivers use RSA uclass

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
(Removed duplicate line in Kconfig comment)

Change-Id: I7663c4d5350e2bfc3dfa2696f70ef777d6ccc6f6

# c4beb22f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

FIT: Modify option FIT_SIGNATURE in Kconfig

For FIT signature based approach to work, RSA library needs to be selected.
The FIT_SIGNATURE option in Kconfig is modified to automatically select RSA.
Selecting RSA compiles the RSA library required for image verification.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 45ccec8f 23-Oct-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_USE_PRIVATE_LIBGCC to Kconfig

The private libgcc is supported only on ARM, MIPS, PowerPC, SH, x86.
Those architectures should "select" HAVE_PRIVATE_LIBGCC and
CONFIG_USE_PRIVATE_LIBGCC should depend on it.

Currently, this option is enabled on Tegra boards and x86 architecture.
Move the definition from header files to Kconfig.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Tested-by: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: Tom Warren <twarren@nvidia.com>

# 8c688bc4 23-Oct-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_SYS_HZ to lib/Kconfig

CONFIG_SYS_HZ is always defined as 1000 in config_fallbacks.h
(but some boards still have redundant definitions).

This commit moves the definition and the document in README to
Kconfig. Since lib/Kconfig can assure that CONFIG_SYS_HZ is 1000,
the sanity check in lib/time.c should be removed.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Reviewed-by: Marek Vasut <marex@denx.de>

# b0928da6 16-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED to Kconfig

If this option is enabled, the objects under lib/ directory
are compiled with speed optimization, not size optimization.
(Currently, only used by some Blackfin boards.)

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# ed36323f 16-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: add blank Kconfig files

This would be useful to start moving various config options.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# ac7606af 14-Nov-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

lmb: fix typo 'commun'

%s/commun/common/

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

# e7d285b2 25-Sep-2021 Simon Glass <sjg@chromium.org>

image: Use the correct checks for CRC32

Add a host Kconfig for CRC32. With this we can use CONFIG_IS_ENABLED(CRC32)
directly in the host build, so drop the unnecessary indirection.

Add a few more conditions to SPL_CRC32 to avoid build failures as well as
TPL_CRC32. Also update hash.c to make crc32 optional and to actually take
notice of SPL_CRC32.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# 2c21256b 25-Sep-2021 Simon Glass <sjg@chromium.org>

hash: Use Kconfig to enable hashing in host tools and SPL

At present when building host tools, we force CONFIG_SHAxxx to be enabled
regardless of the board Kconfig setting. This is done in the image.h
header file.

For SPL we currently just assume the algorithm is desired if U-Boot proper
enables it.

Clean this up by adding new Kconfig options to enable hashing on the host,
relying on CONFIG_IS_ENABLED() to deal with the different builds.

Add new SPL Kconfigs for hardware-accelerated hashing, to maintain the
current settings.

This allows us to drop the image.h code and the I_WANT_MD5 hack.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# 603d15a5 25-Sep-2021 Simon Glass <sjg@chromium.org>

spl: cypto: Bring back SPL_ versions of SHA

Unfortunately these were removed by mistake. This means that adding hash
support to SPL brings in all software algorithms, with a substantial
increase in code size.

The origin of the problem was renaming them to SPL_FIT_xxx and then these
were removed altogether in a later commit.

Add them back. This aligns with CONFIG_MD5, for example, which has an SPL
variant.

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: f5bc9c25f31 ("image: Rename SPL_SHAxxx_SUPPORT to SPL_FIT_SHAxxx")
Fixes: eb5171ddec9 ("common: Remove unused CONFIG_FIT_SHAxxx selectors")
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# 6674edaa 16-Sep-2021 Tom Rini <trini@konsulko.com>

Merge tag 'v2021.10-rc4' into next

Prepare v2021.10-rc4

Signed-off-by: Tom Rini <trini@konsulko.com>

# gpg: Signature made Tue 14 Sep 2021 06:58:32 PM EDT
# gpg: using RSA key 1A3C7F70E08FAB1707809BBF147C39FF9634B72C
# gpg: Good signature from "Thomas Rini <trini@konsulko.com>" [ultimate]

# Conflicts:
# board/Arcturus/ucp1020/spl.c
# cmd/mvebu/Kconfig
# common/Kconfig.boot
# common/image-fit.c
# configs/UCP1020_defconfig
# configs/sifive_unmatched_defconfig
# drivers/pci/Kconfig
# include/configs/UCP1020.h
# include/configs/sifive-unmatched.h
# lib/Makefile
# scripts/config_whitelist.txt


# 5145bc73 01-Sep-2021 Oleksandr Suvorov <oleksandr.suvorov@foundries.io>

lib: fix typos in Kconfig

There are trivial typos in the Kconfig file. Fixed them.
Also, fixed grammar in the descriptions with typos.

Fixes: d56b4b1974 ("configs: Migrate RBTREE, LZO, CMD_MTDPARTS, CMD_UBI and CMD_UBIFS")
Fixes: 7264f2928b ("spl: fit: Eanble GZIP support for image decompression")
Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# e60e4499 02-Sep-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

lib: Drop SHA512_ALGO in lieu of SHA512

SHA512_ALGO was used as a "either SHA512 or SHA384", although the
implementations of these two algorithms share a majority of code.

From a Kconfig interface perspective, it makes sense to present two
distinct options. This requires #ifdefing out the SHA512
implementation from sha512.c. The latter doesn't make any sense.

It's reasonable to say in Kconfig that SHA384 depends on SHA512, and
seems to be the more polite way to handle the selection.

Thus, automatically select SHA512 when SHA384 is enabled.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# b4c2c151 27-Aug-2021 Michal Simek <michal.simek@xilinx.com>

Kconfig: Remove all default n/no options

default n/no doesn't need to be specified. It is default option anyway.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
[trini: Rework FSP_USE_UPD portion]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 928a8be7 29-Jul-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

lib: ecdsa: Implement UCLASS_ECDSA verification on target

Implement the crypto_algo .verify() function for ecdsa256. Because
it backends on UCLASS_ECDSA, this change is focused on parsing the
keys from devicetree and passing this information to the specific
UCLASS driver.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# fa3f1f1d 24-Jul-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: disable CONFIG_SPL_HEXDUMP by default

CONFIG_HEXDUMP is needed to display UEFI variables using 'printenv -e'.

Enabling CONFIG_SPL_HEXDUMP only makes sense for debugging purposes.
Hence CONFIG_SPL_HEXDUMP should not be enabled by default.

The following boards currently have CONFIG_SPL_HEXDUMP=y. This includes
boards that don't use SPL at all.

axm_defconfig
imx8mm-cl-iot-gate_defconfig
imx8mm_venice_defconfig
imxrt1020-evk_defconfig
imxrt1050-evk_defconfig
kontron_sl28_defconfig
kp_imx53_defconfig
lx2160ardb_tfa_stmm_defconfig
mt7622_rfb_defconfig
octeon_ebb7304_defconfig
octeon_nic23_defconfig
qemu_arm64_defconfig
qemu_arm_defconfig
qemu-riscv32_defconfig
qemu-riscv32_smode_defconfig
qemu-riscv64_defconfig
qemu-riscv64_smode_defconfig
qemu-x86_64_defconfig
qemu-x86_defconfig
sandbox64_defconfig
sandbox_defconfig
stm32mp15_basic_defconfig
stm32mp15_trusted_defconfig
synquacer_developerbox_defconfig
taurus_defconfig
xilinx_versal_virt_defconfig

The patch only keeps it enabled on

sandbox_spl_defconfig

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 1a46cb6c 02-Jul-2021 Simon Glass <sjg@chromium.org>

lib: Create a new Kconfig option for charset conversion

Rather than looking at two KConfig options in the Makefile, create a new
Kconfig option for compiling lib/charset.c

Enable it for UFS also, which needs this support.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 26dd9936 08-Jul-2021 Steffen Jaeckel <jaeckel-floss@eyet-services.de>

lib: add crypt subsystem

Add the basic functionality required to support the standard crypt
format.
The files crypt-sha256.c and crypt-sha512.c originate from libxcrypt and
their formatting is therefor retained.
The integration is done via a crypt_compare() function in crypt.c.

```
libxcrypt $ git describe --long --always --all
tags/v4.4.17-0-g6b110bc
```

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 7d0f3fbb 11-Jun-2021 Tero Kristo <t-kristo@ti.com>

lib: rational: copy the rational fraction lib routines from Linux

Copy the best rational approximation calculation routines from Linux.
Typical usecase for these routines is to calculate the M/N divider
values for PLLs to reach a specific clock rate.

This is based on linux kernel commit:
"lib/math/rational.c: fix possible incorrect result from rational
fractions helper"
(sha1: 323dd2c3ed0641f49e89b4e420f9eef5d3d5a881)

Signed-off-by: Tero Kristo <t-kristo@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Tero Kristo <kristo@kernel.org>

# ec0512b1 24-May-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

Revert "lib: introduce HASH_CALCULATE option"

When we think of Kconfig, we usually think of features that we like
to enable or not. Ideally, we wouldn't use Kconfig to fix a build
issue, although sometimes it might make sense. With Kconfig it's hard
to guarantee that the fix is universal. We can only say that it works
for the set of tested configurations. In the majority of cases, it's
preferable to let the linker figure things out for us.

The reverted commit attempted to fix a build issue by adding an
invisible Kconfig option. This is wrong in several ways:

It invents a new Kconfig variable when CONFIG_HASH already
exists for the same purpose.
Second, hash-checksum.c makes use of the hash_progressive_lookup_algo()
symbol, which is only provided with CONFIG_HASH, but this dependency
was not expressed in the reverted patch.

It feels like Kconfig is turning into a listing of all available
source files, and a buffet to 'select' which ones to compile. The
purpose of this revert is to enable the next change to make use of
CONFIG_HASH instead of adding to Kconfig.

This reverts commit 87316da05f2fd49d3709275e64ef0c5980366ade.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Acked-by: Masahisa Kojima <masahisa.kojima@linaro.org>

# 1621d3c4 10-May-2021 Bin Meng <bmeng.cn@gmail.com>

lib: kconfig: Limit BINMAN_FDT for OF_SEPARATE or OF_EMBED

Generally speaking BINMAN_FDT makes sense for OF_SEPARATE or OF_EMBED.
For the other OF_CONTROL methods, it's quite possible binman node is
not available as binman is invoked during the build phase instead of
runtime. Let's only turn it on for OF_SEPARATE or OF_EMBED by default.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 87316da0 13-May-2021 Masahisa Kojima <masahisa.kojima@linaro.org>

lib: introduce HASH_CALCULATE option

Build error occurs when CONFIG_EFI_SECURE_BOOT or
CONFIG_EFI_CAPSULE_AUTHENTICATE is enabled,
because hash-checksum.c is not compiled.

Since hash_calculate() implemented in hash-checksum.c can be
commonly used aside from FIT image signature verification,
this commit itroduces HASH_CALCULATE option to decide
if hash-checksum.c shall be compiled.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# e2ae483c 13-May-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

hash: Kconfig option for SHA512 hardware acceleration

Commit a479f103dc1c ("hash: Allow for SHA512 hardware implementations")
defined function definitions for hardware accelerated SHA384 and SHA512.
If CONFIG_SHA_HW_ACCEL=y, these functions are used.

We already have boards using CONFIG_SHA_HW_ACCEL=y but none implements the
new functions hw_sha384() and hw_sha512().

For implementing the EFI TCG2 protocol we need SHA384 and SHA512. The
missing hardware acceleration functions lead to build errors on boards like
peach-pi_defconfig.

Introduce a new Kconfig symbol CONFIG_SHA512_HW_ACCEL to control if the
functions hw_sha384() and hw_sha512() shall be used to implement the SHA384
and SHA512 algorithms.

Fixes: a479f103dc1c ("hash: Allow for SHA512 hardware implementations")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

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

# 6d66502b 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: Add 2 config to define the max number of regions

Add 2 configs CONFIG_LMB_MEMORY_REGIONS and CONFIG_LMB_RESERVED_REGIONS
to change independently the max number of the regions in lmb
library.

When CONFIG_LMB_USE_MAX_REGIONS=y, move the lmb property arrays to
struct lmb and manage the array size with the element 'max' of struct
lmb_region; their are still allocated in stack.

When CONFIG_LMB_USE_MAX_REGIONS=n, keep the current location in
struct lmb_region to allow compiler optimization.

Increase CONFIG_LMB_RESERVED_REGIONS is useful to avoid lmb errors in
bootm when the number of reserved regions (not adjacent) is reached:
+ 1 region for relocated U-Boot
+ 1 region for initrd
+ 1 region for relocated linux device tree
+ reserved memory regions present in Linux device tree.

The current limit of 8 regions is reached with only 5 reserved regions
in DT.

see Linux kernel commit bf23c51f1f49 ("memblock: Move memblock arrays
to static storage in memblock.c and make their size a variable")

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# 4fa0150d 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: move MAX_LMB_REGIONS value in Kconfig

Move MAX_LMB_REGIONS value in Kconfig, the max number of the regions
in lmb library.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# 77b8cfef 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: move CONFIG_LMB in Kconfig

Migrate CONFIG_LMB in Kconfig.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# a479f103 16-Feb-2021 Joel Stanley <joel@jms.id.au>

hash: Allow for SHA512 hardware implementations

Similar to support for SHA1 and SHA256, allow the use of hardware hashing
engine by enabling the algorithm and setting CONFIG_SHA_HW_ACCEL /
CONFIG_SHA_PROG_HW_ACCEL.

Signed-off-by: Joel Stanley <joel@jms.id.au>

# f2c1442e 14-Mar-2021 Simon Glass <sjg@chromium.org>

bloblist: Make BLOBLIST_TABLES depend on BLOBLIST

Add an extra condition here since we cannot put x86 tables in a bloblist
when bloblists are not supported.

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

# e0103158 25-Feb-2021 Bin Meng <bmeng.cn@gmail.com>

lib: kconfig: Mention CONFIG_ADDR_MAP limitation in the help

Mention that CONFIG_ADDR_MAP only works in the post-relocation phase.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>

# 56e7257c 03-Feb-2021 Bin Meng <bmeng.cn@gmail.com>

lib: Fix BINMAN_FDT dependency

lib/binman.c references the following 3 ofnode APIs:
ofnode_first_subnode(), ofnode_path() and ofnode_read_bool().

These APIs get built only when DM is on. Fix the dependency then.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 59e4e391 18-Jan-2021 Tom Rini <trini@konsulko.com>

Merge https://gitlab.denx.de/u-boot/custodians/u-boot-riscv

- Update qemu-riscv.rst build instructions.
- Add support for SPI on Kendryte K210.
- Add Microchip PolarFire SoC Icicle Kit support.
- Add support for an early timer.
- Select TIMER_EARLY to avoid infinite recursion for Trace.


# a80f8513 17-Jan-2021 Pragnesh Patel <pragnesh.patel@sifive.com>

trace: select TIMER_EARLY to avoid infinite recursion

When tracing functions is enabled this adds calls to
__cyg_profile_func_enter() and __cyg_profile_func_exit() to the traced
functions.

__cyg_profile_func_enter() and __cyg_profile_func_exit() invoke
timer_get_us() to record the entry and exit time.

initr_dm() will make gd->dm_root = NULL and gd->timer = NULL, so
timer_get_us() -> get_ticks() -> dm_timer_init() will lead to an
indefinite recursion.

So select TIMER_EARLY when tracing got enabled.

Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Rick Chen <rick@andestech.com>

# 6205bbb1 04-Jan-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lib: cosmetic update of CONFIG_LIB_ELF description

Change 2 typo error in CONFIG_LIB_ELF description:
- Supoort => Support
- fir => for

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c589132a 02-Dec-2020 Aswath Govindraju <a-govindraju@ti.com>

fdt: Use phandle to distinguish DT nodes with same name

While assigning the sequence number to subsystem instances by reading the
aliases property, only DT nodes names are compared and not the complete
path. This causes a problem when there are two DT nodes with same name but
have different paths.

In arch/arm/dts/k3-am65-main.dtsi there are two USB controllers with the
same device tree node name but different path. When aliases are defined for
these USB controllers then fdtdec_get_alias_seq() fails to pick the correct
instance for a given index.

fdt_path_offset() function is slow and this would effect the U-Boot
startup. To avert the time penalty on all boards, apply this extra check
only when required by using a config option.

Fix it by comparing the phandles of DT nodes after the node names match,
under a config option.

Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Fix whitespace error in Kconfig:
Signed-off-by: Simon Glass <sjg@chromium.org>

# 28cef9ca 19-Nov-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

fs: fat: create correct short names

The current function set_name() used to create short names has the
following deficiencies resolved by this patch:

* Long names (e.g. FOO.TXT) are stored even if a short name is enough.
* Short names with spaces are created, e.g. "A ~1.TXT".
* Short names with illegal characters are created, e.g. "FOO++BAR".
* Debug output does not not consider that the short file name has no
concluding '\0'.

The solution for the following bug is split of into a separate patch:

* Short file names must be unique.

This patch only provides the loop over possible short file names.

Fixes: c30a15e590c ("FAT: Add FAT write feature")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# e4f8e543 05-Nov-2020 Simon Glass <sjg@chromium.org>

smbios: Drop the unused Kconfig options

Now that we can use devicetree to specify this information, drop the old
CONFIG options.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 44c74bdd 05-Nov-2020 Simon Glass <sjg@chromium.org>

sysinfo: Provide a default driver to set SMBIOS values

Some boards want to specify the manufacturer or product name but do not
need to have their own sysinfo driver.

Add a default driver which provides a way to specify this SMBIOS
information in the devicetree, without needing any board-specific
functionality.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d2cb7a22 04-Nov-2020 Simon Glass <sjg@chromium.org>

x86: Allow putting some tables in the bloblist

At present all tables are placed starting at address f0000 in memory, and
can be up to 64KB in size. If the tables are very large, this may not
provide enough space.

Also if the tables point to other tables (such as console log or a ramoops
area) then we must allocate other memory anyway.

The bloblist is a nice place to put these tables since it is contiguous,
which makes it easy to reserve this memory for linux using the 820 tables.

Add an option to put some of the tables in the bloblist. For SMBIOS and
ACPI, create suitable pointers from the f0000 region to the new location
of the tables.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
[bmeng: squashed in http://patchwork.ozlabs.org/project/uboot/patch/
20201105062407.1.I8091ad931cbbb5e3b6f6ababdf3f8d5db0d17bb9@changeid/]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# 415eab06 03-Nov-2020 Christian Gmeiner <christian.gmeiner@gmail.com>

smbios: add parsing API

Add a very simple API to be able to access SMBIOS strings
like vendor, model and bios version.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 72eda507 27-Oct-2020 Sean Anderson <seanga2@gmail.com>

lib: Add getopt

Some commands can get very unweildy if they have too many positional
arguments. Adding options makes them easier to read, remember, and
understand.

This implementation of getopt has been taken from barebox, which has had
option support for quite a while. I have made a few modifications to their
version, such as the removal of opterr in favor of a separate getopt_silent
function. In addition, I have moved all global variables into struct
getopt_context.

The getopt from barebox also re-orders the arguments passed to it so that
non-options are placed last. This allows users to specify options anywhere.
For example, `ls -l foo/ -R` would be re-ordered to `ls -l -R foo/` as
getopt parsed the options. However, this feature conflicts with the const
argv in cmd_tbl->cmd. This was originally added in 54841ab50c ("Make sure
that argv[] argument pointers are not modified."). The reason stated in
that commit is that hush requires argv to stay unmodified. Has this
situation changed? Barebox also uses hush, and does not have this problem.
Perhaps we could use their fix?

I have assigned maintenance of getopt to Simon Glass, as it is currently
only used by the log command. I would also be fine maintaining it.

Signed-off-by: Sean Anderson <seanga2@gmail.com>

# 26637e2e 12-Sep-2020 Simon Glass <sjg@chromium.org>

lib: Allow hexdump to be used in SPL

It is sometimes useful to output hex dumps in SPL. Add a config option to
allow this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# e87dfb05 05-Aug-2020 Andrii Anisov <andrii_anisov@epam.com>

lib: sscanf: add sscanf implementation

Port sscanf implementation from mini-os and introduce new
Kconfig option to enable it: CONFIG_SSCANF. Disable by default.

Signed-off-by: Andrii Anisov <andrii_anisov@epam.com>
Signed-off-by: Anastasiia Lukianenko <anastasiia_lukianenko@epam.com>
Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>

# 81014f73 30-Jul-2020 Joao Marcos Costa <joaomarcos.costa@bootlin.com>

include/u-boot, lib/zlib: add sources for zlib decompression

Add zlib (v1.2.11) uncompr() function to U-Boot. SquashFS depends on
this function to decompress data from a raw disk image. The actual
support for zlib into SquashFS sources will be added in a follow-up
commit.

Signed-off-by: Joao Marcos Costa <joaomarcos.costa@bootlin.com>

# 69be8fd1 03-Jun-2020 Marek Szyprowski <m.szyprowski@samsung.com>

powerpc: move ADDR_MAP to Kconfig

Move ADDR_MAP related config options from include/configs/*.h to the
proper place in lib/Kconfig. This has been done using
./tools/moveconfig.py and manual inspection of the generated changes.
This is a preparation to use ADDR_MAP helper on ARM 32bit Raspberry Pi4
board for mapping the PCIe XHCI MMIO, which is above the 4GiB identity
mapping limit.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# d16b38f4 15-Apr-2020 Reuben Dowle <reubendowle0@gmail.com>

Add support for SHA384 and SHA512

The current recommendation for best security practice from the US government
is to use SHA384 for TOP SECRET [1].

This patch adds support for SHA384 and SHA512 in the hash command, and also
allows FIT images to be hashed with these algorithms, and signed with
sha384,rsaXXXX and sha512,rsaXXXX

The SHA implementation is adapted from the linux kernel implementation.

[1] Commercial National Security Algorithm Suite
http://www.iad.gov/iad/programs/iad-initiatives/cnsa-suite.cfm

Signed-off-by: Reuben Dowle <reuben.dowle@4rf.com>

# 43e442a5 26-May-2020 Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

kconfig: fix some typos

Signed-off-by: Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

# eff5a547 22-May-2020 Michael Walle <michael@walle.cc>

cmd: zip: automatically pull in gzip()

Move the CONFIG_GZIP_COMPRESSED from a config.h macro to a Kconfig menu
item. It is not selectable by a user because there is no reason to do
so. Instead it will be automatically selected by the stuff which uses
gzip(), like the zip command.

Remove it from the config_whitelist.txt. Also remove
CONFIG_GZIP_COMPRESS_DEF_SZ as this was never used on any board. The
default seems to be sane, otherwise it should be added as a Kconfig
option.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8239be61 06-May-2020 Simon Glass <sjg@chromium.org>

lib: Allow MD5 to be enabled in SPL

At present the MD5 option cannot be enabled by board configs since it has
no Kconfig name. It is generally enabled, so long as FIT support is
present. But not all boards use FIT, particularly in SPL

Fix this and add an option for SPL as well. This allows board code to call
md5() even if FIT support is not enabled.

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

# 04cb3994 21-Apr-2020 Weijie Gao <weijie.gao@mediatek.com>

lib: enable lzma decompression support for SPL build

This patch enables LZMA decompression support for SPL build

Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>

# 2a2119e1 05-Mar-2020 Atish Patra <atish.patra@wdc.com>

lib: kconfig: Add option to set BZIP2 compression method

There is no way to select BZIP2 compression method.
Add it under library/compression config where all other
compression related configs are present.

Signed-off-by: Atish Patra <atish.patra@wdc.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 805b3cac 12-Feb-2020 Keerthy <j-keerthy@ti.com>

lib: elf: Move the generic elf loading/validating functions to lib

Move the generic elf loading/validating functions to lib/
so that they can be re-used and accessed by code existing
outside cmd.

While at it remove the duplicate static version of load_elf_image_phdr
under arch/arm/mach-imx/imx_bootaux.c.

Signed-off-by: Keerthy <j-keerthy@ti.com>
Suggested-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>

# 1611235b 19-Jan-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: Kconfig dependencies for pseudo-random library

drivers/rng/sandbox_rng.c requires rand() to be defined but configuration
option CONFIG_CONFIG_LIB_RAND selected in drivers/rng/Kconfig does not
exist.

test/lib/test_aes.c requires rand() to be defined.

Fix the selection criteria for choice "Pseudo-random library support type".

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 3c10dc95 06-Dec-2019 Simon Glass <sjg@chromium.org>

binman: Add a library to access binman entries

SPL and TPL can access information about binman entries using link-time
symbols but this is not available in U-Boot proper. Of course it could be
made available, but the intention is to just read the device tree.

Add support for this, so that U-Boot can locate entries.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# b4adf627 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: crypto: add x509 parser

Imported from linux kernel v5.3:
x509.asn1 without changes
x509_akid.asn1 without changes
x509_parser.h without changes
x509_cert_parser.c with changes marked as __UBOOT__
x509_public_key.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# a9b45e6e 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add oid registry utility

Imported from linux kernel v5.3:
build_OID_registry without changes
oid_registry.h without changes
oid_registry.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# ab8a0e06 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add asn1 decoder

Imported from linux kernel v5.3:
lib/asn1_decoder.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 2b12196d 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

cmd: add asn1_compiler

Imported from linux kernel v5.3:
asn1.h without changes
asn1_ber_bytecode.h without changes
asn1_decoder.h without changes
asn1_compiler.c without changes

This host command will be used to create a ASN1 parser, for example,
for pkcs7 messages or x509 certificates. More specifically, it will
generate *byte code* which will be interpreted by asn1 decoder library.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 05429b6c 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

rtc: move date.c from drivers/rtc/ to lib/

In the next commit, rtc_mktime(), for compatibility with linux, will be
implemented using rtc_mktime(), which is no longer drivers/rtc specific.
So move this file under lib/.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 37ef1774 10-Nov-2019 Thomas Hebb <tommyhebb@gmail.com>

Kconfig: disambiguate config names for tiny printf

27084c03d36a ("spl: Allow tiny printf() to be controlled in SPL and
TPL") split this option in two for TPL and SPL, but didn't change the
Kconfig names, making them hard to set quickly.

Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>

# 0d76afc0 27-Oct-2019 Simon Glass <sjg@chromium.org>

fdt: Add Kconfig options to control code size

For better or worse libfdt recent grew a lot of code that checks the
validity of the device tree in great detail. When using unsigned or
unverified data this makes things safer, but it does add to code size.

Add some controls to select the trade-off between safety and code size.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 27084c03 25-Sep-2019 Simon Glass <sjg@chromium.org>

spl: Allow tiny printf() to be controlled in SPL and TPL

At present there is only one control for this and it is used for both SPL
and TPL. But SPL might have a lot more space than TPL so the extra cost of
a full printf() might be acceptable.

Split the option into two, providing separate SPL and TPL controls. The
TPL setting defaults to the same as SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2a51e16b 07-Jun-2019 Tom Rini <trini@konsulko.com>

configs: Make USE_TINY_PRINTF depend on SPL||TPL and be default

The USE_TINY_PRINTF symbol only changes things within SPL and TPL
builds, so make it depend on that support. Next, make it default as
within these cases we should rarely have need of more advanced print
formats outside of the debug context.

To do this, in a few cases we need to correct our Kconfig dependencies
as we had cases of non-SPL targets select'ing this symbol. Finally, in
the case of a few boards we really do need the full printf
functionality.

Signed-off-by: Tom Rini <trini@konsulko.com>

# da0fb5fd 02-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: make call depth limit customizable

Up to now we had hard coded values for the call depth up to which trace
records are created: 200 for early tracing, 15 thereafter. UEFI
applications reach a call depth of 80 or above.

Provide customizing settings for the call trace depth limit and the early
call trace depth limit. Use the old values as defaults.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8509f22a 29-Apr-2019 Marek Behún <marek.behun@nic.cz>

lib: add Zstandard decompression support

Add the zstd library from Linux kernel (only decompression support).
There are minimal changes to build with U-Boot, otherwise the files are
identical to Linux commit dc35da16 from March 2018, the files had not
been touched since in kernel. Also SPDX lincese tags were added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 83a486b6 29-Apr-2019 Marek Behún <marek.behun@nic.cz>

lib: Add xxhash support

This adds the xxhash support from Linux. Files are almost identical to
those added to Linux in commit 5d240522 ("lib: Add xxhash module") (they
haven't been touched since in Linux). The only difference is to add some
includes to be compatible with U-Boot. Also SPDX lincese tags were
added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 5132361a 29-Apr-2019 Heiko Schocher <hs@denx.de>

lib: Kconfig: fix help text for GZIP

commit 95f4bbd581cf ("lib: fdt: Allow LZO and GZIP DT compression in U-Boot")

introduced Kconfig option for gzip in U-Boot, but help text
says gzip for SPL, which is wrong. Fix this.

Signed-off-by: Heiko Schocher <hs@denx.de>
Acked-by: Marek Vasut <marex@denx.de>

# 1c6eb075 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE_BUFFER_SIZE et al to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE_BUFFER_SIZE
CONFIG_TRACE_EARLY_SIZE
CONFIG_TRACE_EARLY
CONFIG_TRACE_EARLY_ADDR

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

# a24a78d7 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE

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

# 54969b40 21-Mar-2019 Thierry Reding <treding@nvidia.com>

fdtdec: Add Kconfig symbol for tests

Runtime tests are provided as a test_fdtdec command implementation. Add
a Kconfig symbol that allows this command to be built so that the tests
can be used.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 95f4bbd5 08-Mar-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

lib: fdt: Allow LZO and GZIP DT compression in U-Boot

Add required Kconfig symbols, Makefile bits and macro fixes in a
few places to support LZO and DT compression in U-Boot. This can
save a lot of space with multi-DTB fitImages.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>

# 6e705114 13-Jan-2019 Chris Packham <judge.packham@gmail.com>

lib: Kconfig: spelling fixes

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 048c6e89 06-Nov-2018 Simon Glass <sjg@chromium.org>

spl: lz4: Allow use of lz4 compression in SPL

In some cases U-Boot is compressed and it is useful to be able to
decompress it in SPL. Add a Kconfig and Makefile change to allow this.
Note that this does not actually implement decompression.

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

# 2895c4b7 15-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

kconfig: Introduce HAVE_ARCH_IOMAP

Introduce a new Kconfig option for architecture codes to control
whether it provides io{read,write}{8,16,32} I/O accessor functions.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5592a633 01-Oct-2018 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt in TPL

In some cases (e.g. sandbox with verified boot) it is useful to support
libfdt in TPL. Update the Kconfig to handle this.

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

# 6307896c 01-Oct-2018 Simon Glass <sjg@chromium.org>

tpm: Add support for SPL and TPL

At present the tpm can only be used in U-Boot proper. Updated it to work
in SPL and TPL also.

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

# ab948cd2 19-Jul-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

fdt_support: make FDT_FIXUP_PARTITIONS depend on CMD_MTDPARTS

fdt_fixup_mtdparts() calls mtdparts_init() and device_find(),
which are defined in cmd/mtdparts.c

The combination of FDT_FIXUP_PARTITIONS=y and CMD_MTDPARTS=n
emits the following link error:

common/fdt_support.c:903: undefined reference to `mtdparts_init'
common/fdt_support.c:914: undefined reference to `device_find'

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 3330584d 03-Jun-2018 Igor Opaniuk <igor.opaniuk@gmail.com>

avb2.0: integrate avb 2.0 into the build system

Integrate libavb into the build system. Introduce CONFIG_LIBAVB
build option.

Signed-off-by: Igor Opaniuk <igor.opaniuk@linaro.org>

# f8c987f8 05-Jun-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

lib: Add hexdump

Often during debugging session it's very interesting to see
what data we were dealing with. For example what we write or read
to/from memory or peripherals.

This change introduces functions that allow to dump binary
data with one simple function invocation like:
------------------->8----------------
print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, buf, len);
------------------->8----------------

which gives us the following:
------------------->8----------------
00000000: f2 b7 c9 88 62 61 75 64 72 61 74 65 3d 31 31 35 ....baudrate=115
00000010: 32 30 30 00 62 6f 6f 74 61 72 67 73 3d 63 6f 6e 200.bootargs=con
00000020: 73 6f 6c 65 3d 74 74 79 53 33 2c 31 31 35 32 30 sole=ttyS3,11520
00000030: 30 6e 38 00 62 6f 6f 74 64 65 6c 61 79 3d 33 00 0n8.bootdelay=3.
00000040: 62 6f 6f 74 66 69 6c 65 3d 75 49 6d 61 67 65 00 bootfile=uImage.
00000050: 66 64 74 63 6f 6e 74 72 6f 6c 61 64 64 72 3d 39 fdtcontroladdr=9
00000060: 66 66 62 31 62 61 30 00 6c 6f 61 64 61 64 64 72 ffb1ba0.loadaddr
00000070: 3d 30 78 38 32 30 30 30 30 30 30 00 73 74 64 65 =0x82000000.stde
00000080: 72 72 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 rr=serial0@e0022
00000090: 30 30 30 00 73 74 64 69 6e 3d 73 65 72 69 61 6c 000.stdin=serial
000000a0: 30 40 65 30 30 32 32 30 30 30 00 73 74 64 6f 75 0@e0022000.stdou
000000b0: 74 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 30 t=serial0@e00220
000000c0: 30 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00..............
...
------------------->8----------------

Source of hexdump.c was copied from Linux kernel v4.7-rc2.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Mario Six <mario.six@gdsys.cc>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Stefan Roese <sr@denx.de>

# c232d14d 29-May-2018 Alex Kiernan <alex.kiernan@gmail.com>

mmc: Separate "mmc swrite" from fastboot

Introduce CONFIG_IMAGE_SPARSE and CONFIG_CMD_MMC_SWRITE so the "mmc
swrite" command is separated from the fastboot code.

Move image-sparse from common to lib so it's clear it's library code.

Rename CONFIG_FASTBOOT_FLASH_FILLBUF_SIZE to CONFIG_IMAGE_SPARSE_FILLBUF_SIZE
and migrate it to Kconfig.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Acked-by: Jassi Brar <jaswinder.singh@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6417572e 08-May-2018 Tom Rini <trini@konsulko.com>

lib/Kconfig: Mark OF_LIBFDT_OVERLAY as depending on OF_LIBFDT

The overlay code is only useful when OF_LIBFDT is set, so mark it as
depending on that first.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 58a46f88 25-Apr-2018 Praneeth Bajjuri <praneeth@ti.com>

configs: TI: Enable FIT Library overlay support

Enable the FDT library overlay support for all TI SOC family.

Without this option, when Loading fdt from FIT image, the
following warning is seen.

"config with overlays but CONFIG_OF_LIBFDT_OVERLAY not set".

Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
Suggested-by: Andrew F.Davis <afd@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>

# 14ad44ab 18-Apr-2018 Alex Kiernan <alex.kiernan@gmail.com>

spl: Split sprintf, strto* from SPL serial in Kconfig

When SPL serial is disabled, callers who need sprintf or strtoul fail
because their inclusion is guarded by CONFIG_SPL_SERIAL_SUPPORT/
CONFIG_TPL_SERIAL_SUPPORT.

Split printf, sprintf and strto into their own entries and then select
all of them if SERIAL_SUPPORT is enabled to match the current behaviour.

Include panic.o unconditionally as it can be called from anywhere which
uses BUG_ON().

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>

# e294ba06 04-Apr-2018 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-sunxi

Signed-off-by: Tom Rini <trini@konsulko.com>


# d14db11d 03-Apr-2018 Andre Przywara <andre.przywara@arm.com>

sunxi: revert disabling of features

In January some commits were introduced to mitigate the U-Boot image
size issues we encountered on sunxi builds.
Now with the MMC environment removed we can bring them back, as we
practically don't have a size limit anymore.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 32ce6179 13-Mar-2018 Bryan O'Donoghue <bryan.odonoghue@linaro.org>

optee: Add lib entries for sharing OPTEE code across ports

This patch adds code to lib to enable sharing of useful OPTEE code between
board-ports and architectures. The code on lib/optee/optee.c comes from the
TI omap2 port. Eventually the OMAP2 code will be patched to include the
shared code. The intention here is to add more useful OPTEE specific code
as more functionality gets added.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Cc: Harinarayan Bhatta <harinarayan@ti.com>
Cc: Andrew F. Davis <afd@ti.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Kever Yang <kever.yang@rock-chips.com>
Cc: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Cc: Peng Fan <peng.fan@nxp.com>
Tested-by: Peng Fan <peng.fan@nxp.com>

# 36c1877c 06-Feb-2018 Faiz Abbas <faiz_abbas@ti.com>

lib: Kconfig: Move DYNAMIC_CRC_TABLE to Kconfig

Add CONFIG prefix to DYNAMIC_CRC_TABLE and implement it in
Kconfig.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>

# a451bc27 05-Feb-2018 Adam Ford <aford173@gmail.com>

Convert LIB_UUID to Kconfig

config_fallback.h has some logic that checks a variety of options
and selects LIB_UUID if it hasn't already been selected. This
will all LIB_UUID in Kconfig and select this option for the list
of options to allow us to remove the logic from fallbacks

Signed-off-by: Adam Ford <aford173@gmail.com>

# a5a37567 06-Feb-2018 Adam Ford <aford173@gmail.com>

Convert CONFIG LIB_HW_RAND to Kconfig

config_fallbacks.h had some logic to automatically select
LIB_RAND if RANDOM_UUID or CMD_UUID were set if LIB_HW_RAND wasn't
already selected. By migrating LIB_HW_RAND to Kconfig, we can
remove this check from config_fallbacks.h and put it into Kconfig

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
[trini: Turn into a choice, add NET_RANDOM_ETHADDR]
Signed-off-by: Tom Rini <trini@konsulko.com>

# acd4d334 16-Jan-2018 Maxime Ripard <maxime.ripard@free-electrons.com>

net: regex: Disable by default on sunXi

The sunXi arm64 build has overflown, leading to the main U-boot binary
overwriting the environment when flashing the new image, or even worse,
overwriting itself when we're calling saveenv.

Disable this option that is not critical until we can adress the issue
properly.

Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 7e3caa81 03-Dec-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

Move CONFIG_PANIC_HANG to Kconfig

Freescale (NXP) boards have lots of defconfig files per board.
I used "imply PANIC_HANG" for them.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# da5337a6 08-Nov-2017 Nandor Han <nandor.han@ge.com>

rtc: add support for s35392a

Add support for S35392A RTC. The driver supports both U-Boot driver
models.

Signed-off-by: Nandor Han <nandor.han@ge.com>
Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
Cc: Heiko Schocher <hs@denx.de>

# f52bdf4b 14-Sep-2017 Jean-Jacques Hiblot <jjhiblot@ti.com>

lib: allow building lzo for the SPL

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 85d8bf57 03-Sep-2017 Marek Behún <marek.behun@nic.cz>

lib: Add CRC32-C

This is needed for BTRFS.

Signed-off-by: Marek Behun <marek.behun@nic.cz>

create mode 100644 lib/crc32c.c

# 7264f292 15-Aug-2017 York Sun <york.sun@nxp.com>

spl: fit: Eanble GZIP support for image decompression

Add Kconfig option SPL_GZIP and SPL_ZLIB to enable gunzip support for
SPL boot, eg. falcon boot compressed kernel image.

Signed-off-by: York Sun <york.sun@nxp.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6ef2f901 11-Aug-2017 Adam Ford <aford173@gmail.com>

Convert CONFIG_BCH to Kconfig

This converts the following to Kconfig:
CONFIG_BCH

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1a7ba1d 18-Aug-2017 Anatolij Gustschin <agust@denx.de>

Fix 'notes' typos

s/notes/nodes

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 96b9082c 03-Aug-2017 Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

rockchip: rk3188: rock: adjust for SPL/TPL split

With the changes to split SPL/TPL for the RK3368, I apparently missed
some needed adjustments to the RK3188 Kconfig and rock_defconfig.

This fixes build-issues for the rock board after applying the RK3368
enablement (and SPL/TPL) set that resulted from TPL_SERIAL_SUPPORT,
TPL_ROCKCHIP_BACK_TO_BROM and TPL_TINY_MEMSET being separate symbols
now.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d56b4b19 22-Jul-2017 Tom Rini <trini@konsulko.com>

configs: Migrate RBTREE, LZO, CMD_MTDPARTS, CMD_UBI and CMD_UBIFS

The above CONFIG options are in Kconfig, and now have correct depends and
inter-dependencies. Migrate these to configs/ from include/configs/. In the
case of CMD_UBIFS also change it to be a default y if CMD_UBI.

Signed-off-by: Tom Rini <trini@konsulko.com>

# aed998aa 17-May-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_LZMA to Kconfig

This converts the following to Kconfig:
CONFIG_LZMA

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

# b1a873df 26-Apr-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_CMD_AES et al to Kconfig

This converts the following to Kconfig:
CONFIG_CMD_AES
CONFIG_AES

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Add select AES to CMD_AES]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 173aafbf 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

cmd: Expose a Kconfig option to enable UBIFS commands

Create a new Kconfig entry to allow CMD_UBIFS selection from Kconfig and
add an hidden LZO option that can be selected by CMD_UBIFS.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>

# aa049152 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

mtd: ubi: Select RBTREE option from MTD_UBI Kconfig entry

Expose the RBTREE feature through Kconfig and select this option from the
MTD_UBI option.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>
[Rebased on master]
Signed-off-by: Jagan Teki <jagan@openedev.com>

# ab4458bd 02-Apr-2017 Simon Glass <sjg@chromium.org>

string: Provide a slimmed-down memset()

Most of the time the optimised memset() is what we want. For extreme
situations such as TPL it may be too large. For example on the 'rock'
board, using a simple loop saves a useful 48 bytes. With gcc 4.9 and
the rodata bug, this patch is enough to reduce the TPL image below the
limit.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>

# bea79d7d 14-Mar-2017 Andre Przywara <andre.przywara@arm.com>

Kconfig: introduce md5sum command selection

So far CONFIG_MD5SUM would need to be set by a board's include file.
Since the command is really generic, move it over to Kconfig to allow
it to be defined by either a board's defconfig, menuconfig or some
config snippet merged via mergeconfig.sh.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e663b350 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

smbios: Expose in efi_loader as table

We can pass SMBIOS easily as EFI configuration table to an EFI payload. This
patch adds enablement for that case.

While at it, we also enable SMBIOS generation for ARM systems, since they support
EFI_LOADER.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4b6dddc2 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

x86: Move smbios generation into arch independent directory

We will need the SMBIOS generation function on ARM as well going forward,
so let's move it into a non arch specific location.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# ebf7fff2 05-Oct-2016 Heiko Schocher <hs@denx.de>

spl: move FDT_FIXUP_PARTITIONS to Kconfig

Move FDT_FIXUP_PARTITIONS to Kconfig and cleanup existing
uses.

Signed-off-by: Heiko Schocher <hs@denx.de>

# ddf67f71 05-Jul-2016 Maxime Ripard <maxime.ripard@free-electrons.com>

libfdt: Add overlay application function

The device tree overlays are a good way to deal with user-modifyable
boards or boards with some kind of an expansion mechanism where we can
easily plug new board in (like the BBB, the Raspberry Pi or the CHIP).

Add a new function to merge overlays with a base device tree.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>

# 91b86e21 26-May-2016 Marek Vasut <marex@denx.de>

lib: Enable private libgcc by default

This patch decouples U-Boot binary from the toolchain on systems where
private libgcc is available. Instead of pulling in functions provided
by the libgcc from the toolchain, U-Boot will use it's own set of libgcc
functions. These functions are usually imported from Linux kernel, which
also uses it's own libgcc functions instead of the ones provided by the
toolchain.

This patch solves a rather common problem. The toolchain can usually
generate code for many variants of target architecture and often even
different endianness. The libgcc on the other hand is usually compiled
for one particular configuration and the functions provided by it may
or may not be suited for use in U-Boot. This can manifest in two ways,
either the U-Boot fails to compile altogether and linker will complain
or, in the much worse case, the resulting U-Boot will build, but will
misbehave in very subtle and hard to debug ways.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 67976306 30-Mar-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

cosmetic: Fix typos "privide"

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# ed980b8c 03-Mar-2016 Alexander Graf <agraf@csgraf.de>

efi_loader: hook up in build environment

Now that we have all the bits and pieces ready for EFI payload loading
support, hook them up in Makefiles and KConfigs so that we can build.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
[trini: Enable only when we of OF_LIBFDT, disable on kwb and colibri_pxa270]
Signed-off-by: Tom Rini <trini@konsulko.com>

# aa34fbc0 22-Feb-2016 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt to be used in SPL

Add an option to enable libfdt in SPL. This can be useful when decoding
FIT files in SPL.

We need to make sure this option is not enabled in SPL by this change.
Also this option needs to be enabled in host builds. Si add a new
IMAGE_USE_LIBFDT #define which can be used in files that are built on the
host but must also build for U-Boot and SPL.

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

# 69e173eb 22-Feb-2016 Simon Glass <sjg@chromium.org>

Move CONFIG_OF_LIBFDT to Kconfig

Move this option to Kconfig and tidy up existing boards.

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

# a187559e 05-Feb-2016 Bin Meng <bmeng.cn@gmail.com>

Use correct spelling of "U-Boot"

Correct spelling of "U-Boot" shall be used in all written text
(documentation, comments in source files etc.).

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Minkyu Kang <mk7.kang@samsung.com>

# 947c626d 14-Jan-2016 Tom Rini <trini@konsulko.com>

vsprintf.c: Always enable CONFIG_SYS_VSNPRINTF

Enabling this function always removes some class of string saftey issues.
The size change here in general is about 400 bytes and this seems a reasonable
trade-off.

Cc: Peng Fan <peng.fan@nxp.com>
Cc: Peter Robinson <pbrobinson@gmail.com>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Adrian Alonso <aalonso@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 7d9cde10 22-Nov-2015 Stefan Roese <sr@denx.de>

lib/tiny-printf.c: Add tiny printf function for space limited environments

This patch adds a small printf() version that supports all basic formats.
Its intented to be used in U-Boot SPL versions on platforms with very
limited internal RAM sizes.

To enable it, just define CONFIG_USE_TINY_PRINTF in your defconfig. This
will result in the SPL using this tiny function and the main U-Boot
still using the full-blown printf() function.

This code was copied from:
http://www.sparetimelabs.com/printfrevisited
With mostly only coding style related changes so that its checkpatch
clean.

The size reduction is about 2.5KiB. Here a comparison for the db-mv784mp-gp
(Marvell AXP) SPL:

Without this patch:
58963 18536 1928 79427 13643 ./spl/u-boot-spl

With this patch:
56542 18536 1956 77034 12cea ./spl/u-boot-spl

Note:
To make it possible to compile tiny-printf.c instead of vsprintf.c when
CONFIG_USE_TINY_PRINTF is defined, the functions printf() and vprintf() are
moved from common/console.c into vsprintf.c in this patch.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>

# 2419cd16 03-Oct-2015 Simon Glass <sjg@chromium.org>

dm: tpm: Drop CONFIG_DM_TPM

Now that all TPM drivers use driver model, we can drop the special driver
model CONFIG option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>

# 027b728d 06-Oct-2015 Julius Werner <jwerner@chromium.org>

Add support for LZ4 decompression algorithm

This patch adds support for LZ4-compressed FIT image contents. This
algorithm has a slightly worse compression ration than LZO while being
nearly twice as fast to decompress. When loading images from a fast
storage medium this usually results in a boot time win.

Sandbox-tested only since I don't have a U-Boot development system set
up right now. The code was imported unchanged from coreboot where it's
proven to work, though. I'm mostly interested in getting this recognized
by mkImage for use in a downstream project.

Signed-off-by: Julius Werner <jwerner@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# a7d660bc 22-Aug-2015 Simon Glass <sjg@chromium.org>

tpm: Add Kconfig options for TPMs

Add new Kconfig options for TPMs in preparation for moving boards to use
Kconfig for TPM configuration.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 867a6ac8 31-Jul-2015 Simon Glass <sjg@chromium.org>

efi: Add start-up library code

When running as an EFI application, U-Boot must request memory from EFI,
and provide access to the boot services U-Boot needs.

Add library code to perform these tasks. This includes efi_main() which is
the entry point from EFI. U-Boot is built as a shared library.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d1389403 23-Jun-2015 Simon Glass <sjg@chromium.org>

Add a dhrystone benchmark command

Drystone provides a convenient sanity check that the CPU is running at full
speed. Add this as a command which can be enabled as needed.

Note: I investigated using Coremark for this but there was a license
agreement and I could not work out if it was GPL-compatible.

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

# f7848d90 22-Jun-2015 Joe Hershberger <joe.hershberger@ni.com>

Allow CONFIG_REGEX to be disabled when CONFIG_NET

Instead of selecting REGEX when NET is enabled, make it the default, but
allow boards that are tiny to disable it and lose functionality on all
but the first Ethernet adapter.

cm-bf548, bf538f-ezkit, and bf533-stamp need this. None appear to have
more than one Ethernet interface.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# 3850dbe8 11-Jun-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

blackfin: fix undefined reference to srand and rand

Commit 9ba9e85f3f1c (net: Fix NET_RANDOM_ETHADDR dependencies)
accidentally dropped CONFIG_LIB_RAND defines for 14 Blackfin boards.

Prior to that commit, those boards defined CONFIG_LIB_RAND, but not
CONFIG_NET_RANDOM_ETHADDR. So, commit 9ba9e85f3f1c should not have
touched them, but in fact it ripped CONFIG_LIB_RAND off from all the
header files, which caused undefined reference to srand and rand.
CONFIG_LIB_RAND=y must be revived for such boards.

BTW, this commit indeed makes it better, but even with this fix,
three boards (bf533-stamp, bf538f-ezkit, cm-bf548) still can not
build due to region 'ram' overflowed error. This was cause by
commit 6eed3786c68c (net: Move the CMD_NET config to defconfigs)
because CMD_NET selects NET, and NET selects REGEX. Eventually,
some boards were newly enabled with CONFIG_REGEX, increasing the
memory footprint. A patch is expected to fix the build error.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 9ba9e85f 25-May-2015 Michal Simek <michal.simek@xilinx.com>

net: Fix NET_RANDOM_ETHADDR dependencies

NET_RANDOM_ETHADDR depends on lib/rand.c. This patch adds dependency to
Kconfig to ensure that library is also compiled.

Remove the definitions from Blackfin boards' include/configs.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 6501ff62 20-Apr-2015 Przemyslaw Marczak <p.marczak@samsung.com>

lib: Kconfig: add entry for errno_str() function

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1a60650c 21-Apr-2015 Joe Hershberger <joe.hershberger@ni.com>

kconfig: Move REGEX to Kconfig

Having this as a Kconfig allows it to be a dependent feature.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8156345d 06-Mar-2015 Simon Glass <sjg@chromium.org>

sandbox: Move CONFIG_SYS_VSNPRINTF to Kconfig

Move this over to Kconfig and tidy up.

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

# 94e3c8c4 19-Feb-2015 gaurav rana <gaurav.rana@freescale.com>

crypto/fsl - Add progressive hashing support using hardware acceleration.

Currently only normal hashing is supported using hardware acceleration.
Added support for progressive hashing using hardware.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
Signed-off-by: Gaurav Rana <gaurav.rana@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>

# d9f23c7f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

lib/rsa: Add Kconfig for devices supporting RSA Modular Exponentiation

Kconfig option added for devices which support RSA Verification.
1. RSA_SOFTWARE_EXP
Enables driver for supporting RSA Modular Exponentiation in Software
2. RSA_FREESCALE_EXP
Enables driver for supporting RSA Modular Exponentiation using Freescale specific
driver

The above drivers use RSA uclass

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
(Removed duplicate line in Kconfig comment)

Change-Id: I7663c4d5350e2bfc3dfa2696f70ef777d6ccc6f6

# c4beb22f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

FIT: Modify option FIT_SIGNATURE in Kconfig

For FIT signature based approach to work, RSA library needs to be selected.
The FIT_SIGNATURE option in Kconfig is modified to automatically select RSA.
Selecting RSA compiles the RSA library required for image verification.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 45ccec8f 23-Oct-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_USE_PRIVATE_LIBGCC to Kconfig

The private libgcc is supported only on ARM, MIPS, PowerPC, SH, x86.
Those architectures should "select" HAVE_PRIVATE_LIBGCC and
CONFIG_USE_PRIVATE_LIBGCC should depend on it.

Currently, this option is enabled on Tegra boards and x86 architecture.
Move the definition from header files to Kconfig.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Tested-by: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: Tom Warren <twarren@nvidia.com>

# 8c688bc4 23-Oct-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_SYS_HZ to lib/Kconfig

CONFIG_SYS_HZ is always defined as 1000 in config_fallbacks.h
(but some boards still have redundant definitions).

This commit moves the definition and the document in README to
Kconfig. Since lib/Kconfig can assure that CONFIG_SYS_HZ is 1000,
the sanity check in lib/time.c should be removed.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Reviewed-by: Marek Vasut <marex@denx.de>

# b0928da6 16-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED to Kconfig

If this option is enabled, the objects under lib/ directory
are compiled with speed optimization, not size optimization.
(Currently, only used by some Blackfin boards.)

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# ed36323f 16-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: add blank Kconfig files

This would be useful to start moving various config options.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# e7d285b2 25-Sep-2021 Simon Glass <sjg@chromium.org>

image: Use the correct checks for CRC32

Add a host Kconfig for CRC32. With this we can use CONFIG_IS_ENABLED(CRC32)
directly in the host build, so drop the unnecessary indirection.

Add a few more conditions to SPL_CRC32 to avoid build failures as well as
TPL_CRC32. Also update hash.c to make crc32 optional and to actually take
notice of SPL_CRC32.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# 2c21256b 25-Sep-2021 Simon Glass <sjg@chromium.org>

hash: Use Kconfig to enable hashing in host tools and SPL

At present when building host tools, we force CONFIG_SHAxxx to be enabled
regardless of the board Kconfig setting. This is done in the image.h
header file.

For SPL we currently just assume the algorithm is desired if U-Boot proper
enables it.

Clean this up by adding new Kconfig options to enable hashing on the host,
relying on CONFIG_IS_ENABLED() to deal with the different builds.

Add new SPL Kconfigs for hardware-accelerated hashing, to maintain the
current settings.

This allows us to drop the image.h code and the I_WANT_MD5 hack.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# 603d15a5 25-Sep-2021 Simon Glass <sjg@chromium.org>

spl: cypto: Bring back SPL_ versions of SHA

Unfortunately these were removed by mistake. This means that adding hash
support to SPL brings in all software algorithms, with a substantial
increase in code size.

The origin of the problem was renaming them to SPL_FIT_xxx and then these
were removed altogether in a later commit.

Add them back. This aligns with CONFIG_MD5, for example, which has an SPL
variant.

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: f5bc9c25f31 ("image: Rename SPL_SHAxxx_SUPPORT to SPL_FIT_SHAxxx")
Fixes: eb5171ddec9 ("common: Remove unused CONFIG_FIT_SHAxxx selectors")
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# 6674edaa 16-Sep-2021 Tom Rini <trini@konsulko.com>

Merge tag 'v2021.10-rc4' into next

Prepare v2021.10-rc4

Signed-off-by: Tom Rini <trini@konsulko.com>

# gpg: Signature made Tue 14 Sep 2021 06:58:32 PM EDT
# gpg: using RSA key 1A3C7F70E08FAB1707809BBF147C39FF9634B72C
# gpg: Good signature from "Thomas Rini <trini@konsulko.com>" [ultimate]

# Conflicts:
# board/Arcturus/ucp1020/spl.c
# cmd/mvebu/Kconfig
# common/Kconfig.boot
# common/image-fit.c
# configs/UCP1020_defconfig
# configs/sifive_unmatched_defconfig
# drivers/pci/Kconfig
# include/configs/UCP1020.h
# include/configs/sifive-unmatched.h
# lib/Makefile
# scripts/config_whitelist.txt


# 5145bc73 01-Sep-2021 Oleksandr Suvorov <oleksandr.suvorov@foundries.io>

lib: fix typos in Kconfig

There are trivial typos in the Kconfig file. Fixed them.
Also, fixed grammar in the descriptions with typos.

Fixes: d56b4b1974 ("configs: Migrate RBTREE, LZO, CMD_MTDPARTS, CMD_UBI and CMD_UBIFS")
Fixes: 7264f2928b ("spl: fit: Eanble GZIP support for image decompression")
Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# e60e4499 02-Sep-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

lib: Drop SHA512_ALGO in lieu of SHA512

SHA512_ALGO was used as a "either SHA512 or SHA384", although the
implementations of these two algorithms share a majority of code.

From a Kconfig interface perspective, it makes sense to present two
distinct options. This requires #ifdefing out the SHA512
implementation from sha512.c. The latter doesn't make any sense.

It's reasonable to say in Kconfig that SHA384 depends on SHA512, and
seems to be the more polite way to handle the selection.

Thus, automatically select SHA512 when SHA384 is enabled.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# b4c2c151 27-Aug-2021 Michal Simek <michal.simek@xilinx.com>

Kconfig: Remove all default n/no options

default n/no doesn't need to be specified. It is default option anyway.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
[trini: Rework FSP_USE_UPD portion]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 928a8be7 29-Jul-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

lib: ecdsa: Implement UCLASS_ECDSA verification on target

Implement the crypto_algo .verify() function for ecdsa256. Because
it backends on UCLASS_ECDSA, this change is focused on parsing the
keys from devicetree and passing this information to the specific
UCLASS driver.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# fa3f1f1d 24-Jul-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: disable CONFIG_SPL_HEXDUMP by default

CONFIG_HEXDUMP is needed to display UEFI variables using 'printenv -e'.

Enabling CONFIG_SPL_HEXDUMP only makes sense for debugging purposes.
Hence CONFIG_SPL_HEXDUMP should not be enabled by default.

The following boards currently have CONFIG_SPL_HEXDUMP=y. This includes
boards that don't use SPL at all.

axm_defconfig
imx8mm-cl-iot-gate_defconfig
imx8mm_venice_defconfig
imxrt1020-evk_defconfig
imxrt1050-evk_defconfig
kontron_sl28_defconfig
kp_imx53_defconfig
lx2160ardb_tfa_stmm_defconfig
mt7622_rfb_defconfig
octeon_ebb7304_defconfig
octeon_nic23_defconfig
qemu_arm64_defconfig
qemu_arm_defconfig
qemu-riscv32_defconfig
qemu-riscv32_smode_defconfig
qemu-riscv64_defconfig
qemu-riscv64_smode_defconfig
qemu-x86_64_defconfig
qemu-x86_defconfig
sandbox64_defconfig
sandbox_defconfig
stm32mp15_basic_defconfig
stm32mp15_trusted_defconfig
synquacer_developerbox_defconfig
taurus_defconfig
xilinx_versal_virt_defconfig

The patch only keeps it enabled on

sandbox_spl_defconfig

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 1a46cb6c 02-Jul-2021 Simon Glass <sjg@chromium.org>

lib: Create a new Kconfig option for charset conversion

Rather than looking at two KConfig options in the Makefile, create a new
Kconfig option for compiling lib/charset.c

Enable it for UFS also, which needs this support.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 26dd9936 08-Jul-2021 Steffen Jaeckel <jaeckel-floss@eyet-services.de>

lib: add crypt subsystem

Add the basic functionality required to support the standard crypt
format.
The files crypt-sha256.c and crypt-sha512.c originate from libxcrypt and
their formatting is therefor retained.
The integration is done via a crypt_compare() function in crypt.c.

```
libxcrypt $ git describe --long --always --all
tags/v4.4.17-0-g6b110bc
```

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 7d0f3fbb 11-Jun-2021 Tero Kristo <t-kristo@ti.com>

lib: rational: copy the rational fraction lib routines from Linux

Copy the best rational approximation calculation routines from Linux.
Typical usecase for these routines is to calculate the M/N divider
values for PLLs to reach a specific clock rate.

This is based on linux kernel commit:
"lib/math/rational.c: fix possible incorrect result from rational
fractions helper"
(sha1: 323dd2c3ed0641f49e89b4e420f9eef5d3d5a881)

Signed-off-by: Tero Kristo <t-kristo@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Tero Kristo <kristo@kernel.org>

# ec0512b1 24-May-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

Revert "lib: introduce HASH_CALCULATE option"

When we think of Kconfig, we usually think of features that we like
to enable or not. Ideally, we wouldn't use Kconfig to fix a build
issue, although sometimes it might make sense. With Kconfig it's hard
to guarantee that the fix is universal. We can only say that it works
for the set of tested configurations. In the majority of cases, it's
preferable to let the linker figure things out for us.

The reverted commit attempted to fix a build issue by adding an
invisible Kconfig option. This is wrong in several ways:

It invents a new Kconfig variable when CONFIG_HASH already
exists for the same purpose.
Second, hash-checksum.c makes use of the hash_progressive_lookup_algo()
symbol, which is only provided with CONFIG_HASH, but this dependency
was not expressed in the reverted patch.

It feels like Kconfig is turning into a listing of all available
source files, and a buffet to 'select' which ones to compile. The
purpose of this revert is to enable the next change to make use of
CONFIG_HASH instead of adding to Kconfig.

This reverts commit 87316da05f2fd49d3709275e64ef0c5980366ade.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Acked-by: Masahisa Kojima <masahisa.kojima@linaro.org>

# 1621d3c4 10-May-2021 Bin Meng <bmeng.cn@gmail.com>

lib: kconfig: Limit BINMAN_FDT for OF_SEPARATE or OF_EMBED

Generally speaking BINMAN_FDT makes sense for OF_SEPARATE or OF_EMBED.
For the other OF_CONTROL methods, it's quite possible binman node is
not available as binman is invoked during the build phase instead of
runtime. Let's only turn it on for OF_SEPARATE or OF_EMBED by default.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 87316da0 13-May-2021 Masahisa Kojima <masahisa.kojima@linaro.org>

lib: introduce HASH_CALCULATE option

Build error occurs when CONFIG_EFI_SECURE_BOOT or
CONFIG_EFI_CAPSULE_AUTHENTICATE is enabled,
because hash-checksum.c is not compiled.

Since hash_calculate() implemented in hash-checksum.c can be
commonly used aside from FIT image signature verification,
this commit itroduces HASH_CALCULATE option to decide
if hash-checksum.c shall be compiled.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# e2ae483c 13-May-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

hash: Kconfig option for SHA512 hardware acceleration

Commit a479f103dc1c ("hash: Allow for SHA512 hardware implementations")
defined function definitions for hardware accelerated SHA384 and SHA512.
If CONFIG_SHA_HW_ACCEL=y, these functions are used.

We already have boards using CONFIG_SHA_HW_ACCEL=y but none implements the
new functions hw_sha384() and hw_sha512().

For implementing the EFI TCG2 protocol we need SHA384 and SHA512. The
missing hardware acceleration functions lead to build errors on boards like
peach-pi_defconfig.

Introduce a new Kconfig symbol CONFIG_SHA512_HW_ACCEL to control if the
functions hw_sha384() and hw_sha512() shall be used to implement the SHA384
and SHA512 algorithms.

Fixes: a479f103dc1c ("hash: Allow for SHA512 hardware implementations")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

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

# 6d66502b 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: Add 2 config to define the max number of regions

Add 2 configs CONFIG_LMB_MEMORY_REGIONS and CONFIG_LMB_RESERVED_REGIONS
to change independently the max number of the regions in lmb
library.

When CONFIG_LMB_USE_MAX_REGIONS=y, move the lmb property arrays to
struct lmb and manage the array size with the element 'max' of struct
lmb_region; their are still allocated in stack.

When CONFIG_LMB_USE_MAX_REGIONS=n, keep the current location in
struct lmb_region to allow compiler optimization.

Increase CONFIG_LMB_RESERVED_REGIONS is useful to avoid lmb errors in
bootm when the number of reserved regions (not adjacent) is reached:
+ 1 region for relocated U-Boot
+ 1 region for initrd
+ 1 region for relocated linux device tree
+ reserved memory regions present in Linux device tree.

The current limit of 8 regions is reached with only 5 reserved regions
in DT.

see Linux kernel commit bf23c51f1f49 ("memblock: Move memblock arrays
to static storage in memblock.c and make their size a variable")

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# 4fa0150d 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: move MAX_LMB_REGIONS value in Kconfig

Move MAX_LMB_REGIONS value in Kconfig, the max number of the regions
in lmb library.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# 77b8cfef 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: move CONFIG_LMB in Kconfig

Migrate CONFIG_LMB in Kconfig.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# a479f103 16-Feb-2021 Joel Stanley <joel@jms.id.au>

hash: Allow for SHA512 hardware implementations

Similar to support for SHA1 and SHA256, allow the use of hardware hashing
engine by enabling the algorithm and setting CONFIG_SHA_HW_ACCEL /
CONFIG_SHA_PROG_HW_ACCEL.

Signed-off-by: Joel Stanley <joel@jms.id.au>

# f2c1442e 14-Mar-2021 Simon Glass <sjg@chromium.org>

bloblist: Make BLOBLIST_TABLES depend on BLOBLIST

Add an extra condition here since we cannot put x86 tables in a bloblist
when bloblists are not supported.

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

# e0103158 25-Feb-2021 Bin Meng <bmeng.cn@gmail.com>

lib: kconfig: Mention CONFIG_ADDR_MAP limitation in the help

Mention that CONFIG_ADDR_MAP only works in the post-relocation phase.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>

# 56e7257c 03-Feb-2021 Bin Meng <bmeng.cn@gmail.com>

lib: Fix BINMAN_FDT dependency

lib/binman.c references the following 3 ofnode APIs:
ofnode_first_subnode(), ofnode_path() and ofnode_read_bool().

These APIs get built only when DM is on. Fix the dependency then.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 59e4e391 18-Jan-2021 Tom Rini <trini@konsulko.com>

Merge https://gitlab.denx.de/u-boot/custodians/u-boot-riscv

- Update qemu-riscv.rst build instructions.
- Add support for SPI on Kendryte K210.
- Add Microchip PolarFire SoC Icicle Kit support.
- Add support for an early timer.
- Select TIMER_EARLY to avoid infinite recursion for Trace.


# a80f8513 17-Jan-2021 Pragnesh Patel <pragnesh.patel@sifive.com>

trace: select TIMER_EARLY to avoid infinite recursion

When tracing functions is enabled this adds calls to
__cyg_profile_func_enter() and __cyg_profile_func_exit() to the traced
functions.

__cyg_profile_func_enter() and __cyg_profile_func_exit() invoke
timer_get_us() to record the entry and exit time.

initr_dm() will make gd->dm_root = NULL and gd->timer = NULL, so
timer_get_us() -> get_ticks() -> dm_timer_init() will lead to an
indefinite recursion.

So select TIMER_EARLY when tracing got enabled.

Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Rick Chen <rick@andestech.com>

# 6205bbb1 04-Jan-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lib: cosmetic update of CONFIG_LIB_ELF description

Change 2 typo error in CONFIG_LIB_ELF description:
- Supoort => Support
- fir => for

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c589132a 02-Dec-2020 Aswath Govindraju <a-govindraju@ti.com>

fdt: Use phandle to distinguish DT nodes with same name

While assigning the sequence number to subsystem instances by reading the
aliases property, only DT nodes names are compared and not the complete
path. This causes a problem when there are two DT nodes with same name but
have different paths.

In arch/arm/dts/k3-am65-main.dtsi there are two USB controllers with the
same device tree node name but different path. When aliases are defined for
these USB controllers then fdtdec_get_alias_seq() fails to pick the correct
instance for a given index.

fdt_path_offset() function is slow and this would effect the U-Boot
startup. To avert the time penalty on all boards, apply this extra check
only when required by using a config option.

Fix it by comparing the phandles of DT nodes after the node names match,
under a config option.

Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Fix whitespace error in Kconfig:
Signed-off-by: Simon Glass <sjg@chromium.org>

# 28cef9ca 19-Nov-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

fs: fat: create correct short names

The current function set_name() used to create short names has the
following deficiencies resolved by this patch:

* Long names (e.g. FOO.TXT) are stored even if a short name is enough.
* Short names with spaces are created, e.g. "A ~1.TXT".
* Short names with illegal characters are created, e.g. "FOO++BAR".
* Debug output does not not consider that the short file name has no
concluding '\0'.

The solution for the following bug is split of into a separate patch:

* Short file names must be unique.

This patch only provides the loop over possible short file names.

Fixes: c30a15e590c ("FAT: Add FAT write feature")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# e4f8e543 05-Nov-2020 Simon Glass <sjg@chromium.org>

smbios: Drop the unused Kconfig options

Now that we can use devicetree to specify this information, drop the old
CONFIG options.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 44c74bdd 05-Nov-2020 Simon Glass <sjg@chromium.org>

sysinfo: Provide a default driver to set SMBIOS values

Some boards want to specify the manufacturer or product name but do not
need to have their own sysinfo driver.

Add a default driver which provides a way to specify this SMBIOS
information in the devicetree, without needing any board-specific
functionality.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d2cb7a22 04-Nov-2020 Simon Glass <sjg@chromium.org>

x86: Allow putting some tables in the bloblist

At present all tables are placed starting at address f0000 in memory, and
can be up to 64KB in size. If the tables are very large, this may not
provide enough space.

Also if the tables point to other tables (such as console log or a ramoops
area) then we must allocate other memory anyway.

The bloblist is a nice place to put these tables since it is contiguous,
which makes it easy to reserve this memory for linux using the 820 tables.

Add an option to put some of the tables in the bloblist. For SMBIOS and
ACPI, create suitable pointers from the f0000 region to the new location
of the tables.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
[bmeng: squashed in http://patchwork.ozlabs.org/project/uboot/patch/
20201105062407.1.I8091ad931cbbb5e3b6f6ababdf3f8d5db0d17bb9@changeid/]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# 415eab06 03-Nov-2020 Christian Gmeiner <christian.gmeiner@gmail.com>

smbios: add parsing API

Add a very simple API to be able to access SMBIOS strings
like vendor, model and bios version.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 72eda507 27-Oct-2020 Sean Anderson <seanga2@gmail.com>

lib: Add getopt

Some commands can get very unweildy if they have too many positional
arguments. Adding options makes them easier to read, remember, and
understand.

This implementation of getopt has been taken from barebox, which has had
option support for quite a while. I have made a few modifications to their
version, such as the removal of opterr in favor of a separate getopt_silent
function. In addition, I have moved all global variables into struct
getopt_context.

The getopt from barebox also re-orders the arguments passed to it so that
non-options are placed last. This allows users to specify options anywhere.
For example, `ls -l foo/ -R` would be re-ordered to `ls -l -R foo/` as
getopt parsed the options. However, this feature conflicts with the const
argv in cmd_tbl->cmd. This was originally added in 54841ab50c ("Make sure
that argv[] argument pointers are not modified."). The reason stated in
that commit is that hush requires argv to stay unmodified. Has this
situation changed? Barebox also uses hush, and does not have this problem.
Perhaps we could use their fix?

I have assigned maintenance of getopt to Simon Glass, as it is currently
only used by the log command. I would also be fine maintaining it.

Signed-off-by: Sean Anderson <seanga2@gmail.com>

# 26637e2e 12-Sep-2020 Simon Glass <sjg@chromium.org>

lib: Allow hexdump to be used in SPL

It is sometimes useful to output hex dumps in SPL. Add a config option to
allow this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# e87dfb05 05-Aug-2020 Andrii Anisov <andrii_anisov@epam.com>

lib: sscanf: add sscanf implementation

Port sscanf implementation from mini-os and introduce new
Kconfig option to enable it: CONFIG_SSCANF. Disable by default.

Signed-off-by: Andrii Anisov <andrii_anisov@epam.com>
Signed-off-by: Anastasiia Lukianenko <anastasiia_lukianenko@epam.com>
Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>

# 81014f73 30-Jul-2020 Joao Marcos Costa <joaomarcos.costa@bootlin.com>

include/u-boot, lib/zlib: add sources for zlib decompression

Add zlib (v1.2.11) uncompr() function to U-Boot. SquashFS depends on
this function to decompress data from a raw disk image. The actual
support for zlib into SquashFS sources will be added in a follow-up
commit.

Signed-off-by: Joao Marcos Costa <joaomarcos.costa@bootlin.com>

# 69be8fd1 03-Jun-2020 Marek Szyprowski <m.szyprowski@samsung.com>

powerpc: move ADDR_MAP to Kconfig

Move ADDR_MAP related config options from include/configs/*.h to the
proper place in lib/Kconfig. This has been done using
./tools/moveconfig.py and manual inspection of the generated changes.
This is a preparation to use ADDR_MAP helper on ARM 32bit Raspberry Pi4
board for mapping the PCIe XHCI MMIO, which is above the 4GiB identity
mapping limit.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# d16b38f4 15-Apr-2020 Reuben Dowle <reubendowle0@gmail.com>

Add support for SHA384 and SHA512

The current recommendation for best security practice from the US government
is to use SHA384 for TOP SECRET [1].

This patch adds support for SHA384 and SHA512 in the hash command, and also
allows FIT images to be hashed with these algorithms, and signed with
sha384,rsaXXXX and sha512,rsaXXXX

The SHA implementation is adapted from the linux kernel implementation.

[1] Commercial National Security Algorithm Suite
http://www.iad.gov/iad/programs/iad-initiatives/cnsa-suite.cfm

Signed-off-by: Reuben Dowle <reuben.dowle@4rf.com>

# 43e442a5 26-May-2020 Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

kconfig: fix some typos

Signed-off-by: Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

# eff5a547 22-May-2020 Michael Walle <michael@walle.cc>

cmd: zip: automatically pull in gzip()

Move the CONFIG_GZIP_COMPRESSED from a config.h macro to a Kconfig menu
item. It is not selectable by a user because there is no reason to do
so. Instead it will be automatically selected by the stuff which uses
gzip(), like the zip command.

Remove it from the config_whitelist.txt. Also remove
CONFIG_GZIP_COMPRESS_DEF_SZ as this was never used on any board. The
default seems to be sane, otherwise it should be added as a Kconfig
option.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8239be61 06-May-2020 Simon Glass <sjg@chromium.org>

lib: Allow MD5 to be enabled in SPL

At present the MD5 option cannot be enabled by board configs since it has
no Kconfig name. It is generally enabled, so long as FIT support is
present. But not all boards use FIT, particularly in SPL

Fix this and add an option for SPL as well. This allows board code to call
md5() even if FIT support is not enabled.

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

# 04cb3994 21-Apr-2020 Weijie Gao <weijie.gao@mediatek.com>

lib: enable lzma decompression support for SPL build

This patch enables LZMA decompression support for SPL build

Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>

# 2a2119e1 05-Mar-2020 Atish Patra <atish.patra@wdc.com>

lib: kconfig: Add option to set BZIP2 compression method

There is no way to select BZIP2 compression method.
Add it under library/compression config where all other
compression related configs are present.

Signed-off-by: Atish Patra <atish.patra@wdc.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 805b3cac 12-Feb-2020 Keerthy <j-keerthy@ti.com>

lib: elf: Move the generic elf loading/validating functions to lib

Move the generic elf loading/validating functions to lib/
so that they can be re-used and accessed by code existing
outside cmd.

While at it remove the duplicate static version of load_elf_image_phdr
under arch/arm/mach-imx/imx_bootaux.c.

Signed-off-by: Keerthy <j-keerthy@ti.com>
Suggested-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>

# 1611235b 19-Jan-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: Kconfig dependencies for pseudo-random library

drivers/rng/sandbox_rng.c requires rand() to be defined but configuration
option CONFIG_CONFIG_LIB_RAND selected in drivers/rng/Kconfig does not
exist.

test/lib/test_aes.c requires rand() to be defined.

Fix the selection criteria for choice "Pseudo-random library support type".

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 3c10dc95 06-Dec-2019 Simon Glass <sjg@chromium.org>

binman: Add a library to access binman entries

SPL and TPL can access information about binman entries using link-time
symbols but this is not available in U-Boot proper. Of course it could be
made available, but the intention is to just read the device tree.

Add support for this, so that U-Boot can locate entries.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# b4adf627 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: crypto: add x509 parser

Imported from linux kernel v5.3:
x509.asn1 without changes
x509_akid.asn1 without changes
x509_parser.h without changes
x509_cert_parser.c with changes marked as __UBOOT__
x509_public_key.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# a9b45e6e 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add oid registry utility

Imported from linux kernel v5.3:
build_OID_registry without changes
oid_registry.h without changes
oid_registry.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# ab8a0e06 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add asn1 decoder

Imported from linux kernel v5.3:
lib/asn1_decoder.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 2b12196d 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

cmd: add asn1_compiler

Imported from linux kernel v5.3:
asn1.h without changes
asn1_ber_bytecode.h without changes
asn1_decoder.h without changes
asn1_compiler.c without changes

This host command will be used to create a ASN1 parser, for example,
for pkcs7 messages or x509 certificates. More specifically, it will
generate *byte code* which will be interpreted by asn1 decoder library.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 05429b6c 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

rtc: move date.c from drivers/rtc/ to lib/

In the next commit, rtc_mktime(), for compatibility with linux, will be
implemented using rtc_mktime(), which is no longer drivers/rtc specific.
So move this file under lib/.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 37ef1774 10-Nov-2019 Thomas Hebb <tommyhebb@gmail.com>

Kconfig: disambiguate config names for tiny printf

27084c03d36a ("spl: Allow tiny printf() to be controlled in SPL and
TPL") split this option in two for TPL and SPL, but didn't change the
Kconfig names, making them hard to set quickly.

Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>

# 0d76afc0 27-Oct-2019 Simon Glass <sjg@chromium.org>

fdt: Add Kconfig options to control code size

For better or worse libfdt recent grew a lot of code that checks the
validity of the device tree in great detail. When using unsigned or
unverified data this makes things safer, but it does add to code size.

Add some controls to select the trade-off between safety and code size.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 27084c03 25-Sep-2019 Simon Glass <sjg@chromium.org>

spl: Allow tiny printf() to be controlled in SPL and TPL

At present there is only one control for this and it is used for both SPL
and TPL. But SPL might have a lot more space than TPL so the extra cost of
a full printf() might be acceptable.

Split the option into two, providing separate SPL and TPL controls. The
TPL setting defaults to the same as SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2a51e16b 07-Jun-2019 Tom Rini <trini@konsulko.com>

configs: Make USE_TINY_PRINTF depend on SPL||TPL and be default

The USE_TINY_PRINTF symbol only changes things within SPL and TPL
builds, so make it depend on that support. Next, make it default as
within these cases we should rarely have need of more advanced print
formats outside of the debug context.

To do this, in a few cases we need to correct our Kconfig dependencies
as we had cases of non-SPL targets select'ing this symbol. Finally, in
the case of a few boards we really do need the full printf
functionality.

Signed-off-by: Tom Rini <trini@konsulko.com>

# da0fb5fd 02-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: make call depth limit customizable

Up to now we had hard coded values for the call depth up to which trace
records are created: 200 for early tracing, 15 thereafter. UEFI
applications reach a call depth of 80 or above.

Provide customizing settings for the call trace depth limit and the early
call trace depth limit. Use the old values as defaults.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8509f22a 29-Apr-2019 Marek Behún <marek.behun@nic.cz>

lib: add Zstandard decompression support

Add the zstd library from Linux kernel (only decompression support).
There are minimal changes to build with U-Boot, otherwise the files are
identical to Linux commit dc35da16 from March 2018, the files had not
been touched since in kernel. Also SPDX lincese tags were added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 83a486b6 29-Apr-2019 Marek Behún <marek.behun@nic.cz>

lib: Add xxhash support

This adds the xxhash support from Linux. Files are almost identical to
those added to Linux in commit 5d240522 ("lib: Add xxhash module") (they
haven't been touched since in Linux). The only difference is to add some
includes to be compatible with U-Boot. Also SPDX lincese tags were
added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 5132361a 29-Apr-2019 Heiko Schocher <hs@denx.de>

lib: Kconfig: fix help text for GZIP

commit 95f4bbd581cf ("lib: fdt: Allow LZO and GZIP DT compression in U-Boot")

introduced Kconfig option for gzip in U-Boot, but help text
says gzip for SPL, which is wrong. Fix this.

Signed-off-by: Heiko Schocher <hs@denx.de>
Acked-by: Marek Vasut <marex@denx.de>

# 1c6eb075 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE_BUFFER_SIZE et al to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE_BUFFER_SIZE
CONFIG_TRACE_EARLY_SIZE
CONFIG_TRACE_EARLY
CONFIG_TRACE_EARLY_ADDR

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

# a24a78d7 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE

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

# 54969b40 21-Mar-2019 Thierry Reding <treding@nvidia.com>

fdtdec: Add Kconfig symbol for tests

Runtime tests are provided as a test_fdtdec command implementation. Add
a Kconfig symbol that allows this command to be built so that the tests
can be used.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 95f4bbd5 08-Mar-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

lib: fdt: Allow LZO and GZIP DT compression in U-Boot

Add required Kconfig symbols, Makefile bits and macro fixes in a
few places to support LZO and DT compression in U-Boot. This can
save a lot of space with multi-DTB fitImages.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>

# 6e705114 13-Jan-2019 Chris Packham <judge.packham@gmail.com>

lib: Kconfig: spelling fixes

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 048c6e89 06-Nov-2018 Simon Glass <sjg@chromium.org>

spl: lz4: Allow use of lz4 compression in SPL

In some cases U-Boot is compressed and it is useful to be able to
decompress it in SPL. Add a Kconfig and Makefile change to allow this.
Note that this does not actually implement decompression.

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

# 2895c4b7 15-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

kconfig: Introduce HAVE_ARCH_IOMAP

Introduce a new Kconfig option for architecture codes to control
whether it provides io{read,write}{8,16,32} I/O accessor functions.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5592a633 01-Oct-2018 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt in TPL

In some cases (e.g. sandbox with verified boot) it is useful to support
libfdt in TPL. Update the Kconfig to handle this.

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

# 6307896c 01-Oct-2018 Simon Glass <sjg@chromium.org>

tpm: Add support for SPL and TPL

At present the tpm can only be used in U-Boot proper. Updated it to work
in SPL and TPL also.

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

# ab948cd2 19-Jul-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

fdt_support: make FDT_FIXUP_PARTITIONS depend on CMD_MTDPARTS

fdt_fixup_mtdparts() calls mtdparts_init() and device_find(),
which are defined in cmd/mtdparts.c

The combination of FDT_FIXUP_PARTITIONS=y and CMD_MTDPARTS=n
emits the following link error:

common/fdt_support.c:903: undefined reference to `mtdparts_init'
common/fdt_support.c:914: undefined reference to `device_find'

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 3330584d 03-Jun-2018 Igor Opaniuk <igor.opaniuk@gmail.com>

avb2.0: integrate avb 2.0 into the build system

Integrate libavb into the build system. Introduce CONFIG_LIBAVB
build option.

Signed-off-by: Igor Opaniuk <igor.opaniuk@linaro.org>

# f8c987f8 05-Jun-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

lib: Add hexdump

Often during debugging session it's very interesting to see
what data we were dealing with. For example what we write or read
to/from memory or peripherals.

This change introduces functions that allow to dump binary
data with one simple function invocation like:
------------------->8----------------
print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, buf, len);
------------------->8----------------

which gives us the following:
------------------->8----------------
00000000: f2 b7 c9 88 62 61 75 64 72 61 74 65 3d 31 31 35 ....baudrate=115
00000010: 32 30 30 00 62 6f 6f 74 61 72 67 73 3d 63 6f 6e 200.bootargs=con
00000020: 73 6f 6c 65 3d 74 74 79 53 33 2c 31 31 35 32 30 sole=ttyS3,11520
00000030: 30 6e 38 00 62 6f 6f 74 64 65 6c 61 79 3d 33 00 0n8.bootdelay=3.
00000040: 62 6f 6f 74 66 69 6c 65 3d 75 49 6d 61 67 65 00 bootfile=uImage.
00000050: 66 64 74 63 6f 6e 74 72 6f 6c 61 64 64 72 3d 39 fdtcontroladdr=9
00000060: 66 66 62 31 62 61 30 00 6c 6f 61 64 61 64 64 72 ffb1ba0.loadaddr
00000070: 3d 30 78 38 32 30 30 30 30 30 30 00 73 74 64 65 =0x82000000.stde
00000080: 72 72 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 rr=serial0@e0022
00000090: 30 30 30 00 73 74 64 69 6e 3d 73 65 72 69 61 6c 000.stdin=serial
000000a0: 30 40 65 30 30 32 32 30 30 30 00 73 74 64 6f 75 0@e0022000.stdou
000000b0: 74 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 30 t=serial0@e00220
000000c0: 30 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00..............
...
------------------->8----------------

Source of hexdump.c was copied from Linux kernel v4.7-rc2.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Mario Six <mario.six@gdsys.cc>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Stefan Roese <sr@denx.de>

# c232d14d 29-May-2018 Alex Kiernan <alex.kiernan@gmail.com>

mmc: Separate "mmc swrite" from fastboot

Introduce CONFIG_IMAGE_SPARSE and CONFIG_CMD_MMC_SWRITE so the "mmc
swrite" command is separated from the fastboot code.

Move image-sparse from common to lib so it's clear it's library code.

Rename CONFIG_FASTBOOT_FLASH_FILLBUF_SIZE to CONFIG_IMAGE_SPARSE_FILLBUF_SIZE
and migrate it to Kconfig.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Acked-by: Jassi Brar <jaswinder.singh@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6417572e 08-May-2018 Tom Rini <trini@konsulko.com>

lib/Kconfig: Mark OF_LIBFDT_OVERLAY as depending on OF_LIBFDT

The overlay code is only useful when OF_LIBFDT is set, so mark it as
depending on that first.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 58a46f88 25-Apr-2018 Praneeth Bajjuri <praneeth@ti.com>

configs: TI: Enable FIT Library overlay support

Enable the FDT library overlay support for all TI SOC family.

Without this option, when Loading fdt from FIT image, the
following warning is seen.

"config with overlays but CONFIG_OF_LIBFDT_OVERLAY not set".

Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
Suggested-by: Andrew F.Davis <afd@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>

# 14ad44ab 18-Apr-2018 Alex Kiernan <alex.kiernan@gmail.com>

spl: Split sprintf, strto* from SPL serial in Kconfig

When SPL serial is disabled, callers who need sprintf or strtoul fail
because their inclusion is guarded by CONFIG_SPL_SERIAL_SUPPORT/
CONFIG_TPL_SERIAL_SUPPORT.

Split printf, sprintf and strto into their own entries and then select
all of them if SERIAL_SUPPORT is enabled to match the current behaviour.

Include panic.o unconditionally as it can be called from anywhere which
uses BUG_ON().

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>

# e294ba06 04-Apr-2018 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-sunxi

Signed-off-by: Tom Rini <trini@konsulko.com>


# d14db11d 03-Apr-2018 Andre Przywara <andre.przywara@arm.com>

sunxi: revert disabling of features

In January some commits were introduced to mitigate the U-Boot image
size issues we encountered on sunxi builds.
Now with the MMC environment removed we can bring them back, as we
practically don't have a size limit anymore.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 32ce6179 13-Mar-2018 Bryan O'Donoghue <bryan.odonoghue@linaro.org>

optee: Add lib entries for sharing OPTEE code across ports

This patch adds code to lib to enable sharing of useful OPTEE code between
board-ports and architectures. The code on lib/optee/optee.c comes from the
TI omap2 port. Eventually the OMAP2 code will be patched to include the
shared code. The intention here is to add more useful OPTEE specific code
as more functionality gets added.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Cc: Harinarayan Bhatta <harinarayan@ti.com>
Cc: Andrew F. Davis <afd@ti.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Kever Yang <kever.yang@rock-chips.com>
Cc: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Cc: Peng Fan <peng.fan@nxp.com>
Tested-by: Peng Fan <peng.fan@nxp.com>

# 36c1877c 06-Feb-2018 Faiz Abbas <faiz_abbas@ti.com>

lib: Kconfig: Move DYNAMIC_CRC_TABLE to Kconfig

Add CONFIG prefix to DYNAMIC_CRC_TABLE and implement it in
Kconfig.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>

# a451bc27 05-Feb-2018 Adam Ford <aford173@gmail.com>

Convert LIB_UUID to Kconfig

config_fallback.h has some logic that checks a variety of options
and selects LIB_UUID if it hasn't already been selected. This
will all LIB_UUID in Kconfig and select this option for the list
of options to allow us to remove the logic from fallbacks

Signed-off-by: Adam Ford <aford173@gmail.com>

# a5a37567 06-Feb-2018 Adam Ford <aford173@gmail.com>

Convert CONFIG LIB_HW_RAND to Kconfig

config_fallbacks.h had some logic to automatically select
LIB_RAND if RANDOM_UUID or CMD_UUID were set if LIB_HW_RAND wasn't
already selected. By migrating LIB_HW_RAND to Kconfig, we can
remove this check from config_fallbacks.h and put it into Kconfig

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
[trini: Turn into a choice, add NET_RANDOM_ETHADDR]
Signed-off-by: Tom Rini <trini@konsulko.com>

# acd4d334 16-Jan-2018 Maxime Ripard <maxime.ripard@free-electrons.com>

net: regex: Disable by default on sunXi

The sunXi arm64 build has overflown, leading to the main U-boot binary
overwriting the environment when flashing the new image, or even worse,
overwriting itself when we're calling saveenv.

Disable this option that is not critical until we can adress the issue
properly.

Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 7e3caa81 03-Dec-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

Move CONFIG_PANIC_HANG to Kconfig

Freescale (NXP) boards have lots of defconfig files per board.
I used "imply PANIC_HANG" for them.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# da5337a6 08-Nov-2017 Nandor Han <nandor.han@ge.com>

rtc: add support for s35392a

Add support for S35392A RTC. The driver supports both U-Boot driver
models.

Signed-off-by: Nandor Han <nandor.han@ge.com>
Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
Cc: Heiko Schocher <hs@denx.de>

# f52bdf4b 14-Sep-2017 Jean-Jacques Hiblot <jjhiblot@ti.com>

lib: allow building lzo for the SPL

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 85d8bf57 03-Sep-2017 Marek Behún <marek.behun@nic.cz>

lib: Add CRC32-C

This is needed for BTRFS.

Signed-off-by: Marek Behun <marek.behun@nic.cz>

create mode 100644 lib/crc32c.c

# 7264f292 15-Aug-2017 York Sun <york.sun@nxp.com>

spl: fit: Eanble GZIP support for image decompression

Add Kconfig option SPL_GZIP and SPL_ZLIB to enable gunzip support for
SPL boot, eg. falcon boot compressed kernel image.

Signed-off-by: York Sun <york.sun@nxp.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6ef2f901 11-Aug-2017 Adam Ford <aford173@gmail.com>

Convert CONFIG_BCH to Kconfig

This converts the following to Kconfig:
CONFIG_BCH

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1a7ba1d 18-Aug-2017 Anatolij Gustschin <agust@denx.de>

Fix 'notes' typos

s/notes/nodes

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 96b9082c 03-Aug-2017 Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

rockchip: rk3188: rock: adjust for SPL/TPL split

With the changes to split SPL/TPL for the RK3368, I apparently missed
some needed adjustments to the RK3188 Kconfig and rock_defconfig.

This fixes build-issues for the rock board after applying the RK3368
enablement (and SPL/TPL) set that resulted from TPL_SERIAL_SUPPORT,
TPL_ROCKCHIP_BACK_TO_BROM and TPL_TINY_MEMSET being separate symbols
now.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d56b4b19 22-Jul-2017 Tom Rini <trini@konsulko.com>

configs: Migrate RBTREE, LZO, CMD_MTDPARTS, CMD_UBI and CMD_UBIFS

The above CONFIG options are in Kconfig, and now have correct depends and
inter-dependencies. Migrate these to configs/ from include/configs/. In the
case of CMD_UBIFS also change it to be a default y if CMD_UBI.

Signed-off-by: Tom Rini <trini@konsulko.com>

# aed998aa 17-May-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_LZMA to Kconfig

This converts the following to Kconfig:
CONFIG_LZMA

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

# b1a873df 26-Apr-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_CMD_AES et al to Kconfig

This converts the following to Kconfig:
CONFIG_CMD_AES
CONFIG_AES

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Add select AES to CMD_AES]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 173aafbf 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

cmd: Expose a Kconfig option to enable UBIFS commands

Create a new Kconfig entry to allow CMD_UBIFS selection from Kconfig and
add an hidden LZO option that can be selected by CMD_UBIFS.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>

# aa049152 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

mtd: ubi: Select RBTREE option from MTD_UBI Kconfig entry

Expose the RBTREE feature through Kconfig and select this option from the
MTD_UBI option.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>
[Rebased on master]
Signed-off-by: Jagan Teki <jagan@openedev.com>

# ab4458bd 02-Apr-2017 Simon Glass <sjg@chromium.org>

string: Provide a slimmed-down memset()

Most of the time the optimised memset() is what we want. For extreme
situations such as TPL it may be too large. For example on the 'rock'
board, using a simple loop saves a useful 48 bytes. With gcc 4.9 and
the rodata bug, this patch is enough to reduce the TPL image below the
limit.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>

# bea79d7d 14-Mar-2017 Andre Przywara <andre.przywara@arm.com>

Kconfig: introduce md5sum command selection

So far CONFIG_MD5SUM would need to be set by a board's include file.
Since the command is really generic, move it over to Kconfig to allow
it to be defined by either a board's defconfig, menuconfig or some
config snippet merged via mergeconfig.sh.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e663b350 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

smbios: Expose in efi_loader as table

We can pass SMBIOS easily as EFI configuration table to an EFI payload. This
patch adds enablement for that case.

While at it, we also enable SMBIOS generation for ARM systems, since they support
EFI_LOADER.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4b6dddc2 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

x86: Move smbios generation into arch independent directory

We will need the SMBIOS generation function on ARM as well going forward,
so let's move it into a non arch specific location.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# ebf7fff2 05-Oct-2016 Heiko Schocher <hs@denx.de>

spl: move FDT_FIXUP_PARTITIONS to Kconfig

Move FDT_FIXUP_PARTITIONS to Kconfig and cleanup existing
uses.

Signed-off-by: Heiko Schocher <hs@denx.de>

# ddf67f71 05-Jul-2016 Maxime Ripard <maxime.ripard@free-electrons.com>

libfdt: Add overlay application function

The device tree overlays are a good way to deal with user-modifyable
boards or boards with some kind of an expansion mechanism where we can
easily plug new board in (like the BBB, the Raspberry Pi or the CHIP).

Add a new function to merge overlays with a base device tree.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>

# 91b86e21 26-May-2016 Marek Vasut <marex@denx.de>

lib: Enable private libgcc by default

This patch decouples U-Boot binary from the toolchain on systems where
private libgcc is available. Instead of pulling in functions provided
by the libgcc from the toolchain, U-Boot will use it's own set of libgcc
functions. These functions are usually imported from Linux kernel, which
also uses it's own libgcc functions instead of the ones provided by the
toolchain.

This patch solves a rather common problem. The toolchain can usually
generate code for many variants of target architecture and often even
different endianness. The libgcc on the other hand is usually compiled
for one particular configuration and the functions provided by it may
or may not be suited for use in U-Boot. This can manifest in two ways,
either the U-Boot fails to compile altogether and linker will complain
or, in the much worse case, the resulting U-Boot will build, but will
misbehave in very subtle and hard to debug ways.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 67976306 30-Mar-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

cosmetic: Fix typos "privide"

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# ed980b8c 03-Mar-2016 Alexander Graf <agraf@csgraf.de>

efi_loader: hook up in build environment

Now that we have all the bits and pieces ready for EFI payload loading
support, hook them up in Makefiles and KConfigs so that we can build.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
[trini: Enable only when we of OF_LIBFDT, disable on kwb and colibri_pxa270]
Signed-off-by: Tom Rini <trini@konsulko.com>

# aa34fbc0 22-Feb-2016 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt to be used in SPL

Add an option to enable libfdt in SPL. This can be useful when decoding
FIT files in SPL.

We need to make sure this option is not enabled in SPL by this change.
Also this option needs to be enabled in host builds. Si add a new
IMAGE_USE_LIBFDT #define which can be used in files that are built on the
host but must also build for U-Boot and SPL.

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

# 69e173eb 22-Feb-2016 Simon Glass <sjg@chromium.org>

Move CONFIG_OF_LIBFDT to Kconfig

Move this option to Kconfig and tidy up existing boards.

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

# a187559e 05-Feb-2016 Bin Meng <bmeng.cn@gmail.com>

Use correct spelling of "U-Boot"

Correct spelling of "U-Boot" shall be used in all written text
(documentation, comments in source files etc.).

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Minkyu Kang <mk7.kang@samsung.com>

# 947c626d 14-Jan-2016 Tom Rini <trini@konsulko.com>

vsprintf.c: Always enable CONFIG_SYS_VSNPRINTF

Enabling this function always removes some class of string saftey issues.
The size change here in general is about 400 bytes and this seems a reasonable
trade-off.

Cc: Peng Fan <peng.fan@nxp.com>
Cc: Peter Robinson <pbrobinson@gmail.com>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Adrian Alonso <aalonso@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 7d9cde10 22-Nov-2015 Stefan Roese <sr@denx.de>

lib/tiny-printf.c: Add tiny printf function for space limited environments

This patch adds a small printf() version that supports all basic formats.
Its intented to be used in U-Boot SPL versions on platforms with very
limited internal RAM sizes.

To enable it, just define CONFIG_USE_TINY_PRINTF in your defconfig. This
will result in the SPL using this tiny function and the main U-Boot
still using the full-blown printf() function.

This code was copied from:
http://www.sparetimelabs.com/printfrevisited
With mostly only coding style related changes so that its checkpatch
clean.

The size reduction is about 2.5KiB. Here a comparison for the db-mv784mp-gp
(Marvell AXP) SPL:

Without this patch:
58963 18536 1928 79427 13643 ./spl/u-boot-spl

With this patch:
56542 18536 1956 77034 12cea ./spl/u-boot-spl

Note:
To make it possible to compile tiny-printf.c instead of vsprintf.c when
CONFIG_USE_TINY_PRINTF is defined, the functions printf() and vprintf() are
moved from common/console.c into vsprintf.c in this patch.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>

# 2419cd16 03-Oct-2015 Simon Glass <sjg@chromium.org>

dm: tpm: Drop CONFIG_DM_TPM

Now that all TPM drivers use driver model, we can drop the special driver
model CONFIG option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>

# 027b728d 06-Oct-2015 Julius Werner <jwerner@chromium.org>

Add support for LZ4 decompression algorithm

This patch adds support for LZ4-compressed FIT image contents. This
algorithm has a slightly worse compression ration than LZO while being
nearly twice as fast to decompress. When loading images from a fast
storage medium this usually results in a boot time win.

Sandbox-tested only since I don't have a U-Boot development system set
up right now. The code was imported unchanged from coreboot where it's
proven to work, though. I'm mostly interested in getting this recognized
by mkImage for use in a downstream project.

Signed-off-by: Julius Werner <jwerner@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# a7d660bc 22-Aug-2015 Simon Glass <sjg@chromium.org>

tpm: Add Kconfig options for TPMs

Add new Kconfig options for TPMs in preparation for moving boards to use
Kconfig for TPM configuration.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 867a6ac8 31-Jul-2015 Simon Glass <sjg@chromium.org>

efi: Add start-up library code

When running as an EFI application, U-Boot must request memory from EFI,
and provide access to the boot services U-Boot needs.

Add library code to perform these tasks. This includes efi_main() which is
the entry point from EFI. U-Boot is built as a shared library.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d1389403 23-Jun-2015 Simon Glass <sjg@chromium.org>

Add a dhrystone benchmark command

Drystone provides a convenient sanity check that the CPU is running at full
speed. Add this as a command which can be enabled as needed.

Note: I investigated using Coremark for this but there was a license
agreement and I could not work out if it was GPL-compatible.

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

# f7848d90 22-Jun-2015 Joe Hershberger <joe.hershberger@ni.com>

Allow CONFIG_REGEX to be disabled when CONFIG_NET

Instead of selecting REGEX when NET is enabled, make it the default, but
allow boards that are tiny to disable it and lose functionality on all
but the first Ethernet adapter.

cm-bf548, bf538f-ezkit, and bf533-stamp need this. None appear to have
more than one Ethernet interface.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# 3850dbe8 11-Jun-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

blackfin: fix undefined reference to srand and rand

Commit 9ba9e85f3f1c (net: Fix NET_RANDOM_ETHADDR dependencies)
accidentally dropped CONFIG_LIB_RAND defines for 14 Blackfin boards.

Prior to that commit, those boards defined CONFIG_LIB_RAND, but not
CONFIG_NET_RANDOM_ETHADDR. So, commit 9ba9e85f3f1c should not have
touched them, but in fact it ripped CONFIG_LIB_RAND off from all the
header files, which caused undefined reference to srand and rand.
CONFIG_LIB_RAND=y must be revived for such boards.

BTW, this commit indeed makes it better, but even with this fix,
three boards (bf533-stamp, bf538f-ezkit, cm-bf548) still can not
build due to region 'ram' overflowed error. This was cause by
commit 6eed3786c68c (net: Move the CMD_NET config to defconfigs)
because CMD_NET selects NET, and NET selects REGEX. Eventually,
some boards were newly enabled with CONFIG_REGEX, increasing the
memory footprint. A patch is expected to fix the build error.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 9ba9e85f 25-May-2015 Michal Simek <michal.simek@xilinx.com>

net: Fix NET_RANDOM_ETHADDR dependencies

NET_RANDOM_ETHADDR depends on lib/rand.c. This patch adds dependency to
Kconfig to ensure that library is also compiled.

Remove the definitions from Blackfin boards' include/configs.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 6501ff62 20-Apr-2015 Przemyslaw Marczak <p.marczak@samsung.com>

lib: Kconfig: add entry for errno_str() function

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1a60650c 21-Apr-2015 Joe Hershberger <joe.hershberger@ni.com>

kconfig: Move REGEX to Kconfig

Having this as a Kconfig allows it to be a dependent feature.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8156345d 06-Mar-2015 Simon Glass <sjg@chromium.org>

sandbox: Move CONFIG_SYS_VSNPRINTF to Kconfig

Move this over to Kconfig and tidy up.

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

# 94e3c8c4 19-Feb-2015 gaurav rana <gaurav.rana@freescale.com>

crypto/fsl - Add progressive hashing support using hardware acceleration.

Currently only normal hashing is supported using hardware acceleration.
Added support for progressive hashing using hardware.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
Signed-off-by: Gaurav Rana <gaurav.rana@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>

# d9f23c7f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

lib/rsa: Add Kconfig for devices supporting RSA Modular Exponentiation

Kconfig option added for devices which support RSA Verification.
1. RSA_SOFTWARE_EXP
Enables driver for supporting RSA Modular Exponentiation in Software
2. RSA_FREESCALE_EXP
Enables driver for supporting RSA Modular Exponentiation using Freescale specific
driver

The above drivers use RSA uclass

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
(Removed duplicate line in Kconfig comment)

Change-Id: I7663c4d5350e2bfc3dfa2696f70ef777d6ccc6f6

# c4beb22f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

FIT: Modify option FIT_SIGNATURE in Kconfig

For FIT signature based approach to work, RSA library needs to be selected.
The FIT_SIGNATURE option in Kconfig is modified to automatically select RSA.
Selecting RSA compiles the RSA library required for image verification.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 45ccec8f 23-Oct-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_USE_PRIVATE_LIBGCC to Kconfig

The private libgcc is supported only on ARM, MIPS, PowerPC, SH, x86.
Those architectures should "select" HAVE_PRIVATE_LIBGCC and
CONFIG_USE_PRIVATE_LIBGCC should depend on it.

Currently, this option is enabled on Tegra boards and x86 architecture.
Move the definition from header files to Kconfig.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Tested-by: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: Tom Warren <twarren@nvidia.com>

# 8c688bc4 23-Oct-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_SYS_HZ to lib/Kconfig

CONFIG_SYS_HZ is always defined as 1000 in config_fallbacks.h
(but some boards still have redundant definitions).

This commit moves the definition and the document in README to
Kconfig. Since lib/Kconfig can assure that CONFIG_SYS_HZ is 1000,
the sanity check in lib/time.c should be removed.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Reviewed-by: Marek Vasut <marex@denx.de>

# b0928da6 16-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED to Kconfig

If this option is enabled, the objects under lib/ directory
are compiled with speed optimization, not size optimization.
(Currently, only used by some Blackfin boards.)

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# ed36323f 16-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: add blank Kconfig files

This would be useful to start moving various config options.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# 5145bc73 01-Sep-2021 Oleksandr Suvorov <oleksandr.suvorov@foundries.io>

lib: fix typos in Kconfig

There are trivial typos in the Kconfig file. Fixed them.
Also, fixed grammar in the descriptions with typos.

Fixes: d56b4b1974 ("configs: Migrate RBTREE, LZO, CMD_MTDPARTS, CMD_UBI and CMD_UBIFS")
Fixes: 7264f2928b ("spl: fit: Eanble GZIP support for image decompression")
Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# e60e4499 02-Sep-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

lib: Drop SHA512_ALGO in lieu of SHA512

SHA512_ALGO was used as a "either SHA512 or SHA384", although the
implementations of these two algorithms share a majority of code.

From a Kconfig interface perspective, it makes sense to present two
distinct options. This requires #ifdefing out the SHA512
implementation from sha512.c. The latter doesn't make any sense.

It's reasonable to say in Kconfig that SHA384 depends on SHA512, and
seems to be the more polite way to handle the selection.

Thus, automatically select SHA512 when SHA384 is enabled.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# 928a8be7 29-Jul-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

lib: ecdsa: Implement UCLASS_ECDSA verification on target

Implement the crypto_algo .verify() function for ecdsa256. Because
it backends on UCLASS_ECDSA, this change is focused on parsing the
keys from devicetree and passing this information to the specific
UCLASS driver.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# fa3f1f1d 24-Jul-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: disable CONFIG_SPL_HEXDUMP by default

CONFIG_HEXDUMP is needed to display UEFI variables using 'printenv -e'.

Enabling CONFIG_SPL_HEXDUMP only makes sense for debugging purposes.
Hence CONFIG_SPL_HEXDUMP should not be enabled by default.

The following boards currently have CONFIG_SPL_HEXDUMP=y. This includes
boards that don't use SPL at all.

axm_defconfig
imx8mm-cl-iot-gate_defconfig
imx8mm_venice_defconfig
imxrt1020-evk_defconfig
imxrt1050-evk_defconfig
kontron_sl28_defconfig
kp_imx53_defconfig
lx2160ardb_tfa_stmm_defconfig
mt7622_rfb_defconfig
octeon_ebb7304_defconfig
octeon_nic23_defconfig
qemu_arm64_defconfig
qemu_arm_defconfig
qemu-riscv32_defconfig
qemu-riscv32_smode_defconfig
qemu-riscv64_defconfig
qemu-riscv64_smode_defconfig
qemu-x86_64_defconfig
qemu-x86_defconfig
sandbox64_defconfig
sandbox_defconfig
stm32mp15_basic_defconfig
stm32mp15_trusted_defconfig
synquacer_developerbox_defconfig
taurus_defconfig
xilinx_versal_virt_defconfig

The patch only keeps it enabled on

sandbox_spl_defconfig

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 1a46cb6c 02-Jul-2021 Simon Glass <sjg@chromium.org>

lib: Create a new Kconfig option for charset conversion

Rather than looking at two KConfig options in the Makefile, create a new
Kconfig option for compiling lib/charset.c

Enable it for UFS also, which needs this support.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 26dd9936 08-Jul-2021 Steffen Jaeckel <jaeckel-floss@eyet-services.de>

lib: add crypt subsystem

Add the basic functionality required to support the standard crypt
format.
The files crypt-sha256.c and crypt-sha512.c originate from libxcrypt and
their formatting is therefor retained.
The integration is done via a crypt_compare() function in crypt.c.

```
libxcrypt $ git describe --long --always --all
tags/v4.4.17-0-g6b110bc
```

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 7d0f3fbb 11-Jun-2021 Tero Kristo <t-kristo@ti.com>

lib: rational: copy the rational fraction lib routines from Linux

Copy the best rational approximation calculation routines from Linux.
Typical usecase for these routines is to calculate the M/N divider
values for PLLs to reach a specific clock rate.

This is based on linux kernel commit:
"lib/math/rational.c: fix possible incorrect result from rational
fractions helper"
(sha1: 323dd2c3ed0641f49e89b4e420f9eef5d3d5a881)

Signed-off-by: Tero Kristo <t-kristo@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Tero Kristo <kristo@kernel.org>

# ec0512b1 24-May-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

Revert "lib: introduce HASH_CALCULATE option"

When we think of Kconfig, we usually think of features that we like
to enable or not. Ideally, we wouldn't use Kconfig to fix a build
issue, although sometimes it might make sense. With Kconfig it's hard
to guarantee that the fix is universal. We can only say that it works
for the set of tested configurations. In the majority of cases, it's
preferable to let the linker figure things out for us.

The reverted commit attempted to fix a build issue by adding an
invisible Kconfig option. This is wrong in several ways:

It invents a new Kconfig variable when CONFIG_HASH already
exists for the same purpose.
Second, hash-checksum.c makes use of the hash_progressive_lookup_algo()
symbol, which is only provided with CONFIG_HASH, but this dependency
was not expressed in the reverted patch.

It feels like Kconfig is turning into a listing of all available
source files, and a buffet to 'select' which ones to compile. The
purpose of this revert is to enable the next change to make use of
CONFIG_HASH instead of adding to Kconfig.

This reverts commit 87316da05f2fd49d3709275e64ef0c5980366ade.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Acked-by: Masahisa Kojima <masahisa.kojima@linaro.org>

# 1621d3c4 10-May-2021 Bin Meng <bmeng.cn@gmail.com>

lib: kconfig: Limit BINMAN_FDT for OF_SEPARATE or OF_EMBED

Generally speaking BINMAN_FDT makes sense for OF_SEPARATE or OF_EMBED.
For the other OF_CONTROL methods, it's quite possible binman node is
not available as binman is invoked during the build phase instead of
runtime. Let's only turn it on for OF_SEPARATE or OF_EMBED by default.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 87316da0 13-May-2021 Masahisa Kojima <masahisa.kojima@linaro.org>

lib: introduce HASH_CALCULATE option

Build error occurs when CONFIG_EFI_SECURE_BOOT or
CONFIG_EFI_CAPSULE_AUTHENTICATE is enabled,
because hash-checksum.c is not compiled.

Since hash_calculate() implemented in hash-checksum.c can be
commonly used aside from FIT image signature verification,
this commit itroduces HASH_CALCULATE option to decide
if hash-checksum.c shall be compiled.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# e2ae483c 13-May-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

hash: Kconfig option for SHA512 hardware acceleration

Commit a479f103dc1c ("hash: Allow for SHA512 hardware implementations")
defined function definitions for hardware accelerated SHA384 and SHA512.
If CONFIG_SHA_HW_ACCEL=y, these functions are used.

We already have boards using CONFIG_SHA_HW_ACCEL=y but none implements the
new functions hw_sha384() and hw_sha512().

For implementing the EFI TCG2 protocol we need SHA384 and SHA512. The
missing hardware acceleration functions lead to build errors on boards like
peach-pi_defconfig.

Introduce a new Kconfig symbol CONFIG_SHA512_HW_ACCEL to control if the
functions hw_sha384() and hw_sha512() shall be used to implement the SHA384
and SHA512 algorithms.

Fixes: a479f103dc1c ("hash: Allow for SHA512 hardware implementations")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

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

# 6d66502b 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: Add 2 config to define the max number of regions

Add 2 configs CONFIG_LMB_MEMORY_REGIONS and CONFIG_LMB_RESERVED_REGIONS
to change independently the max number of the regions in lmb
library.

When CONFIG_LMB_USE_MAX_REGIONS=y, move the lmb property arrays to
struct lmb and manage the array size with the element 'max' of struct
lmb_region; their are still allocated in stack.

When CONFIG_LMB_USE_MAX_REGIONS=n, keep the current location in
struct lmb_region to allow compiler optimization.

Increase CONFIG_LMB_RESERVED_REGIONS is useful to avoid lmb errors in
bootm when the number of reserved regions (not adjacent) is reached:
+ 1 region for relocated U-Boot
+ 1 region for initrd
+ 1 region for relocated linux device tree
+ reserved memory regions present in Linux device tree.

The current limit of 8 regions is reached with only 5 reserved regions
in DT.

see Linux kernel commit bf23c51f1f49 ("memblock: Move memblock arrays
to static storage in memblock.c and make their size a variable")

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# 4fa0150d 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: move MAX_LMB_REGIONS value in Kconfig

Move MAX_LMB_REGIONS value in Kconfig, the max number of the regions
in lmb library.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# 77b8cfef 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: move CONFIG_LMB in Kconfig

Migrate CONFIG_LMB in Kconfig.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# a479f103 16-Feb-2021 Joel Stanley <joel@jms.id.au>

hash: Allow for SHA512 hardware implementations

Similar to support for SHA1 and SHA256, allow the use of hardware hashing
engine by enabling the algorithm and setting CONFIG_SHA_HW_ACCEL /
CONFIG_SHA_PROG_HW_ACCEL.

Signed-off-by: Joel Stanley <joel@jms.id.au>

# f2c1442e 14-Mar-2021 Simon Glass <sjg@chromium.org>

bloblist: Make BLOBLIST_TABLES depend on BLOBLIST

Add an extra condition here since we cannot put x86 tables in a bloblist
when bloblists are not supported.

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

# e0103158 25-Feb-2021 Bin Meng <bmeng.cn@gmail.com>

lib: kconfig: Mention CONFIG_ADDR_MAP limitation in the help

Mention that CONFIG_ADDR_MAP only works in the post-relocation phase.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>

# 56e7257c 03-Feb-2021 Bin Meng <bmeng.cn@gmail.com>

lib: Fix BINMAN_FDT dependency

lib/binman.c references the following 3 ofnode APIs:
ofnode_first_subnode(), ofnode_path() and ofnode_read_bool().

These APIs get built only when DM is on. Fix the dependency then.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 59e4e391 18-Jan-2021 Tom Rini <trini@konsulko.com>

Merge https://gitlab.denx.de/u-boot/custodians/u-boot-riscv

- Update qemu-riscv.rst build instructions.
- Add support for SPI on Kendryte K210.
- Add Microchip PolarFire SoC Icicle Kit support.
- Add support for an early timer.
- Select TIMER_EARLY to avoid infinite recursion for Trace.


# a80f8513 17-Jan-2021 Pragnesh Patel <pragnesh.patel@sifive.com>

trace: select TIMER_EARLY to avoid infinite recursion

When tracing functions is enabled this adds calls to
__cyg_profile_func_enter() and __cyg_profile_func_exit() to the traced
functions.

__cyg_profile_func_enter() and __cyg_profile_func_exit() invoke
timer_get_us() to record the entry and exit time.

initr_dm() will make gd->dm_root = NULL and gd->timer = NULL, so
timer_get_us() -> get_ticks() -> dm_timer_init() will lead to an
indefinite recursion.

So select TIMER_EARLY when tracing got enabled.

Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Rick Chen <rick@andestech.com>

# 6205bbb1 04-Jan-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lib: cosmetic update of CONFIG_LIB_ELF description

Change 2 typo error in CONFIG_LIB_ELF description:
- Supoort => Support
- fir => for

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c589132a 02-Dec-2020 Aswath Govindraju <a-govindraju@ti.com>

fdt: Use phandle to distinguish DT nodes with same name

While assigning the sequence number to subsystem instances by reading the
aliases property, only DT nodes names are compared and not the complete
path. This causes a problem when there are two DT nodes with same name but
have different paths.

In arch/arm/dts/k3-am65-main.dtsi there are two USB controllers with the
same device tree node name but different path. When aliases are defined for
these USB controllers then fdtdec_get_alias_seq() fails to pick the correct
instance for a given index.

fdt_path_offset() function is slow and this would effect the U-Boot
startup. To avert the time penalty on all boards, apply this extra check
only when required by using a config option.

Fix it by comparing the phandles of DT nodes after the node names match,
under a config option.

Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Fix whitespace error in Kconfig:
Signed-off-by: Simon Glass <sjg@chromium.org>

# 28cef9ca 19-Nov-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

fs: fat: create correct short names

The current function set_name() used to create short names has the
following deficiencies resolved by this patch:

* Long names (e.g. FOO.TXT) are stored even if a short name is enough.
* Short names with spaces are created, e.g. "A ~1.TXT".
* Short names with illegal characters are created, e.g. "FOO++BAR".
* Debug output does not not consider that the short file name has no
concluding '\0'.

The solution for the following bug is split of into a separate patch:

* Short file names must be unique.

This patch only provides the loop over possible short file names.

Fixes: c30a15e590c ("FAT: Add FAT write feature")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# e4f8e543 05-Nov-2020 Simon Glass <sjg@chromium.org>

smbios: Drop the unused Kconfig options

Now that we can use devicetree to specify this information, drop the old
CONFIG options.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 44c74bdd 05-Nov-2020 Simon Glass <sjg@chromium.org>

sysinfo: Provide a default driver to set SMBIOS values

Some boards want to specify the manufacturer or product name but do not
need to have their own sysinfo driver.

Add a default driver which provides a way to specify this SMBIOS
information in the devicetree, without needing any board-specific
functionality.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d2cb7a22 04-Nov-2020 Simon Glass <sjg@chromium.org>

x86: Allow putting some tables in the bloblist

At present all tables are placed starting at address f0000 in memory, and
can be up to 64KB in size. If the tables are very large, this may not
provide enough space.

Also if the tables point to other tables (such as console log or a ramoops
area) then we must allocate other memory anyway.

The bloblist is a nice place to put these tables since it is contiguous,
which makes it easy to reserve this memory for linux using the 820 tables.

Add an option to put some of the tables in the bloblist. For SMBIOS and
ACPI, create suitable pointers from the f0000 region to the new location
of the tables.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
[bmeng: squashed in http://patchwork.ozlabs.org/project/uboot/patch/
20201105062407.1.I8091ad931cbbb5e3b6f6ababdf3f8d5db0d17bb9@changeid/]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# 415eab06 03-Nov-2020 Christian Gmeiner <christian.gmeiner@gmail.com>

smbios: add parsing API

Add a very simple API to be able to access SMBIOS strings
like vendor, model and bios version.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 72eda507 27-Oct-2020 Sean Anderson <seanga2@gmail.com>

lib: Add getopt

Some commands can get very unweildy if they have too many positional
arguments. Adding options makes them easier to read, remember, and
understand.

This implementation of getopt has been taken from barebox, which has had
option support for quite a while. I have made a few modifications to their
version, such as the removal of opterr in favor of a separate getopt_silent
function. In addition, I have moved all global variables into struct
getopt_context.

The getopt from barebox also re-orders the arguments passed to it so that
non-options are placed last. This allows users to specify options anywhere.
For example, `ls -l foo/ -R` would be re-ordered to `ls -l -R foo/` as
getopt parsed the options. However, this feature conflicts with the const
argv in cmd_tbl->cmd. This was originally added in 54841ab50c ("Make sure
that argv[] argument pointers are not modified."). The reason stated in
that commit is that hush requires argv to stay unmodified. Has this
situation changed? Barebox also uses hush, and does not have this problem.
Perhaps we could use their fix?

I have assigned maintenance of getopt to Simon Glass, as it is currently
only used by the log command. I would also be fine maintaining it.

Signed-off-by: Sean Anderson <seanga2@gmail.com>

# 26637e2e 12-Sep-2020 Simon Glass <sjg@chromium.org>

lib: Allow hexdump to be used in SPL

It is sometimes useful to output hex dumps in SPL. Add a config option to
allow this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# e87dfb05 05-Aug-2020 Andrii Anisov <andrii_anisov@epam.com>

lib: sscanf: add sscanf implementation

Port sscanf implementation from mini-os and introduce new
Kconfig option to enable it: CONFIG_SSCANF. Disable by default.

Signed-off-by: Andrii Anisov <andrii_anisov@epam.com>
Signed-off-by: Anastasiia Lukianenko <anastasiia_lukianenko@epam.com>
Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>

# 81014f73 30-Jul-2020 Joao Marcos Costa <joaomarcos.costa@bootlin.com>

include/u-boot, lib/zlib: add sources for zlib decompression

Add zlib (v1.2.11) uncompr() function to U-Boot. SquashFS depends on
this function to decompress data from a raw disk image. The actual
support for zlib into SquashFS sources will be added in a follow-up
commit.

Signed-off-by: Joao Marcos Costa <joaomarcos.costa@bootlin.com>

# 69be8fd1 03-Jun-2020 Marek Szyprowski <m.szyprowski@samsung.com>

powerpc: move ADDR_MAP to Kconfig

Move ADDR_MAP related config options from include/configs/*.h to the
proper place in lib/Kconfig. This has been done using
./tools/moveconfig.py and manual inspection of the generated changes.
This is a preparation to use ADDR_MAP helper on ARM 32bit Raspberry Pi4
board for mapping the PCIe XHCI MMIO, which is above the 4GiB identity
mapping limit.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# d16b38f4 15-Apr-2020 Reuben Dowle <reubendowle0@gmail.com>

Add support for SHA384 and SHA512

The current recommendation for best security practice from the US government
is to use SHA384 for TOP SECRET [1].

This patch adds support for SHA384 and SHA512 in the hash command, and also
allows FIT images to be hashed with these algorithms, and signed with
sha384,rsaXXXX and sha512,rsaXXXX

The SHA implementation is adapted from the linux kernel implementation.

[1] Commercial National Security Algorithm Suite
http://www.iad.gov/iad/programs/iad-initiatives/cnsa-suite.cfm

Signed-off-by: Reuben Dowle <reuben.dowle@4rf.com>

# 43e442a5 26-May-2020 Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

kconfig: fix some typos

Signed-off-by: Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

# eff5a547 22-May-2020 Michael Walle <michael@walle.cc>

cmd: zip: automatically pull in gzip()

Move the CONFIG_GZIP_COMPRESSED from a config.h macro to a Kconfig menu
item. It is not selectable by a user because there is no reason to do
so. Instead it will be automatically selected by the stuff which uses
gzip(), like the zip command.

Remove it from the config_whitelist.txt. Also remove
CONFIG_GZIP_COMPRESS_DEF_SZ as this was never used on any board. The
default seems to be sane, otherwise it should be added as a Kconfig
option.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8239be61 06-May-2020 Simon Glass <sjg@chromium.org>

lib: Allow MD5 to be enabled in SPL

At present the MD5 option cannot be enabled by board configs since it has
no Kconfig name. It is generally enabled, so long as FIT support is
present. But not all boards use FIT, particularly in SPL

Fix this and add an option for SPL as well. This allows board code to call
md5() even if FIT support is not enabled.

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

# 04cb3994 21-Apr-2020 Weijie Gao <weijie.gao@mediatek.com>

lib: enable lzma decompression support for SPL build

This patch enables LZMA decompression support for SPL build

Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>

# 2a2119e1 05-Mar-2020 Atish Patra <atish.patra@wdc.com>

lib: kconfig: Add option to set BZIP2 compression method

There is no way to select BZIP2 compression method.
Add it under library/compression config where all other
compression related configs are present.

Signed-off-by: Atish Patra <atish.patra@wdc.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 805b3cac 12-Feb-2020 Keerthy <j-keerthy@ti.com>

lib: elf: Move the generic elf loading/validating functions to lib

Move the generic elf loading/validating functions to lib/
so that they can be re-used and accessed by code existing
outside cmd.

While at it remove the duplicate static version of load_elf_image_phdr
under arch/arm/mach-imx/imx_bootaux.c.

Signed-off-by: Keerthy <j-keerthy@ti.com>
Suggested-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>

# 1611235b 19-Jan-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: Kconfig dependencies for pseudo-random library

drivers/rng/sandbox_rng.c requires rand() to be defined but configuration
option CONFIG_CONFIG_LIB_RAND selected in drivers/rng/Kconfig does not
exist.

test/lib/test_aes.c requires rand() to be defined.

Fix the selection criteria for choice "Pseudo-random library support type".

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 3c10dc95 06-Dec-2019 Simon Glass <sjg@chromium.org>

binman: Add a library to access binman entries

SPL and TPL can access information about binman entries using link-time
symbols but this is not available in U-Boot proper. Of course it could be
made available, but the intention is to just read the device tree.

Add support for this, so that U-Boot can locate entries.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# b4adf627 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: crypto: add x509 parser

Imported from linux kernel v5.3:
x509.asn1 without changes
x509_akid.asn1 without changes
x509_parser.h without changes
x509_cert_parser.c with changes marked as __UBOOT__
x509_public_key.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# a9b45e6e 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add oid registry utility

Imported from linux kernel v5.3:
build_OID_registry without changes
oid_registry.h without changes
oid_registry.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# ab8a0e06 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add asn1 decoder

Imported from linux kernel v5.3:
lib/asn1_decoder.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 2b12196d 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

cmd: add asn1_compiler

Imported from linux kernel v5.3:
asn1.h without changes
asn1_ber_bytecode.h without changes
asn1_decoder.h without changes
asn1_compiler.c without changes

This host command will be used to create a ASN1 parser, for example,
for pkcs7 messages or x509 certificates. More specifically, it will
generate *byte code* which will be interpreted by asn1 decoder library.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 05429b6c 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

rtc: move date.c from drivers/rtc/ to lib/

In the next commit, rtc_mktime(), for compatibility with linux, will be
implemented using rtc_mktime(), which is no longer drivers/rtc specific.
So move this file under lib/.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 37ef1774 10-Nov-2019 Thomas Hebb <tommyhebb@gmail.com>

Kconfig: disambiguate config names for tiny printf

27084c03d36a ("spl: Allow tiny printf() to be controlled in SPL and
TPL") split this option in two for TPL and SPL, but didn't change the
Kconfig names, making them hard to set quickly.

Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>

# 0d76afc0 27-Oct-2019 Simon Glass <sjg@chromium.org>

fdt: Add Kconfig options to control code size

For better or worse libfdt recent grew a lot of code that checks the
validity of the device tree in great detail. When using unsigned or
unverified data this makes things safer, but it does add to code size.

Add some controls to select the trade-off between safety and code size.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 27084c03 25-Sep-2019 Simon Glass <sjg@chromium.org>

spl: Allow tiny printf() to be controlled in SPL and TPL

At present there is only one control for this and it is used for both SPL
and TPL. But SPL might have a lot more space than TPL so the extra cost of
a full printf() might be acceptable.

Split the option into two, providing separate SPL and TPL controls. The
TPL setting defaults to the same as SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2a51e16b 07-Jun-2019 Tom Rini <trini@konsulko.com>

configs: Make USE_TINY_PRINTF depend on SPL||TPL and be default

The USE_TINY_PRINTF symbol only changes things within SPL and TPL
builds, so make it depend on that support. Next, make it default as
within these cases we should rarely have need of more advanced print
formats outside of the debug context.

To do this, in a few cases we need to correct our Kconfig dependencies
as we had cases of non-SPL targets select'ing this symbol. Finally, in
the case of a few boards we really do need the full printf
functionality.

Signed-off-by: Tom Rini <trini@konsulko.com>

# da0fb5fd 02-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: make call depth limit customizable

Up to now we had hard coded values for the call depth up to which trace
records are created: 200 for early tracing, 15 thereafter. UEFI
applications reach a call depth of 80 or above.

Provide customizing settings for the call trace depth limit and the early
call trace depth limit. Use the old values as defaults.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8509f22a 29-Apr-2019 Marek Behún <marek.behun@nic.cz>

lib: add Zstandard decompression support

Add the zstd library from Linux kernel (only decompression support).
There are minimal changes to build with U-Boot, otherwise the files are
identical to Linux commit dc35da16 from March 2018, the files had not
been touched since in kernel. Also SPDX lincese tags were added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 83a486b6 29-Apr-2019 Marek Behún <marek.behun@nic.cz>

lib: Add xxhash support

This adds the xxhash support from Linux. Files are almost identical to
those added to Linux in commit 5d240522 ("lib: Add xxhash module") (they
haven't been touched since in Linux). The only difference is to add some
includes to be compatible with U-Boot. Also SPDX lincese tags were
added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 5132361a 29-Apr-2019 Heiko Schocher <hs@denx.de>

lib: Kconfig: fix help text for GZIP

commit 95f4bbd581cf ("lib: fdt: Allow LZO and GZIP DT compression in U-Boot")

introduced Kconfig option for gzip in U-Boot, but help text
says gzip for SPL, which is wrong. Fix this.

Signed-off-by: Heiko Schocher <hs@denx.de>
Acked-by: Marek Vasut <marex@denx.de>

# 1c6eb075 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE_BUFFER_SIZE et al to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE_BUFFER_SIZE
CONFIG_TRACE_EARLY_SIZE
CONFIG_TRACE_EARLY
CONFIG_TRACE_EARLY_ADDR

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

# a24a78d7 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE

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

# 54969b40 21-Mar-2019 Thierry Reding <treding@nvidia.com>

fdtdec: Add Kconfig symbol for tests

Runtime tests are provided as a test_fdtdec command implementation. Add
a Kconfig symbol that allows this command to be built so that the tests
can be used.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 95f4bbd5 08-Mar-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

lib: fdt: Allow LZO and GZIP DT compression in U-Boot

Add required Kconfig symbols, Makefile bits and macro fixes in a
few places to support LZO and DT compression in U-Boot. This can
save a lot of space with multi-DTB fitImages.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>

# 6e705114 13-Jan-2019 Chris Packham <judge.packham@gmail.com>

lib: Kconfig: spelling fixes

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 048c6e89 06-Nov-2018 Simon Glass <sjg@chromium.org>

spl: lz4: Allow use of lz4 compression in SPL

In some cases U-Boot is compressed and it is useful to be able to
decompress it in SPL. Add a Kconfig and Makefile change to allow this.
Note that this does not actually implement decompression.

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

# 2895c4b7 15-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

kconfig: Introduce HAVE_ARCH_IOMAP

Introduce a new Kconfig option for architecture codes to control
whether it provides io{read,write}{8,16,32} I/O accessor functions.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5592a633 01-Oct-2018 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt in TPL

In some cases (e.g. sandbox with verified boot) it is useful to support
libfdt in TPL. Update the Kconfig to handle this.

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

# 6307896c 01-Oct-2018 Simon Glass <sjg@chromium.org>

tpm: Add support for SPL and TPL

At present the tpm can only be used in U-Boot proper. Updated it to work
in SPL and TPL also.

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

# ab948cd2 19-Jul-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

fdt_support: make FDT_FIXUP_PARTITIONS depend on CMD_MTDPARTS

fdt_fixup_mtdparts() calls mtdparts_init() and device_find(),
which are defined in cmd/mtdparts.c

The combination of FDT_FIXUP_PARTITIONS=y and CMD_MTDPARTS=n
emits the following link error:

common/fdt_support.c:903: undefined reference to `mtdparts_init'
common/fdt_support.c:914: undefined reference to `device_find'

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 3330584d 03-Jun-2018 Igor Opaniuk <igor.opaniuk@gmail.com>

avb2.0: integrate avb 2.0 into the build system

Integrate libavb into the build system. Introduce CONFIG_LIBAVB
build option.

Signed-off-by: Igor Opaniuk <igor.opaniuk@linaro.org>

# f8c987f8 05-Jun-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

lib: Add hexdump

Often during debugging session it's very interesting to see
what data we were dealing with. For example what we write or read
to/from memory or peripherals.

This change introduces functions that allow to dump binary
data with one simple function invocation like:
------------------->8----------------
print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, buf, len);
------------------->8----------------

which gives us the following:
------------------->8----------------
00000000: f2 b7 c9 88 62 61 75 64 72 61 74 65 3d 31 31 35 ....baudrate=115
00000010: 32 30 30 00 62 6f 6f 74 61 72 67 73 3d 63 6f 6e 200.bootargs=con
00000020: 73 6f 6c 65 3d 74 74 79 53 33 2c 31 31 35 32 30 sole=ttyS3,11520
00000030: 30 6e 38 00 62 6f 6f 74 64 65 6c 61 79 3d 33 00 0n8.bootdelay=3.
00000040: 62 6f 6f 74 66 69 6c 65 3d 75 49 6d 61 67 65 00 bootfile=uImage.
00000050: 66 64 74 63 6f 6e 74 72 6f 6c 61 64 64 72 3d 39 fdtcontroladdr=9
00000060: 66 66 62 31 62 61 30 00 6c 6f 61 64 61 64 64 72 ffb1ba0.loadaddr
00000070: 3d 30 78 38 32 30 30 30 30 30 30 00 73 74 64 65 =0x82000000.stde
00000080: 72 72 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 rr=serial0@e0022
00000090: 30 30 30 00 73 74 64 69 6e 3d 73 65 72 69 61 6c 000.stdin=serial
000000a0: 30 40 65 30 30 32 32 30 30 30 00 73 74 64 6f 75 0@e0022000.stdou
000000b0: 74 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 30 t=serial0@e00220
000000c0: 30 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00..............
...
------------------->8----------------

Source of hexdump.c was copied from Linux kernel v4.7-rc2.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Mario Six <mario.six@gdsys.cc>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Stefan Roese <sr@denx.de>

# c232d14d 29-May-2018 Alex Kiernan <alex.kiernan@gmail.com>

mmc: Separate "mmc swrite" from fastboot

Introduce CONFIG_IMAGE_SPARSE and CONFIG_CMD_MMC_SWRITE so the "mmc
swrite" command is separated from the fastboot code.

Move image-sparse from common to lib so it's clear it's library code.

Rename CONFIG_FASTBOOT_FLASH_FILLBUF_SIZE to CONFIG_IMAGE_SPARSE_FILLBUF_SIZE
and migrate it to Kconfig.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Acked-by: Jassi Brar <jaswinder.singh@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6417572e 08-May-2018 Tom Rini <trini@konsulko.com>

lib/Kconfig: Mark OF_LIBFDT_OVERLAY as depending on OF_LIBFDT

The overlay code is only useful when OF_LIBFDT is set, so mark it as
depending on that first.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 58a46f88 25-Apr-2018 Praneeth Bajjuri <praneeth@ti.com>

configs: TI: Enable FIT Library overlay support

Enable the FDT library overlay support for all TI SOC family.

Without this option, when Loading fdt from FIT image, the
following warning is seen.

"config with overlays but CONFIG_OF_LIBFDT_OVERLAY not set".

Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
Suggested-by: Andrew F.Davis <afd@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>

# 14ad44ab 18-Apr-2018 Alex Kiernan <alex.kiernan@gmail.com>

spl: Split sprintf, strto* from SPL serial in Kconfig

When SPL serial is disabled, callers who need sprintf or strtoul fail
because their inclusion is guarded by CONFIG_SPL_SERIAL_SUPPORT/
CONFIG_TPL_SERIAL_SUPPORT.

Split printf, sprintf and strto into their own entries and then select
all of them if SERIAL_SUPPORT is enabled to match the current behaviour.

Include panic.o unconditionally as it can be called from anywhere which
uses BUG_ON().

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>

# e294ba06 04-Apr-2018 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-sunxi

Signed-off-by: Tom Rini <trini@konsulko.com>


# d14db11d 03-Apr-2018 Andre Przywara <andre.przywara@arm.com>

sunxi: revert disabling of features

In January some commits were introduced to mitigate the U-Boot image
size issues we encountered on sunxi builds.
Now with the MMC environment removed we can bring them back, as we
practically don't have a size limit anymore.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 32ce6179 13-Mar-2018 Bryan O'Donoghue <bryan.odonoghue@linaro.org>

optee: Add lib entries for sharing OPTEE code across ports

This patch adds code to lib to enable sharing of useful OPTEE code between
board-ports and architectures. The code on lib/optee/optee.c comes from the
TI omap2 port. Eventually the OMAP2 code will be patched to include the
shared code. The intention here is to add more useful OPTEE specific code
as more functionality gets added.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Cc: Harinarayan Bhatta <harinarayan@ti.com>
Cc: Andrew F. Davis <afd@ti.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Kever Yang <kever.yang@rock-chips.com>
Cc: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Cc: Peng Fan <peng.fan@nxp.com>
Tested-by: Peng Fan <peng.fan@nxp.com>

# 36c1877c 06-Feb-2018 Faiz Abbas <faiz_abbas@ti.com>

lib: Kconfig: Move DYNAMIC_CRC_TABLE to Kconfig

Add CONFIG prefix to DYNAMIC_CRC_TABLE and implement it in
Kconfig.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>

# a451bc27 05-Feb-2018 Adam Ford <aford173@gmail.com>

Convert LIB_UUID to Kconfig

config_fallback.h has some logic that checks a variety of options
and selects LIB_UUID if it hasn't already been selected. This
will all LIB_UUID in Kconfig and select this option for the list
of options to allow us to remove the logic from fallbacks

Signed-off-by: Adam Ford <aford173@gmail.com>

# a5a37567 06-Feb-2018 Adam Ford <aford173@gmail.com>

Convert CONFIG LIB_HW_RAND to Kconfig

config_fallbacks.h had some logic to automatically select
LIB_RAND if RANDOM_UUID or CMD_UUID were set if LIB_HW_RAND wasn't
already selected. By migrating LIB_HW_RAND to Kconfig, we can
remove this check from config_fallbacks.h and put it into Kconfig

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
[trini: Turn into a choice, add NET_RANDOM_ETHADDR]
Signed-off-by: Tom Rini <trini@konsulko.com>

# acd4d334 16-Jan-2018 Maxime Ripard <maxime.ripard@free-electrons.com>

net: regex: Disable by default on sunXi

The sunXi arm64 build has overflown, leading to the main U-boot binary
overwriting the environment when flashing the new image, or even worse,
overwriting itself when we're calling saveenv.

Disable this option that is not critical until we can adress the issue
properly.

Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 7e3caa81 03-Dec-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

Move CONFIG_PANIC_HANG to Kconfig

Freescale (NXP) boards have lots of defconfig files per board.
I used "imply PANIC_HANG" for them.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# da5337a6 08-Nov-2017 Nandor Han <nandor.han@ge.com>

rtc: add support for s35392a

Add support for S35392A RTC. The driver supports both U-Boot driver
models.

Signed-off-by: Nandor Han <nandor.han@ge.com>
Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
Cc: Heiko Schocher <hs@denx.de>

# f52bdf4b 14-Sep-2017 Jean-Jacques Hiblot <jjhiblot@ti.com>

lib: allow building lzo for the SPL

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 85d8bf57 03-Sep-2017 Marek Behún <marek.behun@nic.cz>

lib: Add CRC32-C

This is needed for BTRFS.

Signed-off-by: Marek Behun <marek.behun@nic.cz>

create mode 100644 lib/crc32c.c

# 7264f292 15-Aug-2017 York Sun <york.sun@nxp.com>

spl: fit: Eanble GZIP support for image decompression

Add Kconfig option SPL_GZIP and SPL_ZLIB to enable gunzip support for
SPL boot, eg. falcon boot compressed kernel image.

Signed-off-by: York Sun <york.sun@nxp.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6ef2f901 11-Aug-2017 Adam Ford <aford173@gmail.com>

Convert CONFIG_BCH to Kconfig

This converts the following to Kconfig:
CONFIG_BCH

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1a7ba1d 18-Aug-2017 Anatolij Gustschin <agust@denx.de>

Fix 'notes' typos

s/notes/nodes

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 96b9082c 03-Aug-2017 Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

rockchip: rk3188: rock: adjust for SPL/TPL split

With the changes to split SPL/TPL for the RK3368, I apparently missed
some needed adjustments to the RK3188 Kconfig and rock_defconfig.

This fixes build-issues for the rock board after applying the RK3368
enablement (and SPL/TPL) set that resulted from TPL_SERIAL_SUPPORT,
TPL_ROCKCHIP_BACK_TO_BROM and TPL_TINY_MEMSET being separate symbols
now.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d56b4b19 22-Jul-2017 Tom Rini <trini@konsulko.com>

configs: Migrate RBTREE, LZO, CMD_MTDPARTS, CMD_UBI and CMD_UBIFS

The above CONFIG options are in Kconfig, and now have correct depends and
inter-dependencies. Migrate these to configs/ from include/configs/. In the
case of CMD_UBIFS also change it to be a default y if CMD_UBI.

Signed-off-by: Tom Rini <trini@konsulko.com>

# aed998aa 17-May-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_LZMA to Kconfig

This converts the following to Kconfig:
CONFIG_LZMA

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

# b1a873df 26-Apr-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_CMD_AES et al to Kconfig

This converts the following to Kconfig:
CONFIG_CMD_AES
CONFIG_AES

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Add select AES to CMD_AES]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 173aafbf 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

cmd: Expose a Kconfig option to enable UBIFS commands

Create a new Kconfig entry to allow CMD_UBIFS selection from Kconfig and
add an hidden LZO option that can be selected by CMD_UBIFS.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>

# aa049152 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

mtd: ubi: Select RBTREE option from MTD_UBI Kconfig entry

Expose the RBTREE feature through Kconfig and select this option from the
MTD_UBI option.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>
[Rebased on master]
Signed-off-by: Jagan Teki <jagan@openedev.com>

# ab4458bd 02-Apr-2017 Simon Glass <sjg@chromium.org>

string: Provide a slimmed-down memset()

Most of the time the optimised memset() is what we want. For extreme
situations such as TPL it may be too large. For example on the 'rock'
board, using a simple loop saves a useful 48 bytes. With gcc 4.9 and
the rodata bug, this patch is enough to reduce the TPL image below the
limit.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>

# bea79d7d 14-Mar-2017 Andre Przywara <andre.przywara@arm.com>

Kconfig: introduce md5sum command selection

So far CONFIG_MD5SUM would need to be set by a board's include file.
Since the command is really generic, move it over to Kconfig to allow
it to be defined by either a board's defconfig, menuconfig or some
config snippet merged via mergeconfig.sh.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e663b350 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

smbios: Expose in efi_loader as table

We can pass SMBIOS easily as EFI configuration table to an EFI payload. This
patch adds enablement for that case.

While at it, we also enable SMBIOS generation for ARM systems, since they support
EFI_LOADER.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4b6dddc2 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

x86: Move smbios generation into arch independent directory

We will need the SMBIOS generation function on ARM as well going forward,
so let's move it into a non arch specific location.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# ebf7fff2 05-Oct-2016 Heiko Schocher <hs@denx.de>

spl: move FDT_FIXUP_PARTITIONS to Kconfig

Move FDT_FIXUP_PARTITIONS to Kconfig and cleanup existing
uses.

Signed-off-by: Heiko Schocher <hs@denx.de>

# ddf67f71 05-Jul-2016 Maxime Ripard <maxime.ripard@free-electrons.com>

libfdt: Add overlay application function

The device tree overlays are a good way to deal with user-modifyable
boards or boards with some kind of an expansion mechanism where we can
easily plug new board in (like the BBB, the Raspberry Pi or the CHIP).

Add a new function to merge overlays with a base device tree.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>

# 91b86e21 26-May-2016 Marek Vasut <marex@denx.de>

lib: Enable private libgcc by default

This patch decouples U-Boot binary from the toolchain on systems where
private libgcc is available. Instead of pulling in functions provided
by the libgcc from the toolchain, U-Boot will use it's own set of libgcc
functions. These functions are usually imported from Linux kernel, which
also uses it's own libgcc functions instead of the ones provided by the
toolchain.

This patch solves a rather common problem. The toolchain can usually
generate code for many variants of target architecture and often even
different endianness. The libgcc on the other hand is usually compiled
for one particular configuration and the functions provided by it may
or may not be suited for use in U-Boot. This can manifest in two ways,
either the U-Boot fails to compile altogether and linker will complain
or, in the much worse case, the resulting U-Boot will build, but will
misbehave in very subtle and hard to debug ways.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 67976306 30-Mar-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

cosmetic: Fix typos "privide"

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# ed980b8c 03-Mar-2016 Alexander Graf <agraf@csgraf.de>

efi_loader: hook up in build environment

Now that we have all the bits and pieces ready for EFI payload loading
support, hook them up in Makefiles and KConfigs so that we can build.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
[trini: Enable only when we of OF_LIBFDT, disable on kwb and colibri_pxa270]
Signed-off-by: Tom Rini <trini@konsulko.com>

# aa34fbc0 22-Feb-2016 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt to be used in SPL

Add an option to enable libfdt in SPL. This can be useful when decoding
FIT files in SPL.

We need to make sure this option is not enabled in SPL by this change.
Also this option needs to be enabled in host builds. Si add a new
IMAGE_USE_LIBFDT #define which can be used in files that are built on the
host but must also build for U-Boot and SPL.

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

# 69e173eb 22-Feb-2016 Simon Glass <sjg@chromium.org>

Move CONFIG_OF_LIBFDT to Kconfig

Move this option to Kconfig and tidy up existing boards.

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

# a187559e 05-Feb-2016 Bin Meng <bmeng.cn@gmail.com>

Use correct spelling of "U-Boot"

Correct spelling of "U-Boot" shall be used in all written text
(documentation, comments in source files etc.).

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Minkyu Kang <mk7.kang@samsung.com>

# 947c626d 14-Jan-2016 Tom Rini <trini@konsulko.com>

vsprintf.c: Always enable CONFIG_SYS_VSNPRINTF

Enabling this function always removes some class of string saftey issues.
The size change here in general is about 400 bytes and this seems a reasonable
trade-off.

Cc: Peng Fan <peng.fan@nxp.com>
Cc: Peter Robinson <pbrobinson@gmail.com>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Adrian Alonso <aalonso@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 7d9cde10 22-Nov-2015 Stefan Roese <sr@denx.de>

lib/tiny-printf.c: Add tiny printf function for space limited environments

This patch adds a small printf() version that supports all basic formats.
Its intented to be used in U-Boot SPL versions on platforms with very
limited internal RAM sizes.

To enable it, just define CONFIG_USE_TINY_PRINTF in your defconfig. This
will result in the SPL using this tiny function and the main U-Boot
still using the full-blown printf() function.

This code was copied from:
http://www.sparetimelabs.com/printfrevisited
With mostly only coding style related changes so that its checkpatch
clean.

The size reduction is about 2.5KiB. Here a comparison for the db-mv784mp-gp
(Marvell AXP) SPL:

Without this patch:
58963 18536 1928 79427 13643 ./spl/u-boot-spl

With this patch:
56542 18536 1956 77034 12cea ./spl/u-boot-spl

Note:
To make it possible to compile tiny-printf.c instead of vsprintf.c when
CONFIG_USE_TINY_PRINTF is defined, the functions printf() and vprintf() are
moved from common/console.c into vsprintf.c in this patch.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>

# 2419cd16 03-Oct-2015 Simon Glass <sjg@chromium.org>

dm: tpm: Drop CONFIG_DM_TPM

Now that all TPM drivers use driver model, we can drop the special driver
model CONFIG option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>

# 027b728d 06-Oct-2015 Julius Werner <jwerner@chromium.org>

Add support for LZ4 decompression algorithm

This patch adds support for LZ4-compressed FIT image contents. This
algorithm has a slightly worse compression ration than LZO while being
nearly twice as fast to decompress. When loading images from a fast
storage medium this usually results in a boot time win.

Sandbox-tested only since I don't have a U-Boot development system set
up right now. The code was imported unchanged from coreboot where it's
proven to work, though. I'm mostly interested in getting this recognized
by mkImage for use in a downstream project.

Signed-off-by: Julius Werner <jwerner@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# a7d660bc 22-Aug-2015 Simon Glass <sjg@chromium.org>

tpm: Add Kconfig options for TPMs

Add new Kconfig options for TPMs in preparation for moving boards to use
Kconfig for TPM configuration.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 867a6ac8 31-Jul-2015 Simon Glass <sjg@chromium.org>

efi: Add start-up library code

When running as an EFI application, U-Boot must request memory from EFI,
and provide access to the boot services U-Boot needs.

Add library code to perform these tasks. This includes efi_main() which is
the entry point from EFI. U-Boot is built as a shared library.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d1389403 23-Jun-2015 Simon Glass <sjg@chromium.org>

Add a dhrystone benchmark command

Drystone provides a convenient sanity check that the CPU is running at full
speed. Add this as a command which can be enabled as needed.

Note: I investigated using Coremark for this but there was a license
agreement and I could not work out if it was GPL-compatible.

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

# f7848d90 22-Jun-2015 Joe Hershberger <joe.hershberger@ni.com>

Allow CONFIG_REGEX to be disabled when CONFIG_NET

Instead of selecting REGEX when NET is enabled, make it the default, but
allow boards that are tiny to disable it and lose functionality on all
but the first Ethernet adapter.

cm-bf548, bf538f-ezkit, and bf533-stamp need this. None appear to have
more than one Ethernet interface.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# 3850dbe8 11-Jun-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

blackfin: fix undefined reference to srand and rand

Commit 9ba9e85f3f1c (net: Fix NET_RANDOM_ETHADDR dependencies)
accidentally dropped CONFIG_LIB_RAND defines for 14 Blackfin boards.

Prior to that commit, those boards defined CONFIG_LIB_RAND, but not
CONFIG_NET_RANDOM_ETHADDR. So, commit 9ba9e85f3f1c should not have
touched them, but in fact it ripped CONFIG_LIB_RAND off from all the
header files, which caused undefined reference to srand and rand.
CONFIG_LIB_RAND=y must be revived for such boards.

BTW, this commit indeed makes it better, but even with this fix,
three boards (bf533-stamp, bf538f-ezkit, cm-bf548) still can not
build due to region 'ram' overflowed error. This was cause by
commit 6eed3786c68c (net: Move the CMD_NET config to defconfigs)
because CMD_NET selects NET, and NET selects REGEX. Eventually,
some boards were newly enabled with CONFIG_REGEX, increasing the
memory footprint. A patch is expected to fix the build error.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 9ba9e85f 25-May-2015 Michal Simek <michal.simek@xilinx.com>

net: Fix NET_RANDOM_ETHADDR dependencies

NET_RANDOM_ETHADDR depends on lib/rand.c. This patch adds dependency to
Kconfig to ensure that library is also compiled.

Remove the definitions from Blackfin boards' include/configs.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 6501ff62 20-Apr-2015 Przemyslaw Marczak <p.marczak@samsung.com>

lib: Kconfig: add entry for errno_str() function

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1a60650c 21-Apr-2015 Joe Hershberger <joe.hershberger@ni.com>

kconfig: Move REGEX to Kconfig

Having this as a Kconfig allows it to be a dependent feature.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8156345d 06-Mar-2015 Simon Glass <sjg@chromium.org>

sandbox: Move CONFIG_SYS_VSNPRINTF to Kconfig

Move this over to Kconfig and tidy up.

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

# 94e3c8c4 19-Feb-2015 gaurav rana <gaurav.rana@freescale.com>

crypto/fsl - Add progressive hashing support using hardware acceleration.

Currently only normal hashing is supported using hardware acceleration.
Added support for progressive hashing using hardware.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
Signed-off-by: Gaurav Rana <gaurav.rana@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>

# d9f23c7f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

lib/rsa: Add Kconfig for devices supporting RSA Modular Exponentiation

Kconfig option added for devices which support RSA Verification.
1. RSA_SOFTWARE_EXP
Enables driver for supporting RSA Modular Exponentiation in Software
2. RSA_FREESCALE_EXP
Enables driver for supporting RSA Modular Exponentiation using Freescale specific
driver

The above drivers use RSA uclass

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
(Removed duplicate line in Kconfig comment)

Change-Id: I7663c4d5350e2bfc3dfa2696f70ef777d6ccc6f6

# c4beb22f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

FIT: Modify option FIT_SIGNATURE in Kconfig

For FIT signature based approach to work, RSA library needs to be selected.
The FIT_SIGNATURE option in Kconfig is modified to automatically select RSA.
Selecting RSA compiles the RSA library required for image verification.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 45ccec8f 23-Oct-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_USE_PRIVATE_LIBGCC to Kconfig

The private libgcc is supported only on ARM, MIPS, PowerPC, SH, x86.
Those architectures should "select" HAVE_PRIVATE_LIBGCC and
CONFIG_USE_PRIVATE_LIBGCC should depend on it.

Currently, this option is enabled on Tegra boards and x86 architecture.
Move the definition from header files to Kconfig.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Tested-by: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: Tom Warren <twarren@nvidia.com>

# 8c688bc4 23-Oct-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_SYS_HZ to lib/Kconfig

CONFIG_SYS_HZ is always defined as 1000 in config_fallbacks.h
(but some boards still have redundant definitions).

This commit moves the definition and the document in README to
Kconfig. Since lib/Kconfig can assure that CONFIG_SYS_HZ is 1000,
the sanity check in lib/time.c should be removed.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Reviewed-by: Marek Vasut <marex@denx.de>

# b0928da6 16-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED to Kconfig

If this option is enabled, the objects under lib/ directory
are compiled with speed optimization, not size optimization.
(Currently, only used by some Blackfin boards.)

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# ed36323f 16-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: add blank Kconfig files

This would be useful to start moving various config options.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# e60e4499 02-Sep-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

lib: Drop SHA512_ALGO in lieu of SHA512

SHA512_ALGO was used as a "either SHA512 or SHA384", although the
implementations of these two algorithms share a majority of code.

From a Kconfig interface perspective, it makes sense to present two
distinct options. This requires #ifdefing out the SHA512
implementation from sha512.c. The latter doesn't make any sense.

It's reasonable to say in Kconfig that SHA384 depends on SHA512, and
seems to be the more polite way to handle the selection.

Thus, automatically select SHA512 when SHA384 is enabled.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>

# 928a8be7 29-Jul-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

lib: ecdsa: Implement UCLASS_ECDSA verification on target

Implement the crypto_algo .verify() function for ecdsa256. Because
it backends on UCLASS_ECDSA, this change is focused on parsing the
keys from devicetree and passing this information to the specific
UCLASS driver.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# fa3f1f1d 24-Jul-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: disable CONFIG_SPL_HEXDUMP by default

CONFIG_HEXDUMP is needed to display UEFI variables using 'printenv -e'.

Enabling CONFIG_SPL_HEXDUMP only makes sense for debugging purposes.
Hence CONFIG_SPL_HEXDUMP should not be enabled by default.

The following boards currently have CONFIG_SPL_HEXDUMP=y. This includes
boards that don't use SPL at all.

axm_defconfig
imx8mm-cl-iot-gate_defconfig
imx8mm_venice_defconfig
imxrt1020-evk_defconfig
imxrt1050-evk_defconfig
kontron_sl28_defconfig
kp_imx53_defconfig
lx2160ardb_tfa_stmm_defconfig
mt7622_rfb_defconfig
octeon_ebb7304_defconfig
octeon_nic23_defconfig
qemu_arm64_defconfig
qemu_arm_defconfig
qemu-riscv32_defconfig
qemu-riscv32_smode_defconfig
qemu-riscv64_defconfig
qemu-riscv64_smode_defconfig
qemu-x86_64_defconfig
qemu-x86_defconfig
sandbox64_defconfig
sandbox_defconfig
stm32mp15_basic_defconfig
stm32mp15_trusted_defconfig
synquacer_developerbox_defconfig
taurus_defconfig
xilinx_versal_virt_defconfig

The patch only keeps it enabled on

sandbox_spl_defconfig

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 1a46cb6c 02-Jul-2021 Simon Glass <sjg@chromium.org>

lib: Create a new Kconfig option for charset conversion

Rather than looking at two KConfig options in the Makefile, create a new
Kconfig option for compiling lib/charset.c

Enable it for UFS also, which needs this support.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 26dd9936 08-Jul-2021 Steffen Jaeckel <jaeckel-floss@eyet-services.de>

lib: add crypt subsystem

Add the basic functionality required to support the standard crypt
format.
The files crypt-sha256.c and crypt-sha512.c originate from libxcrypt and
their formatting is therefor retained.
The integration is done via a crypt_compare() function in crypt.c.

```
libxcrypt $ git describe --long --always --all
tags/v4.4.17-0-g6b110bc
```

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 7d0f3fbb 11-Jun-2021 Tero Kristo <t-kristo@ti.com>

lib: rational: copy the rational fraction lib routines from Linux

Copy the best rational approximation calculation routines from Linux.
Typical usecase for these routines is to calculate the M/N divider
values for PLLs to reach a specific clock rate.

This is based on linux kernel commit:
"lib/math/rational.c: fix possible incorrect result from rational
fractions helper"
(sha1: 323dd2c3ed0641f49e89b4e420f9eef5d3d5a881)

Signed-off-by: Tero Kristo <t-kristo@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Tero Kristo <kristo@kernel.org>

# ec0512b1 24-May-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

Revert "lib: introduce HASH_CALCULATE option"

When we think of Kconfig, we usually think of features that we like
to enable or not. Ideally, we wouldn't use Kconfig to fix a build
issue, although sometimes it might make sense. With Kconfig it's hard
to guarantee that the fix is universal. We can only say that it works
for the set of tested configurations. In the majority of cases, it's
preferable to let the linker figure things out for us.

The reverted commit attempted to fix a build issue by adding an
invisible Kconfig option. This is wrong in several ways:

It invents a new Kconfig variable when CONFIG_HASH already
exists for the same purpose.
Second, hash-checksum.c makes use of the hash_progressive_lookup_algo()
symbol, which is only provided with CONFIG_HASH, but this dependency
was not expressed in the reverted patch.

It feels like Kconfig is turning into a listing of all available
source files, and a buffet to 'select' which ones to compile. The
purpose of this revert is to enable the next change to make use of
CONFIG_HASH instead of adding to Kconfig.

This reverts commit 87316da05f2fd49d3709275e64ef0c5980366ade.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Acked-by: Masahisa Kojima <masahisa.kojima@linaro.org>

# 1621d3c4 10-May-2021 Bin Meng <bmeng.cn@gmail.com>

lib: kconfig: Limit BINMAN_FDT for OF_SEPARATE or OF_EMBED

Generally speaking BINMAN_FDT makes sense for OF_SEPARATE or OF_EMBED.
For the other OF_CONTROL methods, it's quite possible binman node is
not available as binman is invoked during the build phase instead of
runtime. Let's only turn it on for OF_SEPARATE or OF_EMBED by default.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 87316da0 13-May-2021 Masahisa Kojima <masahisa.kojima@linaro.org>

lib: introduce HASH_CALCULATE option

Build error occurs when CONFIG_EFI_SECURE_BOOT or
CONFIG_EFI_CAPSULE_AUTHENTICATE is enabled,
because hash-checksum.c is not compiled.

Since hash_calculate() implemented in hash-checksum.c can be
commonly used aside from FIT image signature verification,
this commit itroduces HASH_CALCULATE option to decide
if hash-checksum.c shall be compiled.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# e2ae483c 13-May-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

hash: Kconfig option for SHA512 hardware acceleration

Commit a479f103dc1c ("hash: Allow for SHA512 hardware implementations")
defined function definitions for hardware accelerated SHA384 and SHA512.
If CONFIG_SHA_HW_ACCEL=y, these functions are used.

We already have boards using CONFIG_SHA_HW_ACCEL=y but none implements the
new functions hw_sha384() and hw_sha512().

For implementing the EFI TCG2 protocol we need SHA384 and SHA512. The
missing hardware acceleration functions lead to build errors on boards like
peach-pi_defconfig.

Introduce a new Kconfig symbol CONFIG_SHA512_HW_ACCEL to control if the
functions hw_sha384() and hw_sha512() shall be used to implement the SHA384
and SHA512 algorithms.

Fixes: a479f103dc1c ("hash: Allow for SHA512 hardware implementations")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

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

# 6d66502b 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: Add 2 config to define the max number of regions

Add 2 configs CONFIG_LMB_MEMORY_REGIONS and CONFIG_LMB_RESERVED_REGIONS
to change independently the max number of the regions in lmb
library.

When CONFIG_LMB_USE_MAX_REGIONS=y, move the lmb property arrays to
struct lmb and manage the array size with the element 'max' of struct
lmb_region; their are still allocated in stack.

When CONFIG_LMB_USE_MAX_REGIONS=n, keep the current location in
struct lmb_region to allow compiler optimization.

Increase CONFIG_LMB_RESERVED_REGIONS is useful to avoid lmb errors in
bootm when the number of reserved regions (not adjacent) is reached:
+ 1 region for relocated U-Boot
+ 1 region for initrd
+ 1 region for relocated linux device tree
+ reserved memory regions present in Linux device tree.

The current limit of 8 regions is reached with only 5 reserved regions
in DT.

see Linux kernel commit bf23c51f1f49 ("memblock: Move memblock arrays
to static storage in memblock.c and make their size a variable")

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# 4fa0150d 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: move MAX_LMB_REGIONS value in Kconfig

Move MAX_LMB_REGIONS value in Kconfig, the max number of the regions
in lmb library.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# 77b8cfef 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: move CONFIG_LMB in Kconfig

Migrate CONFIG_LMB in Kconfig.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# a479f103 16-Feb-2021 Joel Stanley <joel@jms.id.au>

hash: Allow for SHA512 hardware implementations

Similar to support for SHA1 and SHA256, allow the use of hardware hashing
engine by enabling the algorithm and setting CONFIG_SHA_HW_ACCEL /
CONFIG_SHA_PROG_HW_ACCEL.

Signed-off-by: Joel Stanley <joel@jms.id.au>

# f2c1442e 14-Mar-2021 Simon Glass <sjg@chromium.org>

bloblist: Make BLOBLIST_TABLES depend on BLOBLIST

Add an extra condition here since we cannot put x86 tables in a bloblist
when bloblists are not supported.

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

# e0103158 25-Feb-2021 Bin Meng <bmeng.cn@gmail.com>

lib: kconfig: Mention CONFIG_ADDR_MAP limitation in the help

Mention that CONFIG_ADDR_MAP only works in the post-relocation phase.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>

# 56e7257c 03-Feb-2021 Bin Meng <bmeng.cn@gmail.com>

lib: Fix BINMAN_FDT dependency

lib/binman.c references the following 3 ofnode APIs:
ofnode_first_subnode(), ofnode_path() and ofnode_read_bool().

These APIs get built only when DM is on. Fix the dependency then.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 59e4e391 18-Jan-2021 Tom Rini <trini@konsulko.com>

Merge https://gitlab.denx.de/u-boot/custodians/u-boot-riscv

- Update qemu-riscv.rst build instructions.
- Add support for SPI on Kendryte K210.
- Add Microchip PolarFire SoC Icicle Kit support.
- Add support for an early timer.
- Select TIMER_EARLY to avoid infinite recursion for Trace.


# a80f8513 17-Jan-2021 Pragnesh Patel <pragnesh.patel@sifive.com>

trace: select TIMER_EARLY to avoid infinite recursion

When tracing functions is enabled this adds calls to
__cyg_profile_func_enter() and __cyg_profile_func_exit() to the traced
functions.

__cyg_profile_func_enter() and __cyg_profile_func_exit() invoke
timer_get_us() to record the entry and exit time.

initr_dm() will make gd->dm_root = NULL and gd->timer = NULL, so
timer_get_us() -> get_ticks() -> dm_timer_init() will lead to an
indefinite recursion.

So select TIMER_EARLY when tracing got enabled.

Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Rick Chen <rick@andestech.com>

# 6205bbb1 04-Jan-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lib: cosmetic update of CONFIG_LIB_ELF description

Change 2 typo error in CONFIG_LIB_ELF description:
- Supoort => Support
- fir => for

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c589132a 02-Dec-2020 Aswath Govindraju <a-govindraju@ti.com>

fdt: Use phandle to distinguish DT nodes with same name

While assigning the sequence number to subsystem instances by reading the
aliases property, only DT nodes names are compared and not the complete
path. This causes a problem when there are two DT nodes with same name but
have different paths.

In arch/arm/dts/k3-am65-main.dtsi there are two USB controllers with the
same device tree node name but different path. When aliases are defined for
these USB controllers then fdtdec_get_alias_seq() fails to pick the correct
instance for a given index.

fdt_path_offset() function is slow and this would effect the U-Boot
startup. To avert the time penalty on all boards, apply this extra check
only when required by using a config option.

Fix it by comparing the phandles of DT nodes after the node names match,
under a config option.

Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Fix whitespace error in Kconfig:
Signed-off-by: Simon Glass <sjg@chromium.org>

# 28cef9ca 19-Nov-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

fs: fat: create correct short names

The current function set_name() used to create short names has the
following deficiencies resolved by this patch:

* Long names (e.g. FOO.TXT) are stored even if a short name is enough.
* Short names with spaces are created, e.g. "A ~1.TXT".
* Short names with illegal characters are created, e.g. "FOO++BAR".
* Debug output does not not consider that the short file name has no
concluding '\0'.

The solution for the following bug is split of into a separate patch:

* Short file names must be unique.

This patch only provides the loop over possible short file names.

Fixes: c30a15e590c ("FAT: Add FAT write feature")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# e4f8e543 05-Nov-2020 Simon Glass <sjg@chromium.org>

smbios: Drop the unused Kconfig options

Now that we can use devicetree to specify this information, drop the old
CONFIG options.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 44c74bdd 05-Nov-2020 Simon Glass <sjg@chromium.org>

sysinfo: Provide a default driver to set SMBIOS values

Some boards want to specify the manufacturer or product name but do not
need to have their own sysinfo driver.

Add a default driver which provides a way to specify this SMBIOS
information in the devicetree, without needing any board-specific
functionality.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d2cb7a22 04-Nov-2020 Simon Glass <sjg@chromium.org>

x86: Allow putting some tables in the bloblist

At present all tables are placed starting at address f0000 in memory, and
can be up to 64KB in size. If the tables are very large, this may not
provide enough space.

Also if the tables point to other tables (such as console log or a ramoops
area) then we must allocate other memory anyway.

The bloblist is a nice place to put these tables since it is contiguous,
which makes it easy to reserve this memory for linux using the 820 tables.

Add an option to put some of the tables in the bloblist. For SMBIOS and
ACPI, create suitable pointers from the f0000 region to the new location
of the tables.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
[bmeng: squashed in http://patchwork.ozlabs.org/project/uboot/patch/
20201105062407.1.I8091ad931cbbb5e3b6f6ababdf3f8d5db0d17bb9@changeid/]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# 415eab06 03-Nov-2020 Christian Gmeiner <christian.gmeiner@gmail.com>

smbios: add parsing API

Add a very simple API to be able to access SMBIOS strings
like vendor, model and bios version.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 72eda507 27-Oct-2020 Sean Anderson <seanga2@gmail.com>

lib: Add getopt

Some commands can get very unweildy if they have too many positional
arguments. Adding options makes them easier to read, remember, and
understand.

This implementation of getopt has been taken from barebox, which has had
option support for quite a while. I have made a few modifications to their
version, such as the removal of opterr in favor of a separate getopt_silent
function. In addition, I have moved all global variables into struct
getopt_context.

The getopt from barebox also re-orders the arguments passed to it so that
non-options are placed last. This allows users to specify options anywhere.
For example, `ls -l foo/ -R` would be re-ordered to `ls -l -R foo/` as
getopt parsed the options. However, this feature conflicts with the const
argv in cmd_tbl->cmd. This was originally added in 54841ab50c ("Make sure
that argv[] argument pointers are not modified."). The reason stated in
that commit is that hush requires argv to stay unmodified. Has this
situation changed? Barebox also uses hush, and does not have this problem.
Perhaps we could use their fix?

I have assigned maintenance of getopt to Simon Glass, as it is currently
only used by the log command. I would also be fine maintaining it.

Signed-off-by: Sean Anderson <seanga2@gmail.com>

# 26637e2e 12-Sep-2020 Simon Glass <sjg@chromium.org>

lib: Allow hexdump to be used in SPL

It is sometimes useful to output hex dumps in SPL. Add a config option to
allow this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# e87dfb05 05-Aug-2020 Andrii Anisov <andrii_anisov@epam.com>

lib: sscanf: add sscanf implementation

Port sscanf implementation from mini-os and introduce new
Kconfig option to enable it: CONFIG_SSCANF. Disable by default.

Signed-off-by: Andrii Anisov <andrii_anisov@epam.com>
Signed-off-by: Anastasiia Lukianenko <anastasiia_lukianenko@epam.com>
Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>

# 81014f73 30-Jul-2020 Joao Marcos Costa <joaomarcos.costa@bootlin.com>

include/u-boot, lib/zlib: add sources for zlib decompression

Add zlib (v1.2.11) uncompr() function to U-Boot. SquashFS depends on
this function to decompress data from a raw disk image. The actual
support for zlib into SquashFS sources will be added in a follow-up
commit.

Signed-off-by: Joao Marcos Costa <joaomarcos.costa@bootlin.com>

# 69be8fd1 03-Jun-2020 Marek Szyprowski <m.szyprowski@samsung.com>

powerpc: move ADDR_MAP to Kconfig

Move ADDR_MAP related config options from include/configs/*.h to the
proper place in lib/Kconfig. This has been done using
./tools/moveconfig.py and manual inspection of the generated changes.
This is a preparation to use ADDR_MAP helper on ARM 32bit Raspberry Pi4
board for mapping the PCIe XHCI MMIO, which is above the 4GiB identity
mapping limit.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# d16b38f4 15-Apr-2020 Reuben Dowle <reubendowle0@gmail.com>

Add support for SHA384 and SHA512

The current recommendation for best security practice from the US government
is to use SHA384 for TOP SECRET [1].

This patch adds support for SHA384 and SHA512 in the hash command, and also
allows FIT images to be hashed with these algorithms, and signed with
sha384,rsaXXXX and sha512,rsaXXXX

The SHA implementation is adapted from the linux kernel implementation.

[1] Commercial National Security Algorithm Suite
http://www.iad.gov/iad/programs/iad-initiatives/cnsa-suite.cfm

Signed-off-by: Reuben Dowle <reuben.dowle@4rf.com>

# 43e442a5 26-May-2020 Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

kconfig: fix some typos

Signed-off-by: Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

# eff5a547 22-May-2020 Michael Walle <michael@walle.cc>

cmd: zip: automatically pull in gzip()

Move the CONFIG_GZIP_COMPRESSED from a config.h macro to a Kconfig menu
item. It is not selectable by a user because there is no reason to do
so. Instead it will be automatically selected by the stuff which uses
gzip(), like the zip command.

Remove it from the config_whitelist.txt. Also remove
CONFIG_GZIP_COMPRESS_DEF_SZ as this was never used on any board. The
default seems to be sane, otherwise it should be added as a Kconfig
option.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8239be61 06-May-2020 Simon Glass <sjg@chromium.org>

lib: Allow MD5 to be enabled in SPL

At present the MD5 option cannot be enabled by board configs since it has
no Kconfig name. It is generally enabled, so long as FIT support is
present. But not all boards use FIT, particularly in SPL

Fix this and add an option for SPL as well. This allows board code to call
md5() even if FIT support is not enabled.

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

# 04cb3994 21-Apr-2020 Weijie Gao <weijie.gao@mediatek.com>

lib: enable lzma decompression support for SPL build

This patch enables LZMA decompression support for SPL build

Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>

# 2a2119e1 05-Mar-2020 Atish Patra <atish.patra@wdc.com>

lib: kconfig: Add option to set BZIP2 compression method

There is no way to select BZIP2 compression method.
Add it under library/compression config where all other
compression related configs are present.

Signed-off-by: Atish Patra <atish.patra@wdc.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 805b3cac 12-Feb-2020 Keerthy <j-keerthy@ti.com>

lib: elf: Move the generic elf loading/validating functions to lib

Move the generic elf loading/validating functions to lib/
so that they can be re-used and accessed by code existing
outside cmd.

While at it remove the duplicate static version of load_elf_image_phdr
under arch/arm/mach-imx/imx_bootaux.c.

Signed-off-by: Keerthy <j-keerthy@ti.com>
Suggested-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>

# 1611235b 19-Jan-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: Kconfig dependencies for pseudo-random library

drivers/rng/sandbox_rng.c requires rand() to be defined but configuration
option CONFIG_CONFIG_LIB_RAND selected in drivers/rng/Kconfig does not
exist.

test/lib/test_aes.c requires rand() to be defined.

Fix the selection criteria for choice "Pseudo-random library support type".

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 3c10dc95 06-Dec-2019 Simon Glass <sjg@chromium.org>

binman: Add a library to access binman entries

SPL and TPL can access information about binman entries using link-time
symbols but this is not available in U-Boot proper. Of course it could be
made available, but the intention is to just read the device tree.

Add support for this, so that U-Boot can locate entries.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# b4adf627 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: crypto: add x509 parser

Imported from linux kernel v5.3:
x509.asn1 without changes
x509_akid.asn1 without changes
x509_parser.h without changes
x509_cert_parser.c with changes marked as __UBOOT__
x509_public_key.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# a9b45e6e 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add oid registry utility

Imported from linux kernel v5.3:
build_OID_registry without changes
oid_registry.h without changes
oid_registry.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# ab8a0e06 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add asn1 decoder

Imported from linux kernel v5.3:
lib/asn1_decoder.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 2b12196d 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

cmd: add asn1_compiler

Imported from linux kernel v5.3:
asn1.h without changes
asn1_ber_bytecode.h without changes
asn1_decoder.h without changes
asn1_compiler.c without changes

This host command will be used to create a ASN1 parser, for example,
for pkcs7 messages or x509 certificates. More specifically, it will
generate *byte code* which will be interpreted by asn1 decoder library.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 05429b6c 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

rtc: move date.c from drivers/rtc/ to lib/

In the next commit, rtc_mktime(), for compatibility with linux, will be
implemented using rtc_mktime(), which is no longer drivers/rtc specific.
So move this file under lib/.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 37ef1774 10-Nov-2019 Thomas Hebb <tommyhebb@gmail.com>

Kconfig: disambiguate config names for tiny printf

27084c03d36a ("spl: Allow tiny printf() to be controlled in SPL and
TPL") split this option in two for TPL and SPL, but didn't change the
Kconfig names, making them hard to set quickly.

Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>

# 0d76afc0 27-Oct-2019 Simon Glass <sjg@chromium.org>

fdt: Add Kconfig options to control code size

For better or worse libfdt recent grew a lot of code that checks the
validity of the device tree in great detail. When using unsigned or
unverified data this makes things safer, but it does add to code size.

Add some controls to select the trade-off between safety and code size.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 27084c03 25-Sep-2019 Simon Glass <sjg@chromium.org>

spl: Allow tiny printf() to be controlled in SPL and TPL

At present there is only one control for this and it is used for both SPL
and TPL. But SPL might have a lot more space than TPL so the extra cost of
a full printf() might be acceptable.

Split the option into two, providing separate SPL and TPL controls. The
TPL setting defaults to the same as SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2a51e16b 07-Jun-2019 Tom Rini <trini@konsulko.com>

configs: Make USE_TINY_PRINTF depend on SPL||TPL and be default

The USE_TINY_PRINTF symbol only changes things within SPL and TPL
builds, so make it depend on that support. Next, make it default as
within these cases we should rarely have need of more advanced print
formats outside of the debug context.

To do this, in a few cases we need to correct our Kconfig dependencies
as we had cases of non-SPL targets select'ing this symbol. Finally, in
the case of a few boards we really do need the full printf
functionality.

Signed-off-by: Tom Rini <trini@konsulko.com>

# da0fb5fd 02-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: make call depth limit customizable

Up to now we had hard coded values for the call depth up to which trace
records are created: 200 for early tracing, 15 thereafter. UEFI
applications reach a call depth of 80 or above.

Provide customizing settings for the call trace depth limit and the early
call trace depth limit. Use the old values as defaults.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8509f22a 29-Apr-2019 Marek Behún <marek.behun@nic.cz>

lib: add Zstandard decompression support

Add the zstd library from Linux kernel (only decompression support).
There are minimal changes to build with U-Boot, otherwise the files are
identical to Linux commit dc35da16 from March 2018, the files had not
been touched since in kernel. Also SPDX lincese tags were added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 83a486b6 29-Apr-2019 Marek Behún <marek.behun@nic.cz>

lib: Add xxhash support

This adds the xxhash support from Linux. Files are almost identical to
those added to Linux in commit 5d240522 ("lib: Add xxhash module") (they
haven't been touched since in Linux). The only difference is to add some
includes to be compatible with U-Boot. Also SPDX lincese tags were
added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 5132361a 29-Apr-2019 Heiko Schocher <hs@denx.de>

lib: Kconfig: fix help text for GZIP

commit 95f4bbd581cf ("lib: fdt: Allow LZO and GZIP DT compression in U-Boot")

introduced Kconfig option for gzip in U-Boot, but help text
says gzip for SPL, which is wrong. Fix this.

Signed-off-by: Heiko Schocher <hs@denx.de>
Acked-by: Marek Vasut <marex@denx.de>

# 1c6eb075 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE_BUFFER_SIZE et al to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE_BUFFER_SIZE
CONFIG_TRACE_EARLY_SIZE
CONFIG_TRACE_EARLY
CONFIG_TRACE_EARLY_ADDR

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

# a24a78d7 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE

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

# 54969b40 21-Mar-2019 Thierry Reding <treding@nvidia.com>

fdtdec: Add Kconfig symbol for tests

Runtime tests are provided as a test_fdtdec command implementation. Add
a Kconfig symbol that allows this command to be built so that the tests
can be used.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 95f4bbd5 08-Mar-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

lib: fdt: Allow LZO and GZIP DT compression in U-Boot

Add required Kconfig symbols, Makefile bits and macro fixes in a
few places to support LZO and DT compression in U-Boot. This can
save a lot of space with multi-DTB fitImages.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>

# 6e705114 13-Jan-2019 Chris Packham <judge.packham@gmail.com>

lib: Kconfig: spelling fixes

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 048c6e89 06-Nov-2018 Simon Glass <sjg@chromium.org>

spl: lz4: Allow use of lz4 compression in SPL

In some cases U-Boot is compressed and it is useful to be able to
decompress it in SPL. Add a Kconfig and Makefile change to allow this.
Note that this does not actually implement decompression.

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

# 2895c4b7 15-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

kconfig: Introduce HAVE_ARCH_IOMAP

Introduce a new Kconfig option for architecture codes to control
whether it provides io{read,write}{8,16,32} I/O accessor functions.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5592a633 01-Oct-2018 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt in TPL

In some cases (e.g. sandbox with verified boot) it is useful to support
libfdt in TPL. Update the Kconfig to handle this.

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

# 6307896c 01-Oct-2018 Simon Glass <sjg@chromium.org>

tpm: Add support for SPL and TPL

At present the tpm can only be used in U-Boot proper. Updated it to work
in SPL and TPL also.

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

# ab948cd2 19-Jul-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

fdt_support: make FDT_FIXUP_PARTITIONS depend on CMD_MTDPARTS

fdt_fixup_mtdparts() calls mtdparts_init() and device_find(),
which are defined in cmd/mtdparts.c

The combination of FDT_FIXUP_PARTITIONS=y and CMD_MTDPARTS=n
emits the following link error:

common/fdt_support.c:903: undefined reference to `mtdparts_init'
common/fdt_support.c:914: undefined reference to `device_find'

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 3330584d 03-Jun-2018 Igor Opaniuk <igor.opaniuk@gmail.com>

avb2.0: integrate avb 2.0 into the build system

Integrate libavb into the build system. Introduce CONFIG_LIBAVB
build option.

Signed-off-by: Igor Opaniuk <igor.opaniuk@linaro.org>

# f8c987f8 05-Jun-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

lib: Add hexdump

Often during debugging session it's very interesting to see
what data we were dealing with. For example what we write or read
to/from memory or peripherals.

This change introduces functions that allow to dump binary
data with one simple function invocation like:
------------------->8----------------
print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, buf, len);
------------------->8----------------

which gives us the following:
------------------->8----------------
00000000: f2 b7 c9 88 62 61 75 64 72 61 74 65 3d 31 31 35 ....baudrate=115
00000010: 32 30 30 00 62 6f 6f 74 61 72 67 73 3d 63 6f 6e 200.bootargs=con
00000020: 73 6f 6c 65 3d 74 74 79 53 33 2c 31 31 35 32 30 sole=ttyS3,11520
00000030: 30 6e 38 00 62 6f 6f 74 64 65 6c 61 79 3d 33 00 0n8.bootdelay=3.
00000040: 62 6f 6f 74 66 69 6c 65 3d 75 49 6d 61 67 65 00 bootfile=uImage.
00000050: 66 64 74 63 6f 6e 74 72 6f 6c 61 64 64 72 3d 39 fdtcontroladdr=9
00000060: 66 66 62 31 62 61 30 00 6c 6f 61 64 61 64 64 72 ffb1ba0.loadaddr
00000070: 3d 30 78 38 32 30 30 30 30 30 30 00 73 74 64 65 =0x82000000.stde
00000080: 72 72 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 rr=serial0@e0022
00000090: 30 30 30 00 73 74 64 69 6e 3d 73 65 72 69 61 6c 000.stdin=serial
000000a0: 30 40 65 30 30 32 32 30 30 30 00 73 74 64 6f 75 0@e0022000.stdou
000000b0: 74 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 30 t=serial0@e00220
000000c0: 30 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00..............
...
------------------->8----------------

Source of hexdump.c was copied from Linux kernel v4.7-rc2.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Mario Six <mario.six@gdsys.cc>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Stefan Roese <sr@denx.de>

# c232d14d 29-May-2018 Alex Kiernan <alex.kiernan@gmail.com>

mmc: Separate "mmc swrite" from fastboot

Introduce CONFIG_IMAGE_SPARSE and CONFIG_CMD_MMC_SWRITE so the "mmc
swrite" command is separated from the fastboot code.

Move image-sparse from common to lib so it's clear it's library code.

Rename CONFIG_FASTBOOT_FLASH_FILLBUF_SIZE to CONFIG_IMAGE_SPARSE_FILLBUF_SIZE
and migrate it to Kconfig.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Acked-by: Jassi Brar <jaswinder.singh@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6417572e 08-May-2018 Tom Rini <trini@konsulko.com>

lib/Kconfig: Mark OF_LIBFDT_OVERLAY as depending on OF_LIBFDT

The overlay code is only useful when OF_LIBFDT is set, so mark it as
depending on that first.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 58a46f88 25-Apr-2018 Praneeth Bajjuri <praneeth@ti.com>

configs: TI: Enable FIT Library overlay support

Enable the FDT library overlay support for all TI SOC family.

Without this option, when Loading fdt from FIT image, the
following warning is seen.

"config with overlays but CONFIG_OF_LIBFDT_OVERLAY not set".

Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
Suggested-by: Andrew F.Davis <afd@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>

# 14ad44ab 18-Apr-2018 Alex Kiernan <alex.kiernan@gmail.com>

spl: Split sprintf, strto* from SPL serial in Kconfig

When SPL serial is disabled, callers who need sprintf or strtoul fail
because their inclusion is guarded by CONFIG_SPL_SERIAL_SUPPORT/
CONFIG_TPL_SERIAL_SUPPORT.

Split printf, sprintf and strto into their own entries and then select
all of them if SERIAL_SUPPORT is enabled to match the current behaviour.

Include panic.o unconditionally as it can be called from anywhere which
uses BUG_ON().

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>

# e294ba06 04-Apr-2018 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-sunxi

Signed-off-by: Tom Rini <trini@konsulko.com>


# d14db11d 03-Apr-2018 Andre Przywara <andre.przywara@arm.com>

sunxi: revert disabling of features

In January some commits were introduced to mitigate the U-Boot image
size issues we encountered on sunxi builds.
Now with the MMC environment removed we can bring them back, as we
practically don't have a size limit anymore.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 32ce6179 13-Mar-2018 Bryan O'Donoghue <bryan.odonoghue@linaro.org>

optee: Add lib entries for sharing OPTEE code across ports

This patch adds code to lib to enable sharing of useful OPTEE code between
board-ports and architectures. The code on lib/optee/optee.c comes from the
TI omap2 port. Eventually the OMAP2 code will be patched to include the
shared code. The intention here is to add more useful OPTEE specific code
as more functionality gets added.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Cc: Harinarayan Bhatta <harinarayan@ti.com>
Cc: Andrew F. Davis <afd@ti.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Kever Yang <kever.yang@rock-chips.com>
Cc: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Cc: Peng Fan <peng.fan@nxp.com>
Tested-by: Peng Fan <peng.fan@nxp.com>

# 36c1877c 06-Feb-2018 Faiz Abbas <faiz_abbas@ti.com>

lib: Kconfig: Move DYNAMIC_CRC_TABLE to Kconfig

Add CONFIG prefix to DYNAMIC_CRC_TABLE and implement it in
Kconfig.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>

# a451bc27 05-Feb-2018 Adam Ford <aford173@gmail.com>

Convert LIB_UUID to Kconfig

config_fallback.h has some logic that checks a variety of options
and selects LIB_UUID if it hasn't already been selected. This
will all LIB_UUID in Kconfig and select this option for the list
of options to allow us to remove the logic from fallbacks

Signed-off-by: Adam Ford <aford173@gmail.com>

# a5a37567 06-Feb-2018 Adam Ford <aford173@gmail.com>

Convert CONFIG LIB_HW_RAND to Kconfig

config_fallbacks.h had some logic to automatically select
LIB_RAND if RANDOM_UUID or CMD_UUID were set if LIB_HW_RAND wasn't
already selected. By migrating LIB_HW_RAND to Kconfig, we can
remove this check from config_fallbacks.h and put it into Kconfig

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
[trini: Turn into a choice, add NET_RANDOM_ETHADDR]
Signed-off-by: Tom Rini <trini@konsulko.com>

# acd4d334 16-Jan-2018 Maxime Ripard <maxime.ripard@free-electrons.com>

net: regex: Disable by default on sunXi

The sunXi arm64 build has overflown, leading to the main U-boot binary
overwriting the environment when flashing the new image, or even worse,
overwriting itself when we're calling saveenv.

Disable this option that is not critical until we can adress the issue
properly.

Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 7e3caa81 03-Dec-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

Move CONFIG_PANIC_HANG to Kconfig

Freescale (NXP) boards have lots of defconfig files per board.
I used "imply PANIC_HANG" for them.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# da5337a6 08-Nov-2017 Nandor Han <nandor.han@ge.com>

rtc: add support for s35392a

Add support for S35392A RTC. The driver supports both U-Boot driver
models.

Signed-off-by: Nandor Han <nandor.han@ge.com>
Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
Cc: Heiko Schocher <hs@denx.de>

# f52bdf4b 14-Sep-2017 Jean-Jacques Hiblot <jjhiblot@ti.com>

lib: allow building lzo for the SPL

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 85d8bf57 03-Sep-2017 Marek Behún <marek.behun@nic.cz>

lib: Add CRC32-C

This is needed for BTRFS.

Signed-off-by: Marek Behun <marek.behun@nic.cz>

create mode 100644 lib/crc32c.c

# 7264f292 15-Aug-2017 York Sun <york.sun@nxp.com>

spl: fit: Eanble GZIP support for image decompression

Add Kconfig option SPL_GZIP and SPL_ZLIB to enable gunzip support for
SPL boot, eg. falcon boot compressed kernel image.

Signed-off-by: York Sun <york.sun@nxp.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6ef2f901 11-Aug-2017 Adam Ford <aford173@gmail.com>

Convert CONFIG_BCH to Kconfig

This converts the following to Kconfig:
CONFIG_BCH

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1a7ba1d 18-Aug-2017 Anatolij Gustschin <agust@denx.de>

Fix 'notes' typos

s/notes/nodes

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 96b9082c 03-Aug-2017 Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

rockchip: rk3188: rock: adjust for SPL/TPL split

With the changes to split SPL/TPL for the RK3368, I apparently missed
some needed adjustments to the RK3188 Kconfig and rock_defconfig.

This fixes build-issues for the rock board after applying the RK3368
enablement (and SPL/TPL) set that resulted from TPL_SERIAL_SUPPORT,
TPL_ROCKCHIP_BACK_TO_BROM and TPL_TINY_MEMSET being separate symbols
now.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d56b4b19 22-Jul-2017 Tom Rini <trini@konsulko.com>

configs: Migrate RBTREE, LZO, CMD_MTDPARTS, CMD_UBI and CMD_UBIFS

The above CONFIG options are in Kconfig, and now have correct depends and
inter-dependencies. Migrate these to configs/ from include/configs/. In the
case of CMD_UBIFS also change it to be a default y if CMD_UBI.

Signed-off-by: Tom Rini <trini@konsulko.com>

# aed998aa 17-May-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_LZMA to Kconfig

This converts the following to Kconfig:
CONFIG_LZMA

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

# b1a873df 26-Apr-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_CMD_AES et al to Kconfig

This converts the following to Kconfig:
CONFIG_CMD_AES
CONFIG_AES

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Add select AES to CMD_AES]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 173aafbf 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

cmd: Expose a Kconfig option to enable UBIFS commands

Create a new Kconfig entry to allow CMD_UBIFS selection from Kconfig and
add an hidden LZO option that can be selected by CMD_UBIFS.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>

# aa049152 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

mtd: ubi: Select RBTREE option from MTD_UBI Kconfig entry

Expose the RBTREE feature through Kconfig and select this option from the
MTD_UBI option.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>
[Rebased on master]
Signed-off-by: Jagan Teki <jagan@openedev.com>

# ab4458bd 02-Apr-2017 Simon Glass <sjg@chromium.org>

string: Provide a slimmed-down memset()

Most of the time the optimised memset() is what we want. For extreme
situations such as TPL it may be too large. For example on the 'rock'
board, using a simple loop saves a useful 48 bytes. With gcc 4.9 and
the rodata bug, this patch is enough to reduce the TPL image below the
limit.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>

# bea79d7d 14-Mar-2017 Andre Przywara <andre.przywara@arm.com>

Kconfig: introduce md5sum command selection

So far CONFIG_MD5SUM would need to be set by a board's include file.
Since the command is really generic, move it over to Kconfig to allow
it to be defined by either a board's defconfig, menuconfig or some
config snippet merged via mergeconfig.sh.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e663b350 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

smbios: Expose in efi_loader as table

We can pass SMBIOS easily as EFI configuration table to an EFI payload. This
patch adds enablement for that case.

While at it, we also enable SMBIOS generation for ARM systems, since they support
EFI_LOADER.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4b6dddc2 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

x86: Move smbios generation into arch independent directory

We will need the SMBIOS generation function on ARM as well going forward,
so let's move it into a non arch specific location.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# ebf7fff2 05-Oct-2016 Heiko Schocher <hs@denx.de>

spl: move FDT_FIXUP_PARTITIONS to Kconfig

Move FDT_FIXUP_PARTITIONS to Kconfig and cleanup existing
uses.

Signed-off-by: Heiko Schocher <hs@denx.de>

# ddf67f71 05-Jul-2016 Maxime Ripard <maxime.ripard@free-electrons.com>

libfdt: Add overlay application function

The device tree overlays are a good way to deal with user-modifyable
boards or boards with some kind of an expansion mechanism where we can
easily plug new board in (like the BBB, the Raspberry Pi or the CHIP).

Add a new function to merge overlays with a base device tree.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>

# 91b86e21 26-May-2016 Marek Vasut <marex@denx.de>

lib: Enable private libgcc by default

This patch decouples U-Boot binary from the toolchain on systems where
private libgcc is available. Instead of pulling in functions provided
by the libgcc from the toolchain, U-Boot will use it's own set of libgcc
functions. These functions are usually imported from Linux kernel, which
also uses it's own libgcc functions instead of the ones provided by the
toolchain.

This patch solves a rather common problem. The toolchain can usually
generate code for many variants of target architecture and often even
different endianness. The libgcc on the other hand is usually compiled
for one particular configuration and the functions provided by it may
or may not be suited for use in U-Boot. This can manifest in two ways,
either the U-Boot fails to compile altogether and linker will complain
or, in the much worse case, the resulting U-Boot will build, but will
misbehave in very subtle and hard to debug ways.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 67976306 30-Mar-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

cosmetic: Fix typos "privide"

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# ed980b8c 03-Mar-2016 Alexander Graf <agraf@csgraf.de>

efi_loader: hook up in build environment

Now that we have all the bits and pieces ready for EFI payload loading
support, hook them up in Makefiles and KConfigs so that we can build.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
[trini: Enable only when we of OF_LIBFDT, disable on kwb and colibri_pxa270]
Signed-off-by: Tom Rini <trini@konsulko.com>

# aa34fbc0 22-Feb-2016 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt to be used in SPL

Add an option to enable libfdt in SPL. This can be useful when decoding
FIT files in SPL.

We need to make sure this option is not enabled in SPL by this change.
Also this option needs to be enabled in host builds. Si add a new
IMAGE_USE_LIBFDT #define which can be used in files that are built on the
host but must also build for U-Boot and SPL.

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

# 69e173eb 22-Feb-2016 Simon Glass <sjg@chromium.org>

Move CONFIG_OF_LIBFDT to Kconfig

Move this option to Kconfig and tidy up existing boards.

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

# a187559e 05-Feb-2016 Bin Meng <bmeng.cn@gmail.com>

Use correct spelling of "U-Boot"

Correct spelling of "U-Boot" shall be used in all written text
(documentation, comments in source files etc.).

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Minkyu Kang <mk7.kang@samsung.com>

# 947c626d 14-Jan-2016 Tom Rini <trini@konsulko.com>

vsprintf.c: Always enable CONFIG_SYS_VSNPRINTF

Enabling this function always removes some class of string saftey issues.
The size change here in general is about 400 bytes and this seems a reasonable
trade-off.

Cc: Peng Fan <peng.fan@nxp.com>
Cc: Peter Robinson <pbrobinson@gmail.com>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Adrian Alonso <aalonso@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 7d9cde10 22-Nov-2015 Stefan Roese <sr@denx.de>

lib/tiny-printf.c: Add tiny printf function for space limited environments

This patch adds a small printf() version that supports all basic formats.
Its intented to be used in U-Boot SPL versions on platforms with very
limited internal RAM sizes.

To enable it, just define CONFIG_USE_TINY_PRINTF in your defconfig. This
will result in the SPL using this tiny function and the main U-Boot
still using the full-blown printf() function.

This code was copied from:
http://www.sparetimelabs.com/printfrevisited
With mostly only coding style related changes so that its checkpatch
clean.

The size reduction is about 2.5KiB. Here a comparison for the db-mv784mp-gp
(Marvell AXP) SPL:

Without this patch:
58963 18536 1928 79427 13643 ./spl/u-boot-spl

With this patch:
56542 18536 1956 77034 12cea ./spl/u-boot-spl

Note:
To make it possible to compile tiny-printf.c instead of vsprintf.c when
CONFIG_USE_TINY_PRINTF is defined, the functions printf() and vprintf() are
moved from common/console.c into vsprintf.c in this patch.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>

# 2419cd16 03-Oct-2015 Simon Glass <sjg@chromium.org>

dm: tpm: Drop CONFIG_DM_TPM

Now that all TPM drivers use driver model, we can drop the special driver
model CONFIG option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>

# 027b728d 06-Oct-2015 Julius Werner <jwerner@chromium.org>

Add support for LZ4 decompression algorithm

This patch adds support for LZ4-compressed FIT image contents. This
algorithm has a slightly worse compression ration than LZO while being
nearly twice as fast to decompress. When loading images from a fast
storage medium this usually results in a boot time win.

Sandbox-tested only since I don't have a U-Boot development system set
up right now. The code was imported unchanged from coreboot where it's
proven to work, though. I'm mostly interested in getting this recognized
by mkImage for use in a downstream project.

Signed-off-by: Julius Werner <jwerner@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# a7d660bc 22-Aug-2015 Simon Glass <sjg@chromium.org>

tpm: Add Kconfig options for TPMs

Add new Kconfig options for TPMs in preparation for moving boards to use
Kconfig for TPM configuration.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 867a6ac8 31-Jul-2015 Simon Glass <sjg@chromium.org>

efi: Add start-up library code

When running as an EFI application, U-Boot must request memory from EFI,
and provide access to the boot services U-Boot needs.

Add library code to perform these tasks. This includes efi_main() which is
the entry point from EFI. U-Boot is built as a shared library.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d1389403 23-Jun-2015 Simon Glass <sjg@chromium.org>

Add a dhrystone benchmark command

Drystone provides a convenient sanity check that the CPU is running at full
speed. Add this as a command which can be enabled as needed.

Note: I investigated using Coremark for this but there was a license
agreement and I could not work out if it was GPL-compatible.

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

# f7848d90 22-Jun-2015 Joe Hershberger <joe.hershberger@ni.com>

Allow CONFIG_REGEX to be disabled when CONFIG_NET

Instead of selecting REGEX when NET is enabled, make it the default, but
allow boards that are tiny to disable it and lose functionality on all
but the first Ethernet adapter.

cm-bf548, bf538f-ezkit, and bf533-stamp need this. None appear to have
more than one Ethernet interface.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# 3850dbe8 11-Jun-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

blackfin: fix undefined reference to srand and rand

Commit 9ba9e85f3f1c (net: Fix NET_RANDOM_ETHADDR dependencies)
accidentally dropped CONFIG_LIB_RAND defines for 14 Blackfin boards.

Prior to that commit, those boards defined CONFIG_LIB_RAND, but not
CONFIG_NET_RANDOM_ETHADDR. So, commit 9ba9e85f3f1c should not have
touched them, but in fact it ripped CONFIG_LIB_RAND off from all the
header files, which caused undefined reference to srand and rand.
CONFIG_LIB_RAND=y must be revived for such boards.

BTW, this commit indeed makes it better, but even with this fix,
three boards (bf533-stamp, bf538f-ezkit, cm-bf548) still can not
build due to region 'ram' overflowed error. This was cause by
commit 6eed3786c68c (net: Move the CMD_NET config to defconfigs)
because CMD_NET selects NET, and NET selects REGEX. Eventually,
some boards were newly enabled with CONFIG_REGEX, increasing the
memory footprint. A patch is expected to fix the build error.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 9ba9e85f 25-May-2015 Michal Simek <michal.simek@xilinx.com>

net: Fix NET_RANDOM_ETHADDR dependencies

NET_RANDOM_ETHADDR depends on lib/rand.c. This patch adds dependency to
Kconfig to ensure that library is also compiled.

Remove the definitions from Blackfin boards' include/configs.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 6501ff62 20-Apr-2015 Przemyslaw Marczak <p.marczak@samsung.com>

lib: Kconfig: add entry for errno_str() function

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1a60650c 21-Apr-2015 Joe Hershberger <joe.hershberger@ni.com>

kconfig: Move REGEX to Kconfig

Having this as a Kconfig allows it to be a dependent feature.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8156345d 06-Mar-2015 Simon Glass <sjg@chromium.org>

sandbox: Move CONFIG_SYS_VSNPRINTF to Kconfig

Move this over to Kconfig and tidy up.

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

# 94e3c8c4 19-Feb-2015 gaurav rana <gaurav.rana@freescale.com>

crypto/fsl - Add progressive hashing support using hardware acceleration.

Currently only normal hashing is supported using hardware acceleration.
Added support for progressive hashing using hardware.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
Signed-off-by: Gaurav Rana <gaurav.rana@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>

# d9f23c7f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

lib/rsa: Add Kconfig for devices supporting RSA Modular Exponentiation

Kconfig option added for devices which support RSA Verification.
1. RSA_SOFTWARE_EXP
Enables driver for supporting RSA Modular Exponentiation in Software
2. RSA_FREESCALE_EXP
Enables driver for supporting RSA Modular Exponentiation using Freescale specific
driver

The above drivers use RSA uclass

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
(Removed duplicate line in Kconfig comment)

Change-Id: I7663c4d5350e2bfc3dfa2696f70ef777d6ccc6f6

# c4beb22f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

FIT: Modify option FIT_SIGNATURE in Kconfig

For FIT signature based approach to work, RSA library needs to be selected.
The FIT_SIGNATURE option in Kconfig is modified to automatically select RSA.
Selecting RSA compiles the RSA library required for image verification.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 45ccec8f 23-Oct-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_USE_PRIVATE_LIBGCC to Kconfig

The private libgcc is supported only on ARM, MIPS, PowerPC, SH, x86.
Those architectures should "select" HAVE_PRIVATE_LIBGCC and
CONFIG_USE_PRIVATE_LIBGCC should depend on it.

Currently, this option is enabled on Tegra boards and x86 architecture.
Move the definition from header files to Kconfig.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Tested-by: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: Tom Warren <twarren@nvidia.com>

# 8c688bc4 23-Oct-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_SYS_HZ to lib/Kconfig

CONFIG_SYS_HZ is always defined as 1000 in config_fallbacks.h
(but some boards still have redundant definitions).

This commit moves the definition and the document in README to
Kconfig. Since lib/Kconfig can assure that CONFIG_SYS_HZ is 1000,
the sanity check in lib/time.c should be removed.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Reviewed-by: Marek Vasut <marex@denx.de>

# b0928da6 16-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED to Kconfig

If this option is enabled, the objects under lib/ directory
are compiled with speed optimization, not size optimization.
(Currently, only used by some Blackfin boards.)

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# ed36323f 16-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: add blank Kconfig files

This would be useful to start moving various config options.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# 928a8be7 29-Jul-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

lib: ecdsa: Implement UCLASS_ECDSA verification on target

Implement the crypto_algo .verify() function for ecdsa256. Because
it backends on UCLASS_ECDSA, this change is focused on parsing the
keys from devicetree and passing this information to the specific
UCLASS driver.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# fa3f1f1d 24-Jul-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: disable CONFIG_SPL_HEXDUMP by default

CONFIG_HEXDUMP is needed to display UEFI variables using 'printenv -e'.

Enabling CONFIG_SPL_HEXDUMP only makes sense for debugging purposes.
Hence CONFIG_SPL_HEXDUMP should not be enabled by default.

The following boards currently have CONFIG_SPL_HEXDUMP=y. This includes
boards that don't use SPL at all.

axm_defconfig
imx8mm-cl-iot-gate_defconfig
imx8mm_venice_defconfig
imxrt1020-evk_defconfig
imxrt1050-evk_defconfig
kontron_sl28_defconfig
kp_imx53_defconfig
lx2160ardb_tfa_stmm_defconfig
mt7622_rfb_defconfig
octeon_ebb7304_defconfig
octeon_nic23_defconfig
qemu_arm64_defconfig
qemu_arm_defconfig
qemu-riscv32_defconfig
qemu-riscv32_smode_defconfig
qemu-riscv64_defconfig
qemu-riscv64_smode_defconfig
qemu-x86_64_defconfig
qemu-x86_defconfig
sandbox64_defconfig
sandbox_defconfig
stm32mp15_basic_defconfig
stm32mp15_trusted_defconfig
synquacer_developerbox_defconfig
taurus_defconfig
xilinx_versal_virt_defconfig

The patch only keeps it enabled on

sandbox_spl_defconfig

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 1a46cb6c 02-Jul-2021 Simon Glass <sjg@chromium.org>

lib: Create a new Kconfig option for charset conversion

Rather than looking at two KConfig options in the Makefile, create a new
Kconfig option for compiling lib/charset.c

Enable it for UFS also, which needs this support.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 26dd9936 08-Jul-2021 Steffen Jaeckel <jaeckel-floss@eyet-services.de>

lib: add crypt subsystem

Add the basic functionality required to support the standard crypt
format.
The files crypt-sha256.c and crypt-sha512.c originate from libxcrypt and
their formatting is therefor retained.
The integration is done via a crypt_compare() function in crypt.c.

```
libxcrypt $ git describe --long --always --all
tags/v4.4.17-0-g6b110bc
```

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 7d0f3fbb 11-Jun-2021 Tero Kristo <t-kristo@ti.com>

lib: rational: copy the rational fraction lib routines from Linux

Copy the best rational approximation calculation routines from Linux.
Typical usecase for these routines is to calculate the M/N divider
values for PLLs to reach a specific clock rate.

This is based on linux kernel commit:
"lib/math/rational.c: fix possible incorrect result from rational
fractions helper"
(sha1: 323dd2c3ed0641f49e89b4e420f9eef5d3d5a881)

Signed-off-by: Tero Kristo <t-kristo@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Tero Kristo <kristo@kernel.org>

# ec0512b1 24-May-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

Revert "lib: introduce HASH_CALCULATE option"

When we think of Kconfig, we usually think of features that we like
to enable or not. Ideally, we wouldn't use Kconfig to fix a build
issue, although sometimes it might make sense. With Kconfig it's hard
to guarantee that the fix is universal. We can only say that it works
for the set of tested configurations. In the majority of cases, it's
preferable to let the linker figure things out for us.

The reverted commit attempted to fix a build issue by adding an
invisible Kconfig option. This is wrong in several ways:

It invents a new Kconfig variable when CONFIG_HASH already
exists for the same purpose.
Second, hash-checksum.c makes use of the hash_progressive_lookup_algo()
symbol, which is only provided with CONFIG_HASH, but this dependency
was not expressed in the reverted patch.

It feels like Kconfig is turning into a listing of all available
source files, and a buffet to 'select' which ones to compile. The
purpose of this revert is to enable the next change to make use of
CONFIG_HASH instead of adding to Kconfig.

This reverts commit 87316da05f2fd49d3709275e64ef0c5980366ade.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Acked-by: Masahisa Kojima <masahisa.kojima@linaro.org>

# 1621d3c4 10-May-2021 Bin Meng <bmeng.cn@gmail.com>

lib: kconfig: Limit BINMAN_FDT for OF_SEPARATE or OF_EMBED

Generally speaking BINMAN_FDT makes sense for OF_SEPARATE or OF_EMBED.
For the other OF_CONTROL methods, it's quite possible binman node is
not available as binman is invoked during the build phase instead of
runtime. Let's only turn it on for OF_SEPARATE or OF_EMBED by default.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 87316da0 13-May-2021 Masahisa Kojima <masahisa.kojima@linaro.org>

lib: introduce HASH_CALCULATE option

Build error occurs when CONFIG_EFI_SECURE_BOOT or
CONFIG_EFI_CAPSULE_AUTHENTICATE is enabled,
because hash-checksum.c is not compiled.

Since hash_calculate() implemented in hash-checksum.c can be
commonly used aside from FIT image signature verification,
this commit itroduces HASH_CALCULATE option to decide
if hash-checksum.c shall be compiled.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# e2ae483c 13-May-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

hash: Kconfig option for SHA512 hardware acceleration

Commit a479f103dc1c ("hash: Allow for SHA512 hardware implementations")
defined function definitions for hardware accelerated SHA384 and SHA512.
If CONFIG_SHA_HW_ACCEL=y, these functions are used.

We already have boards using CONFIG_SHA_HW_ACCEL=y but none implements the
new functions hw_sha384() and hw_sha512().

For implementing the EFI TCG2 protocol we need SHA384 and SHA512. The
missing hardware acceleration functions lead to build errors on boards like
peach-pi_defconfig.

Introduce a new Kconfig symbol CONFIG_SHA512_HW_ACCEL to control if the
functions hw_sha384() and hw_sha512() shall be used to implement the SHA384
and SHA512 algorithms.

Fixes: a479f103dc1c ("hash: Allow for SHA512 hardware implementations")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

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

# 6d66502b 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: Add 2 config to define the max number of regions

Add 2 configs CONFIG_LMB_MEMORY_REGIONS and CONFIG_LMB_RESERVED_REGIONS
to change independently the max number of the regions in lmb
library.

When CONFIG_LMB_USE_MAX_REGIONS=y, move the lmb property arrays to
struct lmb and manage the array size with the element 'max' of struct
lmb_region; their are still allocated in stack.

When CONFIG_LMB_USE_MAX_REGIONS=n, keep the current location in
struct lmb_region to allow compiler optimization.

Increase CONFIG_LMB_RESERVED_REGIONS is useful to avoid lmb errors in
bootm when the number of reserved regions (not adjacent) is reached:
+ 1 region for relocated U-Boot
+ 1 region for initrd
+ 1 region for relocated linux device tree
+ reserved memory regions present in Linux device tree.

The current limit of 8 regions is reached with only 5 reserved regions
in DT.

see Linux kernel commit bf23c51f1f49 ("memblock: Move memblock arrays
to static storage in memblock.c and make their size a variable")

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# 4fa0150d 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: move MAX_LMB_REGIONS value in Kconfig

Move MAX_LMB_REGIONS value in Kconfig, the max number of the regions
in lmb library.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# 77b8cfef 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: move CONFIG_LMB in Kconfig

Migrate CONFIG_LMB in Kconfig.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# a479f103 16-Feb-2021 Joel Stanley <joel@jms.id.au>

hash: Allow for SHA512 hardware implementations

Similar to support for SHA1 and SHA256, allow the use of hardware hashing
engine by enabling the algorithm and setting CONFIG_SHA_HW_ACCEL /
CONFIG_SHA_PROG_HW_ACCEL.

Signed-off-by: Joel Stanley <joel@jms.id.au>

# f2c1442e 14-Mar-2021 Simon Glass <sjg@chromium.org>

bloblist: Make BLOBLIST_TABLES depend on BLOBLIST

Add an extra condition here since we cannot put x86 tables in a bloblist
when bloblists are not supported.

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

# e0103158 25-Feb-2021 Bin Meng <bmeng.cn@gmail.com>

lib: kconfig: Mention CONFIG_ADDR_MAP limitation in the help

Mention that CONFIG_ADDR_MAP only works in the post-relocation phase.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>

# 56e7257c 03-Feb-2021 Bin Meng <bmeng.cn@gmail.com>

lib: Fix BINMAN_FDT dependency

lib/binman.c references the following 3 ofnode APIs:
ofnode_first_subnode(), ofnode_path() and ofnode_read_bool().

These APIs get built only when DM is on. Fix the dependency then.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 59e4e391 18-Jan-2021 Tom Rini <trini@konsulko.com>

Merge https://gitlab.denx.de/u-boot/custodians/u-boot-riscv

- Update qemu-riscv.rst build instructions.
- Add support for SPI on Kendryte K210.
- Add Microchip PolarFire SoC Icicle Kit support.
- Add support for an early timer.
- Select TIMER_EARLY to avoid infinite recursion for Trace.


# a80f8513 17-Jan-2021 Pragnesh Patel <pragnesh.patel@sifive.com>

trace: select TIMER_EARLY to avoid infinite recursion

When tracing functions is enabled this adds calls to
__cyg_profile_func_enter() and __cyg_profile_func_exit() to the traced
functions.

__cyg_profile_func_enter() and __cyg_profile_func_exit() invoke
timer_get_us() to record the entry and exit time.

initr_dm() will make gd->dm_root = NULL and gd->timer = NULL, so
timer_get_us() -> get_ticks() -> dm_timer_init() will lead to an
indefinite recursion.

So select TIMER_EARLY when tracing got enabled.

Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Rick Chen <rick@andestech.com>

# 6205bbb1 04-Jan-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lib: cosmetic update of CONFIG_LIB_ELF description

Change 2 typo error in CONFIG_LIB_ELF description:
- Supoort => Support
- fir => for

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c589132a 02-Dec-2020 Aswath Govindraju <a-govindraju@ti.com>

fdt: Use phandle to distinguish DT nodes with same name

While assigning the sequence number to subsystem instances by reading the
aliases property, only DT nodes names are compared and not the complete
path. This causes a problem when there are two DT nodes with same name but
have different paths.

In arch/arm/dts/k3-am65-main.dtsi there are two USB controllers with the
same device tree node name but different path. When aliases are defined for
these USB controllers then fdtdec_get_alias_seq() fails to pick the correct
instance for a given index.

fdt_path_offset() function is slow and this would effect the U-Boot
startup. To avert the time penalty on all boards, apply this extra check
only when required by using a config option.

Fix it by comparing the phandles of DT nodes after the node names match,
under a config option.

Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Fix whitespace error in Kconfig:
Signed-off-by: Simon Glass <sjg@chromium.org>

# 28cef9ca 19-Nov-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

fs: fat: create correct short names

The current function set_name() used to create short names has the
following deficiencies resolved by this patch:

* Long names (e.g. FOO.TXT) are stored even if a short name is enough.
* Short names with spaces are created, e.g. "A ~1.TXT".
* Short names with illegal characters are created, e.g. "FOO++BAR".
* Debug output does not not consider that the short file name has no
concluding '\0'.

The solution for the following bug is split of into a separate patch:

* Short file names must be unique.

This patch only provides the loop over possible short file names.

Fixes: c30a15e590c ("FAT: Add FAT write feature")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# e4f8e543 05-Nov-2020 Simon Glass <sjg@chromium.org>

smbios: Drop the unused Kconfig options

Now that we can use devicetree to specify this information, drop the old
CONFIG options.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 44c74bdd 05-Nov-2020 Simon Glass <sjg@chromium.org>

sysinfo: Provide a default driver to set SMBIOS values

Some boards want to specify the manufacturer or product name but do not
need to have their own sysinfo driver.

Add a default driver which provides a way to specify this SMBIOS
information in the devicetree, without needing any board-specific
functionality.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d2cb7a22 04-Nov-2020 Simon Glass <sjg@chromium.org>

x86: Allow putting some tables in the bloblist

At present all tables are placed starting at address f0000 in memory, and
can be up to 64KB in size. If the tables are very large, this may not
provide enough space.

Also if the tables point to other tables (such as console log or a ramoops
area) then we must allocate other memory anyway.

The bloblist is a nice place to put these tables since it is contiguous,
which makes it easy to reserve this memory for linux using the 820 tables.

Add an option to put some of the tables in the bloblist. For SMBIOS and
ACPI, create suitable pointers from the f0000 region to the new location
of the tables.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
[bmeng: squashed in http://patchwork.ozlabs.org/project/uboot/patch/
20201105062407.1.I8091ad931cbbb5e3b6f6ababdf3f8d5db0d17bb9@changeid/]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# 415eab06 03-Nov-2020 Christian Gmeiner <christian.gmeiner@gmail.com>

smbios: add parsing API

Add a very simple API to be able to access SMBIOS strings
like vendor, model and bios version.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 72eda507 27-Oct-2020 Sean Anderson <seanga2@gmail.com>

lib: Add getopt

Some commands can get very unweildy if they have too many positional
arguments. Adding options makes them easier to read, remember, and
understand.

This implementation of getopt has been taken from barebox, which has had
option support for quite a while. I have made a few modifications to their
version, such as the removal of opterr in favor of a separate getopt_silent
function. In addition, I have moved all global variables into struct
getopt_context.

The getopt from barebox also re-orders the arguments passed to it so that
non-options are placed last. This allows users to specify options anywhere.
For example, `ls -l foo/ -R` would be re-ordered to `ls -l -R foo/` as
getopt parsed the options. However, this feature conflicts with the const
argv in cmd_tbl->cmd. This was originally added in 54841ab50c ("Make sure
that argv[] argument pointers are not modified."). The reason stated in
that commit is that hush requires argv to stay unmodified. Has this
situation changed? Barebox also uses hush, and does not have this problem.
Perhaps we could use their fix?

I have assigned maintenance of getopt to Simon Glass, as it is currently
only used by the log command. I would also be fine maintaining it.

Signed-off-by: Sean Anderson <seanga2@gmail.com>

# 26637e2e 12-Sep-2020 Simon Glass <sjg@chromium.org>

lib: Allow hexdump to be used in SPL

It is sometimes useful to output hex dumps in SPL. Add a config option to
allow this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# e87dfb05 05-Aug-2020 Andrii Anisov <andrii_anisov@epam.com>

lib: sscanf: add sscanf implementation

Port sscanf implementation from mini-os and introduce new
Kconfig option to enable it: CONFIG_SSCANF. Disable by default.

Signed-off-by: Andrii Anisov <andrii_anisov@epam.com>
Signed-off-by: Anastasiia Lukianenko <anastasiia_lukianenko@epam.com>
Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>

# 81014f73 30-Jul-2020 Joao Marcos Costa <joaomarcos.costa@bootlin.com>

include/u-boot, lib/zlib: add sources for zlib decompression

Add zlib (v1.2.11) uncompr() function to U-Boot. SquashFS depends on
this function to decompress data from a raw disk image. The actual
support for zlib into SquashFS sources will be added in a follow-up
commit.

Signed-off-by: Joao Marcos Costa <joaomarcos.costa@bootlin.com>

# 69be8fd1 03-Jun-2020 Marek Szyprowski <m.szyprowski@samsung.com>

powerpc: move ADDR_MAP to Kconfig

Move ADDR_MAP related config options from include/configs/*.h to the
proper place in lib/Kconfig. This has been done using
./tools/moveconfig.py and manual inspection of the generated changes.
This is a preparation to use ADDR_MAP helper on ARM 32bit Raspberry Pi4
board for mapping the PCIe XHCI MMIO, which is above the 4GiB identity
mapping limit.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# d16b38f4 15-Apr-2020 Reuben Dowle <reubendowle0@gmail.com>

Add support for SHA384 and SHA512

The current recommendation for best security practice from the US government
is to use SHA384 for TOP SECRET [1].

This patch adds support for SHA384 and SHA512 in the hash command, and also
allows FIT images to be hashed with these algorithms, and signed with
sha384,rsaXXXX and sha512,rsaXXXX

The SHA implementation is adapted from the linux kernel implementation.

[1] Commercial National Security Algorithm Suite
http://www.iad.gov/iad/programs/iad-initiatives/cnsa-suite.cfm

Signed-off-by: Reuben Dowle <reuben.dowle@4rf.com>

# 43e442a5 26-May-2020 Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

kconfig: fix some typos

Signed-off-by: Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

# eff5a547 22-May-2020 Michael Walle <michael@walle.cc>

cmd: zip: automatically pull in gzip()

Move the CONFIG_GZIP_COMPRESSED from a config.h macro to a Kconfig menu
item. It is not selectable by a user because there is no reason to do
so. Instead it will be automatically selected by the stuff which uses
gzip(), like the zip command.

Remove it from the config_whitelist.txt. Also remove
CONFIG_GZIP_COMPRESS_DEF_SZ as this was never used on any board. The
default seems to be sane, otherwise it should be added as a Kconfig
option.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8239be61 06-May-2020 Simon Glass <sjg@chromium.org>

lib: Allow MD5 to be enabled in SPL

At present the MD5 option cannot be enabled by board configs since it has
no Kconfig name. It is generally enabled, so long as FIT support is
present. But not all boards use FIT, particularly in SPL

Fix this and add an option for SPL as well. This allows board code to call
md5() even if FIT support is not enabled.

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

# 04cb3994 21-Apr-2020 Weijie Gao <weijie.gao@mediatek.com>

lib: enable lzma decompression support for SPL build

This patch enables LZMA decompression support for SPL build

Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>

# 2a2119e1 05-Mar-2020 Atish Patra <atish.patra@wdc.com>

lib: kconfig: Add option to set BZIP2 compression method

There is no way to select BZIP2 compression method.
Add it under library/compression config where all other
compression related configs are present.

Signed-off-by: Atish Patra <atish.patra@wdc.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 805b3cac 12-Feb-2020 Keerthy <j-keerthy@ti.com>

lib: elf: Move the generic elf loading/validating functions to lib

Move the generic elf loading/validating functions to lib/
so that they can be re-used and accessed by code existing
outside cmd.

While at it remove the duplicate static version of load_elf_image_phdr
under arch/arm/mach-imx/imx_bootaux.c.

Signed-off-by: Keerthy <j-keerthy@ti.com>
Suggested-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>

# 1611235b 19-Jan-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: Kconfig dependencies for pseudo-random library

drivers/rng/sandbox_rng.c requires rand() to be defined but configuration
option CONFIG_CONFIG_LIB_RAND selected in drivers/rng/Kconfig does not
exist.

test/lib/test_aes.c requires rand() to be defined.

Fix the selection criteria for choice "Pseudo-random library support type".

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 3c10dc95 06-Dec-2019 Simon Glass <sjg@chromium.org>

binman: Add a library to access binman entries

SPL and TPL can access information about binman entries using link-time
symbols but this is not available in U-Boot proper. Of course it could be
made available, but the intention is to just read the device tree.

Add support for this, so that U-Boot can locate entries.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# b4adf627 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: crypto: add x509 parser

Imported from linux kernel v5.3:
x509.asn1 without changes
x509_akid.asn1 without changes
x509_parser.h without changes
x509_cert_parser.c with changes marked as __UBOOT__
x509_public_key.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# a9b45e6e 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add oid registry utility

Imported from linux kernel v5.3:
build_OID_registry without changes
oid_registry.h without changes
oid_registry.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# ab8a0e06 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add asn1 decoder

Imported from linux kernel v5.3:
lib/asn1_decoder.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 2b12196d 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

cmd: add asn1_compiler

Imported from linux kernel v5.3:
asn1.h without changes
asn1_ber_bytecode.h without changes
asn1_decoder.h without changes
asn1_compiler.c without changes

This host command will be used to create a ASN1 parser, for example,
for pkcs7 messages or x509 certificates. More specifically, it will
generate *byte code* which will be interpreted by asn1 decoder library.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 05429b6c 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

rtc: move date.c from drivers/rtc/ to lib/

In the next commit, rtc_mktime(), for compatibility with linux, will be
implemented using rtc_mktime(), which is no longer drivers/rtc specific.
So move this file under lib/.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 37ef1774 10-Nov-2019 Thomas Hebb <tommyhebb@gmail.com>

Kconfig: disambiguate config names for tiny printf

27084c03d36a ("spl: Allow tiny printf() to be controlled in SPL and
TPL") split this option in two for TPL and SPL, but didn't change the
Kconfig names, making them hard to set quickly.

Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>

# 0d76afc0 27-Oct-2019 Simon Glass <sjg@chromium.org>

fdt: Add Kconfig options to control code size

For better or worse libfdt recent grew a lot of code that checks the
validity of the device tree in great detail. When using unsigned or
unverified data this makes things safer, but it does add to code size.

Add some controls to select the trade-off between safety and code size.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 27084c03 25-Sep-2019 Simon Glass <sjg@chromium.org>

spl: Allow tiny printf() to be controlled in SPL and TPL

At present there is only one control for this and it is used for both SPL
and TPL. But SPL might have a lot more space than TPL so the extra cost of
a full printf() might be acceptable.

Split the option into two, providing separate SPL and TPL controls. The
TPL setting defaults to the same as SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2a51e16b 07-Jun-2019 Tom Rini <trini@konsulko.com>

configs: Make USE_TINY_PRINTF depend on SPL||TPL and be default

The USE_TINY_PRINTF symbol only changes things within SPL and TPL
builds, so make it depend on that support. Next, make it default as
within these cases we should rarely have need of more advanced print
formats outside of the debug context.

To do this, in a few cases we need to correct our Kconfig dependencies
as we had cases of non-SPL targets select'ing this symbol. Finally, in
the case of a few boards we really do need the full printf
functionality.

Signed-off-by: Tom Rini <trini@konsulko.com>

# da0fb5fd 02-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: make call depth limit customizable

Up to now we had hard coded values for the call depth up to which trace
records are created: 200 for early tracing, 15 thereafter. UEFI
applications reach a call depth of 80 or above.

Provide customizing settings for the call trace depth limit and the early
call trace depth limit. Use the old values as defaults.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8509f22a 29-Apr-2019 Marek Behún <marek.behun@nic.cz>

lib: add Zstandard decompression support

Add the zstd library from Linux kernel (only decompression support).
There are minimal changes to build with U-Boot, otherwise the files are
identical to Linux commit dc35da16 from March 2018, the files had not
been touched since in kernel. Also SPDX lincese tags were added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 83a486b6 29-Apr-2019 Marek Behún <marek.behun@nic.cz>

lib: Add xxhash support

This adds the xxhash support from Linux. Files are almost identical to
those added to Linux in commit 5d240522 ("lib: Add xxhash module") (they
haven't been touched since in Linux). The only difference is to add some
includes to be compatible with U-Boot. Also SPDX lincese tags were
added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 5132361a 29-Apr-2019 Heiko Schocher <hs@denx.de>

lib: Kconfig: fix help text for GZIP

commit 95f4bbd581cf ("lib: fdt: Allow LZO and GZIP DT compression in U-Boot")

introduced Kconfig option for gzip in U-Boot, but help text
says gzip for SPL, which is wrong. Fix this.

Signed-off-by: Heiko Schocher <hs@denx.de>
Acked-by: Marek Vasut <marex@denx.de>

# 1c6eb075 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE_BUFFER_SIZE et al to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE_BUFFER_SIZE
CONFIG_TRACE_EARLY_SIZE
CONFIG_TRACE_EARLY
CONFIG_TRACE_EARLY_ADDR

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

# a24a78d7 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE

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

# 54969b40 21-Mar-2019 Thierry Reding <treding@nvidia.com>

fdtdec: Add Kconfig symbol for tests

Runtime tests are provided as a test_fdtdec command implementation. Add
a Kconfig symbol that allows this command to be built so that the tests
can be used.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 95f4bbd5 08-Mar-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

lib: fdt: Allow LZO and GZIP DT compression in U-Boot

Add required Kconfig symbols, Makefile bits and macro fixes in a
few places to support LZO and DT compression in U-Boot. This can
save a lot of space with multi-DTB fitImages.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>

# 6e705114 13-Jan-2019 Chris Packham <judge.packham@gmail.com>

lib: Kconfig: spelling fixes

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 048c6e89 06-Nov-2018 Simon Glass <sjg@chromium.org>

spl: lz4: Allow use of lz4 compression in SPL

In some cases U-Boot is compressed and it is useful to be able to
decompress it in SPL. Add a Kconfig and Makefile change to allow this.
Note that this does not actually implement decompression.

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

# 2895c4b7 15-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

kconfig: Introduce HAVE_ARCH_IOMAP

Introduce a new Kconfig option for architecture codes to control
whether it provides io{read,write}{8,16,32} I/O accessor functions.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5592a633 01-Oct-2018 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt in TPL

In some cases (e.g. sandbox with verified boot) it is useful to support
libfdt in TPL. Update the Kconfig to handle this.

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

# 6307896c 01-Oct-2018 Simon Glass <sjg@chromium.org>

tpm: Add support for SPL and TPL

At present the tpm can only be used in U-Boot proper. Updated it to work
in SPL and TPL also.

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

# ab948cd2 19-Jul-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

fdt_support: make FDT_FIXUP_PARTITIONS depend on CMD_MTDPARTS

fdt_fixup_mtdparts() calls mtdparts_init() and device_find(),
which are defined in cmd/mtdparts.c

The combination of FDT_FIXUP_PARTITIONS=y and CMD_MTDPARTS=n
emits the following link error:

common/fdt_support.c:903: undefined reference to `mtdparts_init'
common/fdt_support.c:914: undefined reference to `device_find'

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 3330584d 03-Jun-2018 Igor Opaniuk <igor.opaniuk@gmail.com>

avb2.0: integrate avb 2.0 into the build system

Integrate libavb into the build system. Introduce CONFIG_LIBAVB
build option.

Signed-off-by: Igor Opaniuk <igor.opaniuk@linaro.org>

# f8c987f8 05-Jun-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

lib: Add hexdump

Often during debugging session it's very interesting to see
what data we were dealing with. For example what we write or read
to/from memory or peripherals.

This change introduces functions that allow to dump binary
data with one simple function invocation like:
------------------->8----------------
print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, buf, len);
------------------->8----------------

which gives us the following:
------------------->8----------------
00000000: f2 b7 c9 88 62 61 75 64 72 61 74 65 3d 31 31 35 ....baudrate=115
00000010: 32 30 30 00 62 6f 6f 74 61 72 67 73 3d 63 6f 6e 200.bootargs=con
00000020: 73 6f 6c 65 3d 74 74 79 53 33 2c 31 31 35 32 30 sole=ttyS3,11520
00000030: 30 6e 38 00 62 6f 6f 74 64 65 6c 61 79 3d 33 00 0n8.bootdelay=3.
00000040: 62 6f 6f 74 66 69 6c 65 3d 75 49 6d 61 67 65 00 bootfile=uImage.
00000050: 66 64 74 63 6f 6e 74 72 6f 6c 61 64 64 72 3d 39 fdtcontroladdr=9
00000060: 66 66 62 31 62 61 30 00 6c 6f 61 64 61 64 64 72 ffb1ba0.loadaddr
00000070: 3d 30 78 38 32 30 30 30 30 30 30 00 73 74 64 65 =0x82000000.stde
00000080: 72 72 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 rr=serial0@e0022
00000090: 30 30 30 00 73 74 64 69 6e 3d 73 65 72 69 61 6c 000.stdin=serial
000000a0: 30 40 65 30 30 32 32 30 30 30 00 73 74 64 6f 75 0@e0022000.stdou
000000b0: 74 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 30 t=serial0@e00220
000000c0: 30 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00..............
...
------------------->8----------------

Source of hexdump.c was copied from Linux kernel v4.7-rc2.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Mario Six <mario.six@gdsys.cc>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Stefan Roese <sr@denx.de>

# c232d14d 29-May-2018 Alex Kiernan <alex.kiernan@gmail.com>

mmc: Separate "mmc swrite" from fastboot

Introduce CONFIG_IMAGE_SPARSE and CONFIG_CMD_MMC_SWRITE so the "mmc
swrite" command is separated from the fastboot code.

Move image-sparse from common to lib so it's clear it's library code.

Rename CONFIG_FASTBOOT_FLASH_FILLBUF_SIZE to CONFIG_IMAGE_SPARSE_FILLBUF_SIZE
and migrate it to Kconfig.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Acked-by: Jassi Brar <jaswinder.singh@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6417572e 08-May-2018 Tom Rini <trini@konsulko.com>

lib/Kconfig: Mark OF_LIBFDT_OVERLAY as depending on OF_LIBFDT

The overlay code is only useful when OF_LIBFDT is set, so mark it as
depending on that first.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 58a46f88 25-Apr-2018 Praneeth Bajjuri <praneeth@ti.com>

configs: TI: Enable FIT Library overlay support

Enable the FDT library overlay support for all TI SOC family.

Without this option, when Loading fdt from FIT image, the
following warning is seen.

"config with overlays but CONFIG_OF_LIBFDT_OVERLAY not set".

Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
Suggested-by: Andrew F.Davis <afd@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>

# 14ad44ab 18-Apr-2018 Alex Kiernan <alex.kiernan@gmail.com>

spl: Split sprintf, strto* from SPL serial in Kconfig

When SPL serial is disabled, callers who need sprintf or strtoul fail
because their inclusion is guarded by CONFIG_SPL_SERIAL_SUPPORT/
CONFIG_TPL_SERIAL_SUPPORT.

Split printf, sprintf and strto into their own entries and then select
all of them if SERIAL_SUPPORT is enabled to match the current behaviour.

Include panic.o unconditionally as it can be called from anywhere which
uses BUG_ON().

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>

# e294ba06 04-Apr-2018 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-sunxi

Signed-off-by: Tom Rini <trini@konsulko.com>


# d14db11d 03-Apr-2018 Andre Przywara <andre.przywara@arm.com>

sunxi: revert disabling of features

In January some commits were introduced to mitigate the U-Boot image
size issues we encountered on sunxi builds.
Now with the MMC environment removed we can bring them back, as we
practically don't have a size limit anymore.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 32ce6179 13-Mar-2018 Bryan O'Donoghue <bryan.odonoghue@linaro.org>

optee: Add lib entries for sharing OPTEE code across ports

This patch adds code to lib to enable sharing of useful OPTEE code between
board-ports and architectures. The code on lib/optee/optee.c comes from the
TI omap2 port. Eventually the OMAP2 code will be patched to include the
shared code. The intention here is to add more useful OPTEE specific code
as more functionality gets added.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Cc: Harinarayan Bhatta <harinarayan@ti.com>
Cc: Andrew F. Davis <afd@ti.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Kever Yang <kever.yang@rock-chips.com>
Cc: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Cc: Peng Fan <peng.fan@nxp.com>
Tested-by: Peng Fan <peng.fan@nxp.com>

# 36c1877c 06-Feb-2018 Faiz Abbas <faiz_abbas@ti.com>

lib: Kconfig: Move DYNAMIC_CRC_TABLE to Kconfig

Add CONFIG prefix to DYNAMIC_CRC_TABLE and implement it in
Kconfig.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>

# a451bc27 05-Feb-2018 Adam Ford <aford173@gmail.com>

Convert LIB_UUID to Kconfig

config_fallback.h has some logic that checks a variety of options
and selects LIB_UUID if it hasn't already been selected. This
will all LIB_UUID in Kconfig and select this option for the list
of options to allow us to remove the logic from fallbacks

Signed-off-by: Adam Ford <aford173@gmail.com>

# a5a37567 06-Feb-2018 Adam Ford <aford173@gmail.com>

Convert CONFIG LIB_HW_RAND to Kconfig

config_fallbacks.h had some logic to automatically select
LIB_RAND if RANDOM_UUID or CMD_UUID were set if LIB_HW_RAND wasn't
already selected. By migrating LIB_HW_RAND to Kconfig, we can
remove this check from config_fallbacks.h and put it into Kconfig

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
[trini: Turn into a choice, add NET_RANDOM_ETHADDR]
Signed-off-by: Tom Rini <trini@konsulko.com>

# acd4d334 16-Jan-2018 Maxime Ripard <maxime.ripard@free-electrons.com>

net: regex: Disable by default on sunXi

The sunXi arm64 build has overflown, leading to the main U-boot binary
overwriting the environment when flashing the new image, or even worse,
overwriting itself when we're calling saveenv.

Disable this option that is not critical until we can adress the issue
properly.

Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 7e3caa81 03-Dec-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

Move CONFIG_PANIC_HANG to Kconfig

Freescale (NXP) boards have lots of defconfig files per board.
I used "imply PANIC_HANG" for them.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# da5337a6 08-Nov-2017 Nandor Han <nandor.han@ge.com>

rtc: add support for s35392a

Add support for S35392A RTC. The driver supports both U-Boot driver
models.

Signed-off-by: Nandor Han <nandor.han@ge.com>
Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
Cc: Heiko Schocher <hs@denx.de>

# f52bdf4b 14-Sep-2017 Jean-Jacques Hiblot <jjhiblot@ti.com>

lib: allow building lzo for the SPL

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 85d8bf57 03-Sep-2017 Marek Behún <marek.behun@nic.cz>

lib: Add CRC32-C

This is needed for BTRFS.

Signed-off-by: Marek Behun <marek.behun@nic.cz>

create mode 100644 lib/crc32c.c

# 7264f292 15-Aug-2017 York Sun <york.sun@nxp.com>

spl: fit: Eanble GZIP support for image decompression

Add Kconfig option SPL_GZIP and SPL_ZLIB to enable gunzip support for
SPL boot, eg. falcon boot compressed kernel image.

Signed-off-by: York Sun <york.sun@nxp.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6ef2f901 11-Aug-2017 Adam Ford <aford173@gmail.com>

Convert CONFIG_BCH to Kconfig

This converts the following to Kconfig:
CONFIG_BCH

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1a7ba1d 18-Aug-2017 Anatolij Gustschin <agust@denx.de>

Fix 'notes' typos

s/notes/nodes

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 96b9082c 03-Aug-2017 Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

rockchip: rk3188: rock: adjust for SPL/TPL split

With the changes to split SPL/TPL for the RK3368, I apparently missed
some needed adjustments to the RK3188 Kconfig and rock_defconfig.

This fixes build-issues for the rock board after applying the RK3368
enablement (and SPL/TPL) set that resulted from TPL_SERIAL_SUPPORT,
TPL_ROCKCHIP_BACK_TO_BROM and TPL_TINY_MEMSET being separate symbols
now.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d56b4b19 22-Jul-2017 Tom Rini <trini@konsulko.com>

configs: Migrate RBTREE, LZO, CMD_MTDPARTS, CMD_UBI and CMD_UBIFS

The above CONFIG options are in Kconfig, and now have correct depends and
inter-dependencies. Migrate these to configs/ from include/configs/. In the
case of CMD_UBIFS also change it to be a default y if CMD_UBI.

Signed-off-by: Tom Rini <trini@konsulko.com>

# aed998aa 17-May-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_LZMA to Kconfig

This converts the following to Kconfig:
CONFIG_LZMA

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

# b1a873df 26-Apr-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_CMD_AES et al to Kconfig

This converts the following to Kconfig:
CONFIG_CMD_AES
CONFIG_AES

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Add select AES to CMD_AES]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 173aafbf 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

cmd: Expose a Kconfig option to enable UBIFS commands

Create a new Kconfig entry to allow CMD_UBIFS selection from Kconfig and
add an hidden LZO option that can be selected by CMD_UBIFS.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>

# aa049152 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

mtd: ubi: Select RBTREE option from MTD_UBI Kconfig entry

Expose the RBTREE feature through Kconfig and select this option from the
MTD_UBI option.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>
[Rebased on master]
Signed-off-by: Jagan Teki <jagan@openedev.com>

# ab4458bd 02-Apr-2017 Simon Glass <sjg@chromium.org>

string: Provide a slimmed-down memset()

Most of the time the optimised memset() is what we want. For extreme
situations such as TPL it may be too large. For example on the 'rock'
board, using a simple loop saves a useful 48 bytes. With gcc 4.9 and
the rodata bug, this patch is enough to reduce the TPL image below the
limit.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>

# bea79d7d 14-Mar-2017 Andre Przywara <andre.przywara@arm.com>

Kconfig: introduce md5sum command selection

So far CONFIG_MD5SUM would need to be set by a board's include file.
Since the command is really generic, move it over to Kconfig to allow
it to be defined by either a board's defconfig, menuconfig or some
config snippet merged via mergeconfig.sh.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e663b350 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

smbios: Expose in efi_loader as table

We can pass SMBIOS easily as EFI configuration table to an EFI payload. This
patch adds enablement for that case.

While at it, we also enable SMBIOS generation for ARM systems, since they support
EFI_LOADER.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4b6dddc2 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

x86: Move smbios generation into arch independent directory

We will need the SMBIOS generation function on ARM as well going forward,
so let's move it into a non arch specific location.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# ebf7fff2 05-Oct-2016 Heiko Schocher <hs@denx.de>

spl: move FDT_FIXUP_PARTITIONS to Kconfig

Move FDT_FIXUP_PARTITIONS to Kconfig and cleanup existing
uses.

Signed-off-by: Heiko Schocher <hs@denx.de>

# ddf67f71 05-Jul-2016 Maxime Ripard <maxime.ripard@free-electrons.com>

libfdt: Add overlay application function

The device tree overlays are a good way to deal with user-modifyable
boards or boards with some kind of an expansion mechanism where we can
easily plug new board in (like the BBB, the Raspberry Pi or the CHIP).

Add a new function to merge overlays with a base device tree.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>

# 91b86e21 26-May-2016 Marek Vasut <marex@denx.de>

lib: Enable private libgcc by default

This patch decouples U-Boot binary from the toolchain on systems where
private libgcc is available. Instead of pulling in functions provided
by the libgcc from the toolchain, U-Boot will use it's own set of libgcc
functions. These functions are usually imported from Linux kernel, which
also uses it's own libgcc functions instead of the ones provided by the
toolchain.

This patch solves a rather common problem. The toolchain can usually
generate code for many variants of target architecture and often even
different endianness. The libgcc on the other hand is usually compiled
for one particular configuration and the functions provided by it may
or may not be suited for use in U-Boot. This can manifest in two ways,
either the U-Boot fails to compile altogether and linker will complain
or, in the much worse case, the resulting U-Boot will build, but will
misbehave in very subtle and hard to debug ways.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 67976306 30-Mar-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

cosmetic: Fix typos "privide"

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# ed980b8c 03-Mar-2016 Alexander Graf <agraf@csgraf.de>

efi_loader: hook up in build environment

Now that we have all the bits and pieces ready for EFI payload loading
support, hook them up in Makefiles and KConfigs so that we can build.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
[trini: Enable only when we of OF_LIBFDT, disable on kwb and colibri_pxa270]
Signed-off-by: Tom Rini <trini@konsulko.com>

# aa34fbc0 22-Feb-2016 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt to be used in SPL

Add an option to enable libfdt in SPL. This can be useful when decoding
FIT files in SPL.

We need to make sure this option is not enabled in SPL by this change.
Also this option needs to be enabled in host builds. Si add a new
IMAGE_USE_LIBFDT #define which can be used in files that are built on the
host but must also build for U-Boot and SPL.

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

# 69e173eb 22-Feb-2016 Simon Glass <sjg@chromium.org>

Move CONFIG_OF_LIBFDT to Kconfig

Move this option to Kconfig and tidy up existing boards.

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

# a187559e 05-Feb-2016 Bin Meng <bmeng.cn@gmail.com>

Use correct spelling of "U-Boot"

Correct spelling of "U-Boot" shall be used in all written text
(documentation, comments in source files etc.).

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Minkyu Kang <mk7.kang@samsung.com>

# 947c626d 14-Jan-2016 Tom Rini <trini@konsulko.com>

vsprintf.c: Always enable CONFIG_SYS_VSNPRINTF

Enabling this function always removes some class of string saftey issues.
The size change here in general is about 400 bytes and this seems a reasonable
trade-off.

Cc: Peng Fan <peng.fan@nxp.com>
Cc: Peter Robinson <pbrobinson@gmail.com>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Adrian Alonso <aalonso@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 7d9cde10 22-Nov-2015 Stefan Roese <sr@denx.de>

lib/tiny-printf.c: Add tiny printf function for space limited environments

This patch adds a small printf() version that supports all basic formats.
Its intented to be used in U-Boot SPL versions on platforms with very
limited internal RAM sizes.

To enable it, just define CONFIG_USE_TINY_PRINTF in your defconfig. This
will result in the SPL using this tiny function and the main U-Boot
still using the full-blown printf() function.

This code was copied from:
http://www.sparetimelabs.com/printfrevisited
With mostly only coding style related changes so that its checkpatch
clean.

The size reduction is about 2.5KiB. Here a comparison for the db-mv784mp-gp
(Marvell AXP) SPL:

Without this patch:
58963 18536 1928 79427 13643 ./spl/u-boot-spl

With this patch:
56542 18536 1956 77034 12cea ./spl/u-boot-spl

Note:
To make it possible to compile tiny-printf.c instead of vsprintf.c when
CONFIG_USE_TINY_PRINTF is defined, the functions printf() and vprintf() are
moved from common/console.c into vsprintf.c in this patch.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>

# 2419cd16 03-Oct-2015 Simon Glass <sjg@chromium.org>

dm: tpm: Drop CONFIG_DM_TPM

Now that all TPM drivers use driver model, we can drop the special driver
model CONFIG option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>

# 027b728d 06-Oct-2015 Julius Werner <jwerner@chromium.org>

Add support for LZ4 decompression algorithm

This patch adds support for LZ4-compressed FIT image contents. This
algorithm has a slightly worse compression ration than LZO while being
nearly twice as fast to decompress. When loading images from a fast
storage medium this usually results in a boot time win.

Sandbox-tested only since I don't have a U-Boot development system set
up right now. The code was imported unchanged from coreboot where it's
proven to work, though. I'm mostly interested in getting this recognized
by mkImage for use in a downstream project.

Signed-off-by: Julius Werner <jwerner@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# a7d660bc 22-Aug-2015 Simon Glass <sjg@chromium.org>

tpm: Add Kconfig options for TPMs

Add new Kconfig options for TPMs in preparation for moving boards to use
Kconfig for TPM configuration.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 867a6ac8 31-Jul-2015 Simon Glass <sjg@chromium.org>

efi: Add start-up library code

When running as an EFI application, U-Boot must request memory from EFI,
and provide access to the boot services U-Boot needs.

Add library code to perform these tasks. This includes efi_main() which is
the entry point from EFI. U-Boot is built as a shared library.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d1389403 23-Jun-2015 Simon Glass <sjg@chromium.org>

Add a dhrystone benchmark command

Drystone provides a convenient sanity check that the CPU is running at full
speed. Add this as a command which can be enabled as needed.

Note: I investigated using Coremark for this but there was a license
agreement and I could not work out if it was GPL-compatible.

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

# f7848d90 22-Jun-2015 Joe Hershberger <joe.hershberger@ni.com>

Allow CONFIG_REGEX to be disabled when CONFIG_NET

Instead of selecting REGEX when NET is enabled, make it the default, but
allow boards that are tiny to disable it and lose functionality on all
but the first Ethernet adapter.

cm-bf548, bf538f-ezkit, and bf533-stamp need this. None appear to have
more than one Ethernet interface.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# 3850dbe8 11-Jun-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

blackfin: fix undefined reference to srand and rand

Commit 9ba9e85f3f1c (net: Fix NET_RANDOM_ETHADDR dependencies)
accidentally dropped CONFIG_LIB_RAND defines for 14 Blackfin boards.

Prior to that commit, those boards defined CONFIG_LIB_RAND, but not
CONFIG_NET_RANDOM_ETHADDR. So, commit 9ba9e85f3f1c should not have
touched them, but in fact it ripped CONFIG_LIB_RAND off from all the
header files, which caused undefined reference to srand and rand.
CONFIG_LIB_RAND=y must be revived for such boards.

BTW, this commit indeed makes it better, but even with this fix,
three boards (bf533-stamp, bf538f-ezkit, cm-bf548) still can not
build due to region 'ram' overflowed error. This was cause by
commit 6eed3786c68c (net: Move the CMD_NET config to defconfigs)
because CMD_NET selects NET, and NET selects REGEX. Eventually,
some boards were newly enabled with CONFIG_REGEX, increasing the
memory footprint. A patch is expected to fix the build error.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 9ba9e85f 25-May-2015 Michal Simek <michal.simek@xilinx.com>

net: Fix NET_RANDOM_ETHADDR dependencies

NET_RANDOM_ETHADDR depends on lib/rand.c. This patch adds dependency to
Kconfig to ensure that library is also compiled.

Remove the definitions from Blackfin boards' include/configs.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 6501ff62 20-Apr-2015 Przemyslaw Marczak <p.marczak@samsung.com>

lib: Kconfig: add entry for errno_str() function

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1a60650c 21-Apr-2015 Joe Hershberger <joe.hershberger@ni.com>

kconfig: Move REGEX to Kconfig

Having this as a Kconfig allows it to be a dependent feature.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8156345d 06-Mar-2015 Simon Glass <sjg@chromium.org>

sandbox: Move CONFIG_SYS_VSNPRINTF to Kconfig

Move this over to Kconfig and tidy up.

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

# 94e3c8c4 19-Feb-2015 gaurav rana <gaurav.rana@freescale.com>

crypto/fsl - Add progressive hashing support using hardware acceleration.

Currently only normal hashing is supported using hardware acceleration.
Added support for progressive hashing using hardware.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
Signed-off-by: Gaurav Rana <gaurav.rana@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>

# d9f23c7f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

lib/rsa: Add Kconfig for devices supporting RSA Modular Exponentiation

Kconfig option added for devices which support RSA Verification.
1. RSA_SOFTWARE_EXP
Enables driver for supporting RSA Modular Exponentiation in Software
2. RSA_FREESCALE_EXP
Enables driver for supporting RSA Modular Exponentiation using Freescale specific
driver

The above drivers use RSA uclass

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
(Removed duplicate line in Kconfig comment)

Change-Id: I7663c4d5350e2bfc3dfa2696f70ef777d6ccc6f6

# c4beb22f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

FIT: Modify option FIT_SIGNATURE in Kconfig

For FIT signature based approach to work, RSA library needs to be selected.
The FIT_SIGNATURE option in Kconfig is modified to automatically select RSA.
Selecting RSA compiles the RSA library required for image verification.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 45ccec8f 23-Oct-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_USE_PRIVATE_LIBGCC to Kconfig

The private libgcc is supported only on ARM, MIPS, PowerPC, SH, x86.
Those architectures should "select" HAVE_PRIVATE_LIBGCC and
CONFIG_USE_PRIVATE_LIBGCC should depend on it.

Currently, this option is enabled on Tegra boards and x86 architecture.
Move the definition from header files to Kconfig.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Tested-by: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: Tom Warren <twarren@nvidia.com>

# 8c688bc4 23-Oct-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_SYS_HZ to lib/Kconfig

CONFIG_SYS_HZ is always defined as 1000 in config_fallbacks.h
(but some boards still have redundant definitions).

This commit moves the definition and the document in README to
Kconfig. Since lib/Kconfig can assure that CONFIG_SYS_HZ is 1000,
the sanity check in lib/time.c should be removed.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Reviewed-by: Marek Vasut <marex@denx.de>

# b0928da6 16-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED to Kconfig

If this option is enabled, the objects under lib/ directory
are compiled with speed optimization, not size optimization.
(Currently, only used by some Blackfin boards.)

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# ed36323f 16-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: add blank Kconfig files

This would be useful to start moving various config options.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# fa3f1f1d 24-Jul-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: disable CONFIG_SPL_HEXDUMP by default

CONFIG_HEXDUMP is needed to display UEFI variables using 'printenv -e'.

Enabling CONFIG_SPL_HEXDUMP only makes sense for debugging purposes.
Hence CONFIG_SPL_HEXDUMP should not be enabled by default.

The following boards currently have CONFIG_SPL_HEXDUMP=y. This includes
boards that don't use SPL at all.

axm_defconfig
imx8mm-cl-iot-gate_defconfig
imx8mm_venice_defconfig
imxrt1020-evk_defconfig
imxrt1050-evk_defconfig
kontron_sl28_defconfig
kp_imx53_defconfig
lx2160ardb_tfa_stmm_defconfig
mt7622_rfb_defconfig
octeon_ebb7304_defconfig
octeon_nic23_defconfig
qemu_arm64_defconfig
qemu_arm_defconfig
qemu-riscv32_defconfig
qemu-riscv32_smode_defconfig
qemu-riscv64_defconfig
qemu-riscv64_smode_defconfig
qemu-x86_64_defconfig
qemu-x86_defconfig
sandbox64_defconfig
sandbox_defconfig
stm32mp15_basic_defconfig
stm32mp15_trusted_defconfig
synquacer_developerbox_defconfig
taurus_defconfig
xilinx_versal_virt_defconfig

The patch only keeps it enabled on

sandbox_spl_defconfig

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 1a46cb6c 02-Jul-2021 Simon Glass <sjg@chromium.org>

lib: Create a new Kconfig option for charset conversion

Rather than looking at two KConfig options in the Makefile, create a new
Kconfig option for compiling lib/charset.c

Enable it for UFS also, which needs this support.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 26dd9936 08-Jul-2021 Steffen Jaeckel <jaeckel-floss@eyet-services.de>

lib: add crypt subsystem

Add the basic functionality required to support the standard crypt
format.
The files crypt-sha256.c and crypt-sha512.c originate from libxcrypt and
their formatting is therefor retained.
The integration is done via a crypt_compare() function in crypt.c.

```
libxcrypt $ git describe --long --always --all
tags/v4.4.17-0-g6b110bc
```

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 7d0f3fbb 11-Jun-2021 Tero Kristo <t-kristo@ti.com>

lib: rational: copy the rational fraction lib routines from Linux

Copy the best rational approximation calculation routines from Linux.
Typical usecase for these routines is to calculate the M/N divider
values for PLLs to reach a specific clock rate.

This is based on linux kernel commit:
"lib/math/rational.c: fix possible incorrect result from rational
fractions helper"
(sha1: 323dd2c3ed0641f49e89b4e420f9eef5d3d5a881)

Signed-off-by: Tero Kristo <t-kristo@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Tero Kristo <kristo@kernel.org>

# ec0512b1 24-May-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

Revert "lib: introduce HASH_CALCULATE option"

When we think of Kconfig, we usually think of features that we like
to enable or not. Ideally, we wouldn't use Kconfig to fix a build
issue, although sometimes it might make sense. With Kconfig it's hard
to guarantee that the fix is universal. We can only say that it works
for the set of tested configurations. In the majority of cases, it's
preferable to let the linker figure things out for us.

The reverted commit attempted to fix a build issue by adding an
invisible Kconfig option. This is wrong in several ways:

It invents a new Kconfig variable when CONFIG_HASH already
exists for the same purpose.
Second, hash-checksum.c makes use of the hash_progressive_lookup_algo()
symbol, which is only provided with CONFIG_HASH, but this dependency
was not expressed in the reverted patch.

It feels like Kconfig is turning into a listing of all available
source files, and a buffet to 'select' which ones to compile. The
purpose of this revert is to enable the next change to make use of
CONFIG_HASH instead of adding to Kconfig.

This reverts commit 87316da05f2fd49d3709275e64ef0c5980366ade.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Acked-by: Masahisa Kojima <masahisa.kojima@linaro.org>

# 1621d3c4 10-May-2021 Bin Meng <bmeng.cn@gmail.com>

lib: kconfig: Limit BINMAN_FDT for OF_SEPARATE or OF_EMBED

Generally speaking BINMAN_FDT makes sense for OF_SEPARATE or OF_EMBED.
For the other OF_CONTROL methods, it's quite possible binman node is
not available as binman is invoked during the build phase instead of
runtime. Let's only turn it on for OF_SEPARATE or OF_EMBED by default.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 87316da0 13-May-2021 Masahisa Kojima <masahisa.kojima@linaro.org>

lib: introduce HASH_CALCULATE option

Build error occurs when CONFIG_EFI_SECURE_BOOT or
CONFIG_EFI_CAPSULE_AUTHENTICATE is enabled,
because hash-checksum.c is not compiled.

Since hash_calculate() implemented in hash-checksum.c can be
commonly used aside from FIT image signature verification,
this commit itroduces HASH_CALCULATE option to decide
if hash-checksum.c shall be compiled.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# e2ae483c 13-May-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

hash: Kconfig option for SHA512 hardware acceleration

Commit a479f103dc1c ("hash: Allow for SHA512 hardware implementations")
defined function definitions for hardware accelerated SHA384 and SHA512.
If CONFIG_SHA_HW_ACCEL=y, these functions are used.

We already have boards using CONFIG_SHA_HW_ACCEL=y but none implements the
new functions hw_sha384() and hw_sha512().

For implementing the EFI TCG2 protocol we need SHA384 and SHA512. The
missing hardware acceleration functions lead to build errors on boards like
peach-pi_defconfig.

Introduce a new Kconfig symbol CONFIG_SHA512_HW_ACCEL to control if the
functions hw_sha384() and hw_sha512() shall be used to implement the SHA384
and SHA512 algorithms.

Fixes: a479f103dc1c ("hash: Allow for SHA512 hardware implementations")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

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

# 6d66502b 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: Add 2 config to define the max number of regions

Add 2 configs CONFIG_LMB_MEMORY_REGIONS and CONFIG_LMB_RESERVED_REGIONS
to change independently the max number of the regions in lmb
library.

When CONFIG_LMB_USE_MAX_REGIONS=y, move the lmb property arrays to
struct lmb and manage the array size with the element 'max' of struct
lmb_region; their are still allocated in stack.

When CONFIG_LMB_USE_MAX_REGIONS=n, keep the current location in
struct lmb_region to allow compiler optimization.

Increase CONFIG_LMB_RESERVED_REGIONS is useful to avoid lmb errors in
bootm when the number of reserved regions (not adjacent) is reached:
+ 1 region for relocated U-Boot
+ 1 region for initrd
+ 1 region for relocated linux device tree
+ reserved memory regions present in Linux device tree.

The current limit of 8 regions is reached with only 5 reserved regions
in DT.

see Linux kernel commit bf23c51f1f49 ("memblock: Move memblock arrays
to static storage in memblock.c and make their size a variable")

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# 4fa0150d 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: move MAX_LMB_REGIONS value in Kconfig

Move MAX_LMB_REGIONS value in Kconfig, the max number of the regions
in lmb library.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# 77b8cfef 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: move CONFIG_LMB in Kconfig

Migrate CONFIG_LMB in Kconfig.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# a479f103 16-Feb-2021 Joel Stanley <joel@jms.id.au>

hash: Allow for SHA512 hardware implementations

Similar to support for SHA1 and SHA256, allow the use of hardware hashing
engine by enabling the algorithm and setting CONFIG_SHA_HW_ACCEL /
CONFIG_SHA_PROG_HW_ACCEL.

Signed-off-by: Joel Stanley <joel@jms.id.au>

# f2c1442e 14-Mar-2021 Simon Glass <sjg@chromium.org>

bloblist: Make BLOBLIST_TABLES depend on BLOBLIST

Add an extra condition here since we cannot put x86 tables in a bloblist
when bloblists are not supported.

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

# e0103158 25-Feb-2021 Bin Meng <bmeng.cn@gmail.com>

lib: kconfig: Mention CONFIG_ADDR_MAP limitation in the help

Mention that CONFIG_ADDR_MAP only works in the post-relocation phase.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>

# 56e7257c 03-Feb-2021 Bin Meng <bmeng.cn@gmail.com>

lib: Fix BINMAN_FDT dependency

lib/binman.c references the following 3 ofnode APIs:
ofnode_first_subnode(), ofnode_path() and ofnode_read_bool().

These APIs get built only when DM is on. Fix the dependency then.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 59e4e391 18-Jan-2021 Tom Rini <trini@konsulko.com>

Merge https://gitlab.denx.de/u-boot/custodians/u-boot-riscv

- Update qemu-riscv.rst build instructions.
- Add support for SPI on Kendryte K210.
- Add Microchip PolarFire SoC Icicle Kit support.
- Add support for an early timer.
- Select TIMER_EARLY to avoid infinite recursion for Trace.


# a80f8513 17-Jan-2021 Pragnesh Patel <pragnesh.patel@sifive.com>

trace: select TIMER_EARLY to avoid infinite recursion

When tracing functions is enabled this adds calls to
__cyg_profile_func_enter() and __cyg_profile_func_exit() to the traced
functions.

__cyg_profile_func_enter() and __cyg_profile_func_exit() invoke
timer_get_us() to record the entry and exit time.

initr_dm() will make gd->dm_root = NULL and gd->timer = NULL, so
timer_get_us() -> get_ticks() -> dm_timer_init() will lead to an
indefinite recursion.

So select TIMER_EARLY when tracing got enabled.

Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Rick Chen <rick@andestech.com>

# 6205bbb1 04-Jan-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lib: cosmetic update of CONFIG_LIB_ELF description

Change 2 typo error in CONFIG_LIB_ELF description:
- Supoort => Support
- fir => for

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c589132a 02-Dec-2020 Aswath Govindraju <a-govindraju@ti.com>

fdt: Use phandle to distinguish DT nodes with same name

While assigning the sequence number to subsystem instances by reading the
aliases property, only DT nodes names are compared and not the complete
path. This causes a problem when there are two DT nodes with same name but
have different paths.

In arch/arm/dts/k3-am65-main.dtsi there are two USB controllers with the
same device tree node name but different path. When aliases are defined for
these USB controllers then fdtdec_get_alias_seq() fails to pick the correct
instance for a given index.

fdt_path_offset() function is slow and this would effect the U-Boot
startup. To avert the time penalty on all boards, apply this extra check
only when required by using a config option.

Fix it by comparing the phandles of DT nodes after the node names match,
under a config option.

Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Fix whitespace error in Kconfig:
Signed-off-by: Simon Glass <sjg@chromium.org>

# 28cef9ca 19-Nov-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

fs: fat: create correct short names

The current function set_name() used to create short names has the
following deficiencies resolved by this patch:

* Long names (e.g. FOO.TXT) are stored even if a short name is enough.
* Short names with spaces are created, e.g. "A ~1.TXT".
* Short names with illegal characters are created, e.g. "FOO++BAR".
* Debug output does not not consider that the short file name has no
concluding '\0'.

The solution for the following bug is split of into a separate patch:

* Short file names must be unique.

This patch only provides the loop over possible short file names.

Fixes: c30a15e590c ("FAT: Add FAT write feature")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# e4f8e543 05-Nov-2020 Simon Glass <sjg@chromium.org>

smbios: Drop the unused Kconfig options

Now that we can use devicetree to specify this information, drop the old
CONFIG options.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 44c74bdd 05-Nov-2020 Simon Glass <sjg@chromium.org>

sysinfo: Provide a default driver to set SMBIOS values

Some boards want to specify the manufacturer or product name but do not
need to have their own sysinfo driver.

Add a default driver which provides a way to specify this SMBIOS
information in the devicetree, without needing any board-specific
functionality.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d2cb7a22 04-Nov-2020 Simon Glass <sjg@chromium.org>

x86: Allow putting some tables in the bloblist

At present all tables are placed starting at address f0000 in memory, and
can be up to 64KB in size. If the tables are very large, this may not
provide enough space.

Also if the tables point to other tables (such as console log or a ramoops
area) then we must allocate other memory anyway.

The bloblist is a nice place to put these tables since it is contiguous,
which makes it easy to reserve this memory for linux using the 820 tables.

Add an option to put some of the tables in the bloblist. For SMBIOS and
ACPI, create suitable pointers from the f0000 region to the new location
of the tables.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
[bmeng: squashed in http://patchwork.ozlabs.org/project/uboot/patch/
20201105062407.1.I8091ad931cbbb5e3b6f6ababdf3f8d5db0d17bb9@changeid/]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# 415eab06 03-Nov-2020 Christian Gmeiner <christian.gmeiner@gmail.com>

smbios: add parsing API

Add a very simple API to be able to access SMBIOS strings
like vendor, model and bios version.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 72eda507 27-Oct-2020 Sean Anderson <seanga2@gmail.com>

lib: Add getopt

Some commands can get very unweildy if they have too many positional
arguments. Adding options makes them easier to read, remember, and
understand.

This implementation of getopt has been taken from barebox, which has had
option support for quite a while. I have made a few modifications to their
version, such as the removal of opterr in favor of a separate getopt_silent
function. In addition, I have moved all global variables into struct
getopt_context.

The getopt from barebox also re-orders the arguments passed to it so that
non-options are placed last. This allows users to specify options anywhere.
For example, `ls -l foo/ -R` would be re-ordered to `ls -l -R foo/` as
getopt parsed the options. However, this feature conflicts with the const
argv in cmd_tbl->cmd. This was originally added in 54841ab50c ("Make sure
that argv[] argument pointers are not modified."). The reason stated in
that commit is that hush requires argv to stay unmodified. Has this
situation changed? Barebox also uses hush, and does not have this problem.
Perhaps we could use their fix?

I have assigned maintenance of getopt to Simon Glass, as it is currently
only used by the log command. I would also be fine maintaining it.

Signed-off-by: Sean Anderson <seanga2@gmail.com>

# 26637e2e 12-Sep-2020 Simon Glass <sjg@chromium.org>

lib: Allow hexdump to be used in SPL

It is sometimes useful to output hex dumps in SPL. Add a config option to
allow this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# e87dfb05 05-Aug-2020 Andrii Anisov <andrii_anisov@epam.com>

lib: sscanf: add sscanf implementation

Port sscanf implementation from mini-os and introduce new
Kconfig option to enable it: CONFIG_SSCANF. Disable by default.

Signed-off-by: Andrii Anisov <andrii_anisov@epam.com>
Signed-off-by: Anastasiia Lukianenko <anastasiia_lukianenko@epam.com>
Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>

# 81014f73 30-Jul-2020 Joao Marcos Costa <joaomarcos.costa@bootlin.com>

include/u-boot, lib/zlib: add sources for zlib decompression

Add zlib (v1.2.11) uncompr() function to U-Boot. SquashFS depends on
this function to decompress data from a raw disk image. The actual
support for zlib into SquashFS sources will be added in a follow-up
commit.

Signed-off-by: Joao Marcos Costa <joaomarcos.costa@bootlin.com>

# 69be8fd1 03-Jun-2020 Marek Szyprowski <m.szyprowski@samsung.com>

powerpc: move ADDR_MAP to Kconfig

Move ADDR_MAP related config options from include/configs/*.h to the
proper place in lib/Kconfig. This has been done using
./tools/moveconfig.py and manual inspection of the generated changes.
This is a preparation to use ADDR_MAP helper on ARM 32bit Raspberry Pi4
board for mapping the PCIe XHCI MMIO, which is above the 4GiB identity
mapping limit.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# d16b38f4 15-Apr-2020 Reuben Dowle <reubendowle0@gmail.com>

Add support for SHA384 and SHA512

The current recommendation for best security practice from the US government
is to use SHA384 for TOP SECRET [1].

This patch adds support for SHA384 and SHA512 in the hash command, and also
allows FIT images to be hashed with these algorithms, and signed with
sha384,rsaXXXX and sha512,rsaXXXX

The SHA implementation is adapted from the linux kernel implementation.

[1] Commercial National Security Algorithm Suite
http://www.iad.gov/iad/programs/iad-initiatives/cnsa-suite.cfm

Signed-off-by: Reuben Dowle <reuben.dowle@4rf.com>

# 43e442a5 26-May-2020 Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

kconfig: fix some typos

Signed-off-by: Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

# eff5a547 22-May-2020 Michael Walle <michael@walle.cc>

cmd: zip: automatically pull in gzip()

Move the CONFIG_GZIP_COMPRESSED from a config.h macro to a Kconfig menu
item. It is not selectable by a user because there is no reason to do
so. Instead it will be automatically selected by the stuff which uses
gzip(), like the zip command.

Remove it from the config_whitelist.txt. Also remove
CONFIG_GZIP_COMPRESS_DEF_SZ as this was never used on any board. The
default seems to be sane, otherwise it should be added as a Kconfig
option.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8239be61 06-May-2020 Simon Glass <sjg@chromium.org>

lib: Allow MD5 to be enabled in SPL

At present the MD5 option cannot be enabled by board configs since it has
no Kconfig name. It is generally enabled, so long as FIT support is
present. But not all boards use FIT, particularly in SPL

Fix this and add an option for SPL as well. This allows board code to call
md5() even if FIT support is not enabled.

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

# 04cb3994 21-Apr-2020 Weijie Gao <weijie.gao@mediatek.com>

lib: enable lzma decompression support for SPL build

This patch enables LZMA decompression support for SPL build

Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>

# 2a2119e1 05-Mar-2020 Atish Patra <atish.patra@wdc.com>

lib: kconfig: Add option to set BZIP2 compression method

There is no way to select BZIP2 compression method.
Add it under library/compression config where all other
compression related configs are present.

Signed-off-by: Atish Patra <atish.patra@wdc.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 805b3cac 12-Feb-2020 Keerthy <j-keerthy@ti.com>

lib: elf: Move the generic elf loading/validating functions to lib

Move the generic elf loading/validating functions to lib/
so that they can be re-used and accessed by code existing
outside cmd.

While at it remove the duplicate static version of load_elf_image_phdr
under arch/arm/mach-imx/imx_bootaux.c.

Signed-off-by: Keerthy <j-keerthy@ti.com>
Suggested-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>

# 1611235b 19-Jan-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: Kconfig dependencies for pseudo-random library

drivers/rng/sandbox_rng.c requires rand() to be defined but configuration
option CONFIG_CONFIG_LIB_RAND selected in drivers/rng/Kconfig does not
exist.

test/lib/test_aes.c requires rand() to be defined.

Fix the selection criteria for choice "Pseudo-random library support type".

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 3c10dc95 06-Dec-2019 Simon Glass <sjg@chromium.org>

binman: Add a library to access binman entries

SPL and TPL can access information about binman entries using link-time
symbols but this is not available in U-Boot proper. Of course it could be
made available, but the intention is to just read the device tree.

Add support for this, so that U-Boot can locate entries.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# b4adf627 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: crypto: add x509 parser

Imported from linux kernel v5.3:
x509.asn1 without changes
x509_akid.asn1 without changes
x509_parser.h without changes
x509_cert_parser.c with changes marked as __UBOOT__
x509_public_key.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# a9b45e6e 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add oid registry utility

Imported from linux kernel v5.3:
build_OID_registry without changes
oid_registry.h without changes
oid_registry.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# ab8a0e06 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add asn1 decoder

Imported from linux kernel v5.3:
lib/asn1_decoder.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 2b12196d 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

cmd: add asn1_compiler

Imported from linux kernel v5.3:
asn1.h without changes
asn1_ber_bytecode.h without changes
asn1_decoder.h without changes
asn1_compiler.c without changes

This host command will be used to create a ASN1 parser, for example,
for pkcs7 messages or x509 certificates. More specifically, it will
generate *byte code* which will be interpreted by asn1 decoder library.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 05429b6c 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

rtc: move date.c from drivers/rtc/ to lib/

In the next commit, rtc_mktime(), for compatibility with linux, will be
implemented using rtc_mktime(), which is no longer drivers/rtc specific.
So move this file under lib/.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 37ef1774 10-Nov-2019 Thomas Hebb <tommyhebb@gmail.com>

Kconfig: disambiguate config names for tiny printf

27084c03d36a ("spl: Allow tiny printf() to be controlled in SPL and
TPL") split this option in two for TPL and SPL, but didn't change the
Kconfig names, making them hard to set quickly.

Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>

# 0d76afc0 27-Oct-2019 Simon Glass <sjg@chromium.org>

fdt: Add Kconfig options to control code size

For better or worse libfdt recent grew a lot of code that checks the
validity of the device tree in great detail. When using unsigned or
unverified data this makes things safer, but it does add to code size.

Add some controls to select the trade-off between safety and code size.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 27084c03 25-Sep-2019 Simon Glass <sjg@chromium.org>

spl: Allow tiny printf() to be controlled in SPL and TPL

At present there is only one control for this and it is used for both SPL
and TPL. But SPL might have a lot more space than TPL so the extra cost of
a full printf() might be acceptable.

Split the option into two, providing separate SPL and TPL controls. The
TPL setting defaults to the same as SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2a51e16b 07-Jun-2019 Tom Rini <trini@konsulko.com>

configs: Make USE_TINY_PRINTF depend on SPL||TPL and be default

The USE_TINY_PRINTF symbol only changes things within SPL and TPL
builds, so make it depend on that support. Next, make it default as
within these cases we should rarely have need of more advanced print
formats outside of the debug context.

To do this, in a few cases we need to correct our Kconfig dependencies
as we had cases of non-SPL targets select'ing this symbol. Finally, in
the case of a few boards we really do need the full printf
functionality.

Signed-off-by: Tom Rini <trini@konsulko.com>

# da0fb5fd 02-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: make call depth limit customizable

Up to now we had hard coded values for the call depth up to which trace
records are created: 200 for early tracing, 15 thereafter. UEFI
applications reach a call depth of 80 or above.

Provide customizing settings for the call trace depth limit and the early
call trace depth limit. Use the old values as defaults.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8509f22a 29-Apr-2019 Marek Behún <marek.behun@nic.cz>

lib: add Zstandard decompression support

Add the zstd library from Linux kernel (only decompression support).
There are minimal changes to build with U-Boot, otherwise the files are
identical to Linux commit dc35da16 from March 2018, the files had not
been touched since in kernel. Also SPDX lincese tags were added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 83a486b6 29-Apr-2019 Marek Behún <marek.behun@nic.cz>

lib: Add xxhash support

This adds the xxhash support from Linux. Files are almost identical to
those added to Linux in commit 5d240522 ("lib: Add xxhash module") (they
haven't been touched since in Linux). The only difference is to add some
includes to be compatible with U-Boot. Also SPDX lincese tags were
added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 5132361a 29-Apr-2019 Heiko Schocher <hs@denx.de>

lib: Kconfig: fix help text for GZIP

commit 95f4bbd581cf ("lib: fdt: Allow LZO and GZIP DT compression in U-Boot")

introduced Kconfig option for gzip in U-Boot, but help text
says gzip for SPL, which is wrong. Fix this.

Signed-off-by: Heiko Schocher <hs@denx.de>
Acked-by: Marek Vasut <marex@denx.de>

# 1c6eb075 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE_BUFFER_SIZE et al to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE_BUFFER_SIZE
CONFIG_TRACE_EARLY_SIZE
CONFIG_TRACE_EARLY
CONFIG_TRACE_EARLY_ADDR

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

# a24a78d7 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE

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

# 54969b40 21-Mar-2019 Thierry Reding <treding@nvidia.com>

fdtdec: Add Kconfig symbol for tests

Runtime tests are provided as a test_fdtdec command implementation. Add
a Kconfig symbol that allows this command to be built so that the tests
can be used.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 95f4bbd5 08-Mar-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

lib: fdt: Allow LZO and GZIP DT compression in U-Boot

Add required Kconfig symbols, Makefile bits and macro fixes in a
few places to support LZO and DT compression in U-Boot. This can
save a lot of space with multi-DTB fitImages.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>

# 6e705114 13-Jan-2019 Chris Packham <judge.packham@gmail.com>

lib: Kconfig: spelling fixes

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 048c6e89 06-Nov-2018 Simon Glass <sjg@chromium.org>

spl: lz4: Allow use of lz4 compression in SPL

In some cases U-Boot is compressed and it is useful to be able to
decompress it in SPL. Add a Kconfig and Makefile change to allow this.
Note that this does not actually implement decompression.

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

# 2895c4b7 15-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

kconfig: Introduce HAVE_ARCH_IOMAP

Introduce a new Kconfig option for architecture codes to control
whether it provides io{read,write}{8,16,32} I/O accessor functions.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5592a633 01-Oct-2018 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt in TPL

In some cases (e.g. sandbox with verified boot) it is useful to support
libfdt in TPL. Update the Kconfig to handle this.

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

# 6307896c 01-Oct-2018 Simon Glass <sjg@chromium.org>

tpm: Add support for SPL and TPL

At present the tpm can only be used in U-Boot proper. Updated it to work
in SPL and TPL also.

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

# ab948cd2 19-Jul-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

fdt_support: make FDT_FIXUP_PARTITIONS depend on CMD_MTDPARTS

fdt_fixup_mtdparts() calls mtdparts_init() and device_find(),
which are defined in cmd/mtdparts.c

The combination of FDT_FIXUP_PARTITIONS=y and CMD_MTDPARTS=n
emits the following link error:

common/fdt_support.c:903: undefined reference to `mtdparts_init'
common/fdt_support.c:914: undefined reference to `device_find'

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 3330584d 03-Jun-2018 Igor Opaniuk <igor.opaniuk@gmail.com>

avb2.0: integrate avb 2.0 into the build system

Integrate libavb into the build system. Introduce CONFIG_LIBAVB
build option.

Signed-off-by: Igor Opaniuk <igor.opaniuk@linaro.org>

# f8c987f8 05-Jun-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

lib: Add hexdump

Often during debugging session it's very interesting to see
what data we were dealing with. For example what we write or read
to/from memory or peripherals.

This change introduces functions that allow to dump binary
data with one simple function invocation like:
------------------->8----------------
print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, buf, len);
------------------->8----------------

which gives us the following:
------------------->8----------------
00000000: f2 b7 c9 88 62 61 75 64 72 61 74 65 3d 31 31 35 ....baudrate=115
00000010: 32 30 30 00 62 6f 6f 74 61 72 67 73 3d 63 6f 6e 200.bootargs=con
00000020: 73 6f 6c 65 3d 74 74 79 53 33 2c 31 31 35 32 30 sole=ttyS3,11520
00000030: 30 6e 38 00 62 6f 6f 74 64 65 6c 61 79 3d 33 00 0n8.bootdelay=3.
00000040: 62 6f 6f 74 66 69 6c 65 3d 75 49 6d 61 67 65 00 bootfile=uImage.
00000050: 66 64 74 63 6f 6e 74 72 6f 6c 61 64 64 72 3d 39 fdtcontroladdr=9
00000060: 66 66 62 31 62 61 30 00 6c 6f 61 64 61 64 64 72 ffb1ba0.loadaddr
00000070: 3d 30 78 38 32 30 30 30 30 30 30 00 73 74 64 65 =0x82000000.stde
00000080: 72 72 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 rr=serial0@e0022
00000090: 30 30 30 00 73 74 64 69 6e 3d 73 65 72 69 61 6c 000.stdin=serial
000000a0: 30 40 65 30 30 32 32 30 30 30 00 73 74 64 6f 75 0@e0022000.stdou
000000b0: 74 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 30 t=serial0@e00220
000000c0: 30 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00..............
...
------------------->8----------------

Source of hexdump.c was copied from Linux kernel v4.7-rc2.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Mario Six <mario.six@gdsys.cc>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Stefan Roese <sr@denx.de>

# c232d14d 29-May-2018 Alex Kiernan <alex.kiernan@gmail.com>

mmc: Separate "mmc swrite" from fastboot

Introduce CONFIG_IMAGE_SPARSE and CONFIG_CMD_MMC_SWRITE so the "mmc
swrite" command is separated from the fastboot code.

Move image-sparse from common to lib so it's clear it's library code.

Rename CONFIG_FASTBOOT_FLASH_FILLBUF_SIZE to CONFIG_IMAGE_SPARSE_FILLBUF_SIZE
and migrate it to Kconfig.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Acked-by: Jassi Brar <jaswinder.singh@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6417572e 08-May-2018 Tom Rini <trini@konsulko.com>

lib/Kconfig: Mark OF_LIBFDT_OVERLAY as depending on OF_LIBFDT

The overlay code is only useful when OF_LIBFDT is set, so mark it as
depending on that first.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 58a46f88 25-Apr-2018 Praneeth Bajjuri <praneeth@ti.com>

configs: TI: Enable FIT Library overlay support

Enable the FDT library overlay support for all TI SOC family.

Without this option, when Loading fdt from FIT image, the
following warning is seen.

"config with overlays but CONFIG_OF_LIBFDT_OVERLAY not set".

Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
Suggested-by: Andrew F.Davis <afd@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>

# 14ad44ab 18-Apr-2018 Alex Kiernan <alex.kiernan@gmail.com>

spl: Split sprintf, strto* from SPL serial in Kconfig

When SPL serial is disabled, callers who need sprintf or strtoul fail
because their inclusion is guarded by CONFIG_SPL_SERIAL_SUPPORT/
CONFIG_TPL_SERIAL_SUPPORT.

Split printf, sprintf and strto into their own entries and then select
all of them if SERIAL_SUPPORT is enabled to match the current behaviour.

Include panic.o unconditionally as it can be called from anywhere which
uses BUG_ON().

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>

# e294ba06 04-Apr-2018 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-sunxi

Signed-off-by: Tom Rini <trini@konsulko.com>


# d14db11d 03-Apr-2018 Andre Przywara <andre.przywara@arm.com>

sunxi: revert disabling of features

In January some commits were introduced to mitigate the U-Boot image
size issues we encountered on sunxi builds.
Now with the MMC environment removed we can bring them back, as we
practically don't have a size limit anymore.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 32ce6179 13-Mar-2018 Bryan O'Donoghue <bryan.odonoghue@linaro.org>

optee: Add lib entries for sharing OPTEE code across ports

This patch adds code to lib to enable sharing of useful OPTEE code between
board-ports and architectures. The code on lib/optee/optee.c comes from the
TI omap2 port. Eventually the OMAP2 code will be patched to include the
shared code. The intention here is to add more useful OPTEE specific code
as more functionality gets added.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Cc: Harinarayan Bhatta <harinarayan@ti.com>
Cc: Andrew F. Davis <afd@ti.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Kever Yang <kever.yang@rock-chips.com>
Cc: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Cc: Peng Fan <peng.fan@nxp.com>
Tested-by: Peng Fan <peng.fan@nxp.com>

# 36c1877c 06-Feb-2018 Faiz Abbas <faiz_abbas@ti.com>

lib: Kconfig: Move DYNAMIC_CRC_TABLE to Kconfig

Add CONFIG prefix to DYNAMIC_CRC_TABLE and implement it in
Kconfig.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>

# a451bc27 05-Feb-2018 Adam Ford <aford173@gmail.com>

Convert LIB_UUID to Kconfig

config_fallback.h has some logic that checks a variety of options
and selects LIB_UUID if it hasn't already been selected. This
will all LIB_UUID in Kconfig and select this option for the list
of options to allow us to remove the logic from fallbacks

Signed-off-by: Adam Ford <aford173@gmail.com>

# a5a37567 06-Feb-2018 Adam Ford <aford173@gmail.com>

Convert CONFIG LIB_HW_RAND to Kconfig

config_fallbacks.h had some logic to automatically select
LIB_RAND if RANDOM_UUID or CMD_UUID were set if LIB_HW_RAND wasn't
already selected. By migrating LIB_HW_RAND to Kconfig, we can
remove this check from config_fallbacks.h and put it into Kconfig

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
[trini: Turn into a choice, add NET_RANDOM_ETHADDR]
Signed-off-by: Tom Rini <trini@konsulko.com>

# acd4d334 16-Jan-2018 Maxime Ripard <maxime.ripard@free-electrons.com>

net: regex: Disable by default on sunXi

The sunXi arm64 build has overflown, leading to the main U-boot binary
overwriting the environment when flashing the new image, or even worse,
overwriting itself when we're calling saveenv.

Disable this option that is not critical until we can adress the issue
properly.

Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 7e3caa81 03-Dec-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

Move CONFIG_PANIC_HANG to Kconfig

Freescale (NXP) boards have lots of defconfig files per board.
I used "imply PANIC_HANG" for them.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# da5337a6 08-Nov-2017 Nandor Han <nandor.han@ge.com>

rtc: add support for s35392a

Add support for S35392A RTC. The driver supports both U-Boot driver
models.

Signed-off-by: Nandor Han <nandor.han@ge.com>
Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
Cc: Heiko Schocher <hs@denx.de>

# f52bdf4b 14-Sep-2017 Jean-Jacques Hiblot <jjhiblot@ti.com>

lib: allow building lzo for the SPL

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 85d8bf57 03-Sep-2017 Marek Behún <marek.behun@nic.cz>

lib: Add CRC32-C

This is needed for BTRFS.

Signed-off-by: Marek Behun <marek.behun@nic.cz>

create mode 100644 lib/crc32c.c

# 7264f292 15-Aug-2017 York Sun <york.sun@nxp.com>

spl: fit: Eanble GZIP support for image decompression

Add Kconfig option SPL_GZIP and SPL_ZLIB to enable gunzip support for
SPL boot, eg. falcon boot compressed kernel image.

Signed-off-by: York Sun <york.sun@nxp.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6ef2f901 11-Aug-2017 Adam Ford <aford173@gmail.com>

Convert CONFIG_BCH to Kconfig

This converts the following to Kconfig:
CONFIG_BCH

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1a7ba1d 18-Aug-2017 Anatolij Gustschin <agust@denx.de>

Fix 'notes' typos

s/notes/nodes

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 96b9082c 03-Aug-2017 Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

rockchip: rk3188: rock: adjust for SPL/TPL split

With the changes to split SPL/TPL for the RK3368, I apparently missed
some needed adjustments to the RK3188 Kconfig and rock_defconfig.

This fixes build-issues for the rock board after applying the RK3368
enablement (and SPL/TPL) set that resulted from TPL_SERIAL_SUPPORT,
TPL_ROCKCHIP_BACK_TO_BROM and TPL_TINY_MEMSET being separate symbols
now.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d56b4b19 22-Jul-2017 Tom Rini <trini@konsulko.com>

configs: Migrate RBTREE, LZO, CMD_MTDPARTS, CMD_UBI and CMD_UBIFS

The above CONFIG options are in Kconfig, and now have correct depends and
inter-dependencies. Migrate these to configs/ from include/configs/. In the
case of CMD_UBIFS also change it to be a default y if CMD_UBI.

Signed-off-by: Tom Rini <trini@konsulko.com>

# aed998aa 17-May-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_LZMA to Kconfig

This converts the following to Kconfig:
CONFIG_LZMA

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

# b1a873df 26-Apr-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_CMD_AES et al to Kconfig

This converts the following to Kconfig:
CONFIG_CMD_AES
CONFIG_AES

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Add select AES to CMD_AES]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 173aafbf 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

cmd: Expose a Kconfig option to enable UBIFS commands

Create a new Kconfig entry to allow CMD_UBIFS selection from Kconfig and
add an hidden LZO option that can be selected by CMD_UBIFS.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>

# aa049152 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

mtd: ubi: Select RBTREE option from MTD_UBI Kconfig entry

Expose the RBTREE feature through Kconfig and select this option from the
MTD_UBI option.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>
[Rebased on master]
Signed-off-by: Jagan Teki <jagan@openedev.com>

# ab4458bd 02-Apr-2017 Simon Glass <sjg@chromium.org>

string: Provide a slimmed-down memset()

Most of the time the optimised memset() is what we want. For extreme
situations such as TPL it may be too large. For example on the 'rock'
board, using a simple loop saves a useful 48 bytes. With gcc 4.9 and
the rodata bug, this patch is enough to reduce the TPL image below the
limit.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>

# bea79d7d 14-Mar-2017 Andre Przywara <andre.przywara@arm.com>

Kconfig: introduce md5sum command selection

So far CONFIG_MD5SUM would need to be set by a board's include file.
Since the command is really generic, move it over to Kconfig to allow
it to be defined by either a board's defconfig, menuconfig or some
config snippet merged via mergeconfig.sh.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e663b350 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

smbios: Expose in efi_loader as table

We can pass SMBIOS easily as EFI configuration table to an EFI payload. This
patch adds enablement for that case.

While at it, we also enable SMBIOS generation for ARM systems, since they support
EFI_LOADER.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4b6dddc2 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

x86: Move smbios generation into arch independent directory

We will need the SMBIOS generation function on ARM as well going forward,
so let's move it into a non arch specific location.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# ebf7fff2 05-Oct-2016 Heiko Schocher <hs@denx.de>

spl: move FDT_FIXUP_PARTITIONS to Kconfig

Move FDT_FIXUP_PARTITIONS to Kconfig and cleanup existing
uses.

Signed-off-by: Heiko Schocher <hs@denx.de>

# ddf67f71 05-Jul-2016 Maxime Ripard <maxime.ripard@free-electrons.com>

libfdt: Add overlay application function

The device tree overlays are a good way to deal with user-modifyable
boards or boards with some kind of an expansion mechanism where we can
easily plug new board in (like the BBB, the Raspberry Pi or the CHIP).

Add a new function to merge overlays with a base device tree.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>

# 91b86e21 26-May-2016 Marek Vasut <marex@denx.de>

lib: Enable private libgcc by default

This patch decouples U-Boot binary from the toolchain on systems where
private libgcc is available. Instead of pulling in functions provided
by the libgcc from the toolchain, U-Boot will use it's own set of libgcc
functions. These functions are usually imported from Linux kernel, which
also uses it's own libgcc functions instead of the ones provided by the
toolchain.

This patch solves a rather common problem. The toolchain can usually
generate code for many variants of target architecture and often even
different endianness. The libgcc on the other hand is usually compiled
for one particular configuration and the functions provided by it may
or may not be suited for use in U-Boot. This can manifest in two ways,
either the U-Boot fails to compile altogether and linker will complain
or, in the much worse case, the resulting U-Boot will build, but will
misbehave in very subtle and hard to debug ways.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 67976306 30-Mar-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

cosmetic: Fix typos "privide"

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# ed980b8c 03-Mar-2016 Alexander Graf <agraf@csgraf.de>

efi_loader: hook up in build environment

Now that we have all the bits and pieces ready for EFI payload loading
support, hook them up in Makefiles and KConfigs so that we can build.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
[trini: Enable only when we of OF_LIBFDT, disable on kwb and colibri_pxa270]
Signed-off-by: Tom Rini <trini@konsulko.com>

# aa34fbc0 22-Feb-2016 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt to be used in SPL

Add an option to enable libfdt in SPL. This can be useful when decoding
FIT files in SPL.

We need to make sure this option is not enabled in SPL by this change.
Also this option needs to be enabled in host builds. Si add a new
IMAGE_USE_LIBFDT #define which can be used in files that are built on the
host but must also build for U-Boot and SPL.

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

# 69e173eb 22-Feb-2016 Simon Glass <sjg@chromium.org>

Move CONFIG_OF_LIBFDT to Kconfig

Move this option to Kconfig and tidy up existing boards.

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

# a187559e 05-Feb-2016 Bin Meng <bmeng.cn@gmail.com>

Use correct spelling of "U-Boot"

Correct spelling of "U-Boot" shall be used in all written text
(documentation, comments in source files etc.).

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Minkyu Kang <mk7.kang@samsung.com>

# 947c626d 14-Jan-2016 Tom Rini <trini@konsulko.com>

vsprintf.c: Always enable CONFIG_SYS_VSNPRINTF

Enabling this function always removes some class of string saftey issues.
The size change here in general is about 400 bytes and this seems a reasonable
trade-off.

Cc: Peng Fan <peng.fan@nxp.com>
Cc: Peter Robinson <pbrobinson@gmail.com>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Adrian Alonso <aalonso@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 7d9cde10 22-Nov-2015 Stefan Roese <sr@denx.de>

lib/tiny-printf.c: Add tiny printf function for space limited environments

This patch adds a small printf() version that supports all basic formats.
Its intented to be used in U-Boot SPL versions on platforms with very
limited internal RAM sizes.

To enable it, just define CONFIG_USE_TINY_PRINTF in your defconfig. This
will result in the SPL using this tiny function and the main U-Boot
still using the full-blown printf() function.

This code was copied from:
http://www.sparetimelabs.com/printfrevisited
With mostly only coding style related changes so that its checkpatch
clean.

The size reduction is about 2.5KiB. Here a comparison for the db-mv784mp-gp
(Marvell AXP) SPL:

Without this patch:
58963 18536 1928 79427 13643 ./spl/u-boot-spl

With this patch:
56542 18536 1956 77034 12cea ./spl/u-boot-spl

Note:
To make it possible to compile tiny-printf.c instead of vsprintf.c when
CONFIG_USE_TINY_PRINTF is defined, the functions printf() and vprintf() are
moved from common/console.c into vsprintf.c in this patch.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>

# 2419cd16 03-Oct-2015 Simon Glass <sjg@chromium.org>

dm: tpm: Drop CONFIG_DM_TPM

Now that all TPM drivers use driver model, we can drop the special driver
model CONFIG option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>

# 027b728d 06-Oct-2015 Julius Werner <jwerner@chromium.org>

Add support for LZ4 decompression algorithm

This patch adds support for LZ4-compressed FIT image contents. This
algorithm has a slightly worse compression ration than LZO while being
nearly twice as fast to decompress. When loading images from a fast
storage medium this usually results in a boot time win.

Sandbox-tested only since I don't have a U-Boot development system set
up right now. The code was imported unchanged from coreboot where it's
proven to work, though. I'm mostly interested in getting this recognized
by mkImage for use in a downstream project.

Signed-off-by: Julius Werner <jwerner@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# a7d660bc 22-Aug-2015 Simon Glass <sjg@chromium.org>

tpm: Add Kconfig options for TPMs

Add new Kconfig options for TPMs in preparation for moving boards to use
Kconfig for TPM configuration.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 867a6ac8 31-Jul-2015 Simon Glass <sjg@chromium.org>

efi: Add start-up library code

When running as an EFI application, U-Boot must request memory from EFI,
and provide access to the boot services U-Boot needs.

Add library code to perform these tasks. This includes efi_main() which is
the entry point from EFI. U-Boot is built as a shared library.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d1389403 23-Jun-2015 Simon Glass <sjg@chromium.org>

Add a dhrystone benchmark command

Drystone provides a convenient sanity check that the CPU is running at full
speed. Add this as a command which can be enabled as needed.

Note: I investigated using Coremark for this but there was a license
agreement and I could not work out if it was GPL-compatible.

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

# f7848d90 22-Jun-2015 Joe Hershberger <joe.hershberger@ni.com>

Allow CONFIG_REGEX to be disabled when CONFIG_NET

Instead of selecting REGEX when NET is enabled, make it the default, but
allow boards that are tiny to disable it and lose functionality on all
but the first Ethernet adapter.

cm-bf548, bf538f-ezkit, and bf533-stamp need this. None appear to have
more than one Ethernet interface.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# 3850dbe8 11-Jun-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

blackfin: fix undefined reference to srand and rand

Commit 9ba9e85f3f1c (net: Fix NET_RANDOM_ETHADDR dependencies)
accidentally dropped CONFIG_LIB_RAND defines for 14 Blackfin boards.

Prior to that commit, those boards defined CONFIG_LIB_RAND, but not
CONFIG_NET_RANDOM_ETHADDR. So, commit 9ba9e85f3f1c should not have
touched them, but in fact it ripped CONFIG_LIB_RAND off from all the
header files, which caused undefined reference to srand and rand.
CONFIG_LIB_RAND=y must be revived for such boards.

BTW, this commit indeed makes it better, but even with this fix,
three boards (bf533-stamp, bf538f-ezkit, cm-bf548) still can not
build due to region 'ram' overflowed error. This was cause by
commit 6eed3786c68c (net: Move the CMD_NET config to defconfigs)
because CMD_NET selects NET, and NET selects REGEX. Eventually,
some boards were newly enabled with CONFIG_REGEX, increasing the
memory footprint. A patch is expected to fix the build error.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 9ba9e85f 25-May-2015 Michal Simek <michal.simek@xilinx.com>

net: Fix NET_RANDOM_ETHADDR dependencies

NET_RANDOM_ETHADDR depends on lib/rand.c. This patch adds dependency to
Kconfig to ensure that library is also compiled.

Remove the definitions from Blackfin boards' include/configs.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 6501ff62 20-Apr-2015 Przemyslaw Marczak <p.marczak@samsung.com>

lib: Kconfig: add entry for errno_str() function

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1a60650c 21-Apr-2015 Joe Hershberger <joe.hershberger@ni.com>

kconfig: Move REGEX to Kconfig

Having this as a Kconfig allows it to be a dependent feature.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8156345d 06-Mar-2015 Simon Glass <sjg@chromium.org>

sandbox: Move CONFIG_SYS_VSNPRINTF to Kconfig

Move this over to Kconfig and tidy up.

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

# 94e3c8c4 19-Feb-2015 gaurav rana <gaurav.rana@freescale.com>

crypto/fsl - Add progressive hashing support using hardware acceleration.

Currently only normal hashing is supported using hardware acceleration.
Added support for progressive hashing using hardware.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
Signed-off-by: Gaurav Rana <gaurav.rana@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>

# d9f23c7f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

lib/rsa: Add Kconfig for devices supporting RSA Modular Exponentiation

Kconfig option added for devices which support RSA Verification.
1. RSA_SOFTWARE_EXP
Enables driver for supporting RSA Modular Exponentiation in Software
2. RSA_FREESCALE_EXP
Enables driver for supporting RSA Modular Exponentiation using Freescale specific
driver

The above drivers use RSA uclass

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
(Removed duplicate line in Kconfig comment)

Change-Id: I7663c4d5350e2bfc3dfa2696f70ef777d6ccc6f6

# c4beb22f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

FIT: Modify option FIT_SIGNATURE in Kconfig

For FIT signature based approach to work, RSA library needs to be selected.
The FIT_SIGNATURE option in Kconfig is modified to automatically select RSA.
Selecting RSA compiles the RSA library required for image verification.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 45ccec8f 23-Oct-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_USE_PRIVATE_LIBGCC to Kconfig

The private libgcc is supported only on ARM, MIPS, PowerPC, SH, x86.
Those architectures should "select" HAVE_PRIVATE_LIBGCC and
CONFIG_USE_PRIVATE_LIBGCC should depend on it.

Currently, this option is enabled on Tegra boards and x86 architecture.
Move the definition from header files to Kconfig.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Tested-by: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: Tom Warren <twarren@nvidia.com>

# 8c688bc4 23-Oct-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_SYS_HZ to lib/Kconfig

CONFIG_SYS_HZ is always defined as 1000 in config_fallbacks.h
(but some boards still have redundant definitions).

This commit moves the definition and the document in README to
Kconfig. Since lib/Kconfig can assure that CONFIG_SYS_HZ is 1000,
the sanity check in lib/time.c should be removed.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Reviewed-by: Marek Vasut <marex@denx.de>

# b0928da6 16-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED to Kconfig

If this option is enabled, the objects under lib/ directory
are compiled with speed optimization, not size optimization.
(Currently, only used by some Blackfin boards.)

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# ed36323f 16-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: add blank Kconfig files

This would be useful to start moving various config options.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# 1a46cb6c 02-Jul-2021 Simon Glass <sjg@chromium.org>

lib: Create a new Kconfig option for charset conversion

Rather than looking at two KConfig options in the Makefile, create a new
Kconfig option for compiling lib/charset.c

Enable it for UFS also, which needs this support.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 26dd9936 08-Jul-2021 Steffen Jaeckel <jaeckel-floss@eyet-services.de>

lib: add crypt subsystem

Add the basic functionality required to support the standard crypt
format.
The files crypt-sha256.c and crypt-sha512.c originate from libxcrypt and
their formatting is therefor retained.
The integration is done via a crypt_compare() function in crypt.c.

```
libxcrypt $ git describe --long --always --all
tags/v4.4.17-0-g6b110bc
```

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 7d0f3fbb 11-Jun-2021 Tero Kristo <t-kristo@ti.com>

lib: rational: copy the rational fraction lib routines from Linux

Copy the best rational approximation calculation routines from Linux.
Typical usecase for these routines is to calculate the M/N divider
values for PLLs to reach a specific clock rate.

This is based on linux kernel commit:
"lib/math/rational.c: fix possible incorrect result from rational
fractions helper"
(sha1: 323dd2c3ed0641f49e89b4e420f9eef5d3d5a881)

Signed-off-by: Tero Kristo <t-kristo@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Tero Kristo <kristo@kernel.org>

# ec0512b1 24-May-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

Revert "lib: introduce HASH_CALCULATE option"

When we think of Kconfig, we usually think of features that we like
to enable or not. Ideally, we wouldn't use Kconfig to fix a build
issue, although sometimes it might make sense. With Kconfig it's hard
to guarantee that the fix is universal. We can only say that it works
for the set of tested configurations. In the majority of cases, it's
preferable to let the linker figure things out for us.

The reverted commit attempted to fix a build issue by adding an
invisible Kconfig option. This is wrong in several ways:

It invents a new Kconfig variable when CONFIG_HASH already
exists for the same purpose.
Second, hash-checksum.c makes use of the hash_progressive_lookup_algo()
symbol, which is only provided with CONFIG_HASH, but this dependency
was not expressed in the reverted patch.

It feels like Kconfig is turning into a listing of all available
source files, and a buffet to 'select' which ones to compile. The
purpose of this revert is to enable the next change to make use of
CONFIG_HASH instead of adding to Kconfig.

This reverts commit 87316da05f2fd49d3709275e64ef0c5980366ade.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Acked-by: Masahisa Kojima <masahisa.kojima@linaro.org>

# 1621d3c4 10-May-2021 Bin Meng <bmeng.cn@gmail.com>

lib: kconfig: Limit BINMAN_FDT for OF_SEPARATE or OF_EMBED

Generally speaking BINMAN_FDT makes sense for OF_SEPARATE or OF_EMBED.
For the other OF_CONTROL methods, it's quite possible binman node is
not available as binman is invoked during the build phase instead of
runtime. Let's only turn it on for OF_SEPARATE or OF_EMBED by default.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 87316da0 13-May-2021 Masahisa Kojima <masahisa.kojima@linaro.org>

lib: introduce HASH_CALCULATE option

Build error occurs when CONFIG_EFI_SECURE_BOOT or
CONFIG_EFI_CAPSULE_AUTHENTICATE is enabled,
because hash-checksum.c is not compiled.

Since hash_calculate() implemented in hash-checksum.c can be
commonly used aside from FIT image signature verification,
this commit itroduces HASH_CALCULATE option to decide
if hash-checksum.c shall be compiled.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# e2ae483c 13-May-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

hash: Kconfig option for SHA512 hardware acceleration

Commit a479f103dc1c ("hash: Allow for SHA512 hardware implementations")
defined function definitions for hardware accelerated SHA384 and SHA512.
If CONFIG_SHA_HW_ACCEL=y, these functions are used.

We already have boards using CONFIG_SHA_HW_ACCEL=y but none implements the
new functions hw_sha384() and hw_sha512().

For implementing the EFI TCG2 protocol we need SHA384 and SHA512. The
missing hardware acceleration functions lead to build errors on boards like
peach-pi_defconfig.

Introduce a new Kconfig symbol CONFIG_SHA512_HW_ACCEL to control if the
functions hw_sha384() and hw_sha512() shall be used to implement the SHA384
and SHA512 algorithms.

Fixes: a479f103dc1c ("hash: Allow for SHA512 hardware implementations")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

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

# 6d66502b 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: Add 2 config to define the max number of regions

Add 2 configs CONFIG_LMB_MEMORY_REGIONS and CONFIG_LMB_RESERVED_REGIONS
to change independently the max number of the regions in lmb
library.

When CONFIG_LMB_USE_MAX_REGIONS=y, move the lmb property arrays to
struct lmb and manage the array size with the element 'max' of struct
lmb_region; their are still allocated in stack.

When CONFIG_LMB_USE_MAX_REGIONS=n, keep the current location in
struct lmb_region to allow compiler optimization.

Increase CONFIG_LMB_RESERVED_REGIONS is useful to avoid lmb errors in
bootm when the number of reserved regions (not adjacent) is reached:
+ 1 region for relocated U-Boot
+ 1 region for initrd
+ 1 region for relocated linux device tree
+ reserved memory regions present in Linux device tree.

The current limit of 8 regions is reached with only 5 reserved regions
in DT.

see Linux kernel commit bf23c51f1f49 ("memblock: Move memblock arrays
to static storage in memblock.c and make their size a variable")

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# 4fa0150d 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: move MAX_LMB_REGIONS value in Kconfig

Move MAX_LMB_REGIONS value in Kconfig, the max number of the regions
in lmb library.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# 77b8cfef 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: move CONFIG_LMB in Kconfig

Migrate CONFIG_LMB in Kconfig.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# a479f103 16-Feb-2021 Joel Stanley <joel@jms.id.au>

hash: Allow for SHA512 hardware implementations

Similar to support for SHA1 and SHA256, allow the use of hardware hashing
engine by enabling the algorithm and setting CONFIG_SHA_HW_ACCEL /
CONFIG_SHA_PROG_HW_ACCEL.

Signed-off-by: Joel Stanley <joel@jms.id.au>

# f2c1442e 14-Mar-2021 Simon Glass <sjg@chromium.org>

bloblist: Make BLOBLIST_TABLES depend on BLOBLIST

Add an extra condition here since we cannot put x86 tables in a bloblist
when bloblists are not supported.

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

# e0103158 25-Feb-2021 Bin Meng <bmeng.cn@gmail.com>

lib: kconfig: Mention CONFIG_ADDR_MAP limitation in the help

Mention that CONFIG_ADDR_MAP only works in the post-relocation phase.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>

# 56e7257c 03-Feb-2021 Bin Meng <bmeng.cn@gmail.com>

lib: Fix BINMAN_FDT dependency

lib/binman.c references the following 3 ofnode APIs:
ofnode_first_subnode(), ofnode_path() and ofnode_read_bool().

These APIs get built only when DM is on. Fix the dependency then.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 59e4e391 18-Jan-2021 Tom Rini <trini@konsulko.com>

Merge https://gitlab.denx.de/u-boot/custodians/u-boot-riscv

- Update qemu-riscv.rst build instructions.
- Add support for SPI on Kendryte K210.
- Add Microchip PolarFire SoC Icicle Kit support.
- Add support for an early timer.
- Select TIMER_EARLY to avoid infinite recursion for Trace.


# a80f8513 17-Jan-2021 Pragnesh Patel <pragnesh.patel@sifive.com>

trace: select TIMER_EARLY to avoid infinite recursion

When tracing functions is enabled this adds calls to
__cyg_profile_func_enter() and __cyg_profile_func_exit() to the traced
functions.

__cyg_profile_func_enter() and __cyg_profile_func_exit() invoke
timer_get_us() to record the entry and exit time.

initr_dm() will make gd->dm_root = NULL and gd->timer = NULL, so
timer_get_us() -> get_ticks() -> dm_timer_init() will lead to an
indefinite recursion.

So select TIMER_EARLY when tracing got enabled.

Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Rick Chen <rick@andestech.com>

# 6205bbb1 04-Jan-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lib: cosmetic update of CONFIG_LIB_ELF description

Change 2 typo error in CONFIG_LIB_ELF description:
- Supoort => Support
- fir => for

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c589132a 02-Dec-2020 Aswath Govindraju <a-govindraju@ti.com>

fdt: Use phandle to distinguish DT nodes with same name

While assigning the sequence number to subsystem instances by reading the
aliases property, only DT nodes names are compared and not the complete
path. This causes a problem when there are two DT nodes with same name but
have different paths.

In arch/arm/dts/k3-am65-main.dtsi there are two USB controllers with the
same device tree node name but different path. When aliases are defined for
these USB controllers then fdtdec_get_alias_seq() fails to pick the correct
instance for a given index.

fdt_path_offset() function is slow and this would effect the U-Boot
startup. To avert the time penalty on all boards, apply this extra check
only when required by using a config option.

Fix it by comparing the phandles of DT nodes after the node names match,
under a config option.

Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Fix whitespace error in Kconfig:
Signed-off-by: Simon Glass <sjg@chromium.org>

# 28cef9ca 19-Nov-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

fs: fat: create correct short names

The current function set_name() used to create short names has the
following deficiencies resolved by this patch:

* Long names (e.g. FOO.TXT) are stored even if a short name is enough.
* Short names with spaces are created, e.g. "A ~1.TXT".
* Short names with illegal characters are created, e.g. "FOO++BAR".
* Debug output does not not consider that the short file name has no
concluding '\0'.

The solution for the following bug is split of into a separate patch:

* Short file names must be unique.

This patch only provides the loop over possible short file names.

Fixes: c30a15e590c ("FAT: Add FAT write feature")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# e4f8e543 05-Nov-2020 Simon Glass <sjg@chromium.org>

smbios: Drop the unused Kconfig options

Now that we can use devicetree to specify this information, drop the old
CONFIG options.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 44c74bdd 05-Nov-2020 Simon Glass <sjg@chromium.org>

sysinfo: Provide a default driver to set SMBIOS values

Some boards want to specify the manufacturer or product name but do not
need to have their own sysinfo driver.

Add a default driver which provides a way to specify this SMBIOS
information in the devicetree, without needing any board-specific
functionality.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d2cb7a22 04-Nov-2020 Simon Glass <sjg@chromium.org>

x86: Allow putting some tables in the bloblist

At present all tables are placed starting at address f0000 in memory, and
can be up to 64KB in size. If the tables are very large, this may not
provide enough space.

Also if the tables point to other tables (such as console log or a ramoops
area) then we must allocate other memory anyway.

The bloblist is a nice place to put these tables since it is contiguous,
which makes it easy to reserve this memory for linux using the 820 tables.

Add an option to put some of the tables in the bloblist. For SMBIOS and
ACPI, create suitable pointers from the f0000 region to the new location
of the tables.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
[bmeng: squashed in http://patchwork.ozlabs.org/project/uboot/patch/
20201105062407.1.I8091ad931cbbb5e3b6f6ababdf3f8d5db0d17bb9@changeid/]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# 415eab06 03-Nov-2020 Christian Gmeiner <christian.gmeiner@gmail.com>

smbios: add parsing API

Add a very simple API to be able to access SMBIOS strings
like vendor, model and bios version.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 72eda507 27-Oct-2020 Sean Anderson <seanga2@gmail.com>

lib: Add getopt

Some commands can get very unweildy if they have too many positional
arguments. Adding options makes them easier to read, remember, and
understand.

This implementation of getopt has been taken from barebox, which has had
option support for quite a while. I have made a few modifications to their
version, such as the removal of opterr in favor of a separate getopt_silent
function. In addition, I have moved all global variables into struct
getopt_context.

The getopt from barebox also re-orders the arguments passed to it so that
non-options are placed last. This allows users to specify options anywhere.
For example, `ls -l foo/ -R` would be re-ordered to `ls -l -R foo/` as
getopt parsed the options. However, this feature conflicts with the const
argv in cmd_tbl->cmd. This was originally added in 54841ab50c ("Make sure
that argv[] argument pointers are not modified."). The reason stated in
that commit is that hush requires argv to stay unmodified. Has this
situation changed? Barebox also uses hush, and does not have this problem.
Perhaps we could use their fix?

I have assigned maintenance of getopt to Simon Glass, as it is currently
only used by the log command. I would also be fine maintaining it.

Signed-off-by: Sean Anderson <seanga2@gmail.com>

# 26637e2e 12-Sep-2020 Simon Glass <sjg@chromium.org>

lib: Allow hexdump to be used in SPL

It is sometimes useful to output hex dumps in SPL. Add a config option to
allow this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# e87dfb05 05-Aug-2020 Andrii Anisov <andrii_anisov@epam.com>

lib: sscanf: add sscanf implementation

Port sscanf implementation from mini-os and introduce new
Kconfig option to enable it: CONFIG_SSCANF. Disable by default.

Signed-off-by: Andrii Anisov <andrii_anisov@epam.com>
Signed-off-by: Anastasiia Lukianenko <anastasiia_lukianenko@epam.com>
Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>

# 81014f73 30-Jul-2020 Joao Marcos Costa <joaomarcos.costa@bootlin.com>

include/u-boot, lib/zlib: add sources for zlib decompression

Add zlib (v1.2.11) uncompr() function to U-Boot. SquashFS depends on
this function to decompress data from a raw disk image. The actual
support for zlib into SquashFS sources will be added in a follow-up
commit.

Signed-off-by: Joao Marcos Costa <joaomarcos.costa@bootlin.com>

# 69be8fd1 03-Jun-2020 Marek Szyprowski <m.szyprowski@samsung.com>

powerpc: move ADDR_MAP to Kconfig

Move ADDR_MAP related config options from include/configs/*.h to the
proper place in lib/Kconfig. This has been done using
./tools/moveconfig.py and manual inspection of the generated changes.
This is a preparation to use ADDR_MAP helper on ARM 32bit Raspberry Pi4
board for mapping the PCIe XHCI MMIO, which is above the 4GiB identity
mapping limit.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# d16b38f4 15-Apr-2020 Reuben Dowle <reubendowle0@gmail.com>

Add support for SHA384 and SHA512

The current recommendation for best security practice from the US government
is to use SHA384 for TOP SECRET [1].

This patch adds support for SHA384 and SHA512 in the hash command, and also
allows FIT images to be hashed with these algorithms, and signed with
sha384,rsaXXXX and sha512,rsaXXXX

The SHA implementation is adapted from the linux kernel implementation.

[1] Commercial National Security Algorithm Suite
http://www.iad.gov/iad/programs/iad-initiatives/cnsa-suite.cfm

Signed-off-by: Reuben Dowle <reuben.dowle@4rf.com>

# 43e442a5 26-May-2020 Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

kconfig: fix some typos

Signed-off-by: Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

# eff5a547 22-May-2020 Michael Walle <michael@walle.cc>

cmd: zip: automatically pull in gzip()

Move the CONFIG_GZIP_COMPRESSED from a config.h macro to a Kconfig menu
item. It is not selectable by a user because there is no reason to do
so. Instead it will be automatically selected by the stuff which uses
gzip(), like the zip command.

Remove it from the config_whitelist.txt. Also remove
CONFIG_GZIP_COMPRESS_DEF_SZ as this was never used on any board. The
default seems to be sane, otherwise it should be added as a Kconfig
option.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8239be61 06-May-2020 Simon Glass <sjg@chromium.org>

lib: Allow MD5 to be enabled in SPL

At present the MD5 option cannot be enabled by board configs since it has
no Kconfig name. It is generally enabled, so long as FIT support is
present. But not all boards use FIT, particularly in SPL

Fix this and add an option for SPL as well. This allows board code to call
md5() even if FIT support is not enabled.

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

# 04cb3994 21-Apr-2020 Weijie Gao <weijie.gao@mediatek.com>

lib: enable lzma decompression support for SPL build

This patch enables LZMA decompression support for SPL build

Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>

# 2a2119e1 05-Mar-2020 Atish Patra <atish.patra@wdc.com>

lib: kconfig: Add option to set BZIP2 compression method

There is no way to select BZIP2 compression method.
Add it under library/compression config where all other
compression related configs are present.

Signed-off-by: Atish Patra <atish.patra@wdc.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 805b3cac 12-Feb-2020 Keerthy <j-keerthy@ti.com>

lib: elf: Move the generic elf loading/validating functions to lib

Move the generic elf loading/validating functions to lib/
so that they can be re-used and accessed by code existing
outside cmd.

While at it remove the duplicate static version of load_elf_image_phdr
under arch/arm/mach-imx/imx_bootaux.c.

Signed-off-by: Keerthy <j-keerthy@ti.com>
Suggested-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>

# 1611235b 19-Jan-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: Kconfig dependencies for pseudo-random library

drivers/rng/sandbox_rng.c requires rand() to be defined but configuration
option CONFIG_CONFIG_LIB_RAND selected in drivers/rng/Kconfig does not
exist.

test/lib/test_aes.c requires rand() to be defined.

Fix the selection criteria for choice "Pseudo-random library support type".

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 3c10dc95 06-Dec-2019 Simon Glass <sjg@chromium.org>

binman: Add a library to access binman entries

SPL and TPL can access information about binman entries using link-time
symbols but this is not available in U-Boot proper. Of course it could be
made available, but the intention is to just read the device tree.

Add support for this, so that U-Boot can locate entries.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# b4adf627 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: crypto: add x509 parser

Imported from linux kernel v5.3:
x509.asn1 without changes
x509_akid.asn1 without changes
x509_parser.h without changes
x509_cert_parser.c with changes marked as __UBOOT__
x509_public_key.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# a9b45e6e 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add oid registry utility

Imported from linux kernel v5.3:
build_OID_registry without changes
oid_registry.h without changes
oid_registry.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# ab8a0e06 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add asn1 decoder

Imported from linux kernel v5.3:
lib/asn1_decoder.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 2b12196d 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

cmd: add asn1_compiler

Imported from linux kernel v5.3:
asn1.h without changes
asn1_ber_bytecode.h without changes
asn1_decoder.h without changes
asn1_compiler.c without changes

This host command will be used to create a ASN1 parser, for example,
for pkcs7 messages or x509 certificates. More specifically, it will
generate *byte code* which will be interpreted by asn1 decoder library.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 05429b6c 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

rtc: move date.c from drivers/rtc/ to lib/

In the next commit, rtc_mktime(), for compatibility with linux, will be
implemented using rtc_mktime(), which is no longer drivers/rtc specific.
So move this file under lib/.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 37ef1774 10-Nov-2019 Thomas Hebb <tommyhebb@gmail.com>

Kconfig: disambiguate config names for tiny printf

27084c03d36a ("spl: Allow tiny printf() to be controlled in SPL and
TPL") split this option in two for TPL and SPL, but didn't change the
Kconfig names, making them hard to set quickly.

Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>

# 0d76afc0 27-Oct-2019 Simon Glass <sjg@chromium.org>

fdt: Add Kconfig options to control code size

For better or worse libfdt recent grew a lot of code that checks the
validity of the device tree in great detail. When using unsigned or
unverified data this makes things safer, but it does add to code size.

Add some controls to select the trade-off between safety and code size.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 27084c03 25-Sep-2019 Simon Glass <sjg@chromium.org>

spl: Allow tiny printf() to be controlled in SPL and TPL

At present there is only one control for this and it is used for both SPL
and TPL. But SPL might have a lot more space than TPL so the extra cost of
a full printf() might be acceptable.

Split the option into two, providing separate SPL and TPL controls. The
TPL setting defaults to the same as SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2a51e16b 07-Jun-2019 Tom Rini <trini@konsulko.com>

configs: Make USE_TINY_PRINTF depend on SPL||TPL and be default

The USE_TINY_PRINTF symbol only changes things within SPL and TPL
builds, so make it depend on that support. Next, make it default as
within these cases we should rarely have need of more advanced print
formats outside of the debug context.

To do this, in a few cases we need to correct our Kconfig dependencies
as we had cases of non-SPL targets select'ing this symbol. Finally, in
the case of a few boards we really do need the full printf
functionality.

Signed-off-by: Tom Rini <trini@konsulko.com>

# da0fb5fd 02-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: make call depth limit customizable

Up to now we had hard coded values for the call depth up to which trace
records are created: 200 for early tracing, 15 thereafter. UEFI
applications reach a call depth of 80 or above.

Provide customizing settings for the call trace depth limit and the early
call trace depth limit. Use the old values as defaults.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8509f22a 29-Apr-2019 Marek Behún <marek.behun@nic.cz>

lib: add Zstandard decompression support

Add the zstd library from Linux kernel (only decompression support).
There are minimal changes to build with U-Boot, otherwise the files are
identical to Linux commit dc35da16 from March 2018, the files had not
been touched since in kernel. Also SPDX lincese tags were added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 83a486b6 29-Apr-2019 Marek Behún <marek.behun@nic.cz>

lib: Add xxhash support

This adds the xxhash support from Linux. Files are almost identical to
those added to Linux in commit 5d240522 ("lib: Add xxhash module") (they
haven't been touched since in Linux). The only difference is to add some
includes to be compatible with U-Boot. Also SPDX lincese tags were
added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 5132361a 29-Apr-2019 Heiko Schocher <hs@denx.de>

lib: Kconfig: fix help text for GZIP

commit 95f4bbd581cf ("lib: fdt: Allow LZO and GZIP DT compression in U-Boot")

introduced Kconfig option for gzip in U-Boot, but help text
says gzip for SPL, which is wrong. Fix this.

Signed-off-by: Heiko Schocher <hs@denx.de>
Acked-by: Marek Vasut <marex@denx.de>

# 1c6eb075 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE_BUFFER_SIZE et al to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE_BUFFER_SIZE
CONFIG_TRACE_EARLY_SIZE
CONFIG_TRACE_EARLY
CONFIG_TRACE_EARLY_ADDR

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

# a24a78d7 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE

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

# 54969b40 21-Mar-2019 Thierry Reding <treding@nvidia.com>

fdtdec: Add Kconfig symbol for tests

Runtime tests are provided as a test_fdtdec command implementation. Add
a Kconfig symbol that allows this command to be built so that the tests
can be used.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 95f4bbd5 08-Mar-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

lib: fdt: Allow LZO and GZIP DT compression in U-Boot

Add required Kconfig symbols, Makefile bits and macro fixes in a
few places to support LZO and DT compression in U-Boot. This can
save a lot of space with multi-DTB fitImages.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>

# 6e705114 13-Jan-2019 Chris Packham <judge.packham@gmail.com>

lib: Kconfig: spelling fixes

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 048c6e89 06-Nov-2018 Simon Glass <sjg@chromium.org>

spl: lz4: Allow use of lz4 compression in SPL

In some cases U-Boot is compressed and it is useful to be able to
decompress it in SPL. Add a Kconfig and Makefile change to allow this.
Note that this does not actually implement decompression.

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

# 2895c4b7 15-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

kconfig: Introduce HAVE_ARCH_IOMAP

Introduce a new Kconfig option for architecture codes to control
whether it provides io{read,write}{8,16,32} I/O accessor functions.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5592a633 01-Oct-2018 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt in TPL

In some cases (e.g. sandbox with verified boot) it is useful to support
libfdt in TPL. Update the Kconfig to handle this.

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

# 6307896c 01-Oct-2018 Simon Glass <sjg@chromium.org>

tpm: Add support for SPL and TPL

At present the tpm can only be used in U-Boot proper. Updated it to work
in SPL and TPL also.

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

# ab948cd2 19-Jul-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

fdt_support: make FDT_FIXUP_PARTITIONS depend on CMD_MTDPARTS

fdt_fixup_mtdparts() calls mtdparts_init() and device_find(),
which are defined in cmd/mtdparts.c

The combination of FDT_FIXUP_PARTITIONS=y and CMD_MTDPARTS=n
emits the following link error:

common/fdt_support.c:903: undefined reference to `mtdparts_init'
common/fdt_support.c:914: undefined reference to `device_find'

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 3330584d 03-Jun-2018 Igor Opaniuk <igor.opaniuk@gmail.com>

avb2.0: integrate avb 2.0 into the build system

Integrate libavb into the build system. Introduce CONFIG_LIBAVB
build option.

Signed-off-by: Igor Opaniuk <igor.opaniuk@linaro.org>

# f8c987f8 05-Jun-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

lib: Add hexdump

Often during debugging session it's very interesting to see
what data we were dealing with. For example what we write or read
to/from memory or peripherals.

This change introduces functions that allow to dump binary
data with one simple function invocation like:
------------------->8----------------
print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, buf, len);
------------------->8----------------

which gives us the following:
------------------->8----------------
00000000: f2 b7 c9 88 62 61 75 64 72 61 74 65 3d 31 31 35 ....baudrate=115
00000010: 32 30 30 00 62 6f 6f 74 61 72 67 73 3d 63 6f 6e 200.bootargs=con
00000020: 73 6f 6c 65 3d 74 74 79 53 33 2c 31 31 35 32 30 sole=ttyS3,11520
00000030: 30 6e 38 00 62 6f 6f 74 64 65 6c 61 79 3d 33 00 0n8.bootdelay=3.
00000040: 62 6f 6f 74 66 69 6c 65 3d 75 49 6d 61 67 65 00 bootfile=uImage.
00000050: 66 64 74 63 6f 6e 74 72 6f 6c 61 64 64 72 3d 39 fdtcontroladdr=9
00000060: 66 66 62 31 62 61 30 00 6c 6f 61 64 61 64 64 72 ffb1ba0.loadaddr
00000070: 3d 30 78 38 32 30 30 30 30 30 30 00 73 74 64 65 =0x82000000.stde
00000080: 72 72 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 rr=serial0@e0022
00000090: 30 30 30 00 73 74 64 69 6e 3d 73 65 72 69 61 6c 000.stdin=serial
000000a0: 30 40 65 30 30 32 32 30 30 30 00 73 74 64 6f 75 0@e0022000.stdou
000000b0: 74 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 30 t=serial0@e00220
000000c0: 30 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00..............
...
------------------->8----------------

Source of hexdump.c was copied from Linux kernel v4.7-rc2.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Mario Six <mario.six@gdsys.cc>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Stefan Roese <sr@denx.de>

# c232d14d 29-May-2018 Alex Kiernan <alex.kiernan@gmail.com>

mmc: Separate "mmc swrite" from fastboot

Introduce CONFIG_IMAGE_SPARSE and CONFIG_CMD_MMC_SWRITE so the "mmc
swrite" command is separated from the fastboot code.

Move image-sparse from common to lib so it's clear it's library code.

Rename CONFIG_FASTBOOT_FLASH_FILLBUF_SIZE to CONFIG_IMAGE_SPARSE_FILLBUF_SIZE
and migrate it to Kconfig.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Acked-by: Jassi Brar <jaswinder.singh@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6417572e 08-May-2018 Tom Rini <trini@konsulko.com>

lib/Kconfig: Mark OF_LIBFDT_OVERLAY as depending on OF_LIBFDT

The overlay code is only useful when OF_LIBFDT is set, so mark it as
depending on that first.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 58a46f88 25-Apr-2018 Praneeth Bajjuri <praneeth@ti.com>

configs: TI: Enable FIT Library overlay support

Enable the FDT library overlay support for all TI SOC family.

Without this option, when Loading fdt from FIT image, the
following warning is seen.

"config with overlays but CONFIG_OF_LIBFDT_OVERLAY not set".

Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
Suggested-by: Andrew F.Davis <afd@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>

# 14ad44ab 18-Apr-2018 Alex Kiernan <alex.kiernan@gmail.com>

spl: Split sprintf, strto* from SPL serial in Kconfig

When SPL serial is disabled, callers who need sprintf or strtoul fail
because their inclusion is guarded by CONFIG_SPL_SERIAL_SUPPORT/
CONFIG_TPL_SERIAL_SUPPORT.

Split printf, sprintf and strto into their own entries and then select
all of them if SERIAL_SUPPORT is enabled to match the current behaviour.

Include panic.o unconditionally as it can be called from anywhere which
uses BUG_ON().

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>

# e294ba06 04-Apr-2018 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-sunxi

Signed-off-by: Tom Rini <trini@konsulko.com>


# d14db11d 03-Apr-2018 Andre Przywara <andre.przywara@arm.com>

sunxi: revert disabling of features

In January some commits were introduced to mitigate the U-Boot image
size issues we encountered on sunxi builds.
Now with the MMC environment removed we can bring them back, as we
practically don't have a size limit anymore.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 32ce6179 13-Mar-2018 Bryan O'Donoghue <bryan.odonoghue@linaro.org>

optee: Add lib entries for sharing OPTEE code across ports

This patch adds code to lib to enable sharing of useful OPTEE code between
board-ports and architectures. The code on lib/optee/optee.c comes from the
TI omap2 port. Eventually the OMAP2 code will be patched to include the
shared code. The intention here is to add more useful OPTEE specific code
as more functionality gets added.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Cc: Harinarayan Bhatta <harinarayan@ti.com>
Cc: Andrew F. Davis <afd@ti.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Kever Yang <kever.yang@rock-chips.com>
Cc: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Cc: Peng Fan <peng.fan@nxp.com>
Tested-by: Peng Fan <peng.fan@nxp.com>

# 36c1877c 06-Feb-2018 Faiz Abbas <faiz_abbas@ti.com>

lib: Kconfig: Move DYNAMIC_CRC_TABLE to Kconfig

Add CONFIG prefix to DYNAMIC_CRC_TABLE and implement it in
Kconfig.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>

# a451bc27 05-Feb-2018 Adam Ford <aford173@gmail.com>

Convert LIB_UUID to Kconfig

config_fallback.h has some logic that checks a variety of options
and selects LIB_UUID if it hasn't already been selected. This
will all LIB_UUID in Kconfig and select this option for the list
of options to allow us to remove the logic from fallbacks

Signed-off-by: Adam Ford <aford173@gmail.com>

# a5a37567 06-Feb-2018 Adam Ford <aford173@gmail.com>

Convert CONFIG LIB_HW_RAND to Kconfig

config_fallbacks.h had some logic to automatically select
LIB_RAND if RANDOM_UUID or CMD_UUID were set if LIB_HW_RAND wasn't
already selected. By migrating LIB_HW_RAND to Kconfig, we can
remove this check from config_fallbacks.h and put it into Kconfig

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
[trini: Turn into a choice, add NET_RANDOM_ETHADDR]
Signed-off-by: Tom Rini <trini@konsulko.com>

# acd4d334 16-Jan-2018 Maxime Ripard <maxime.ripard@free-electrons.com>

net: regex: Disable by default on sunXi

The sunXi arm64 build has overflown, leading to the main U-boot binary
overwriting the environment when flashing the new image, or even worse,
overwriting itself when we're calling saveenv.

Disable this option that is not critical until we can adress the issue
properly.

Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 7e3caa81 03-Dec-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

Move CONFIG_PANIC_HANG to Kconfig

Freescale (NXP) boards have lots of defconfig files per board.
I used "imply PANIC_HANG" for them.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# da5337a6 08-Nov-2017 Nandor Han <nandor.han@ge.com>

rtc: add support for s35392a

Add support for S35392A RTC. The driver supports both U-Boot driver
models.

Signed-off-by: Nandor Han <nandor.han@ge.com>
Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
Cc: Heiko Schocher <hs@denx.de>

# f52bdf4b 14-Sep-2017 Jean-Jacques Hiblot <jjhiblot@ti.com>

lib: allow building lzo for the SPL

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 85d8bf57 03-Sep-2017 Marek Behún <marek.behun@nic.cz>

lib: Add CRC32-C

This is needed for BTRFS.

Signed-off-by: Marek Behun <marek.behun@nic.cz>

create mode 100644 lib/crc32c.c

# 7264f292 15-Aug-2017 York Sun <york.sun@nxp.com>

spl: fit: Eanble GZIP support for image decompression

Add Kconfig option SPL_GZIP and SPL_ZLIB to enable gunzip support for
SPL boot, eg. falcon boot compressed kernel image.

Signed-off-by: York Sun <york.sun@nxp.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6ef2f901 11-Aug-2017 Adam Ford <aford173@gmail.com>

Convert CONFIG_BCH to Kconfig

This converts the following to Kconfig:
CONFIG_BCH

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1a7ba1d 18-Aug-2017 Anatolij Gustschin <agust@denx.de>

Fix 'notes' typos

s/notes/nodes

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 96b9082c 03-Aug-2017 Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

rockchip: rk3188: rock: adjust for SPL/TPL split

With the changes to split SPL/TPL for the RK3368, I apparently missed
some needed adjustments to the RK3188 Kconfig and rock_defconfig.

This fixes build-issues for the rock board after applying the RK3368
enablement (and SPL/TPL) set that resulted from TPL_SERIAL_SUPPORT,
TPL_ROCKCHIP_BACK_TO_BROM and TPL_TINY_MEMSET being separate symbols
now.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d56b4b19 22-Jul-2017 Tom Rini <trini@konsulko.com>

configs: Migrate RBTREE, LZO, CMD_MTDPARTS, CMD_UBI and CMD_UBIFS

The above CONFIG options are in Kconfig, and now have correct depends and
inter-dependencies. Migrate these to configs/ from include/configs/. In the
case of CMD_UBIFS also change it to be a default y if CMD_UBI.

Signed-off-by: Tom Rini <trini@konsulko.com>

# aed998aa 17-May-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_LZMA to Kconfig

This converts the following to Kconfig:
CONFIG_LZMA

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

# b1a873df 26-Apr-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_CMD_AES et al to Kconfig

This converts the following to Kconfig:
CONFIG_CMD_AES
CONFIG_AES

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Add select AES to CMD_AES]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 173aafbf 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

cmd: Expose a Kconfig option to enable UBIFS commands

Create a new Kconfig entry to allow CMD_UBIFS selection from Kconfig and
add an hidden LZO option that can be selected by CMD_UBIFS.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>

# aa049152 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

mtd: ubi: Select RBTREE option from MTD_UBI Kconfig entry

Expose the RBTREE feature through Kconfig and select this option from the
MTD_UBI option.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>
[Rebased on master]
Signed-off-by: Jagan Teki <jagan@openedev.com>

# ab4458bd 02-Apr-2017 Simon Glass <sjg@chromium.org>

string: Provide a slimmed-down memset()

Most of the time the optimised memset() is what we want. For extreme
situations such as TPL it may be too large. For example on the 'rock'
board, using a simple loop saves a useful 48 bytes. With gcc 4.9 and
the rodata bug, this patch is enough to reduce the TPL image below the
limit.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>

# bea79d7d 14-Mar-2017 Andre Przywara <andre.przywara@arm.com>

Kconfig: introduce md5sum command selection

So far CONFIG_MD5SUM would need to be set by a board's include file.
Since the command is really generic, move it over to Kconfig to allow
it to be defined by either a board's defconfig, menuconfig or some
config snippet merged via mergeconfig.sh.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e663b350 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

smbios: Expose in efi_loader as table

We can pass SMBIOS easily as EFI configuration table to an EFI payload. This
patch adds enablement for that case.

While at it, we also enable SMBIOS generation for ARM systems, since they support
EFI_LOADER.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4b6dddc2 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

x86: Move smbios generation into arch independent directory

We will need the SMBIOS generation function on ARM as well going forward,
so let's move it into a non arch specific location.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# ebf7fff2 05-Oct-2016 Heiko Schocher <hs@denx.de>

spl: move FDT_FIXUP_PARTITIONS to Kconfig

Move FDT_FIXUP_PARTITIONS to Kconfig and cleanup existing
uses.

Signed-off-by: Heiko Schocher <hs@denx.de>

# ddf67f71 05-Jul-2016 Maxime Ripard <maxime.ripard@free-electrons.com>

libfdt: Add overlay application function

The device tree overlays are a good way to deal with user-modifyable
boards or boards with some kind of an expansion mechanism where we can
easily plug new board in (like the BBB, the Raspberry Pi or the CHIP).

Add a new function to merge overlays with a base device tree.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>

# 91b86e21 26-May-2016 Marek Vasut <marex@denx.de>

lib: Enable private libgcc by default

This patch decouples U-Boot binary from the toolchain on systems where
private libgcc is available. Instead of pulling in functions provided
by the libgcc from the toolchain, U-Boot will use it's own set of libgcc
functions. These functions are usually imported from Linux kernel, which
also uses it's own libgcc functions instead of the ones provided by the
toolchain.

This patch solves a rather common problem. The toolchain can usually
generate code for many variants of target architecture and often even
different endianness. The libgcc on the other hand is usually compiled
for one particular configuration and the functions provided by it may
or may not be suited for use in U-Boot. This can manifest in two ways,
either the U-Boot fails to compile altogether and linker will complain
or, in the much worse case, the resulting U-Boot will build, but will
misbehave in very subtle and hard to debug ways.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 67976306 30-Mar-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

cosmetic: Fix typos "privide"

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# ed980b8c 03-Mar-2016 Alexander Graf <agraf@csgraf.de>

efi_loader: hook up in build environment

Now that we have all the bits and pieces ready for EFI payload loading
support, hook them up in Makefiles and KConfigs so that we can build.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
[trini: Enable only when we of OF_LIBFDT, disable on kwb and colibri_pxa270]
Signed-off-by: Tom Rini <trini@konsulko.com>

# aa34fbc0 22-Feb-2016 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt to be used in SPL

Add an option to enable libfdt in SPL. This can be useful when decoding
FIT files in SPL.

We need to make sure this option is not enabled in SPL by this change.
Also this option needs to be enabled in host builds. Si add a new
IMAGE_USE_LIBFDT #define which can be used in files that are built on the
host but must also build for U-Boot and SPL.

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

# 69e173eb 22-Feb-2016 Simon Glass <sjg@chromium.org>

Move CONFIG_OF_LIBFDT to Kconfig

Move this option to Kconfig and tidy up existing boards.

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

# a187559e 05-Feb-2016 Bin Meng <bmeng.cn@gmail.com>

Use correct spelling of "U-Boot"

Correct spelling of "U-Boot" shall be used in all written text
(documentation, comments in source files etc.).

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Minkyu Kang <mk7.kang@samsung.com>

# 947c626d 14-Jan-2016 Tom Rini <trini@konsulko.com>

vsprintf.c: Always enable CONFIG_SYS_VSNPRINTF

Enabling this function always removes some class of string saftey issues.
The size change here in general is about 400 bytes and this seems a reasonable
trade-off.

Cc: Peng Fan <peng.fan@nxp.com>
Cc: Peter Robinson <pbrobinson@gmail.com>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Adrian Alonso <aalonso@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 7d9cde10 22-Nov-2015 Stefan Roese <sr@denx.de>

lib/tiny-printf.c: Add tiny printf function for space limited environments

This patch adds a small printf() version that supports all basic formats.
Its intented to be used in U-Boot SPL versions on platforms with very
limited internal RAM sizes.

To enable it, just define CONFIG_USE_TINY_PRINTF in your defconfig. This
will result in the SPL using this tiny function and the main U-Boot
still using the full-blown printf() function.

This code was copied from:
http://www.sparetimelabs.com/printfrevisited
With mostly only coding style related changes so that its checkpatch
clean.

The size reduction is about 2.5KiB. Here a comparison for the db-mv784mp-gp
(Marvell AXP) SPL:

Without this patch:
58963 18536 1928 79427 13643 ./spl/u-boot-spl

With this patch:
56542 18536 1956 77034 12cea ./spl/u-boot-spl

Note:
To make it possible to compile tiny-printf.c instead of vsprintf.c when
CONFIG_USE_TINY_PRINTF is defined, the functions printf() and vprintf() are
moved from common/console.c into vsprintf.c in this patch.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>

# 2419cd16 03-Oct-2015 Simon Glass <sjg@chromium.org>

dm: tpm: Drop CONFIG_DM_TPM

Now that all TPM drivers use driver model, we can drop the special driver
model CONFIG option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>

# 027b728d 06-Oct-2015 Julius Werner <jwerner@chromium.org>

Add support for LZ4 decompression algorithm

This patch adds support for LZ4-compressed FIT image contents. This
algorithm has a slightly worse compression ration than LZO while being
nearly twice as fast to decompress. When loading images from a fast
storage medium this usually results in a boot time win.

Sandbox-tested only since I don't have a U-Boot development system set
up right now. The code was imported unchanged from coreboot where it's
proven to work, though. I'm mostly interested in getting this recognized
by mkImage for use in a downstream project.

Signed-off-by: Julius Werner <jwerner@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# a7d660bc 22-Aug-2015 Simon Glass <sjg@chromium.org>

tpm: Add Kconfig options for TPMs

Add new Kconfig options for TPMs in preparation for moving boards to use
Kconfig for TPM configuration.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 867a6ac8 31-Jul-2015 Simon Glass <sjg@chromium.org>

efi: Add start-up library code

When running as an EFI application, U-Boot must request memory from EFI,
and provide access to the boot services U-Boot needs.

Add library code to perform these tasks. This includes efi_main() which is
the entry point from EFI. U-Boot is built as a shared library.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d1389403 23-Jun-2015 Simon Glass <sjg@chromium.org>

Add a dhrystone benchmark command

Drystone provides a convenient sanity check that the CPU is running at full
speed. Add this as a command which can be enabled as needed.

Note: I investigated using Coremark for this but there was a license
agreement and I could not work out if it was GPL-compatible.

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

# f7848d90 22-Jun-2015 Joe Hershberger <joe.hershberger@ni.com>

Allow CONFIG_REGEX to be disabled when CONFIG_NET

Instead of selecting REGEX when NET is enabled, make it the default, but
allow boards that are tiny to disable it and lose functionality on all
but the first Ethernet adapter.

cm-bf548, bf538f-ezkit, and bf533-stamp need this. None appear to have
more than one Ethernet interface.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# 3850dbe8 11-Jun-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

blackfin: fix undefined reference to srand and rand

Commit 9ba9e85f3f1c (net: Fix NET_RANDOM_ETHADDR dependencies)
accidentally dropped CONFIG_LIB_RAND defines for 14 Blackfin boards.

Prior to that commit, those boards defined CONFIG_LIB_RAND, but not
CONFIG_NET_RANDOM_ETHADDR. So, commit 9ba9e85f3f1c should not have
touched them, but in fact it ripped CONFIG_LIB_RAND off from all the
header files, which caused undefined reference to srand and rand.
CONFIG_LIB_RAND=y must be revived for such boards.

BTW, this commit indeed makes it better, but even with this fix,
three boards (bf533-stamp, bf538f-ezkit, cm-bf548) still can not
build due to region 'ram' overflowed error. This was cause by
commit 6eed3786c68c (net: Move the CMD_NET config to defconfigs)
because CMD_NET selects NET, and NET selects REGEX. Eventually,
some boards were newly enabled with CONFIG_REGEX, increasing the
memory footprint. A patch is expected to fix the build error.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 9ba9e85f 25-May-2015 Michal Simek <michal.simek@xilinx.com>

net: Fix NET_RANDOM_ETHADDR dependencies

NET_RANDOM_ETHADDR depends on lib/rand.c. This patch adds dependency to
Kconfig to ensure that library is also compiled.

Remove the definitions from Blackfin boards' include/configs.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 6501ff62 20-Apr-2015 Przemyslaw Marczak <p.marczak@samsung.com>

lib: Kconfig: add entry for errno_str() function

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1a60650c 21-Apr-2015 Joe Hershberger <joe.hershberger@ni.com>

kconfig: Move REGEX to Kconfig

Having this as a Kconfig allows it to be a dependent feature.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8156345d 06-Mar-2015 Simon Glass <sjg@chromium.org>

sandbox: Move CONFIG_SYS_VSNPRINTF to Kconfig

Move this over to Kconfig and tidy up.

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

# 94e3c8c4 19-Feb-2015 gaurav rana <gaurav.rana@freescale.com>

crypto/fsl - Add progressive hashing support using hardware acceleration.

Currently only normal hashing is supported using hardware acceleration.
Added support for progressive hashing using hardware.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
Signed-off-by: Gaurav Rana <gaurav.rana@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>

# d9f23c7f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

lib/rsa: Add Kconfig for devices supporting RSA Modular Exponentiation

Kconfig option added for devices which support RSA Verification.
1. RSA_SOFTWARE_EXP
Enables driver for supporting RSA Modular Exponentiation in Software
2. RSA_FREESCALE_EXP
Enables driver for supporting RSA Modular Exponentiation using Freescale specific
driver

The above drivers use RSA uclass

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
(Removed duplicate line in Kconfig comment)

Change-Id: I7663c4d5350e2bfc3dfa2696f70ef777d6ccc6f6

# c4beb22f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

FIT: Modify option FIT_SIGNATURE in Kconfig

For FIT signature based approach to work, RSA library needs to be selected.
The FIT_SIGNATURE option in Kconfig is modified to automatically select RSA.
Selecting RSA compiles the RSA library required for image verification.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 45ccec8f 23-Oct-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_USE_PRIVATE_LIBGCC to Kconfig

The private libgcc is supported only on ARM, MIPS, PowerPC, SH, x86.
Those architectures should "select" HAVE_PRIVATE_LIBGCC and
CONFIG_USE_PRIVATE_LIBGCC should depend on it.

Currently, this option is enabled on Tegra boards and x86 architecture.
Move the definition from header files to Kconfig.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Tested-by: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: Tom Warren <twarren@nvidia.com>

# 8c688bc4 23-Oct-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_SYS_HZ to lib/Kconfig

CONFIG_SYS_HZ is always defined as 1000 in config_fallbacks.h
(but some boards still have redundant definitions).

This commit moves the definition and the document in README to
Kconfig. Since lib/Kconfig can assure that CONFIG_SYS_HZ is 1000,
the sanity check in lib/time.c should be removed.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Reviewed-by: Marek Vasut <marex@denx.de>

# b0928da6 16-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED to Kconfig

If this option is enabled, the objects under lib/ directory
are compiled with speed optimization, not size optimization.
(Currently, only used by some Blackfin boards.)

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# ed36323f 16-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: add blank Kconfig files

This would be useful to start moving various config options.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# 26dd9936 08-Jul-2021 Steffen Jaeckel <jaeckel-floss@eyet-services.de>

lib: add crypt subsystem

Add the basic functionality required to support the standard crypt
format.
The files crypt-sha256.c and crypt-sha512.c originate from libxcrypt and
their formatting is therefor retained.
The integration is done via a crypt_compare() function in crypt.c.

```
libxcrypt $ git describe --long --always --all
tags/v4.4.17-0-g6b110bc
```

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 7d0f3fbb 11-Jun-2021 Tero Kristo <t-kristo@ti.com>

lib: rational: copy the rational fraction lib routines from Linux

Copy the best rational approximation calculation routines from Linux.
Typical usecase for these routines is to calculate the M/N divider
values for PLLs to reach a specific clock rate.

This is based on linux kernel commit:
"lib/math/rational.c: fix possible incorrect result from rational
fractions helper"
(sha1: 323dd2c3ed0641f49e89b4e420f9eef5d3d5a881)

Signed-off-by: Tero Kristo <t-kristo@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Tero Kristo <kristo@kernel.org>

# ec0512b1 24-May-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

Revert "lib: introduce HASH_CALCULATE option"

When we think of Kconfig, we usually think of features that we like
to enable or not. Ideally, we wouldn't use Kconfig to fix a build
issue, although sometimes it might make sense. With Kconfig it's hard
to guarantee that the fix is universal. We can only say that it works
for the set of tested configurations. In the majority of cases, it's
preferable to let the linker figure things out for us.

The reverted commit attempted to fix a build issue by adding an
invisible Kconfig option. This is wrong in several ways:

It invents a new Kconfig variable when CONFIG_HASH already
exists for the same purpose.
Second, hash-checksum.c makes use of the hash_progressive_lookup_algo()
symbol, which is only provided with CONFIG_HASH, but this dependency
was not expressed in the reverted patch.

It feels like Kconfig is turning into a listing of all available
source files, and a buffet to 'select' which ones to compile. The
purpose of this revert is to enable the next change to make use of
CONFIG_HASH instead of adding to Kconfig.

This reverts commit 87316da05f2fd49d3709275e64ef0c5980366ade.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Acked-by: Masahisa Kojima <masahisa.kojima@linaro.org>

# 1621d3c4 10-May-2021 Bin Meng <bmeng.cn@gmail.com>

lib: kconfig: Limit BINMAN_FDT for OF_SEPARATE or OF_EMBED

Generally speaking BINMAN_FDT makes sense for OF_SEPARATE or OF_EMBED.
For the other OF_CONTROL methods, it's quite possible binman node is
not available as binman is invoked during the build phase instead of
runtime. Let's only turn it on for OF_SEPARATE or OF_EMBED by default.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 87316da0 13-May-2021 Masahisa Kojima <masahisa.kojima@linaro.org>

lib: introduce HASH_CALCULATE option

Build error occurs when CONFIG_EFI_SECURE_BOOT or
CONFIG_EFI_CAPSULE_AUTHENTICATE is enabled,
because hash-checksum.c is not compiled.

Since hash_calculate() implemented in hash-checksum.c can be
commonly used aside from FIT image signature verification,
this commit itroduces HASH_CALCULATE option to decide
if hash-checksum.c shall be compiled.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# e2ae483c 13-May-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

hash: Kconfig option for SHA512 hardware acceleration

Commit a479f103dc1c ("hash: Allow for SHA512 hardware implementations")
defined function definitions for hardware accelerated SHA384 and SHA512.
If CONFIG_SHA_HW_ACCEL=y, these functions are used.

We already have boards using CONFIG_SHA_HW_ACCEL=y but none implements the
new functions hw_sha384() and hw_sha512().

For implementing the EFI TCG2 protocol we need SHA384 and SHA512. The
missing hardware acceleration functions lead to build errors on boards like
peach-pi_defconfig.

Introduce a new Kconfig symbol CONFIG_SHA512_HW_ACCEL to control if the
functions hw_sha384() and hw_sha512() shall be used to implement the SHA384
and SHA512 algorithms.

Fixes: a479f103dc1c ("hash: Allow for SHA512 hardware implementations")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

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

# 6d66502b 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: Add 2 config to define the max number of regions

Add 2 configs CONFIG_LMB_MEMORY_REGIONS and CONFIG_LMB_RESERVED_REGIONS
to change independently the max number of the regions in lmb
library.

When CONFIG_LMB_USE_MAX_REGIONS=y, move the lmb property arrays to
struct lmb and manage the array size with the element 'max' of struct
lmb_region; their are still allocated in stack.

When CONFIG_LMB_USE_MAX_REGIONS=n, keep the current location in
struct lmb_region to allow compiler optimization.

Increase CONFIG_LMB_RESERVED_REGIONS is useful to avoid lmb errors in
bootm when the number of reserved regions (not adjacent) is reached:
+ 1 region for relocated U-Boot
+ 1 region for initrd
+ 1 region for relocated linux device tree
+ reserved memory regions present in Linux device tree.

The current limit of 8 regions is reached with only 5 reserved regions
in DT.

see Linux kernel commit bf23c51f1f49 ("memblock: Move memblock arrays
to static storage in memblock.c and make their size a variable")

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# 4fa0150d 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: move MAX_LMB_REGIONS value in Kconfig

Move MAX_LMB_REGIONS value in Kconfig, the max number of the regions
in lmb library.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# 77b8cfef 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: move CONFIG_LMB in Kconfig

Migrate CONFIG_LMB in Kconfig.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# a479f103 16-Feb-2021 Joel Stanley <joel@jms.id.au>

hash: Allow for SHA512 hardware implementations

Similar to support for SHA1 and SHA256, allow the use of hardware hashing
engine by enabling the algorithm and setting CONFIG_SHA_HW_ACCEL /
CONFIG_SHA_PROG_HW_ACCEL.

Signed-off-by: Joel Stanley <joel@jms.id.au>

# f2c1442e 14-Mar-2021 Simon Glass <sjg@chromium.org>

bloblist: Make BLOBLIST_TABLES depend on BLOBLIST

Add an extra condition here since we cannot put x86 tables in a bloblist
when bloblists are not supported.

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

# e0103158 25-Feb-2021 Bin Meng <bmeng.cn@gmail.com>

lib: kconfig: Mention CONFIG_ADDR_MAP limitation in the help

Mention that CONFIG_ADDR_MAP only works in the post-relocation phase.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>

# 56e7257c 03-Feb-2021 Bin Meng <bmeng.cn@gmail.com>

lib: Fix BINMAN_FDT dependency

lib/binman.c references the following 3 ofnode APIs:
ofnode_first_subnode(), ofnode_path() and ofnode_read_bool().

These APIs get built only when DM is on. Fix the dependency then.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 59e4e391 18-Jan-2021 Tom Rini <trini@konsulko.com>

Merge https://gitlab.denx.de/u-boot/custodians/u-boot-riscv

- Update qemu-riscv.rst build instructions.
- Add support for SPI on Kendryte K210.
- Add Microchip PolarFire SoC Icicle Kit support.
- Add support for an early timer.
- Select TIMER_EARLY to avoid infinite recursion for Trace.


# a80f8513 17-Jan-2021 Pragnesh Patel <pragnesh.patel@sifive.com>

trace: select TIMER_EARLY to avoid infinite recursion

When tracing functions is enabled this adds calls to
__cyg_profile_func_enter() and __cyg_profile_func_exit() to the traced
functions.

__cyg_profile_func_enter() and __cyg_profile_func_exit() invoke
timer_get_us() to record the entry and exit time.

initr_dm() will make gd->dm_root = NULL and gd->timer = NULL, so
timer_get_us() -> get_ticks() -> dm_timer_init() will lead to an
indefinite recursion.

So select TIMER_EARLY when tracing got enabled.

Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Rick Chen <rick@andestech.com>

# 6205bbb1 04-Jan-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lib: cosmetic update of CONFIG_LIB_ELF description

Change 2 typo error in CONFIG_LIB_ELF description:
- Supoort => Support
- fir => for

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c589132a 02-Dec-2020 Aswath Govindraju <a-govindraju@ti.com>

fdt: Use phandle to distinguish DT nodes with same name

While assigning the sequence number to subsystem instances by reading the
aliases property, only DT nodes names are compared and not the complete
path. This causes a problem when there are two DT nodes with same name but
have different paths.

In arch/arm/dts/k3-am65-main.dtsi there are two USB controllers with the
same device tree node name but different path. When aliases are defined for
these USB controllers then fdtdec_get_alias_seq() fails to pick the correct
instance for a given index.

fdt_path_offset() function is slow and this would effect the U-Boot
startup. To avert the time penalty on all boards, apply this extra check
only when required by using a config option.

Fix it by comparing the phandles of DT nodes after the node names match,
under a config option.

Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Fix whitespace error in Kconfig:
Signed-off-by: Simon Glass <sjg@chromium.org>

# 28cef9ca 19-Nov-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

fs: fat: create correct short names

The current function set_name() used to create short names has the
following deficiencies resolved by this patch:

* Long names (e.g. FOO.TXT) are stored even if a short name is enough.
* Short names with spaces are created, e.g. "A ~1.TXT".
* Short names with illegal characters are created, e.g. "FOO++BAR".
* Debug output does not not consider that the short file name has no
concluding '\0'.

The solution for the following bug is split of into a separate patch:

* Short file names must be unique.

This patch only provides the loop over possible short file names.

Fixes: c30a15e590c ("FAT: Add FAT write feature")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# e4f8e543 05-Nov-2020 Simon Glass <sjg@chromium.org>

smbios: Drop the unused Kconfig options

Now that we can use devicetree to specify this information, drop the old
CONFIG options.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 44c74bdd 05-Nov-2020 Simon Glass <sjg@chromium.org>

sysinfo: Provide a default driver to set SMBIOS values

Some boards want to specify the manufacturer or product name but do not
need to have their own sysinfo driver.

Add a default driver which provides a way to specify this SMBIOS
information in the devicetree, without needing any board-specific
functionality.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d2cb7a22 04-Nov-2020 Simon Glass <sjg@chromium.org>

x86: Allow putting some tables in the bloblist

At present all tables are placed starting at address f0000 in memory, and
can be up to 64KB in size. If the tables are very large, this may not
provide enough space.

Also if the tables point to other tables (such as console log or a ramoops
area) then we must allocate other memory anyway.

The bloblist is a nice place to put these tables since it is contiguous,
which makes it easy to reserve this memory for linux using the 820 tables.

Add an option to put some of the tables in the bloblist. For SMBIOS and
ACPI, create suitable pointers from the f0000 region to the new location
of the tables.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
[bmeng: squashed in http://patchwork.ozlabs.org/project/uboot/patch/
20201105062407.1.I8091ad931cbbb5e3b6f6ababdf3f8d5db0d17bb9@changeid/]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# 415eab06 03-Nov-2020 Christian Gmeiner <christian.gmeiner@gmail.com>

smbios: add parsing API

Add a very simple API to be able to access SMBIOS strings
like vendor, model and bios version.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 72eda507 27-Oct-2020 Sean Anderson <seanga2@gmail.com>

lib: Add getopt

Some commands can get very unweildy if they have too many positional
arguments. Adding options makes them easier to read, remember, and
understand.

This implementation of getopt has been taken from barebox, which has had
option support for quite a while. I have made a few modifications to their
version, such as the removal of opterr in favor of a separate getopt_silent
function. In addition, I have moved all global variables into struct
getopt_context.

The getopt from barebox also re-orders the arguments passed to it so that
non-options are placed last. This allows users to specify options anywhere.
For example, `ls -l foo/ -R` would be re-ordered to `ls -l -R foo/` as
getopt parsed the options. However, this feature conflicts with the const
argv in cmd_tbl->cmd. This was originally added in 54841ab50c ("Make sure
that argv[] argument pointers are not modified."). The reason stated in
that commit is that hush requires argv to stay unmodified. Has this
situation changed? Barebox also uses hush, and does not have this problem.
Perhaps we could use their fix?

I have assigned maintenance of getopt to Simon Glass, as it is currently
only used by the log command. I would also be fine maintaining it.

Signed-off-by: Sean Anderson <seanga2@gmail.com>

# 26637e2e 12-Sep-2020 Simon Glass <sjg@chromium.org>

lib: Allow hexdump to be used in SPL

It is sometimes useful to output hex dumps in SPL. Add a config option to
allow this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# e87dfb05 05-Aug-2020 Andrii Anisov <andrii_anisov@epam.com>

lib: sscanf: add sscanf implementation

Port sscanf implementation from mini-os and introduce new
Kconfig option to enable it: CONFIG_SSCANF. Disable by default.

Signed-off-by: Andrii Anisov <andrii_anisov@epam.com>
Signed-off-by: Anastasiia Lukianenko <anastasiia_lukianenko@epam.com>
Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>

# 81014f73 30-Jul-2020 Joao Marcos Costa <joaomarcos.costa@bootlin.com>

include/u-boot, lib/zlib: add sources for zlib decompression

Add zlib (v1.2.11) uncompr() function to U-Boot. SquashFS depends on
this function to decompress data from a raw disk image. The actual
support for zlib into SquashFS sources will be added in a follow-up
commit.

Signed-off-by: Joao Marcos Costa <joaomarcos.costa@bootlin.com>

# 69be8fd1 03-Jun-2020 Marek Szyprowski <m.szyprowski@samsung.com>

powerpc: move ADDR_MAP to Kconfig

Move ADDR_MAP related config options from include/configs/*.h to the
proper place in lib/Kconfig. This has been done using
./tools/moveconfig.py and manual inspection of the generated changes.
This is a preparation to use ADDR_MAP helper on ARM 32bit Raspberry Pi4
board for mapping the PCIe XHCI MMIO, which is above the 4GiB identity
mapping limit.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# d16b38f4 15-Apr-2020 Reuben Dowle <reubendowle0@gmail.com>

Add support for SHA384 and SHA512

The current recommendation for best security practice from the US government
is to use SHA384 for TOP SECRET [1].

This patch adds support for SHA384 and SHA512 in the hash command, and also
allows FIT images to be hashed with these algorithms, and signed with
sha384,rsaXXXX and sha512,rsaXXXX

The SHA implementation is adapted from the linux kernel implementation.

[1] Commercial National Security Algorithm Suite
http://www.iad.gov/iad/programs/iad-initiatives/cnsa-suite.cfm

Signed-off-by: Reuben Dowle <reuben.dowle@4rf.com>

# 43e442a5 26-May-2020 Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

kconfig: fix some typos

Signed-off-by: Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

# eff5a547 22-May-2020 Michael Walle <michael@walle.cc>

cmd: zip: automatically pull in gzip()

Move the CONFIG_GZIP_COMPRESSED from a config.h macro to a Kconfig menu
item. It is not selectable by a user because there is no reason to do
so. Instead it will be automatically selected by the stuff which uses
gzip(), like the zip command.

Remove it from the config_whitelist.txt. Also remove
CONFIG_GZIP_COMPRESS_DEF_SZ as this was never used on any board. The
default seems to be sane, otherwise it should be added as a Kconfig
option.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8239be61 06-May-2020 Simon Glass <sjg@chromium.org>

lib: Allow MD5 to be enabled in SPL

At present the MD5 option cannot be enabled by board configs since it has
no Kconfig name. It is generally enabled, so long as FIT support is
present. But not all boards use FIT, particularly in SPL

Fix this and add an option for SPL as well. This allows board code to call
md5() even if FIT support is not enabled.

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

# 04cb3994 21-Apr-2020 Weijie Gao <weijie.gao@mediatek.com>

lib: enable lzma decompression support for SPL build

This patch enables LZMA decompression support for SPL build

Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>

# 2a2119e1 05-Mar-2020 Atish Patra <atish.patra@wdc.com>

lib: kconfig: Add option to set BZIP2 compression method

There is no way to select BZIP2 compression method.
Add it under library/compression config where all other
compression related configs are present.

Signed-off-by: Atish Patra <atish.patra@wdc.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 805b3cac 12-Feb-2020 Keerthy <j-keerthy@ti.com>

lib: elf: Move the generic elf loading/validating functions to lib

Move the generic elf loading/validating functions to lib/
so that they can be re-used and accessed by code existing
outside cmd.

While at it remove the duplicate static version of load_elf_image_phdr
under arch/arm/mach-imx/imx_bootaux.c.

Signed-off-by: Keerthy <j-keerthy@ti.com>
Suggested-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>

# 1611235b 19-Jan-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: Kconfig dependencies for pseudo-random library

drivers/rng/sandbox_rng.c requires rand() to be defined but configuration
option CONFIG_CONFIG_LIB_RAND selected in drivers/rng/Kconfig does not
exist.

test/lib/test_aes.c requires rand() to be defined.

Fix the selection criteria for choice "Pseudo-random library support type".

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 3c10dc95 06-Dec-2019 Simon Glass <sjg@chromium.org>

binman: Add a library to access binman entries

SPL and TPL can access information about binman entries using link-time
symbols but this is not available in U-Boot proper. Of course it could be
made available, but the intention is to just read the device tree.

Add support for this, so that U-Boot can locate entries.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# b4adf627 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: crypto: add x509 parser

Imported from linux kernel v5.3:
x509.asn1 without changes
x509_akid.asn1 without changes
x509_parser.h without changes
x509_cert_parser.c with changes marked as __UBOOT__
x509_public_key.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# a9b45e6e 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add oid registry utility

Imported from linux kernel v5.3:
build_OID_registry without changes
oid_registry.h without changes
oid_registry.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# ab8a0e06 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add asn1 decoder

Imported from linux kernel v5.3:
lib/asn1_decoder.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 2b12196d 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

cmd: add asn1_compiler

Imported from linux kernel v5.3:
asn1.h without changes
asn1_ber_bytecode.h without changes
asn1_decoder.h without changes
asn1_compiler.c without changes

This host command will be used to create a ASN1 parser, for example,
for pkcs7 messages or x509 certificates. More specifically, it will
generate *byte code* which will be interpreted by asn1 decoder library.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 05429b6c 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

rtc: move date.c from drivers/rtc/ to lib/

In the next commit, rtc_mktime(), for compatibility with linux, will be
implemented using rtc_mktime(), which is no longer drivers/rtc specific.
So move this file under lib/.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 37ef1774 10-Nov-2019 Thomas Hebb <tommyhebb@gmail.com>

Kconfig: disambiguate config names for tiny printf

27084c03d36a ("spl: Allow tiny printf() to be controlled in SPL and
TPL") split this option in two for TPL and SPL, but didn't change the
Kconfig names, making them hard to set quickly.

Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>

# 0d76afc0 27-Oct-2019 Simon Glass <sjg@chromium.org>

fdt: Add Kconfig options to control code size

For better or worse libfdt recent grew a lot of code that checks the
validity of the device tree in great detail. When using unsigned or
unverified data this makes things safer, but it does add to code size.

Add some controls to select the trade-off between safety and code size.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 27084c03 25-Sep-2019 Simon Glass <sjg@chromium.org>

spl: Allow tiny printf() to be controlled in SPL and TPL

At present there is only one control for this and it is used for both SPL
and TPL. But SPL might have a lot more space than TPL so the extra cost of
a full printf() might be acceptable.

Split the option into two, providing separate SPL and TPL controls. The
TPL setting defaults to the same as SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2a51e16b 07-Jun-2019 Tom Rini <trini@konsulko.com>

configs: Make USE_TINY_PRINTF depend on SPL||TPL and be default

The USE_TINY_PRINTF symbol only changes things within SPL and TPL
builds, so make it depend on that support. Next, make it default as
within these cases we should rarely have need of more advanced print
formats outside of the debug context.

To do this, in a few cases we need to correct our Kconfig dependencies
as we had cases of non-SPL targets select'ing this symbol. Finally, in
the case of a few boards we really do need the full printf
functionality.

Signed-off-by: Tom Rini <trini@konsulko.com>

# da0fb5fd 02-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: make call depth limit customizable

Up to now we had hard coded values for the call depth up to which trace
records are created: 200 for early tracing, 15 thereafter. UEFI
applications reach a call depth of 80 or above.

Provide customizing settings for the call trace depth limit and the early
call trace depth limit. Use the old values as defaults.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8509f22a 29-Apr-2019 Marek Behún <marek.behun@nic.cz>

lib: add Zstandard decompression support

Add the zstd library from Linux kernel (only decompression support).
There are minimal changes to build with U-Boot, otherwise the files are
identical to Linux commit dc35da16 from March 2018, the files had not
been touched since in kernel. Also SPDX lincese tags were added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 83a486b6 29-Apr-2019 Marek Behún <marek.behun@nic.cz>

lib: Add xxhash support

This adds the xxhash support from Linux. Files are almost identical to
those added to Linux in commit 5d240522 ("lib: Add xxhash module") (they
haven't been touched since in Linux). The only difference is to add some
includes to be compatible with U-Boot. Also SPDX lincese tags were
added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 5132361a 29-Apr-2019 Heiko Schocher <hs@denx.de>

lib: Kconfig: fix help text for GZIP

commit 95f4bbd581cf ("lib: fdt: Allow LZO and GZIP DT compression in U-Boot")

introduced Kconfig option for gzip in U-Boot, but help text
says gzip for SPL, which is wrong. Fix this.

Signed-off-by: Heiko Schocher <hs@denx.de>
Acked-by: Marek Vasut <marex@denx.de>

# 1c6eb075 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE_BUFFER_SIZE et al to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE_BUFFER_SIZE
CONFIG_TRACE_EARLY_SIZE
CONFIG_TRACE_EARLY
CONFIG_TRACE_EARLY_ADDR

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

# a24a78d7 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE

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

# 54969b40 21-Mar-2019 Thierry Reding <treding@nvidia.com>

fdtdec: Add Kconfig symbol for tests

Runtime tests are provided as a test_fdtdec command implementation. Add
a Kconfig symbol that allows this command to be built so that the tests
can be used.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 95f4bbd5 08-Mar-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

lib: fdt: Allow LZO and GZIP DT compression in U-Boot

Add required Kconfig symbols, Makefile bits and macro fixes in a
few places to support LZO and DT compression in U-Boot. This can
save a lot of space with multi-DTB fitImages.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>

# 6e705114 13-Jan-2019 Chris Packham <judge.packham@gmail.com>

lib: Kconfig: spelling fixes

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 048c6e89 06-Nov-2018 Simon Glass <sjg@chromium.org>

spl: lz4: Allow use of lz4 compression in SPL

In some cases U-Boot is compressed and it is useful to be able to
decompress it in SPL. Add a Kconfig and Makefile change to allow this.
Note that this does not actually implement decompression.

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

# 2895c4b7 15-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

kconfig: Introduce HAVE_ARCH_IOMAP

Introduce a new Kconfig option for architecture codes to control
whether it provides io{read,write}{8,16,32} I/O accessor functions.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5592a633 01-Oct-2018 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt in TPL

In some cases (e.g. sandbox with verified boot) it is useful to support
libfdt in TPL. Update the Kconfig to handle this.

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

# 6307896c 01-Oct-2018 Simon Glass <sjg@chromium.org>

tpm: Add support for SPL and TPL

At present the tpm can only be used in U-Boot proper. Updated it to work
in SPL and TPL also.

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

# ab948cd2 19-Jul-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

fdt_support: make FDT_FIXUP_PARTITIONS depend on CMD_MTDPARTS

fdt_fixup_mtdparts() calls mtdparts_init() and device_find(),
which are defined in cmd/mtdparts.c

The combination of FDT_FIXUP_PARTITIONS=y and CMD_MTDPARTS=n
emits the following link error:

common/fdt_support.c:903: undefined reference to `mtdparts_init'
common/fdt_support.c:914: undefined reference to `device_find'

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 3330584d 03-Jun-2018 Igor Opaniuk <igor.opaniuk@gmail.com>

avb2.0: integrate avb 2.0 into the build system

Integrate libavb into the build system. Introduce CONFIG_LIBAVB
build option.

Signed-off-by: Igor Opaniuk <igor.opaniuk@linaro.org>

# f8c987f8 05-Jun-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

lib: Add hexdump

Often during debugging session it's very interesting to see
what data we were dealing with. For example what we write or read
to/from memory or peripherals.

This change introduces functions that allow to dump binary
data with one simple function invocation like:
------------------->8----------------
print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, buf, len);
------------------->8----------------

which gives us the following:
------------------->8----------------
00000000: f2 b7 c9 88 62 61 75 64 72 61 74 65 3d 31 31 35 ....baudrate=115
00000010: 32 30 30 00 62 6f 6f 74 61 72 67 73 3d 63 6f 6e 200.bootargs=con
00000020: 73 6f 6c 65 3d 74 74 79 53 33 2c 31 31 35 32 30 sole=ttyS3,11520
00000030: 30 6e 38 00 62 6f 6f 74 64 65 6c 61 79 3d 33 00 0n8.bootdelay=3.
00000040: 62 6f 6f 74 66 69 6c 65 3d 75 49 6d 61 67 65 00 bootfile=uImage.
00000050: 66 64 74 63 6f 6e 74 72 6f 6c 61 64 64 72 3d 39 fdtcontroladdr=9
00000060: 66 66 62 31 62 61 30 00 6c 6f 61 64 61 64 64 72 ffb1ba0.loadaddr
00000070: 3d 30 78 38 32 30 30 30 30 30 30 00 73 74 64 65 =0x82000000.stde
00000080: 72 72 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 rr=serial0@e0022
00000090: 30 30 30 00 73 74 64 69 6e 3d 73 65 72 69 61 6c 000.stdin=serial
000000a0: 30 40 65 30 30 32 32 30 30 30 00 73 74 64 6f 75 0@e0022000.stdou
000000b0: 74 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 30 t=serial0@e00220
000000c0: 30 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00..............
...
------------------->8----------------

Source of hexdump.c was copied from Linux kernel v4.7-rc2.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Mario Six <mario.six@gdsys.cc>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Stefan Roese <sr@denx.de>

# c232d14d 29-May-2018 Alex Kiernan <alex.kiernan@gmail.com>

mmc: Separate "mmc swrite" from fastboot

Introduce CONFIG_IMAGE_SPARSE and CONFIG_CMD_MMC_SWRITE so the "mmc
swrite" command is separated from the fastboot code.

Move image-sparse from common to lib so it's clear it's library code.

Rename CONFIG_FASTBOOT_FLASH_FILLBUF_SIZE to CONFIG_IMAGE_SPARSE_FILLBUF_SIZE
and migrate it to Kconfig.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Acked-by: Jassi Brar <jaswinder.singh@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6417572e 08-May-2018 Tom Rini <trini@konsulko.com>

lib/Kconfig: Mark OF_LIBFDT_OVERLAY as depending on OF_LIBFDT

The overlay code is only useful when OF_LIBFDT is set, so mark it as
depending on that first.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 58a46f88 25-Apr-2018 Praneeth Bajjuri <praneeth@ti.com>

configs: TI: Enable FIT Library overlay support

Enable the FDT library overlay support for all TI SOC family.

Without this option, when Loading fdt from FIT image, the
following warning is seen.

"config with overlays but CONFIG_OF_LIBFDT_OVERLAY not set".

Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
Suggested-by: Andrew F.Davis <afd@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>

# 14ad44ab 18-Apr-2018 Alex Kiernan <alex.kiernan@gmail.com>

spl: Split sprintf, strto* from SPL serial in Kconfig

When SPL serial is disabled, callers who need sprintf or strtoul fail
because their inclusion is guarded by CONFIG_SPL_SERIAL_SUPPORT/
CONFIG_TPL_SERIAL_SUPPORT.

Split printf, sprintf and strto into their own entries and then select
all of them if SERIAL_SUPPORT is enabled to match the current behaviour.

Include panic.o unconditionally as it can be called from anywhere which
uses BUG_ON().

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>

# e294ba06 04-Apr-2018 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-sunxi

Signed-off-by: Tom Rini <trini@konsulko.com>


# d14db11d 03-Apr-2018 Andre Przywara <andre.przywara@arm.com>

sunxi: revert disabling of features

In January some commits were introduced to mitigate the U-Boot image
size issues we encountered on sunxi builds.
Now with the MMC environment removed we can bring them back, as we
practically don't have a size limit anymore.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 32ce6179 13-Mar-2018 Bryan O'Donoghue <bryan.odonoghue@linaro.org>

optee: Add lib entries for sharing OPTEE code across ports

This patch adds code to lib to enable sharing of useful OPTEE code between
board-ports and architectures. The code on lib/optee/optee.c comes from the
TI omap2 port. Eventually the OMAP2 code will be patched to include the
shared code. The intention here is to add more useful OPTEE specific code
as more functionality gets added.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Cc: Harinarayan Bhatta <harinarayan@ti.com>
Cc: Andrew F. Davis <afd@ti.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Kever Yang <kever.yang@rock-chips.com>
Cc: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Cc: Peng Fan <peng.fan@nxp.com>
Tested-by: Peng Fan <peng.fan@nxp.com>

# 36c1877c 06-Feb-2018 Faiz Abbas <faiz_abbas@ti.com>

lib: Kconfig: Move DYNAMIC_CRC_TABLE to Kconfig

Add CONFIG prefix to DYNAMIC_CRC_TABLE and implement it in
Kconfig.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>

# a451bc27 05-Feb-2018 Adam Ford <aford173@gmail.com>

Convert LIB_UUID to Kconfig

config_fallback.h has some logic that checks a variety of options
and selects LIB_UUID if it hasn't already been selected. This
will all LIB_UUID in Kconfig and select this option for the list
of options to allow us to remove the logic from fallbacks

Signed-off-by: Adam Ford <aford173@gmail.com>

# a5a37567 06-Feb-2018 Adam Ford <aford173@gmail.com>

Convert CONFIG LIB_HW_RAND to Kconfig

config_fallbacks.h had some logic to automatically select
LIB_RAND if RANDOM_UUID or CMD_UUID were set if LIB_HW_RAND wasn't
already selected. By migrating LIB_HW_RAND to Kconfig, we can
remove this check from config_fallbacks.h and put it into Kconfig

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
[trini: Turn into a choice, add NET_RANDOM_ETHADDR]
Signed-off-by: Tom Rini <trini@konsulko.com>

# acd4d334 16-Jan-2018 Maxime Ripard <maxime.ripard@free-electrons.com>

net: regex: Disable by default on sunXi

The sunXi arm64 build has overflown, leading to the main U-boot binary
overwriting the environment when flashing the new image, or even worse,
overwriting itself when we're calling saveenv.

Disable this option that is not critical until we can adress the issue
properly.

Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 7e3caa81 03-Dec-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

Move CONFIG_PANIC_HANG to Kconfig

Freescale (NXP) boards have lots of defconfig files per board.
I used "imply PANIC_HANG" for them.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# da5337a6 08-Nov-2017 Nandor Han <nandor.han@ge.com>

rtc: add support for s35392a

Add support for S35392A RTC. The driver supports both U-Boot driver
models.

Signed-off-by: Nandor Han <nandor.han@ge.com>
Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
Cc: Heiko Schocher <hs@denx.de>

# f52bdf4b 14-Sep-2017 Jean-Jacques Hiblot <jjhiblot@ti.com>

lib: allow building lzo for the SPL

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 85d8bf57 03-Sep-2017 Marek Behún <marek.behun@nic.cz>

lib: Add CRC32-C

This is needed for BTRFS.

Signed-off-by: Marek Behun <marek.behun@nic.cz>

create mode 100644 lib/crc32c.c

# 7264f292 15-Aug-2017 York Sun <york.sun@nxp.com>

spl: fit: Eanble GZIP support for image decompression

Add Kconfig option SPL_GZIP and SPL_ZLIB to enable gunzip support for
SPL boot, eg. falcon boot compressed kernel image.

Signed-off-by: York Sun <york.sun@nxp.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6ef2f901 11-Aug-2017 Adam Ford <aford173@gmail.com>

Convert CONFIG_BCH to Kconfig

This converts the following to Kconfig:
CONFIG_BCH

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1a7ba1d 18-Aug-2017 Anatolij Gustschin <agust@denx.de>

Fix 'notes' typos

s/notes/nodes

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 96b9082c 03-Aug-2017 Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

rockchip: rk3188: rock: adjust for SPL/TPL split

With the changes to split SPL/TPL for the RK3368, I apparently missed
some needed adjustments to the RK3188 Kconfig and rock_defconfig.

This fixes build-issues for the rock board after applying the RK3368
enablement (and SPL/TPL) set that resulted from TPL_SERIAL_SUPPORT,
TPL_ROCKCHIP_BACK_TO_BROM and TPL_TINY_MEMSET being separate symbols
now.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d56b4b19 22-Jul-2017 Tom Rini <trini@konsulko.com>

configs: Migrate RBTREE, LZO, CMD_MTDPARTS, CMD_UBI and CMD_UBIFS

The above CONFIG options are in Kconfig, and now have correct depends and
inter-dependencies. Migrate these to configs/ from include/configs/. In the
case of CMD_UBIFS also change it to be a default y if CMD_UBI.

Signed-off-by: Tom Rini <trini@konsulko.com>

# aed998aa 17-May-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_LZMA to Kconfig

This converts the following to Kconfig:
CONFIG_LZMA

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

# b1a873df 26-Apr-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_CMD_AES et al to Kconfig

This converts the following to Kconfig:
CONFIG_CMD_AES
CONFIG_AES

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Add select AES to CMD_AES]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 173aafbf 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

cmd: Expose a Kconfig option to enable UBIFS commands

Create a new Kconfig entry to allow CMD_UBIFS selection from Kconfig and
add an hidden LZO option that can be selected by CMD_UBIFS.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>

# aa049152 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

mtd: ubi: Select RBTREE option from MTD_UBI Kconfig entry

Expose the RBTREE feature through Kconfig and select this option from the
MTD_UBI option.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>
[Rebased on master]
Signed-off-by: Jagan Teki <jagan@openedev.com>

# ab4458bd 02-Apr-2017 Simon Glass <sjg@chromium.org>

string: Provide a slimmed-down memset()

Most of the time the optimised memset() is what we want. For extreme
situations such as TPL it may be too large. For example on the 'rock'
board, using a simple loop saves a useful 48 bytes. With gcc 4.9 and
the rodata bug, this patch is enough to reduce the TPL image below the
limit.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>

# bea79d7d 14-Mar-2017 Andre Przywara <andre.przywara@arm.com>

Kconfig: introduce md5sum command selection

So far CONFIG_MD5SUM would need to be set by a board's include file.
Since the command is really generic, move it over to Kconfig to allow
it to be defined by either a board's defconfig, menuconfig or some
config snippet merged via mergeconfig.sh.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e663b350 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

smbios: Expose in efi_loader as table

We can pass SMBIOS easily as EFI configuration table to an EFI payload. This
patch adds enablement for that case.

While at it, we also enable SMBIOS generation for ARM systems, since they support
EFI_LOADER.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4b6dddc2 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

x86: Move smbios generation into arch independent directory

We will need the SMBIOS generation function on ARM as well going forward,
so let's move it into a non arch specific location.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# ebf7fff2 05-Oct-2016 Heiko Schocher <hs@denx.de>

spl: move FDT_FIXUP_PARTITIONS to Kconfig

Move FDT_FIXUP_PARTITIONS to Kconfig and cleanup existing
uses.

Signed-off-by: Heiko Schocher <hs@denx.de>

# ddf67f71 05-Jul-2016 Maxime Ripard <maxime.ripard@free-electrons.com>

libfdt: Add overlay application function

The device tree overlays are a good way to deal with user-modifyable
boards or boards with some kind of an expansion mechanism where we can
easily plug new board in (like the BBB, the Raspberry Pi or the CHIP).

Add a new function to merge overlays with a base device tree.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>

# 91b86e21 26-May-2016 Marek Vasut <marex@denx.de>

lib: Enable private libgcc by default

This patch decouples U-Boot binary from the toolchain on systems where
private libgcc is available. Instead of pulling in functions provided
by the libgcc from the toolchain, U-Boot will use it's own set of libgcc
functions. These functions are usually imported from Linux kernel, which
also uses it's own libgcc functions instead of the ones provided by the
toolchain.

This patch solves a rather common problem. The toolchain can usually
generate code for many variants of target architecture and often even
different endianness. The libgcc on the other hand is usually compiled
for one particular configuration and the functions provided by it may
or may not be suited for use in U-Boot. This can manifest in two ways,
either the U-Boot fails to compile altogether and linker will complain
or, in the much worse case, the resulting U-Boot will build, but will
misbehave in very subtle and hard to debug ways.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 67976306 30-Mar-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

cosmetic: Fix typos "privide"

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# ed980b8c 03-Mar-2016 Alexander Graf <agraf@csgraf.de>

efi_loader: hook up in build environment

Now that we have all the bits and pieces ready for EFI payload loading
support, hook them up in Makefiles and KConfigs so that we can build.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
[trini: Enable only when we of OF_LIBFDT, disable on kwb and colibri_pxa270]
Signed-off-by: Tom Rini <trini@konsulko.com>

# aa34fbc0 22-Feb-2016 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt to be used in SPL

Add an option to enable libfdt in SPL. This can be useful when decoding
FIT files in SPL.

We need to make sure this option is not enabled in SPL by this change.
Also this option needs to be enabled in host builds. Si add a new
IMAGE_USE_LIBFDT #define which can be used in files that are built on the
host but must also build for U-Boot and SPL.

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

# 69e173eb 22-Feb-2016 Simon Glass <sjg@chromium.org>

Move CONFIG_OF_LIBFDT to Kconfig

Move this option to Kconfig and tidy up existing boards.

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

# a187559e 05-Feb-2016 Bin Meng <bmeng.cn@gmail.com>

Use correct spelling of "U-Boot"

Correct spelling of "U-Boot" shall be used in all written text
(documentation, comments in source files etc.).

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Minkyu Kang <mk7.kang@samsung.com>

# 947c626d 14-Jan-2016 Tom Rini <trini@konsulko.com>

vsprintf.c: Always enable CONFIG_SYS_VSNPRINTF

Enabling this function always removes some class of string saftey issues.
The size change here in general is about 400 bytes and this seems a reasonable
trade-off.

Cc: Peng Fan <peng.fan@nxp.com>
Cc: Peter Robinson <pbrobinson@gmail.com>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Adrian Alonso <aalonso@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 7d9cde10 22-Nov-2015 Stefan Roese <sr@denx.de>

lib/tiny-printf.c: Add tiny printf function for space limited environments

This patch adds a small printf() version that supports all basic formats.
Its intented to be used in U-Boot SPL versions on platforms with very
limited internal RAM sizes.

To enable it, just define CONFIG_USE_TINY_PRINTF in your defconfig. This
will result in the SPL using this tiny function and the main U-Boot
still using the full-blown printf() function.

This code was copied from:
http://www.sparetimelabs.com/printfrevisited
With mostly only coding style related changes so that its checkpatch
clean.

The size reduction is about 2.5KiB. Here a comparison for the db-mv784mp-gp
(Marvell AXP) SPL:

Without this patch:
58963 18536 1928 79427 13643 ./spl/u-boot-spl

With this patch:
56542 18536 1956 77034 12cea ./spl/u-boot-spl

Note:
To make it possible to compile tiny-printf.c instead of vsprintf.c when
CONFIG_USE_TINY_PRINTF is defined, the functions printf() and vprintf() are
moved from common/console.c into vsprintf.c in this patch.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>

# 2419cd16 03-Oct-2015 Simon Glass <sjg@chromium.org>

dm: tpm: Drop CONFIG_DM_TPM

Now that all TPM drivers use driver model, we can drop the special driver
model CONFIG option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>

# 027b728d 06-Oct-2015 Julius Werner <jwerner@chromium.org>

Add support for LZ4 decompression algorithm

This patch adds support for LZ4-compressed FIT image contents. This
algorithm has a slightly worse compression ration than LZO while being
nearly twice as fast to decompress. When loading images from a fast
storage medium this usually results in a boot time win.

Sandbox-tested only since I don't have a U-Boot development system set
up right now. The code was imported unchanged from coreboot where it's
proven to work, though. I'm mostly interested in getting this recognized
by mkImage for use in a downstream project.

Signed-off-by: Julius Werner <jwerner@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# a7d660bc 22-Aug-2015 Simon Glass <sjg@chromium.org>

tpm: Add Kconfig options for TPMs

Add new Kconfig options for TPMs in preparation for moving boards to use
Kconfig for TPM configuration.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 867a6ac8 31-Jul-2015 Simon Glass <sjg@chromium.org>

efi: Add start-up library code

When running as an EFI application, U-Boot must request memory from EFI,
and provide access to the boot services U-Boot needs.

Add library code to perform these tasks. This includes efi_main() which is
the entry point from EFI. U-Boot is built as a shared library.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d1389403 23-Jun-2015 Simon Glass <sjg@chromium.org>

Add a dhrystone benchmark command

Drystone provides a convenient sanity check that the CPU is running at full
speed. Add this as a command which can be enabled as needed.

Note: I investigated using Coremark for this but there was a license
agreement and I could not work out if it was GPL-compatible.

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

# f7848d90 22-Jun-2015 Joe Hershberger <joe.hershberger@ni.com>

Allow CONFIG_REGEX to be disabled when CONFIG_NET

Instead of selecting REGEX when NET is enabled, make it the default, but
allow boards that are tiny to disable it and lose functionality on all
but the first Ethernet adapter.

cm-bf548, bf538f-ezkit, and bf533-stamp need this. None appear to have
more than one Ethernet interface.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# 3850dbe8 11-Jun-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

blackfin: fix undefined reference to srand and rand

Commit 9ba9e85f3f1c (net: Fix NET_RANDOM_ETHADDR dependencies)
accidentally dropped CONFIG_LIB_RAND defines for 14 Blackfin boards.

Prior to that commit, those boards defined CONFIG_LIB_RAND, but not
CONFIG_NET_RANDOM_ETHADDR. So, commit 9ba9e85f3f1c should not have
touched them, but in fact it ripped CONFIG_LIB_RAND off from all the
header files, which caused undefined reference to srand and rand.
CONFIG_LIB_RAND=y must be revived for such boards.

BTW, this commit indeed makes it better, but even with this fix,
three boards (bf533-stamp, bf538f-ezkit, cm-bf548) still can not
build due to region 'ram' overflowed error. This was cause by
commit 6eed3786c68c (net: Move the CMD_NET config to defconfigs)
because CMD_NET selects NET, and NET selects REGEX. Eventually,
some boards were newly enabled with CONFIG_REGEX, increasing the
memory footprint. A patch is expected to fix the build error.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 9ba9e85f 25-May-2015 Michal Simek <michal.simek@xilinx.com>

net: Fix NET_RANDOM_ETHADDR dependencies

NET_RANDOM_ETHADDR depends on lib/rand.c. This patch adds dependency to
Kconfig to ensure that library is also compiled.

Remove the definitions from Blackfin boards' include/configs.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 6501ff62 20-Apr-2015 Przemyslaw Marczak <p.marczak@samsung.com>

lib: Kconfig: add entry for errno_str() function

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1a60650c 21-Apr-2015 Joe Hershberger <joe.hershberger@ni.com>

kconfig: Move REGEX to Kconfig

Having this as a Kconfig allows it to be a dependent feature.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8156345d 06-Mar-2015 Simon Glass <sjg@chromium.org>

sandbox: Move CONFIG_SYS_VSNPRINTF to Kconfig

Move this over to Kconfig and tidy up.

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

# 94e3c8c4 19-Feb-2015 gaurav rana <gaurav.rana@freescale.com>

crypto/fsl - Add progressive hashing support using hardware acceleration.

Currently only normal hashing is supported using hardware acceleration.
Added support for progressive hashing using hardware.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
Signed-off-by: Gaurav Rana <gaurav.rana@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>

# d9f23c7f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

lib/rsa: Add Kconfig for devices supporting RSA Modular Exponentiation

Kconfig option added for devices which support RSA Verification.
1. RSA_SOFTWARE_EXP
Enables driver for supporting RSA Modular Exponentiation in Software
2. RSA_FREESCALE_EXP
Enables driver for supporting RSA Modular Exponentiation using Freescale specific
driver

The above drivers use RSA uclass

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
(Removed duplicate line in Kconfig comment)

Change-Id: I7663c4d5350e2bfc3dfa2696f70ef777d6ccc6f6

# c4beb22f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

FIT: Modify option FIT_SIGNATURE in Kconfig

For FIT signature based approach to work, RSA library needs to be selected.
The FIT_SIGNATURE option in Kconfig is modified to automatically select RSA.
Selecting RSA compiles the RSA library required for image verification.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 45ccec8f 23-Oct-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_USE_PRIVATE_LIBGCC to Kconfig

The private libgcc is supported only on ARM, MIPS, PowerPC, SH, x86.
Those architectures should "select" HAVE_PRIVATE_LIBGCC and
CONFIG_USE_PRIVATE_LIBGCC should depend on it.

Currently, this option is enabled on Tegra boards and x86 architecture.
Move the definition from header files to Kconfig.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Tested-by: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: Tom Warren <twarren@nvidia.com>

# 8c688bc4 23-Oct-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_SYS_HZ to lib/Kconfig

CONFIG_SYS_HZ is always defined as 1000 in config_fallbacks.h
(but some boards still have redundant definitions).

This commit moves the definition and the document in README to
Kconfig. Since lib/Kconfig can assure that CONFIG_SYS_HZ is 1000,
the sanity check in lib/time.c should be removed.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Reviewed-by: Marek Vasut <marex@denx.de>

# b0928da6 16-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED to Kconfig

If this option is enabled, the objects under lib/ directory
are compiled with speed optimization, not size optimization.
(Currently, only used by some Blackfin boards.)

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# ed36323f 16-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: add blank Kconfig files

This would be useful to start moving various config options.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# 7d0f3fbb 11-Jun-2021 Tero Kristo <t-kristo@ti.com>

lib: rational: copy the rational fraction lib routines from Linux

Copy the best rational approximation calculation routines from Linux.
Typical usecase for these routines is to calculate the M/N divider
values for PLLs to reach a specific clock rate.

This is based on linux kernel commit:
"lib/math/rational.c: fix possible incorrect result from rational
fractions helper"
(sha1: 323dd2c3ed0641f49e89b4e420f9eef5d3d5a881)

Signed-off-by: Tero Kristo <t-kristo@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Tero Kristo <kristo@kernel.org>

# ec0512b1 24-May-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

Revert "lib: introduce HASH_CALCULATE option"

When we think of Kconfig, we usually think of features that we like
to enable or not. Ideally, we wouldn't use Kconfig to fix a build
issue, although sometimes it might make sense. With Kconfig it's hard
to guarantee that the fix is universal. We can only say that it works
for the set of tested configurations. In the majority of cases, it's
preferable to let the linker figure things out for us.

The reverted commit attempted to fix a build issue by adding an
invisible Kconfig option. This is wrong in several ways:

It invents a new Kconfig variable when CONFIG_HASH already
exists for the same purpose.
Second, hash-checksum.c makes use of the hash_progressive_lookup_algo()
symbol, which is only provided with CONFIG_HASH, but this dependency
was not expressed in the reverted patch.

It feels like Kconfig is turning into a listing of all available
source files, and a buffet to 'select' which ones to compile. The
purpose of this revert is to enable the next change to make use of
CONFIG_HASH instead of adding to Kconfig.

This reverts commit 87316da05f2fd49d3709275e64ef0c5980366ade.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Acked-by: Masahisa Kojima <masahisa.kojima@linaro.org>

# 1621d3c4 10-May-2021 Bin Meng <bmeng.cn@gmail.com>

lib: kconfig: Limit BINMAN_FDT for OF_SEPARATE or OF_EMBED

Generally speaking BINMAN_FDT makes sense for OF_SEPARATE or OF_EMBED.
For the other OF_CONTROL methods, it's quite possible binman node is
not available as binman is invoked during the build phase instead of
runtime. Let's only turn it on for OF_SEPARATE or OF_EMBED by default.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 87316da0 13-May-2021 Masahisa Kojima <masahisa.kojima@linaro.org>

lib: introduce HASH_CALCULATE option

Build error occurs when CONFIG_EFI_SECURE_BOOT or
CONFIG_EFI_CAPSULE_AUTHENTICATE is enabled,
because hash-checksum.c is not compiled.

Since hash_calculate() implemented in hash-checksum.c can be
commonly used aside from FIT image signature verification,
this commit itroduces HASH_CALCULATE option to decide
if hash-checksum.c shall be compiled.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# e2ae483c 13-May-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

hash: Kconfig option for SHA512 hardware acceleration

Commit a479f103dc1c ("hash: Allow for SHA512 hardware implementations")
defined function definitions for hardware accelerated SHA384 and SHA512.
If CONFIG_SHA_HW_ACCEL=y, these functions are used.

We already have boards using CONFIG_SHA_HW_ACCEL=y but none implements the
new functions hw_sha384() and hw_sha512().

For implementing the EFI TCG2 protocol we need SHA384 and SHA512. The
missing hardware acceleration functions lead to build errors on boards like
peach-pi_defconfig.

Introduce a new Kconfig symbol CONFIG_SHA512_HW_ACCEL to control if the
functions hw_sha384() and hw_sha512() shall be used to implement the SHA384
and SHA512 algorithms.

Fixes: a479f103dc1c ("hash: Allow for SHA512 hardware implementations")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

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

# 6d66502b 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: Add 2 config to define the max number of regions

Add 2 configs CONFIG_LMB_MEMORY_REGIONS and CONFIG_LMB_RESERVED_REGIONS
to change independently the max number of the regions in lmb
library.

When CONFIG_LMB_USE_MAX_REGIONS=y, move the lmb property arrays to
struct lmb and manage the array size with the element 'max' of struct
lmb_region; their are still allocated in stack.

When CONFIG_LMB_USE_MAX_REGIONS=n, keep the current location in
struct lmb_region to allow compiler optimization.

Increase CONFIG_LMB_RESERVED_REGIONS is useful to avoid lmb errors in
bootm when the number of reserved regions (not adjacent) is reached:
+ 1 region for relocated U-Boot
+ 1 region for initrd
+ 1 region for relocated linux device tree
+ reserved memory regions present in Linux device tree.

The current limit of 8 regions is reached with only 5 reserved regions
in DT.

see Linux kernel commit bf23c51f1f49 ("memblock: Move memblock arrays
to static storage in memblock.c and make their size a variable")

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# 4fa0150d 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: move MAX_LMB_REGIONS value in Kconfig

Move MAX_LMB_REGIONS value in Kconfig, the max number of the regions
in lmb library.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# 77b8cfef 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: move CONFIG_LMB in Kconfig

Migrate CONFIG_LMB in Kconfig.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# a479f103 16-Feb-2021 Joel Stanley <joel@jms.id.au>

hash: Allow for SHA512 hardware implementations

Similar to support for SHA1 and SHA256, allow the use of hardware hashing
engine by enabling the algorithm and setting CONFIG_SHA_HW_ACCEL /
CONFIG_SHA_PROG_HW_ACCEL.

Signed-off-by: Joel Stanley <joel@jms.id.au>

# f2c1442e 14-Mar-2021 Simon Glass <sjg@chromium.org>

bloblist: Make BLOBLIST_TABLES depend on BLOBLIST

Add an extra condition here since we cannot put x86 tables in a bloblist
when bloblists are not supported.

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

# e0103158 25-Feb-2021 Bin Meng <bmeng.cn@gmail.com>

lib: kconfig: Mention CONFIG_ADDR_MAP limitation in the help

Mention that CONFIG_ADDR_MAP only works in the post-relocation phase.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>

# 56e7257c 03-Feb-2021 Bin Meng <bmeng.cn@gmail.com>

lib: Fix BINMAN_FDT dependency

lib/binman.c references the following 3 ofnode APIs:
ofnode_first_subnode(), ofnode_path() and ofnode_read_bool().

These APIs get built only when DM is on. Fix the dependency then.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 59e4e391 18-Jan-2021 Tom Rini <trini@konsulko.com>

Merge https://gitlab.denx.de/u-boot/custodians/u-boot-riscv

- Update qemu-riscv.rst build instructions.
- Add support for SPI on Kendryte K210.
- Add Microchip PolarFire SoC Icicle Kit support.
- Add support for an early timer.
- Select TIMER_EARLY to avoid infinite recursion for Trace.


# a80f8513 17-Jan-2021 Pragnesh Patel <pragnesh.patel@sifive.com>

trace: select TIMER_EARLY to avoid infinite recursion

When tracing functions is enabled this adds calls to
__cyg_profile_func_enter() and __cyg_profile_func_exit() to the traced
functions.

__cyg_profile_func_enter() and __cyg_profile_func_exit() invoke
timer_get_us() to record the entry and exit time.

initr_dm() will make gd->dm_root = NULL and gd->timer = NULL, so
timer_get_us() -> get_ticks() -> dm_timer_init() will lead to an
indefinite recursion.

So select TIMER_EARLY when tracing got enabled.

Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Rick Chen <rick@andestech.com>

# 6205bbb1 04-Jan-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lib: cosmetic update of CONFIG_LIB_ELF description

Change 2 typo error in CONFIG_LIB_ELF description:
- Supoort => Support
- fir => for

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c589132a 02-Dec-2020 Aswath Govindraju <a-govindraju@ti.com>

fdt: Use phandle to distinguish DT nodes with same name

While assigning the sequence number to subsystem instances by reading the
aliases property, only DT nodes names are compared and not the complete
path. This causes a problem when there are two DT nodes with same name but
have different paths.

In arch/arm/dts/k3-am65-main.dtsi there are two USB controllers with the
same device tree node name but different path. When aliases are defined for
these USB controllers then fdtdec_get_alias_seq() fails to pick the correct
instance for a given index.

fdt_path_offset() function is slow and this would effect the U-Boot
startup. To avert the time penalty on all boards, apply this extra check
only when required by using a config option.

Fix it by comparing the phandles of DT nodes after the node names match,
under a config option.

Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Fix whitespace error in Kconfig:
Signed-off-by: Simon Glass <sjg@chromium.org>

# 28cef9ca 19-Nov-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

fs: fat: create correct short names

The current function set_name() used to create short names has the
following deficiencies resolved by this patch:

* Long names (e.g. FOO.TXT) are stored even if a short name is enough.
* Short names with spaces are created, e.g. "A ~1.TXT".
* Short names with illegal characters are created, e.g. "FOO++BAR".
* Debug output does not not consider that the short file name has no
concluding '\0'.

The solution for the following bug is split of into a separate patch:

* Short file names must be unique.

This patch only provides the loop over possible short file names.

Fixes: c30a15e590c ("FAT: Add FAT write feature")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# e4f8e543 05-Nov-2020 Simon Glass <sjg@chromium.org>

smbios: Drop the unused Kconfig options

Now that we can use devicetree to specify this information, drop the old
CONFIG options.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 44c74bdd 05-Nov-2020 Simon Glass <sjg@chromium.org>

sysinfo: Provide a default driver to set SMBIOS values

Some boards want to specify the manufacturer or product name but do not
need to have their own sysinfo driver.

Add a default driver which provides a way to specify this SMBIOS
information in the devicetree, without needing any board-specific
functionality.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d2cb7a22 04-Nov-2020 Simon Glass <sjg@chromium.org>

x86: Allow putting some tables in the bloblist

At present all tables are placed starting at address f0000 in memory, and
can be up to 64KB in size. If the tables are very large, this may not
provide enough space.

Also if the tables point to other tables (such as console log or a ramoops
area) then we must allocate other memory anyway.

The bloblist is a nice place to put these tables since it is contiguous,
which makes it easy to reserve this memory for linux using the 820 tables.

Add an option to put some of the tables in the bloblist. For SMBIOS and
ACPI, create suitable pointers from the f0000 region to the new location
of the tables.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
[bmeng: squashed in http://patchwork.ozlabs.org/project/uboot/patch/
20201105062407.1.I8091ad931cbbb5e3b6f6ababdf3f8d5db0d17bb9@changeid/]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# 415eab06 03-Nov-2020 Christian Gmeiner <christian.gmeiner@gmail.com>

smbios: add parsing API

Add a very simple API to be able to access SMBIOS strings
like vendor, model and bios version.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 72eda507 27-Oct-2020 Sean Anderson <seanga2@gmail.com>

lib: Add getopt

Some commands can get very unweildy if they have too many positional
arguments. Adding options makes them easier to read, remember, and
understand.

This implementation of getopt has been taken from barebox, which has had
option support for quite a while. I have made a few modifications to their
version, such as the removal of opterr in favor of a separate getopt_silent
function. In addition, I have moved all global variables into struct
getopt_context.

The getopt from barebox also re-orders the arguments passed to it so that
non-options are placed last. This allows users to specify options anywhere.
For example, `ls -l foo/ -R` would be re-ordered to `ls -l -R foo/` as
getopt parsed the options. However, this feature conflicts with the const
argv in cmd_tbl->cmd. This was originally added in 54841ab50c ("Make sure
that argv[] argument pointers are not modified."). The reason stated in
that commit is that hush requires argv to stay unmodified. Has this
situation changed? Barebox also uses hush, and does not have this problem.
Perhaps we could use their fix?

I have assigned maintenance of getopt to Simon Glass, as it is currently
only used by the log command. I would also be fine maintaining it.

Signed-off-by: Sean Anderson <seanga2@gmail.com>

# 26637e2e 12-Sep-2020 Simon Glass <sjg@chromium.org>

lib: Allow hexdump to be used in SPL

It is sometimes useful to output hex dumps in SPL. Add a config option to
allow this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# e87dfb05 05-Aug-2020 Andrii Anisov <andrii_anisov@epam.com>

lib: sscanf: add sscanf implementation

Port sscanf implementation from mini-os and introduce new
Kconfig option to enable it: CONFIG_SSCANF. Disable by default.

Signed-off-by: Andrii Anisov <andrii_anisov@epam.com>
Signed-off-by: Anastasiia Lukianenko <anastasiia_lukianenko@epam.com>
Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>

# 81014f73 30-Jul-2020 Joao Marcos Costa <joaomarcos.costa@bootlin.com>

include/u-boot, lib/zlib: add sources for zlib decompression

Add zlib (v1.2.11) uncompr() function to U-Boot. SquashFS depends on
this function to decompress data from a raw disk image. The actual
support for zlib into SquashFS sources will be added in a follow-up
commit.

Signed-off-by: Joao Marcos Costa <joaomarcos.costa@bootlin.com>

# 69be8fd1 03-Jun-2020 Marek Szyprowski <m.szyprowski@samsung.com>

powerpc: move ADDR_MAP to Kconfig

Move ADDR_MAP related config options from include/configs/*.h to the
proper place in lib/Kconfig. This has been done using
./tools/moveconfig.py and manual inspection of the generated changes.
This is a preparation to use ADDR_MAP helper on ARM 32bit Raspberry Pi4
board for mapping the PCIe XHCI MMIO, which is above the 4GiB identity
mapping limit.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# d16b38f4 15-Apr-2020 Reuben Dowle <reubendowle0@gmail.com>

Add support for SHA384 and SHA512

The current recommendation for best security practice from the US government
is to use SHA384 for TOP SECRET [1].

This patch adds support for SHA384 and SHA512 in the hash command, and also
allows FIT images to be hashed with these algorithms, and signed with
sha384,rsaXXXX and sha512,rsaXXXX

The SHA implementation is adapted from the linux kernel implementation.

[1] Commercial National Security Algorithm Suite
http://www.iad.gov/iad/programs/iad-initiatives/cnsa-suite.cfm

Signed-off-by: Reuben Dowle <reuben.dowle@4rf.com>

# 43e442a5 26-May-2020 Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

kconfig: fix some typos

Signed-off-by: Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

# eff5a547 22-May-2020 Michael Walle <michael@walle.cc>

cmd: zip: automatically pull in gzip()

Move the CONFIG_GZIP_COMPRESSED from a config.h macro to a Kconfig menu
item. It is not selectable by a user because there is no reason to do
so. Instead it will be automatically selected by the stuff which uses
gzip(), like the zip command.

Remove it from the config_whitelist.txt. Also remove
CONFIG_GZIP_COMPRESS_DEF_SZ as this was never used on any board. The
default seems to be sane, otherwise it should be added as a Kconfig
option.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8239be61 06-May-2020 Simon Glass <sjg@chromium.org>

lib: Allow MD5 to be enabled in SPL

At present the MD5 option cannot be enabled by board configs since it has
no Kconfig name. It is generally enabled, so long as FIT support is
present. But not all boards use FIT, particularly in SPL

Fix this and add an option for SPL as well. This allows board code to call
md5() even if FIT support is not enabled.

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

# 04cb3994 21-Apr-2020 Weijie Gao <weijie.gao@mediatek.com>

lib: enable lzma decompression support for SPL build

This patch enables LZMA decompression support for SPL build

Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>

# 2a2119e1 05-Mar-2020 Atish Patra <atish.patra@wdc.com>

lib: kconfig: Add option to set BZIP2 compression method

There is no way to select BZIP2 compression method.
Add it under library/compression config where all other
compression related configs are present.

Signed-off-by: Atish Patra <atish.patra@wdc.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 805b3cac 12-Feb-2020 Keerthy <j-keerthy@ti.com>

lib: elf: Move the generic elf loading/validating functions to lib

Move the generic elf loading/validating functions to lib/
so that they can be re-used and accessed by code existing
outside cmd.

While at it remove the duplicate static version of load_elf_image_phdr
under arch/arm/mach-imx/imx_bootaux.c.

Signed-off-by: Keerthy <j-keerthy@ti.com>
Suggested-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>

# 1611235b 19-Jan-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: Kconfig dependencies for pseudo-random library

drivers/rng/sandbox_rng.c requires rand() to be defined but configuration
option CONFIG_CONFIG_LIB_RAND selected in drivers/rng/Kconfig does not
exist.

test/lib/test_aes.c requires rand() to be defined.

Fix the selection criteria for choice "Pseudo-random library support type".

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 3c10dc95 06-Dec-2019 Simon Glass <sjg@chromium.org>

binman: Add a library to access binman entries

SPL and TPL can access information about binman entries using link-time
symbols but this is not available in U-Boot proper. Of course it could be
made available, but the intention is to just read the device tree.

Add support for this, so that U-Boot can locate entries.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# b4adf627 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: crypto: add x509 parser

Imported from linux kernel v5.3:
x509.asn1 without changes
x509_akid.asn1 without changes
x509_parser.h without changes
x509_cert_parser.c with changes marked as __UBOOT__
x509_public_key.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# a9b45e6e 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add oid registry utility

Imported from linux kernel v5.3:
build_OID_registry without changes
oid_registry.h without changes
oid_registry.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# ab8a0e06 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add asn1 decoder

Imported from linux kernel v5.3:
lib/asn1_decoder.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 2b12196d 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

cmd: add asn1_compiler

Imported from linux kernel v5.3:
asn1.h without changes
asn1_ber_bytecode.h without changes
asn1_decoder.h without changes
asn1_compiler.c without changes

This host command will be used to create a ASN1 parser, for example,
for pkcs7 messages or x509 certificates. More specifically, it will
generate *byte code* which will be interpreted by asn1 decoder library.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 05429b6c 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

rtc: move date.c from drivers/rtc/ to lib/

In the next commit, rtc_mktime(), for compatibility with linux, will be
implemented using rtc_mktime(), which is no longer drivers/rtc specific.
So move this file under lib/.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 37ef1774 10-Nov-2019 Thomas Hebb <tommyhebb@gmail.com>

Kconfig: disambiguate config names for tiny printf

27084c03d36a ("spl: Allow tiny printf() to be controlled in SPL and
TPL") split this option in two for TPL and SPL, but didn't change the
Kconfig names, making them hard to set quickly.

Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>

# 0d76afc0 27-Oct-2019 Simon Glass <sjg@chromium.org>

fdt: Add Kconfig options to control code size

For better or worse libfdt recent grew a lot of code that checks the
validity of the device tree in great detail. When using unsigned or
unverified data this makes things safer, but it does add to code size.

Add some controls to select the trade-off between safety and code size.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 27084c03 25-Sep-2019 Simon Glass <sjg@chromium.org>

spl: Allow tiny printf() to be controlled in SPL and TPL

At present there is only one control for this and it is used for both SPL
and TPL. But SPL might have a lot more space than TPL so the extra cost of
a full printf() might be acceptable.

Split the option into two, providing separate SPL and TPL controls. The
TPL setting defaults to the same as SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2a51e16b 07-Jun-2019 Tom Rini <trini@konsulko.com>

configs: Make USE_TINY_PRINTF depend on SPL||TPL and be default

The USE_TINY_PRINTF symbol only changes things within SPL and TPL
builds, so make it depend on that support. Next, make it default as
within these cases we should rarely have need of more advanced print
formats outside of the debug context.

To do this, in a few cases we need to correct our Kconfig dependencies
as we had cases of non-SPL targets select'ing this symbol. Finally, in
the case of a few boards we really do need the full printf
functionality.

Signed-off-by: Tom Rini <trini@konsulko.com>

# da0fb5fd 02-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: make call depth limit customizable

Up to now we had hard coded values for the call depth up to which trace
records are created: 200 for early tracing, 15 thereafter. UEFI
applications reach a call depth of 80 or above.

Provide customizing settings for the call trace depth limit and the early
call trace depth limit. Use the old values as defaults.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8509f22a 29-Apr-2019 Marek Behún <marek.behun@nic.cz>

lib: add Zstandard decompression support

Add the zstd library from Linux kernel (only decompression support).
There are minimal changes to build with U-Boot, otherwise the files are
identical to Linux commit dc35da16 from March 2018, the files had not
been touched since in kernel. Also SPDX lincese tags were added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 83a486b6 29-Apr-2019 Marek Behún <marek.behun@nic.cz>

lib: Add xxhash support

This adds the xxhash support from Linux. Files are almost identical to
those added to Linux in commit 5d240522 ("lib: Add xxhash module") (they
haven't been touched since in Linux). The only difference is to add some
includes to be compatible with U-Boot. Also SPDX lincese tags were
added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 5132361a 29-Apr-2019 Heiko Schocher <hs@denx.de>

lib: Kconfig: fix help text for GZIP

commit 95f4bbd581cf ("lib: fdt: Allow LZO and GZIP DT compression in U-Boot")

introduced Kconfig option for gzip in U-Boot, but help text
says gzip for SPL, which is wrong. Fix this.

Signed-off-by: Heiko Schocher <hs@denx.de>
Acked-by: Marek Vasut <marex@denx.de>

# 1c6eb075 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE_BUFFER_SIZE et al to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE_BUFFER_SIZE
CONFIG_TRACE_EARLY_SIZE
CONFIG_TRACE_EARLY
CONFIG_TRACE_EARLY_ADDR

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

# a24a78d7 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE

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

# 54969b40 21-Mar-2019 Thierry Reding <treding@nvidia.com>

fdtdec: Add Kconfig symbol for tests

Runtime tests are provided as a test_fdtdec command implementation. Add
a Kconfig symbol that allows this command to be built so that the tests
can be used.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 95f4bbd5 08-Mar-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

lib: fdt: Allow LZO and GZIP DT compression in U-Boot

Add required Kconfig symbols, Makefile bits and macro fixes in a
few places to support LZO and DT compression in U-Boot. This can
save a lot of space with multi-DTB fitImages.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>

# 6e705114 13-Jan-2019 Chris Packham <judge.packham@gmail.com>

lib: Kconfig: spelling fixes

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 048c6e89 06-Nov-2018 Simon Glass <sjg@chromium.org>

spl: lz4: Allow use of lz4 compression in SPL

In some cases U-Boot is compressed and it is useful to be able to
decompress it in SPL. Add a Kconfig and Makefile change to allow this.
Note that this does not actually implement decompression.

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

# 2895c4b7 15-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

kconfig: Introduce HAVE_ARCH_IOMAP

Introduce a new Kconfig option for architecture codes to control
whether it provides io{read,write}{8,16,32} I/O accessor functions.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5592a633 01-Oct-2018 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt in TPL

In some cases (e.g. sandbox with verified boot) it is useful to support
libfdt in TPL. Update the Kconfig to handle this.

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

# 6307896c 01-Oct-2018 Simon Glass <sjg@chromium.org>

tpm: Add support for SPL and TPL

At present the tpm can only be used in U-Boot proper. Updated it to work
in SPL and TPL also.

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

# ab948cd2 19-Jul-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

fdt_support: make FDT_FIXUP_PARTITIONS depend on CMD_MTDPARTS

fdt_fixup_mtdparts() calls mtdparts_init() and device_find(),
which are defined in cmd/mtdparts.c

The combination of FDT_FIXUP_PARTITIONS=y and CMD_MTDPARTS=n
emits the following link error:

common/fdt_support.c:903: undefined reference to `mtdparts_init'
common/fdt_support.c:914: undefined reference to `device_find'

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 3330584d 03-Jun-2018 Igor Opaniuk <igor.opaniuk@gmail.com>

avb2.0: integrate avb 2.0 into the build system

Integrate libavb into the build system. Introduce CONFIG_LIBAVB
build option.

Signed-off-by: Igor Opaniuk <igor.opaniuk@linaro.org>

# f8c987f8 05-Jun-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

lib: Add hexdump

Often during debugging session it's very interesting to see
what data we were dealing with. For example what we write or read
to/from memory or peripherals.

This change introduces functions that allow to dump binary
data with one simple function invocation like:
------------------->8----------------
print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, buf, len);
------------------->8----------------

which gives us the following:
------------------->8----------------
00000000: f2 b7 c9 88 62 61 75 64 72 61 74 65 3d 31 31 35 ....baudrate=115
00000010: 32 30 30 00 62 6f 6f 74 61 72 67 73 3d 63 6f 6e 200.bootargs=con
00000020: 73 6f 6c 65 3d 74 74 79 53 33 2c 31 31 35 32 30 sole=ttyS3,11520
00000030: 30 6e 38 00 62 6f 6f 74 64 65 6c 61 79 3d 33 00 0n8.bootdelay=3.
00000040: 62 6f 6f 74 66 69 6c 65 3d 75 49 6d 61 67 65 00 bootfile=uImage.
00000050: 66 64 74 63 6f 6e 74 72 6f 6c 61 64 64 72 3d 39 fdtcontroladdr=9
00000060: 66 66 62 31 62 61 30 00 6c 6f 61 64 61 64 64 72 ffb1ba0.loadaddr
00000070: 3d 30 78 38 32 30 30 30 30 30 30 00 73 74 64 65 =0x82000000.stde
00000080: 72 72 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 rr=serial0@e0022
00000090: 30 30 30 00 73 74 64 69 6e 3d 73 65 72 69 61 6c 000.stdin=serial
000000a0: 30 40 65 30 30 32 32 30 30 30 00 73 74 64 6f 75 0@e0022000.stdou
000000b0: 74 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 30 t=serial0@e00220
000000c0: 30 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00..............
...
------------------->8----------------

Source of hexdump.c was copied from Linux kernel v4.7-rc2.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Mario Six <mario.six@gdsys.cc>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Stefan Roese <sr@denx.de>

# c232d14d 29-May-2018 Alex Kiernan <alex.kiernan@gmail.com>

mmc: Separate "mmc swrite" from fastboot

Introduce CONFIG_IMAGE_SPARSE and CONFIG_CMD_MMC_SWRITE so the "mmc
swrite" command is separated from the fastboot code.

Move image-sparse from common to lib so it's clear it's library code.

Rename CONFIG_FASTBOOT_FLASH_FILLBUF_SIZE to CONFIG_IMAGE_SPARSE_FILLBUF_SIZE
and migrate it to Kconfig.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Acked-by: Jassi Brar <jaswinder.singh@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6417572e 08-May-2018 Tom Rini <trini@konsulko.com>

lib/Kconfig: Mark OF_LIBFDT_OVERLAY as depending on OF_LIBFDT

The overlay code is only useful when OF_LIBFDT is set, so mark it as
depending on that first.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 58a46f88 25-Apr-2018 Praneeth Bajjuri <praneeth@ti.com>

configs: TI: Enable FIT Library overlay support

Enable the FDT library overlay support for all TI SOC family.

Without this option, when Loading fdt from FIT image, the
following warning is seen.

"config with overlays but CONFIG_OF_LIBFDT_OVERLAY not set".

Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
Suggested-by: Andrew F.Davis <afd@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>

# 14ad44ab 18-Apr-2018 Alex Kiernan <alex.kiernan@gmail.com>

spl: Split sprintf, strto* from SPL serial in Kconfig

When SPL serial is disabled, callers who need sprintf or strtoul fail
because their inclusion is guarded by CONFIG_SPL_SERIAL_SUPPORT/
CONFIG_TPL_SERIAL_SUPPORT.

Split printf, sprintf and strto into their own entries and then select
all of them if SERIAL_SUPPORT is enabled to match the current behaviour.

Include panic.o unconditionally as it can be called from anywhere which
uses BUG_ON().

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>

# e294ba06 04-Apr-2018 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-sunxi

Signed-off-by: Tom Rini <trini@konsulko.com>


# d14db11d 03-Apr-2018 Andre Przywara <andre.przywara@arm.com>

sunxi: revert disabling of features

In January some commits were introduced to mitigate the U-Boot image
size issues we encountered on sunxi builds.
Now with the MMC environment removed we can bring them back, as we
practically don't have a size limit anymore.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 32ce6179 13-Mar-2018 Bryan O'Donoghue <bryan.odonoghue@linaro.org>

optee: Add lib entries for sharing OPTEE code across ports

This patch adds code to lib to enable sharing of useful OPTEE code between
board-ports and architectures. The code on lib/optee/optee.c comes from the
TI omap2 port. Eventually the OMAP2 code will be patched to include the
shared code. The intention here is to add more useful OPTEE specific code
as more functionality gets added.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Cc: Harinarayan Bhatta <harinarayan@ti.com>
Cc: Andrew F. Davis <afd@ti.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Kever Yang <kever.yang@rock-chips.com>
Cc: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Cc: Peng Fan <peng.fan@nxp.com>
Tested-by: Peng Fan <peng.fan@nxp.com>

# 36c1877c 06-Feb-2018 Faiz Abbas <faiz_abbas@ti.com>

lib: Kconfig: Move DYNAMIC_CRC_TABLE to Kconfig

Add CONFIG prefix to DYNAMIC_CRC_TABLE and implement it in
Kconfig.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>

# a451bc27 05-Feb-2018 Adam Ford <aford173@gmail.com>

Convert LIB_UUID to Kconfig

config_fallback.h has some logic that checks a variety of options
and selects LIB_UUID if it hasn't already been selected. This
will all LIB_UUID in Kconfig and select this option for the list
of options to allow us to remove the logic from fallbacks

Signed-off-by: Adam Ford <aford173@gmail.com>

# a5a37567 06-Feb-2018 Adam Ford <aford173@gmail.com>

Convert CONFIG LIB_HW_RAND to Kconfig

config_fallbacks.h had some logic to automatically select
LIB_RAND if RANDOM_UUID or CMD_UUID were set if LIB_HW_RAND wasn't
already selected. By migrating LIB_HW_RAND to Kconfig, we can
remove this check from config_fallbacks.h and put it into Kconfig

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
[trini: Turn into a choice, add NET_RANDOM_ETHADDR]
Signed-off-by: Tom Rini <trini@konsulko.com>

# acd4d334 16-Jan-2018 Maxime Ripard <maxime.ripard@free-electrons.com>

net: regex: Disable by default on sunXi

The sunXi arm64 build has overflown, leading to the main U-boot binary
overwriting the environment when flashing the new image, or even worse,
overwriting itself when we're calling saveenv.

Disable this option that is not critical until we can adress the issue
properly.

Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 7e3caa81 03-Dec-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

Move CONFIG_PANIC_HANG to Kconfig

Freescale (NXP) boards have lots of defconfig files per board.
I used "imply PANIC_HANG" for them.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# da5337a6 08-Nov-2017 Nandor Han <nandor.han@ge.com>

rtc: add support for s35392a

Add support for S35392A RTC. The driver supports both U-Boot driver
models.

Signed-off-by: Nandor Han <nandor.han@ge.com>
Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
Cc: Heiko Schocher <hs@denx.de>

# f52bdf4b 14-Sep-2017 Jean-Jacques Hiblot <jjhiblot@ti.com>

lib: allow building lzo for the SPL

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 85d8bf57 03-Sep-2017 Marek Behún <marek.behun@nic.cz>

lib: Add CRC32-C

This is needed for BTRFS.

Signed-off-by: Marek Behun <marek.behun@nic.cz>

create mode 100644 lib/crc32c.c

# 7264f292 15-Aug-2017 York Sun <york.sun@nxp.com>

spl: fit: Eanble GZIP support for image decompression

Add Kconfig option SPL_GZIP and SPL_ZLIB to enable gunzip support for
SPL boot, eg. falcon boot compressed kernel image.

Signed-off-by: York Sun <york.sun@nxp.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6ef2f901 11-Aug-2017 Adam Ford <aford173@gmail.com>

Convert CONFIG_BCH to Kconfig

This converts the following to Kconfig:
CONFIG_BCH

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1a7ba1d 18-Aug-2017 Anatolij Gustschin <agust@denx.de>

Fix 'notes' typos

s/notes/nodes

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 96b9082c 03-Aug-2017 Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

rockchip: rk3188: rock: adjust for SPL/TPL split

With the changes to split SPL/TPL for the RK3368, I apparently missed
some needed adjustments to the RK3188 Kconfig and rock_defconfig.

This fixes build-issues for the rock board after applying the RK3368
enablement (and SPL/TPL) set that resulted from TPL_SERIAL_SUPPORT,
TPL_ROCKCHIP_BACK_TO_BROM and TPL_TINY_MEMSET being separate symbols
now.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d56b4b19 22-Jul-2017 Tom Rini <trini@konsulko.com>

configs: Migrate RBTREE, LZO, CMD_MTDPARTS, CMD_UBI and CMD_UBIFS

The above CONFIG options are in Kconfig, and now have correct depends and
inter-dependencies. Migrate these to configs/ from include/configs/. In the
case of CMD_UBIFS also change it to be a default y if CMD_UBI.

Signed-off-by: Tom Rini <trini@konsulko.com>

# aed998aa 17-May-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_LZMA to Kconfig

This converts the following to Kconfig:
CONFIG_LZMA

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

# b1a873df 26-Apr-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_CMD_AES et al to Kconfig

This converts the following to Kconfig:
CONFIG_CMD_AES
CONFIG_AES

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Add select AES to CMD_AES]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 173aafbf 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

cmd: Expose a Kconfig option to enable UBIFS commands

Create a new Kconfig entry to allow CMD_UBIFS selection from Kconfig and
add an hidden LZO option that can be selected by CMD_UBIFS.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>

# aa049152 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

mtd: ubi: Select RBTREE option from MTD_UBI Kconfig entry

Expose the RBTREE feature through Kconfig and select this option from the
MTD_UBI option.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>
[Rebased on master]
Signed-off-by: Jagan Teki <jagan@openedev.com>

# ab4458bd 02-Apr-2017 Simon Glass <sjg@chromium.org>

string: Provide a slimmed-down memset()

Most of the time the optimised memset() is what we want. For extreme
situations such as TPL it may be too large. For example on the 'rock'
board, using a simple loop saves a useful 48 bytes. With gcc 4.9 and
the rodata bug, this patch is enough to reduce the TPL image below the
limit.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>

# bea79d7d 14-Mar-2017 Andre Przywara <andre.przywara@arm.com>

Kconfig: introduce md5sum command selection

So far CONFIG_MD5SUM would need to be set by a board's include file.
Since the command is really generic, move it over to Kconfig to allow
it to be defined by either a board's defconfig, menuconfig or some
config snippet merged via mergeconfig.sh.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e663b350 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

smbios: Expose in efi_loader as table

We can pass SMBIOS easily as EFI configuration table to an EFI payload. This
patch adds enablement for that case.

While at it, we also enable SMBIOS generation for ARM systems, since they support
EFI_LOADER.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4b6dddc2 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

x86: Move smbios generation into arch independent directory

We will need the SMBIOS generation function on ARM as well going forward,
so let's move it into a non arch specific location.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# ebf7fff2 05-Oct-2016 Heiko Schocher <hs@denx.de>

spl: move FDT_FIXUP_PARTITIONS to Kconfig

Move FDT_FIXUP_PARTITIONS to Kconfig and cleanup existing
uses.

Signed-off-by: Heiko Schocher <hs@denx.de>

# ddf67f71 05-Jul-2016 Maxime Ripard <maxime.ripard@free-electrons.com>

libfdt: Add overlay application function

The device tree overlays are a good way to deal with user-modifyable
boards or boards with some kind of an expansion mechanism where we can
easily plug new board in (like the BBB, the Raspberry Pi or the CHIP).

Add a new function to merge overlays with a base device tree.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>

# 91b86e21 26-May-2016 Marek Vasut <marex@denx.de>

lib: Enable private libgcc by default

This patch decouples U-Boot binary from the toolchain on systems where
private libgcc is available. Instead of pulling in functions provided
by the libgcc from the toolchain, U-Boot will use it's own set of libgcc
functions. These functions are usually imported from Linux kernel, which
also uses it's own libgcc functions instead of the ones provided by the
toolchain.

This patch solves a rather common problem. The toolchain can usually
generate code for many variants of target architecture and often even
different endianness. The libgcc on the other hand is usually compiled
for one particular configuration and the functions provided by it may
or may not be suited for use in U-Boot. This can manifest in two ways,
either the U-Boot fails to compile altogether and linker will complain
or, in the much worse case, the resulting U-Boot will build, but will
misbehave in very subtle and hard to debug ways.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 67976306 30-Mar-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

cosmetic: Fix typos "privide"

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# ed980b8c 03-Mar-2016 Alexander Graf <agraf@csgraf.de>

efi_loader: hook up in build environment

Now that we have all the bits and pieces ready for EFI payload loading
support, hook them up in Makefiles and KConfigs so that we can build.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
[trini: Enable only when we of OF_LIBFDT, disable on kwb and colibri_pxa270]
Signed-off-by: Tom Rini <trini@konsulko.com>

# aa34fbc0 22-Feb-2016 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt to be used in SPL

Add an option to enable libfdt in SPL. This can be useful when decoding
FIT files in SPL.

We need to make sure this option is not enabled in SPL by this change.
Also this option needs to be enabled in host builds. Si add a new
IMAGE_USE_LIBFDT #define which can be used in files that are built on the
host but must also build for U-Boot and SPL.

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

# 69e173eb 22-Feb-2016 Simon Glass <sjg@chromium.org>

Move CONFIG_OF_LIBFDT to Kconfig

Move this option to Kconfig and tidy up existing boards.

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

# a187559e 05-Feb-2016 Bin Meng <bmeng.cn@gmail.com>

Use correct spelling of "U-Boot"

Correct spelling of "U-Boot" shall be used in all written text
(documentation, comments in source files etc.).

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Minkyu Kang <mk7.kang@samsung.com>

# 947c626d 14-Jan-2016 Tom Rini <trini@konsulko.com>

vsprintf.c: Always enable CONFIG_SYS_VSNPRINTF

Enabling this function always removes some class of string saftey issues.
The size change here in general is about 400 bytes and this seems a reasonable
trade-off.

Cc: Peng Fan <peng.fan@nxp.com>
Cc: Peter Robinson <pbrobinson@gmail.com>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Adrian Alonso <aalonso@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 7d9cde10 22-Nov-2015 Stefan Roese <sr@denx.de>

lib/tiny-printf.c: Add tiny printf function for space limited environments

This patch adds a small printf() version that supports all basic formats.
Its intented to be used in U-Boot SPL versions on platforms with very
limited internal RAM sizes.

To enable it, just define CONFIG_USE_TINY_PRINTF in your defconfig. This
will result in the SPL using this tiny function and the main U-Boot
still using the full-blown printf() function.

This code was copied from:
http://www.sparetimelabs.com/printfrevisited
With mostly only coding style related changes so that its checkpatch
clean.

The size reduction is about 2.5KiB. Here a comparison for the db-mv784mp-gp
(Marvell AXP) SPL:

Without this patch:
58963 18536 1928 79427 13643 ./spl/u-boot-spl

With this patch:
56542 18536 1956 77034 12cea ./spl/u-boot-spl

Note:
To make it possible to compile tiny-printf.c instead of vsprintf.c when
CONFIG_USE_TINY_PRINTF is defined, the functions printf() and vprintf() are
moved from common/console.c into vsprintf.c in this patch.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>

# 2419cd16 03-Oct-2015 Simon Glass <sjg@chromium.org>

dm: tpm: Drop CONFIG_DM_TPM

Now that all TPM drivers use driver model, we can drop the special driver
model CONFIG option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>

# 027b728d 06-Oct-2015 Julius Werner <jwerner@chromium.org>

Add support for LZ4 decompression algorithm

This patch adds support for LZ4-compressed FIT image contents. This
algorithm has a slightly worse compression ration than LZO while being
nearly twice as fast to decompress. When loading images from a fast
storage medium this usually results in a boot time win.

Sandbox-tested only since I don't have a U-Boot development system set
up right now. The code was imported unchanged from coreboot where it's
proven to work, though. I'm mostly interested in getting this recognized
by mkImage for use in a downstream project.

Signed-off-by: Julius Werner <jwerner@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# a7d660bc 22-Aug-2015 Simon Glass <sjg@chromium.org>

tpm: Add Kconfig options for TPMs

Add new Kconfig options for TPMs in preparation for moving boards to use
Kconfig for TPM configuration.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 867a6ac8 31-Jul-2015 Simon Glass <sjg@chromium.org>

efi: Add start-up library code

When running as an EFI application, U-Boot must request memory from EFI,
and provide access to the boot services U-Boot needs.

Add library code to perform these tasks. This includes efi_main() which is
the entry point from EFI. U-Boot is built as a shared library.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d1389403 23-Jun-2015 Simon Glass <sjg@chromium.org>

Add a dhrystone benchmark command

Drystone provides a convenient sanity check that the CPU is running at full
speed. Add this as a command which can be enabled as needed.

Note: I investigated using Coremark for this but there was a license
agreement and I could not work out if it was GPL-compatible.

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

# f7848d90 22-Jun-2015 Joe Hershberger <joe.hershberger@ni.com>

Allow CONFIG_REGEX to be disabled when CONFIG_NET

Instead of selecting REGEX when NET is enabled, make it the default, but
allow boards that are tiny to disable it and lose functionality on all
but the first Ethernet adapter.

cm-bf548, bf538f-ezkit, and bf533-stamp need this. None appear to have
more than one Ethernet interface.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# 3850dbe8 11-Jun-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

blackfin: fix undefined reference to srand and rand

Commit 9ba9e85f3f1c (net: Fix NET_RANDOM_ETHADDR dependencies)
accidentally dropped CONFIG_LIB_RAND defines for 14 Blackfin boards.

Prior to that commit, those boards defined CONFIG_LIB_RAND, but not
CONFIG_NET_RANDOM_ETHADDR. So, commit 9ba9e85f3f1c should not have
touched them, but in fact it ripped CONFIG_LIB_RAND off from all the
header files, which caused undefined reference to srand and rand.
CONFIG_LIB_RAND=y must be revived for such boards.

BTW, this commit indeed makes it better, but even with this fix,
three boards (bf533-stamp, bf538f-ezkit, cm-bf548) still can not
build due to region 'ram' overflowed error. This was cause by
commit 6eed3786c68c (net: Move the CMD_NET config to defconfigs)
because CMD_NET selects NET, and NET selects REGEX. Eventually,
some boards were newly enabled with CONFIG_REGEX, increasing the
memory footprint. A patch is expected to fix the build error.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 9ba9e85f 25-May-2015 Michal Simek <michal.simek@xilinx.com>

net: Fix NET_RANDOM_ETHADDR dependencies

NET_RANDOM_ETHADDR depends on lib/rand.c. This patch adds dependency to
Kconfig to ensure that library is also compiled.

Remove the definitions from Blackfin boards' include/configs.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 6501ff62 20-Apr-2015 Przemyslaw Marczak <p.marczak@samsung.com>

lib: Kconfig: add entry for errno_str() function

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1a60650c 21-Apr-2015 Joe Hershberger <joe.hershberger@ni.com>

kconfig: Move REGEX to Kconfig

Having this as a Kconfig allows it to be a dependent feature.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8156345d 06-Mar-2015 Simon Glass <sjg@chromium.org>

sandbox: Move CONFIG_SYS_VSNPRINTF to Kconfig

Move this over to Kconfig and tidy up.

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

# 94e3c8c4 19-Feb-2015 gaurav rana <gaurav.rana@freescale.com>

crypto/fsl - Add progressive hashing support using hardware acceleration.

Currently only normal hashing is supported using hardware acceleration.
Added support for progressive hashing using hardware.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
Signed-off-by: Gaurav Rana <gaurav.rana@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>

# d9f23c7f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

lib/rsa: Add Kconfig for devices supporting RSA Modular Exponentiation

Kconfig option added for devices which support RSA Verification.
1. RSA_SOFTWARE_EXP
Enables driver for supporting RSA Modular Exponentiation in Software
2. RSA_FREESCALE_EXP
Enables driver for supporting RSA Modular Exponentiation using Freescale specific
driver

The above drivers use RSA uclass

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
(Removed duplicate line in Kconfig comment)

Change-Id: I7663c4d5350e2bfc3dfa2696f70ef777d6ccc6f6

# c4beb22f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

FIT: Modify option FIT_SIGNATURE in Kconfig

For FIT signature based approach to work, RSA library needs to be selected.
The FIT_SIGNATURE option in Kconfig is modified to automatically select RSA.
Selecting RSA compiles the RSA library required for image verification.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 45ccec8f 23-Oct-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_USE_PRIVATE_LIBGCC to Kconfig

The private libgcc is supported only on ARM, MIPS, PowerPC, SH, x86.
Those architectures should "select" HAVE_PRIVATE_LIBGCC and
CONFIG_USE_PRIVATE_LIBGCC should depend on it.

Currently, this option is enabled on Tegra boards and x86 architecture.
Move the definition from header files to Kconfig.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Tested-by: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: Tom Warren <twarren@nvidia.com>

# 8c688bc4 23-Oct-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_SYS_HZ to lib/Kconfig

CONFIG_SYS_HZ is always defined as 1000 in config_fallbacks.h
(but some boards still have redundant definitions).

This commit moves the definition and the document in README to
Kconfig. Since lib/Kconfig can assure that CONFIG_SYS_HZ is 1000,
the sanity check in lib/time.c should be removed.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Reviewed-by: Marek Vasut <marex@denx.de>

# b0928da6 16-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED to Kconfig

If this option is enabled, the objects under lib/ directory
are compiled with speed optimization, not size optimization.
(Currently, only used by some Blackfin boards.)

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# ed36323f 16-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: add blank Kconfig files

This would be useful to start moving various config options.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# ec0512b1 24-May-2021 Alexandru Gagniuc <mr.nuke.me@gmail.com>

Revert "lib: introduce HASH_CALCULATE option"

When we think of Kconfig, we usually think of features that we like
to enable or not. Ideally, we wouldn't use Kconfig to fix a build
issue, although sometimes it might make sense. With Kconfig it's hard
to guarantee that the fix is universal. We can only say that it works
for the set of tested configurations. In the majority of cases, it's
preferable to let the linker figure things out for us.

The reverted commit attempted to fix a build issue by adding an
invisible Kconfig option. This is wrong in several ways:

It invents a new Kconfig variable when CONFIG_HASH already
exists for the same purpose.
Second, hash-checksum.c makes use of the hash_progressive_lookup_algo()
symbol, which is only provided with CONFIG_HASH, but this dependency
was not expressed in the reverted patch.

It feels like Kconfig is turning into a listing of all available
source files, and a buffet to 'select' which ones to compile. The
purpose of this revert is to enable the next change to make use of
CONFIG_HASH instead of adding to Kconfig.

This reverts commit 87316da05f2fd49d3709275e64ef0c5980366ade.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Acked-by: Masahisa Kojima <masahisa.kojima@linaro.org>

# 1621d3c4 10-May-2021 Bin Meng <bmeng.cn@gmail.com>

lib: kconfig: Limit BINMAN_FDT for OF_SEPARATE or OF_EMBED

Generally speaking BINMAN_FDT makes sense for OF_SEPARATE or OF_EMBED.
For the other OF_CONTROL methods, it's quite possible binman node is
not available as binman is invoked during the build phase instead of
runtime. Let's only turn it on for OF_SEPARATE or OF_EMBED by default.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 87316da0 13-May-2021 Masahisa Kojima <masahisa.kojima@linaro.org>

lib: introduce HASH_CALCULATE option

Build error occurs when CONFIG_EFI_SECURE_BOOT or
CONFIG_EFI_CAPSULE_AUTHENTICATE is enabled,
because hash-checksum.c is not compiled.

Since hash_calculate() implemented in hash-checksum.c can be
commonly used aside from FIT image signature verification,
this commit itroduces HASH_CALCULATE option to decide
if hash-checksum.c shall be compiled.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# e2ae483c 13-May-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

hash: Kconfig option for SHA512 hardware acceleration

Commit a479f103dc1c ("hash: Allow for SHA512 hardware implementations")
defined function definitions for hardware accelerated SHA384 and SHA512.
If CONFIG_SHA_HW_ACCEL=y, these functions are used.

We already have boards using CONFIG_SHA_HW_ACCEL=y but none implements the
new functions hw_sha384() and hw_sha512().

For implementing the EFI TCG2 protocol we need SHA384 and SHA512. The
missing hardware acceleration functions lead to build errors on boards like
peach-pi_defconfig.

Introduce a new Kconfig symbol CONFIG_SHA512_HW_ACCEL to control if the
functions hw_sha384() and hw_sha512() shall be used to implement the SHA384
and SHA512 algorithms.

Fixes: a479f103dc1c ("hash: Allow for SHA512 hardware implementations")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

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

# 6d66502b 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: Add 2 config to define the max number of regions

Add 2 configs CONFIG_LMB_MEMORY_REGIONS and CONFIG_LMB_RESERVED_REGIONS
to change independently the max number of the regions in lmb
library.

When CONFIG_LMB_USE_MAX_REGIONS=y, move the lmb property arrays to
struct lmb and manage the array size with the element 'max' of struct
lmb_region; their are still allocated in stack.

When CONFIG_LMB_USE_MAX_REGIONS=n, keep the current location in
struct lmb_region to allow compiler optimization.

Increase CONFIG_LMB_RESERVED_REGIONS is useful to avoid lmb errors in
bootm when the number of reserved regions (not adjacent) is reached:
+ 1 region for relocated U-Boot
+ 1 region for initrd
+ 1 region for relocated linux device tree
+ reserved memory regions present in Linux device tree.

The current limit of 8 regions is reached with only 5 reserved regions
in DT.

see Linux kernel commit bf23c51f1f49 ("memblock: Move memblock arrays
to static storage in memblock.c and make their size a variable")

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# 4fa0150d 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: move MAX_LMB_REGIONS value in Kconfig

Move MAX_LMB_REGIONS value in Kconfig, the max number of the regions
in lmb library.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# 77b8cfef 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: move CONFIG_LMB in Kconfig

Migrate CONFIG_LMB in Kconfig.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# a479f103 16-Feb-2021 Joel Stanley <joel@jms.id.au>

hash: Allow for SHA512 hardware implementations

Similar to support for SHA1 and SHA256, allow the use of hardware hashing
engine by enabling the algorithm and setting CONFIG_SHA_HW_ACCEL /
CONFIG_SHA_PROG_HW_ACCEL.

Signed-off-by: Joel Stanley <joel@jms.id.au>

# f2c1442e 14-Mar-2021 Simon Glass <sjg@chromium.org>

bloblist: Make BLOBLIST_TABLES depend on BLOBLIST

Add an extra condition here since we cannot put x86 tables in a bloblist
when bloblists are not supported.

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

# e0103158 25-Feb-2021 Bin Meng <bmeng.cn@gmail.com>

lib: kconfig: Mention CONFIG_ADDR_MAP limitation in the help

Mention that CONFIG_ADDR_MAP only works in the post-relocation phase.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>

# 56e7257c 03-Feb-2021 Bin Meng <bmeng.cn@gmail.com>

lib: Fix BINMAN_FDT dependency

lib/binman.c references the following 3 ofnode APIs:
ofnode_first_subnode(), ofnode_path() and ofnode_read_bool().

These APIs get built only when DM is on. Fix the dependency then.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 59e4e391 18-Jan-2021 Tom Rini <trini@konsulko.com>

Merge https://gitlab.denx.de/u-boot/custodians/u-boot-riscv

- Update qemu-riscv.rst build instructions.
- Add support for SPI on Kendryte K210.
- Add Microchip PolarFire SoC Icicle Kit support.
- Add support for an early timer.
- Select TIMER_EARLY to avoid infinite recursion for Trace.


# a80f8513 17-Jan-2021 Pragnesh Patel <pragnesh.patel@sifive.com>

trace: select TIMER_EARLY to avoid infinite recursion

When tracing functions is enabled this adds calls to
__cyg_profile_func_enter() and __cyg_profile_func_exit() to the traced
functions.

__cyg_profile_func_enter() and __cyg_profile_func_exit() invoke
timer_get_us() to record the entry and exit time.

initr_dm() will make gd->dm_root = NULL and gd->timer = NULL, so
timer_get_us() -> get_ticks() -> dm_timer_init() will lead to an
indefinite recursion.

So select TIMER_EARLY when tracing got enabled.

Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Rick Chen <rick@andestech.com>

# 6205bbb1 04-Jan-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lib: cosmetic update of CONFIG_LIB_ELF description

Change 2 typo error in CONFIG_LIB_ELF description:
- Supoort => Support
- fir => for

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c589132a 02-Dec-2020 Aswath Govindraju <a-govindraju@ti.com>

fdt: Use phandle to distinguish DT nodes with same name

While assigning the sequence number to subsystem instances by reading the
aliases property, only DT nodes names are compared and not the complete
path. This causes a problem when there are two DT nodes with same name but
have different paths.

In arch/arm/dts/k3-am65-main.dtsi there are two USB controllers with the
same device tree node name but different path. When aliases are defined for
these USB controllers then fdtdec_get_alias_seq() fails to pick the correct
instance for a given index.

fdt_path_offset() function is slow and this would effect the U-Boot
startup. To avert the time penalty on all boards, apply this extra check
only when required by using a config option.

Fix it by comparing the phandles of DT nodes after the node names match,
under a config option.

Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Fix whitespace error in Kconfig:
Signed-off-by: Simon Glass <sjg@chromium.org>

# 28cef9ca 19-Nov-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

fs: fat: create correct short names

The current function set_name() used to create short names has the
following deficiencies resolved by this patch:

* Long names (e.g. FOO.TXT) are stored even if a short name is enough.
* Short names with spaces are created, e.g. "A ~1.TXT".
* Short names with illegal characters are created, e.g. "FOO++BAR".
* Debug output does not not consider that the short file name has no
concluding '\0'.

The solution for the following bug is split of into a separate patch:

* Short file names must be unique.

This patch only provides the loop over possible short file names.

Fixes: c30a15e590c ("FAT: Add FAT write feature")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# e4f8e543 05-Nov-2020 Simon Glass <sjg@chromium.org>

smbios: Drop the unused Kconfig options

Now that we can use devicetree to specify this information, drop the old
CONFIG options.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 44c74bdd 05-Nov-2020 Simon Glass <sjg@chromium.org>

sysinfo: Provide a default driver to set SMBIOS values

Some boards want to specify the manufacturer or product name but do not
need to have their own sysinfo driver.

Add a default driver which provides a way to specify this SMBIOS
information in the devicetree, without needing any board-specific
functionality.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d2cb7a22 04-Nov-2020 Simon Glass <sjg@chromium.org>

x86: Allow putting some tables in the bloblist

At present all tables are placed starting at address f0000 in memory, and
can be up to 64KB in size. If the tables are very large, this may not
provide enough space.

Also if the tables point to other tables (such as console log or a ramoops
area) then we must allocate other memory anyway.

The bloblist is a nice place to put these tables since it is contiguous,
which makes it easy to reserve this memory for linux using the 820 tables.

Add an option to put some of the tables in the bloblist. For SMBIOS and
ACPI, create suitable pointers from the f0000 region to the new location
of the tables.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
[bmeng: squashed in http://patchwork.ozlabs.org/project/uboot/patch/
20201105062407.1.I8091ad931cbbb5e3b6f6ababdf3f8d5db0d17bb9@changeid/]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# 415eab06 03-Nov-2020 Christian Gmeiner <christian.gmeiner@gmail.com>

smbios: add parsing API

Add a very simple API to be able to access SMBIOS strings
like vendor, model and bios version.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 72eda507 27-Oct-2020 Sean Anderson <seanga2@gmail.com>

lib: Add getopt

Some commands can get very unweildy if they have too many positional
arguments. Adding options makes them easier to read, remember, and
understand.

This implementation of getopt has been taken from barebox, which has had
option support for quite a while. I have made a few modifications to their
version, such as the removal of opterr in favor of a separate getopt_silent
function. In addition, I have moved all global variables into struct
getopt_context.

The getopt from barebox also re-orders the arguments passed to it so that
non-options are placed last. This allows users to specify options anywhere.
For example, `ls -l foo/ -R` would be re-ordered to `ls -l -R foo/` as
getopt parsed the options. However, this feature conflicts with the const
argv in cmd_tbl->cmd. This was originally added in 54841ab50c ("Make sure
that argv[] argument pointers are not modified."). The reason stated in
that commit is that hush requires argv to stay unmodified. Has this
situation changed? Barebox also uses hush, and does not have this problem.
Perhaps we could use their fix?

I have assigned maintenance of getopt to Simon Glass, as it is currently
only used by the log command. I would also be fine maintaining it.

Signed-off-by: Sean Anderson <seanga2@gmail.com>

# 26637e2e 12-Sep-2020 Simon Glass <sjg@chromium.org>

lib: Allow hexdump to be used in SPL

It is sometimes useful to output hex dumps in SPL. Add a config option to
allow this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# e87dfb05 05-Aug-2020 Andrii Anisov <andrii_anisov@epam.com>

lib: sscanf: add sscanf implementation

Port sscanf implementation from mini-os and introduce new
Kconfig option to enable it: CONFIG_SSCANF. Disable by default.

Signed-off-by: Andrii Anisov <andrii_anisov@epam.com>
Signed-off-by: Anastasiia Lukianenko <anastasiia_lukianenko@epam.com>
Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>

# 81014f73 30-Jul-2020 Joao Marcos Costa <joaomarcos.costa@bootlin.com>

include/u-boot, lib/zlib: add sources for zlib decompression

Add zlib (v1.2.11) uncompr() function to U-Boot. SquashFS depends on
this function to decompress data from a raw disk image. The actual
support for zlib into SquashFS sources will be added in a follow-up
commit.

Signed-off-by: Joao Marcos Costa <joaomarcos.costa@bootlin.com>

# 69be8fd1 03-Jun-2020 Marek Szyprowski <m.szyprowski@samsung.com>

powerpc: move ADDR_MAP to Kconfig

Move ADDR_MAP related config options from include/configs/*.h to the
proper place in lib/Kconfig. This has been done using
./tools/moveconfig.py and manual inspection of the generated changes.
This is a preparation to use ADDR_MAP helper on ARM 32bit Raspberry Pi4
board for mapping the PCIe XHCI MMIO, which is above the 4GiB identity
mapping limit.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# d16b38f4 15-Apr-2020 Reuben Dowle <reubendowle0@gmail.com>

Add support for SHA384 and SHA512

The current recommendation for best security practice from the US government
is to use SHA384 for TOP SECRET [1].

This patch adds support for SHA384 and SHA512 in the hash command, and also
allows FIT images to be hashed with these algorithms, and signed with
sha384,rsaXXXX and sha512,rsaXXXX

The SHA implementation is adapted from the linux kernel implementation.

[1] Commercial National Security Algorithm Suite
http://www.iad.gov/iad/programs/iad-initiatives/cnsa-suite.cfm

Signed-off-by: Reuben Dowle <reuben.dowle@4rf.com>

# 43e442a5 26-May-2020 Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

kconfig: fix some typos

Signed-off-by: Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

# eff5a547 22-May-2020 Michael Walle <michael@walle.cc>

cmd: zip: automatically pull in gzip()

Move the CONFIG_GZIP_COMPRESSED from a config.h macro to a Kconfig menu
item. It is not selectable by a user because there is no reason to do
so. Instead it will be automatically selected by the stuff which uses
gzip(), like the zip command.

Remove it from the config_whitelist.txt. Also remove
CONFIG_GZIP_COMPRESS_DEF_SZ as this was never used on any board. The
default seems to be sane, otherwise it should be added as a Kconfig
option.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8239be61 06-May-2020 Simon Glass <sjg@chromium.org>

lib: Allow MD5 to be enabled in SPL

At present the MD5 option cannot be enabled by board configs since it has
no Kconfig name. It is generally enabled, so long as FIT support is
present. But not all boards use FIT, particularly in SPL

Fix this and add an option for SPL as well. This allows board code to call
md5() even if FIT support is not enabled.

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

# 04cb3994 21-Apr-2020 Weijie Gao <weijie.gao@mediatek.com>

lib: enable lzma decompression support for SPL build

This patch enables LZMA decompression support for SPL build

Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>

# 2a2119e1 05-Mar-2020 Atish Patra <atish.patra@wdc.com>

lib: kconfig: Add option to set BZIP2 compression method

There is no way to select BZIP2 compression method.
Add it under library/compression config where all other
compression related configs are present.

Signed-off-by: Atish Patra <atish.patra@wdc.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 805b3cac 12-Feb-2020 Keerthy <j-keerthy@ti.com>

lib: elf: Move the generic elf loading/validating functions to lib

Move the generic elf loading/validating functions to lib/
so that they can be re-used and accessed by code existing
outside cmd.

While at it remove the duplicate static version of load_elf_image_phdr
under arch/arm/mach-imx/imx_bootaux.c.

Signed-off-by: Keerthy <j-keerthy@ti.com>
Suggested-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>

# 1611235b 19-Jan-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: Kconfig dependencies for pseudo-random library

drivers/rng/sandbox_rng.c requires rand() to be defined but configuration
option CONFIG_CONFIG_LIB_RAND selected in drivers/rng/Kconfig does not
exist.

test/lib/test_aes.c requires rand() to be defined.

Fix the selection criteria for choice "Pseudo-random library support type".

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 3c10dc95 06-Dec-2019 Simon Glass <sjg@chromium.org>

binman: Add a library to access binman entries

SPL and TPL can access information about binman entries using link-time
symbols but this is not available in U-Boot proper. Of course it could be
made available, but the intention is to just read the device tree.

Add support for this, so that U-Boot can locate entries.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# b4adf627 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: crypto: add x509 parser

Imported from linux kernel v5.3:
x509.asn1 without changes
x509_akid.asn1 without changes
x509_parser.h without changes
x509_cert_parser.c with changes marked as __UBOOT__
x509_public_key.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# a9b45e6e 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add oid registry utility

Imported from linux kernel v5.3:
build_OID_registry without changes
oid_registry.h without changes
oid_registry.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# ab8a0e06 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add asn1 decoder

Imported from linux kernel v5.3:
lib/asn1_decoder.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 2b12196d 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

cmd: add asn1_compiler

Imported from linux kernel v5.3:
asn1.h without changes
asn1_ber_bytecode.h without changes
asn1_decoder.h without changes
asn1_compiler.c without changes

This host command will be used to create a ASN1 parser, for example,
for pkcs7 messages or x509 certificates. More specifically, it will
generate *byte code* which will be interpreted by asn1 decoder library.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 05429b6c 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

rtc: move date.c from drivers/rtc/ to lib/

In the next commit, rtc_mktime(), for compatibility with linux, will be
implemented using rtc_mktime(), which is no longer drivers/rtc specific.
So move this file under lib/.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 37ef1774 10-Nov-2019 Thomas Hebb <tommyhebb@gmail.com>

Kconfig: disambiguate config names for tiny printf

27084c03d36a ("spl: Allow tiny printf() to be controlled in SPL and
TPL") split this option in two for TPL and SPL, but didn't change the
Kconfig names, making them hard to set quickly.

Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>

# 0d76afc0 27-Oct-2019 Simon Glass <sjg@chromium.org>

fdt: Add Kconfig options to control code size

For better or worse libfdt recent grew a lot of code that checks the
validity of the device tree in great detail. When using unsigned or
unverified data this makes things safer, but it does add to code size.

Add some controls to select the trade-off between safety and code size.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 27084c03 25-Sep-2019 Simon Glass <sjg@chromium.org>

spl: Allow tiny printf() to be controlled in SPL and TPL

At present there is only one control for this and it is used for both SPL
and TPL. But SPL might have a lot more space than TPL so the extra cost of
a full printf() might be acceptable.

Split the option into two, providing separate SPL and TPL controls. The
TPL setting defaults to the same as SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2a51e16b 07-Jun-2019 Tom Rini <trini@konsulko.com>

configs: Make USE_TINY_PRINTF depend on SPL||TPL and be default

The USE_TINY_PRINTF symbol only changes things within SPL and TPL
builds, so make it depend on that support. Next, make it default as
within these cases we should rarely have need of more advanced print
formats outside of the debug context.

To do this, in a few cases we need to correct our Kconfig dependencies
as we had cases of non-SPL targets select'ing this symbol. Finally, in
the case of a few boards we really do need the full printf
functionality.

Signed-off-by: Tom Rini <trini@konsulko.com>

# da0fb5fd 02-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: make call depth limit customizable

Up to now we had hard coded values for the call depth up to which trace
records are created: 200 for early tracing, 15 thereafter. UEFI
applications reach a call depth of 80 or above.

Provide customizing settings for the call trace depth limit and the early
call trace depth limit. Use the old values as defaults.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8509f22a 29-Apr-2019 Marek Behún <marek.behun@nic.cz>

lib: add Zstandard decompression support

Add the zstd library from Linux kernel (only decompression support).
There are minimal changes to build with U-Boot, otherwise the files are
identical to Linux commit dc35da16 from March 2018, the files had not
been touched since in kernel. Also SPDX lincese tags were added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 83a486b6 29-Apr-2019 Marek Behún <marek.behun@nic.cz>

lib: Add xxhash support

This adds the xxhash support from Linux. Files are almost identical to
those added to Linux in commit 5d240522 ("lib: Add xxhash module") (they
haven't been touched since in Linux). The only difference is to add some
includes to be compatible with U-Boot. Also SPDX lincese tags were
added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 5132361a 29-Apr-2019 Heiko Schocher <hs@denx.de>

lib: Kconfig: fix help text for GZIP

commit 95f4bbd581cf ("lib: fdt: Allow LZO and GZIP DT compression in U-Boot")

introduced Kconfig option for gzip in U-Boot, but help text
says gzip for SPL, which is wrong. Fix this.

Signed-off-by: Heiko Schocher <hs@denx.de>
Acked-by: Marek Vasut <marex@denx.de>

# 1c6eb075 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE_BUFFER_SIZE et al to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE_BUFFER_SIZE
CONFIG_TRACE_EARLY_SIZE
CONFIG_TRACE_EARLY
CONFIG_TRACE_EARLY_ADDR

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

# a24a78d7 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE

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

# 54969b40 21-Mar-2019 Thierry Reding <treding@nvidia.com>

fdtdec: Add Kconfig symbol for tests

Runtime tests are provided as a test_fdtdec command implementation. Add
a Kconfig symbol that allows this command to be built so that the tests
can be used.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 95f4bbd5 08-Mar-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

lib: fdt: Allow LZO and GZIP DT compression in U-Boot

Add required Kconfig symbols, Makefile bits and macro fixes in a
few places to support LZO and DT compression in U-Boot. This can
save a lot of space with multi-DTB fitImages.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>

# 6e705114 13-Jan-2019 Chris Packham <judge.packham@gmail.com>

lib: Kconfig: spelling fixes

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 048c6e89 06-Nov-2018 Simon Glass <sjg@chromium.org>

spl: lz4: Allow use of lz4 compression in SPL

In some cases U-Boot is compressed and it is useful to be able to
decompress it in SPL. Add a Kconfig and Makefile change to allow this.
Note that this does not actually implement decompression.

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

# 2895c4b7 15-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

kconfig: Introduce HAVE_ARCH_IOMAP

Introduce a new Kconfig option for architecture codes to control
whether it provides io{read,write}{8,16,32} I/O accessor functions.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5592a633 01-Oct-2018 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt in TPL

In some cases (e.g. sandbox with verified boot) it is useful to support
libfdt in TPL. Update the Kconfig to handle this.

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

# 6307896c 01-Oct-2018 Simon Glass <sjg@chromium.org>

tpm: Add support for SPL and TPL

At present the tpm can only be used in U-Boot proper. Updated it to work
in SPL and TPL also.

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

# ab948cd2 19-Jul-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

fdt_support: make FDT_FIXUP_PARTITIONS depend on CMD_MTDPARTS

fdt_fixup_mtdparts() calls mtdparts_init() and device_find(),
which are defined in cmd/mtdparts.c

The combination of FDT_FIXUP_PARTITIONS=y and CMD_MTDPARTS=n
emits the following link error:

common/fdt_support.c:903: undefined reference to `mtdparts_init'
common/fdt_support.c:914: undefined reference to `device_find'

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 3330584d 03-Jun-2018 Igor Opaniuk <igor.opaniuk@gmail.com>

avb2.0: integrate avb 2.0 into the build system

Integrate libavb into the build system. Introduce CONFIG_LIBAVB
build option.

Signed-off-by: Igor Opaniuk <igor.opaniuk@linaro.org>

# f8c987f8 05-Jun-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

lib: Add hexdump

Often during debugging session it's very interesting to see
what data we were dealing with. For example what we write or read
to/from memory or peripherals.

This change introduces functions that allow to dump binary
data with one simple function invocation like:
------------------->8----------------
print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, buf, len);
------------------->8----------------

which gives us the following:
------------------->8----------------
00000000: f2 b7 c9 88 62 61 75 64 72 61 74 65 3d 31 31 35 ....baudrate=115
00000010: 32 30 30 00 62 6f 6f 74 61 72 67 73 3d 63 6f 6e 200.bootargs=con
00000020: 73 6f 6c 65 3d 74 74 79 53 33 2c 31 31 35 32 30 sole=ttyS3,11520
00000030: 30 6e 38 00 62 6f 6f 74 64 65 6c 61 79 3d 33 00 0n8.bootdelay=3.
00000040: 62 6f 6f 74 66 69 6c 65 3d 75 49 6d 61 67 65 00 bootfile=uImage.
00000050: 66 64 74 63 6f 6e 74 72 6f 6c 61 64 64 72 3d 39 fdtcontroladdr=9
00000060: 66 66 62 31 62 61 30 00 6c 6f 61 64 61 64 64 72 ffb1ba0.loadaddr
00000070: 3d 30 78 38 32 30 30 30 30 30 30 00 73 74 64 65 =0x82000000.stde
00000080: 72 72 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 rr=serial0@e0022
00000090: 30 30 30 00 73 74 64 69 6e 3d 73 65 72 69 61 6c 000.stdin=serial
000000a0: 30 40 65 30 30 32 32 30 30 30 00 73 74 64 6f 75 0@e0022000.stdou
000000b0: 74 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 30 t=serial0@e00220
000000c0: 30 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00..............
...
------------------->8----------------

Source of hexdump.c was copied from Linux kernel v4.7-rc2.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Mario Six <mario.six@gdsys.cc>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Stefan Roese <sr@denx.de>

# c232d14d 29-May-2018 Alex Kiernan <alex.kiernan@gmail.com>

mmc: Separate "mmc swrite" from fastboot

Introduce CONFIG_IMAGE_SPARSE and CONFIG_CMD_MMC_SWRITE so the "mmc
swrite" command is separated from the fastboot code.

Move image-sparse from common to lib so it's clear it's library code.

Rename CONFIG_FASTBOOT_FLASH_FILLBUF_SIZE to CONFIG_IMAGE_SPARSE_FILLBUF_SIZE
and migrate it to Kconfig.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Acked-by: Jassi Brar <jaswinder.singh@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6417572e 08-May-2018 Tom Rini <trini@konsulko.com>

lib/Kconfig: Mark OF_LIBFDT_OVERLAY as depending on OF_LIBFDT

The overlay code is only useful when OF_LIBFDT is set, so mark it as
depending on that first.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 58a46f88 25-Apr-2018 Praneeth Bajjuri <praneeth@ti.com>

configs: TI: Enable FIT Library overlay support

Enable the FDT library overlay support for all TI SOC family.

Without this option, when Loading fdt from FIT image, the
following warning is seen.

"config with overlays but CONFIG_OF_LIBFDT_OVERLAY not set".

Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
Suggested-by: Andrew F.Davis <afd@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>

# 14ad44ab 18-Apr-2018 Alex Kiernan <alex.kiernan@gmail.com>

spl: Split sprintf, strto* from SPL serial in Kconfig

When SPL serial is disabled, callers who need sprintf or strtoul fail
because their inclusion is guarded by CONFIG_SPL_SERIAL_SUPPORT/
CONFIG_TPL_SERIAL_SUPPORT.

Split printf, sprintf and strto into their own entries and then select
all of them if SERIAL_SUPPORT is enabled to match the current behaviour.

Include panic.o unconditionally as it can be called from anywhere which
uses BUG_ON().

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>

# e294ba06 04-Apr-2018 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-sunxi

Signed-off-by: Tom Rini <trini@konsulko.com>


# d14db11d 03-Apr-2018 Andre Przywara <andre.przywara@arm.com>

sunxi: revert disabling of features

In January some commits were introduced to mitigate the U-Boot image
size issues we encountered on sunxi builds.
Now with the MMC environment removed we can bring them back, as we
practically don't have a size limit anymore.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 32ce6179 13-Mar-2018 Bryan O'Donoghue <bryan.odonoghue@linaro.org>

optee: Add lib entries for sharing OPTEE code across ports

This patch adds code to lib to enable sharing of useful OPTEE code between
board-ports and architectures. The code on lib/optee/optee.c comes from the
TI omap2 port. Eventually the OMAP2 code will be patched to include the
shared code. The intention here is to add more useful OPTEE specific code
as more functionality gets added.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Cc: Harinarayan Bhatta <harinarayan@ti.com>
Cc: Andrew F. Davis <afd@ti.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Kever Yang <kever.yang@rock-chips.com>
Cc: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Cc: Peng Fan <peng.fan@nxp.com>
Tested-by: Peng Fan <peng.fan@nxp.com>

# 36c1877c 06-Feb-2018 Faiz Abbas <faiz_abbas@ti.com>

lib: Kconfig: Move DYNAMIC_CRC_TABLE to Kconfig

Add CONFIG prefix to DYNAMIC_CRC_TABLE and implement it in
Kconfig.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>

# a451bc27 05-Feb-2018 Adam Ford <aford173@gmail.com>

Convert LIB_UUID to Kconfig

config_fallback.h has some logic that checks a variety of options
and selects LIB_UUID if it hasn't already been selected. This
will all LIB_UUID in Kconfig and select this option for the list
of options to allow us to remove the logic from fallbacks

Signed-off-by: Adam Ford <aford173@gmail.com>

# a5a37567 06-Feb-2018 Adam Ford <aford173@gmail.com>

Convert CONFIG LIB_HW_RAND to Kconfig

config_fallbacks.h had some logic to automatically select
LIB_RAND if RANDOM_UUID or CMD_UUID were set if LIB_HW_RAND wasn't
already selected. By migrating LIB_HW_RAND to Kconfig, we can
remove this check from config_fallbacks.h and put it into Kconfig

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
[trini: Turn into a choice, add NET_RANDOM_ETHADDR]
Signed-off-by: Tom Rini <trini@konsulko.com>

# acd4d334 16-Jan-2018 Maxime Ripard <maxime.ripard@free-electrons.com>

net: regex: Disable by default on sunXi

The sunXi arm64 build has overflown, leading to the main U-boot binary
overwriting the environment when flashing the new image, or even worse,
overwriting itself when we're calling saveenv.

Disable this option that is not critical until we can adress the issue
properly.

Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 7e3caa81 03-Dec-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

Move CONFIG_PANIC_HANG to Kconfig

Freescale (NXP) boards have lots of defconfig files per board.
I used "imply PANIC_HANG" for them.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# da5337a6 08-Nov-2017 Nandor Han <nandor.han@ge.com>

rtc: add support for s35392a

Add support for S35392A RTC. The driver supports both U-Boot driver
models.

Signed-off-by: Nandor Han <nandor.han@ge.com>
Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
Cc: Heiko Schocher <hs@denx.de>

# f52bdf4b 14-Sep-2017 Jean-Jacques Hiblot <jjhiblot@ti.com>

lib: allow building lzo for the SPL

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 85d8bf57 03-Sep-2017 Marek Behún <marek.behun@nic.cz>

lib: Add CRC32-C

This is needed for BTRFS.

Signed-off-by: Marek Behun <marek.behun@nic.cz>

create mode 100644 lib/crc32c.c

# 7264f292 15-Aug-2017 York Sun <york.sun@nxp.com>

spl: fit: Eanble GZIP support for image decompression

Add Kconfig option SPL_GZIP and SPL_ZLIB to enable gunzip support for
SPL boot, eg. falcon boot compressed kernel image.

Signed-off-by: York Sun <york.sun@nxp.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6ef2f901 11-Aug-2017 Adam Ford <aford173@gmail.com>

Convert CONFIG_BCH to Kconfig

This converts the following to Kconfig:
CONFIG_BCH

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1a7ba1d 18-Aug-2017 Anatolij Gustschin <agust@denx.de>

Fix 'notes' typos

s/notes/nodes

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 96b9082c 03-Aug-2017 Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

rockchip: rk3188: rock: adjust for SPL/TPL split

With the changes to split SPL/TPL for the RK3368, I apparently missed
some needed adjustments to the RK3188 Kconfig and rock_defconfig.

This fixes build-issues for the rock board after applying the RK3368
enablement (and SPL/TPL) set that resulted from TPL_SERIAL_SUPPORT,
TPL_ROCKCHIP_BACK_TO_BROM and TPL_TINY_MEMSET being separate symbols
now.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d56b4b19 22-Jul-2017 Tom Rini <trini@konsulko.com>

configs: Migrate RBTREE, LZO, CMD_MTDPARTS, CMD_UBI and CMD_UBIFS

The above CONFIG options are in Kconfig, and now have correct depends and
inter-dependencies. Migrate these to configs/ from include/configs/. In the
case of CMD_UBIFS also change it to be a default y if CMD_UBI.

Signed-off-by: Tom Rini <trini@konsulko.com>

# aed998aa 17-May-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_LZMA to Kconfig

This converts the following to Kconfig:
CONFIG_LZMA

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

# b1a873df 26-Apr-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_CMD_AES et al to Kconfig

This converts the following to Kconfig:
CONFIG_CMD_AES
CONFIG_AES

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Add select AES to CMD_AES]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 173aafbf 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

cmd: Expose a Kconfig option to enable UBIFS commands

Create a new Kconfig entry to allow CMD_UBIFS selection from Kconfig and
add an hidden LZO option that can be selected by CMD_UBIFS.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>

# aa049152 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

mtd: ubi: Select RBTREE option from MTD_UBI Kconfig entry

Expose the RBTREE feature through Kconfig and select this option from the
MTD_UBI option.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>
[Rebased on master]
Signed-off-by: Jagan Teki <jagan@openedev.com>

# ab4458bd 02-Apr-2017 Simon Glass <sjg@chromium.org>

string: Provide a slimmed-down memset()

Most of the time the optimised memset() is what we want. For extreme
situations such as TPL it may be too large. For example on the 'rock'
board, using a simple loop saves a useful 48 bytes. With gcc 4.9 and
the rodata bug, this patch is enough to reduce the TPL image below the
limit.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>

# bea79d7d 14-Mar-2017 Andre Przywara <andre.przywara@arm.com>

Kconfig: introduce md5sum command selection

So far CONFIG_MD5SUM would need to be set by a board's include file.
Since the command is really generic, move it over to Kconfig to allow
it to be defined by either a board's defconfig, menuconfig or some
config snippet merged via mergeconfig.sh.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e663b350 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

smbios: Expose in efi_loader as table

We can pass SMBIOS easily as EFI configuration table to an EFI payload. This
patch adds enablement for that case.

While at it, we also enable SMBIOS generation for ARM systems, since they support
EFI_LOADER.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4b6dddc2 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

x86: Move smbios generation into arch independent directory

We will need the SMBIOS generation function on ARM as well going forward,
so let's move it into a non arch specific location.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# ebf7fff2 05-Oct-2016 Heiko Schocher <hs@denx.de>

spl: move FDT_FIXUP_PARTITIONS to Kconfig

Move FDT_FIXUP_PARTITIONS to Kconfig and cleanup existing
uses.

Signed-off-by: Heiko Schocher <hs@denx.de>

# ddf67f71 05-Jul-2016 Maxime Ripard <maxime.ripard@free-electrons.com>

libfdt: Add overlay application function

The device tree overlays are a good way to deal with user-modifyable
boards or boards with some kind of an expansion mechanism where we can
easily plug new board in (like the BBB, the Raspberry Pi or the CHIP).

Add a new function to merge overlays with a base device tree.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>

# 91b86e21 26-May-2016 Marek Vasut <marex@denx.de>

lib: Enable private libgcc by default

This patch decouples U-Boot binary from the toolchain on systems where
private libgcc is available. Instead of pulling in functions provided
by the libgcc from the toolchain, U-Boot will use it's own set of libgcc
functions. These functions are usually imported from Linux kernel, which
also uses it's own libgcc functions instead of the ones provided by the
toolchain.

This patch solves a rather common problem. The toolchain can usually
generate code for many variants of target architecture and often even
different endianness. The libgcc on the other hand is usually compiled
for one particular configuration and the functions provided by it may
or may not be suited for use in U-Boot. This can manifest in two ways,
either the U-Boot fails to compile altogether and linker will complain
or, in the much worse case, the resulting U-Boot will build, but will
misbehave in very subtle and hard to debug ways.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 67976306 30-Mar-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

cosmetic: Fix typos "privide"

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# ed980b8c 03-Mar-2016 Alexander Graf <agraf@csgraf.de>

efi_loader: hook up in build environment

Now that we have all the bits and pieces ready for EFI payload loading
support, hook them up in Makefiles and KConfigs so that we can build.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
[trini: Enable only when we of OF_LIBFDT, disable on kwb and colibri_pxa270]
Signed-off-by: Tom Rini <trini@konsulko.com>

# aa34fbc0 22-Feb-2016 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt to be used in SPL

Add an option to enable libfdt in SPL. This can be useful when decoding
FIT files in SPL.

We need to make sure this option is not enabled in SPL by this change.
Also this option needs to be enabled in host builds. Si add a new
IMAGE_USE_LIBFDT #define which can be used in files that are built on the
host but must also build for U-Boot and SPL.

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

# 69e173eb 22-Feb-2016 Simon Glass <sjg@chromium.org>

Move CONFIG_OF_LIBFDT to Kconfig

Move this option to Kconfig and tidy up existing boards.

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

# a187559e 05-Feb-2016 Bin Meng <bmeng.cn@gmail.com>

Use correct spelling of "U-Boot"

Correct spelling of "U-Boot" shall be used in all written text
(documentation, comments in source files etc.).

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Minkyu Kang <mk7.kang@samsung.com>

# 947c626d 14-Jan-2016 Tom Rini <trini@konsulko.com>

vsprintf.c: Always enable CONFIG_SYS_VSNPRINTF

Enabling this function always removes some class of string saftey issues.
The size change here in general is about 400 bytes and this seems a reasonable
trade-off.

Cc: Peng Fan <peng.fan@nxp.com>
Cc: Peter Robinson <pbrobinson@gmail.com>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Adrian Alonso <aalonso@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 7d9cde10 22-Nov-2015 Stefan Roese <sr@denx.de>

lib/tiny-printf.c: Add tiny printf function for space limited environments

This patch adds a small printf() version that supports all basic formats.
Its intented to be used in U-Boot SPL versions on platforms with very
limited internal RAM sizes.

To enable it, just define CONFIG_USE_TINY_PRINTF in your defconfig. This
will result in the SPL using this tiny function and the main U-Boot
still using the full-blown printf() function.

This code was copied from:
http://www.sparetimelabs.com/printfrevisited
With mostly only coding style related changes so that its checkpatch
clean.

The size reduction is about 2.5KiB. Here a comparison for the db-mv784mp-gp
(Marvell AXP) SPL:

Without this patch:
58963 18536 1928 79427 13643 ./spl/u-boot-spl

With this patch:
56542 18536 1956 77034 12cea ./spl/u-boot-spl

Note:
To make it possible to compile tiny-printf.c instead of vsprintf.c when
CONFIG_USE_TINY_PRINTF is defined, the functions printf() and vprintf() are
moved from common/console.c into vsprintf.c in this patch.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>

# 2419cd16 03-Oct-2015 Simon Glass <sjg@chromium.org>

dm: tpm: Drop CONFIG_DM_TPM

Now that all TPM drivers use driver model, we can drop the special driver
model CONFIG option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>

# 027b728d 06-Oct-2015 Julius Werner <jwerner@chromium.org>

Add support for LZ4 decompression algorithm

This patch adds support for LZ4-compressed FIT image contents. This
algorithm has a slightly worse compression ration than LZO while being
nearly twice as fast to decompress. When loading images from a fast
storage medium this usually results in a boot time win.

Sandbox-tested only since I don't have a U-Boot development system set
up right now. The code was imported unchanged from coreboot where it's
proven to work, though. I'm mostly interested in getting this recognized
by mkImage for use in a downstream project.

Signed-off-by: Julius Werner <jwerner@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# a7d660bc 22-Aug-2015 Simon Glass <sjg@chromium.org>

tpm: Add Kconfig options for TPMs

Add new Kconfig options for TPMs in preparation for moving boards to use
Kconfig for TPM configuration.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 867a6ac8 31-Jul-2015 Simon Glass <sjg@chromium.org>

efi: Add start-up library code

When running as an EFI application, U-Boot must request memory from EFI,
and provide access to the boot services U-Boot needs.

Add library code to perform these tasks. This includes efi_main() which is
the entry point from EFI. U-Boot is built as a shared library.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d1389403 23-Jun-2015 Simon Glass <sjg@chromium.org>

Add a dhrystone benchmark command

Drystone provides a convenient sanity check that the CPU is running at full
speed. Add this as a command which can be enabled as needed.

Note: I investigated using Coremark for this but there was a license
agreement and I could not work out if it was GPL-compatible.

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

# f7848d90 22-Jun-2015 Joe Hershberger <joe.hershberger@ni.com>

Allow CONFIG_REGEX to be disabled when CONFIG_NET

Instead of selecting REGEX when NET is enabled, make it the default, but
allow boards that are tiny to disable it and lose functionality on all
but the first Ethernet adapter.

cm-bf548, bf538f-ezkit, and bf533-stamp need this. None appear to have
more than one Ethernet interface.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# 3850dbe8 11-Jun-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

blackfin: fix undefined reference to srand and rand

Commit 9ba9e85f3f1c (net: Fix NET_RANDOM_ETHADDR dependencies)
accidentally dropped CONFIG_LIB_RAND defines for 14 Blackfin boards.

Prior to that commit, those boards defined CONFIG_LIB_RAND, but not
CONFIG_NET_RANDOM_ETHADDR. So, commit 9ba9e85f3f1c should not have
touched them, but in fact it ripped CONFIG_LIB_RAND off from all the
header files, which caused undefined reference to srand and rand.
CONFIG_LIB_RAND=y must be revived for such boards.

BTW, this commit indeed makes it better, but even with this fix,
three boards (bf533-stamp, bf538f-ezkit, cm-bf548) still can not
build due to region 'ram' overflowed error. This was cause by
commit 6eed3786c68c (net: Move the CMD_NET config to defconfigs)
because CMD_NET selects NET, and NET selects REGEX. Eventually,
some boards were newly enabled with CONFIG_REGEX, increasing the
memory footprint. A patch is expected to fix the build error.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 9ba9e85f 25-May-2015 Michal Simek <michal.simek@xilinx.com>

net: Fix NET_RANDOM_ETHADDR dependencies

NET_RANDOM_ETHADDR depends on lib/rand.c. This patch adds dependency to
Kconfig to ensure that library is also compiled.

Remove the definitions from Blackfin boards' include/configs.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 6501ff62 20-Apr-2015 Przemyslaw Marczak <p.marczak@samsung.com>

lib: Kconfig: add entry for errno_str() function

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1a60650c 21-Apr-2015 Joe Hershberger <joe.hershberger@ni.com>

kconfig: Move REGEX to Kconfig

Having this as a Kconfig allows it to be a dependent feature.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8156345d 06-Mar-2015 Simon Glass <sjg@chromium.org>

sandbox: Move CONFIG_SYS_VSNPRINTF to Kconfig

Move this over to Kconfig and tidy up.

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

# 94e3c8c4 19-Feb-2015 gaurav rana <gaurav.rana@freescale.com>

crypto/fsl - Add progressive hashing support using hardware acceleration.

Currently only normal hashing is supported using hardware acceleration.
Added support for progressive hashing using hardware.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
Signed-off-by: Gaurav Rana <gaurav.rana@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>

# d9f23c7f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

lib/rsa: Add Kconfig for devices supporting RSA Modular Exponentiation

Kconfig option added for devices which support RSA Verification.
1. RSA_SOFTWARE_EXP
Enables driver for supporting RSA Modular Exponentiation in Software
2. RSA_FREESCALE_EXP
Enables driver for supporting RSA Modular Exponentiation using Freescale specific
driver

The above drivers use RSA uclass

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
(Removed duplicate line in Kconfig comment)

Change-Id: I7663c4d5350e2bfc3dfa2696f70ef777d6ccc6f6

# c4beb22f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

FIT: Modify option FIT_SIGNATURE in Kconfig

For FIT signature based approach to work, RSA library needs to be selected.
The FIT_SIGNATURE option in Kconfig is modified to automatically select RSA.
Selecting RSA compiles the RSA library required for image verification.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 45ccec8f 23-Oct-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_USE_PRIVATE_LIBGCC to Kconfig

The private libgcc is supported only on ARM, MIPS, PowerPC, SH, x86.
Those architectures should "select" HAVE_PRIVATE_LIBGCC and
CONFIG_USE_PRIVATE_LIBGCC should depend on it.

Currently, this option is enabled on Tegra boards and x86 architecture.
Move the definition from header files to Kconfig.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Tested-by: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: Tom Warren <twarren@nvidia.com>

# 8c688bc4 23-Oct-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_SYS_HZ to lib/Kconfig

CONFIG_SYS_HZ is always defined as 1000 in config_fallbacks.h
(but some boards still have redundant definitions).

This commit moves the definition and the document in README to
Kconfig. Since lib/Kconfig can assure that CONFIG_SYS_HZ is 1000,
the sanity check in lib/time.c should be removed.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Reviewed-by: Marek Vasut <marex@denx.de>

# b0928da6 16-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED to Kconfig

If this option is enabled, the objects under lib/ directory
are compiled with speed optimization, not size optimization.
(Currently, only used by some Blackfin boards.)

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# ed36323f 16-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: add blank Kconfig files

This would be useful to start moving various config options.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# 1621d3c4 10-May-2021 Bin Meng <bmeng.cn@gmail.com>

lib: kconfig: Limit BINMAN_FDT for OF_SEPARATE or OF_EMBED

Generally speaking BINMAN_FDT makes sense for OF_SEPARATE or OF_EMBED.
For the other OF_CONTROL methods, it's quite possible binman node is
not available as binman is invoked during the build phase instead of
runtime. Let's only turn it on for OF_SEPARATE or OF_EMBED by default.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 87316da0 13-May-2021 Masahisa Kojima <masahisa.kojima@linaro.org>

lib: introduce HASH_CALCULATE option

Build error occurs when CONFIG_EFI_SECURE_BOOT or
CONFIG_EFI_CAPSULE_AUTHENTICATE is enabled,
because hash-checksum.c is not compiled.

Since hash_calculate() implemented in hash-checksum.c can be
commonly used aside from FIT image signature verification,
this commit itroduces HASH_CALCULATE option to decide
if hash-checksum.c shall be compiled.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# e2ae483c 13-May-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

hash: Kconfig option for SHA512 hardware acceleration

Commit a479f103dc1c ("hash: Allow for SHA512 hardware implementations")
defined function definitions for hardware accelerated SHA384 and SHA512.
If CONFIG_SHA_HW_ACCEL=y, these functions are used.

We already have boards using CONFIG_SHA_HW_ACCEL=y but none implements the
new functions hw_sha384() and hw_sha512().

For implementing the EFI TCG2 protocol we need SHA384 and SHA512. The
missing hardware acceleration functions lead to build errors on boards like
peach-pi_defconfig.

Introduce a new Kconfig symbol CONFIG_SHA512_HW_ACCEL to control if the
functions hw_sha384() and hw_sha512() shall be used to implement the SHA384
and SHA512 algorithms.

Fixes: a479f103dc1c ("hash: Allow for SHA512 hardware implementations")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

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

# 6d66502b 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: Add 2 config to define the max number of regions

Add 2 configs CONFIG_LMB_MEMORY_REGIONS and CONFIG_LMB_RESERVED_REGIONS
to change independently the max number of the regions in lmb
library.

When CONFIG_LMB_USE_MAX_REGIONS=y, move the lmb property arrays to
struct lmb and manage the array size with the element 'max' of struct
lmb_region; their are still allocated in stack.

When CONFIG_LMB_USE_MAX_REGIONS=n, keep the current location in
struct lmb_region to allow compiler optimization.

Increase CONFIG_LMB_RESERVED_REGIONS is useful to avoid lmb errors in
bootm when the number of reserved regions (not adjacent) is reached:
+ 1 region for relocated U-Boot
+ 1 region for initrd
+ 1 region for relocated linux device tree
+ reserved memory regions present in Linux device tree.

The current limit of 8 regions is reached with only 5 reserved regions
in DT.

see Linux kernel commit bf23c51f1f49 ("memblock: Move memblock arrays
to static storage in memblock.c and make their size a variable")

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# 4fa0150d 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: move MAX_LMB_REGIONS value in Kconfig

Move MAX_LMB_REGIONS value in Kconfig, the max number of the regions
in lmb library.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# 77b8cfef 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: move CONFIG_LMB in Kconfig

Migrate CONFIG_LMB in Kconfig.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# a479f103 16-Feb-2021 Joel Stanley <joel@jms.id.au>

hash: Allow for SHA512 hardware implementations

Similar to support for SHA1 and SHA256, allow the use of hardware hashing
engine by enabling the algorithm and setting CONFIG_SHA_HW_ACCEL /
CONFIG_SHA_PROG_HW_ACCEL.

Signed-off-by: Joel Stanley <joel@jms.id.au>

# f2c1442e 14-Mar-2021 Simon Glass <sjg@chromium.org>

bloblist: Make BLOBLIST_TABLES depend on BLOBLIST

Add an extra condition here since we cannot put x86 tables in a bloblist
when bloblists are not supported.

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

# e0103158 25-Feb-2021 Bin Meng <bmeng.cn@gmail.com>

lib: kconfig: Mention CONFIG_ADDR_MAP limitation in the help

Mention that CONFIG_ADDR_MAP only works in the post-relocation phase.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>

# 56e7257c 03-Feb-2021 Bin Meng <bmeng.cn@gmail.com>

lib: Fix BINMAN_FDT dependency

lib/binman.c references the following 3 ofnode APIs:
ofnode_first_subnode(), ofnode_path() and ofnode_read_bool().

These APIs get built only when DM is on. Fix the dependency then.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 59e4e391 18-Jan-2021 Tom Rini <trini@konsulko.com>

Merge https://gitlab.denx.de/u-boot/custodians/u-boot-riscv

- Update qemu-riscv.rst build instructions.
- Add support for SPI on Kendryte K210.
- Add Microchip PolarFire SoC Icicle Kit support.
- Add support for an early timer.
- Select TIMER_EARLY to avoid infinite recursion for Trace.


# a80f8513 17-Jan-2021 Pragnesh Patel <pragnesh.patel@sifive.com>

trace: select TIMER_EARLY to avoid infinite recursion

When tracing functions is enabled this adds calls to
__cyg_profile_func_enter() and __cyg_profile_func_exit() to the traced
functions.

__cyg_profile_func_enter() and __cyg_profile_func_exit() invoke
timer_get_us() to record the entry and exit time.

initr_dm() will make gd->dm_root = NULL and gd->timer = NULL, so
timer_get_us() -> get_ticks() -> dm_timer_init() will lead to an
indefinite recursion.

So select TIMER_EARLY when tracing got enabled.

Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Rick Chen <rick@andestech.com>

# 6205bbb1 04-Jan-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lib: cosmetic update of CONFIG_LIB_ELF description

Change 2 typo error in CONFIG_LIB_ELF description:
- Supoort => Support
- fir => for

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c589132a 02-Dec-2020 Aswath Govindraju <a-govindraju@ti.com>

fdt: Use phandle to distinguish DT nodes with same name

While assigning the sequence number to subsystem instances by reading the
aliases property, only DT nodes names are compared and not the complete
path. This causes a problem when there are two DT nodes with same name but
have different paths.

In arch/arm/dts/k3-am65-main.dtsi there are two USB controllers with the
same device tree node name but different path. When aliases are defined for
these USB controllers then fdtdec_get_alias_seq() fails to pick the correct
instance for a given index.

fdt_path_offset() function is slow and this would effect the U-Boot
startup. To avert the time penalty on all boards, apply this extra check
only when required by using a config option.

Fix it by comparing the phandles of DT nodes after the node names match,
under a config option.

Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Fix whitespace error in Kconfig:
Signed-off-by: Simon Glass <sjg@chromium.org>

# 28cef9ca 19-Nov-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

fs: fat: create correct short names

The current function set_name() used to create short names has the
following deficiencies resolved by this patch:

* Long names (e.g. FOO.TXT) are stored even if a short name is enough.
* Short names with spaces are created, e.g. "A ~1.TXT".
* Short names with illegal characters are created, e.g. "FOO++BAR".
* Debug output does not not consider that the short file name has no
concluding '\0'.

The solution for the following bug is split of into a separate patch:

* Short file names must be unique.

This patch only provides the loop over possible short file names.

Fixes: c30a15e590c ("FAT: Add FAT write feature")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# e4f8e543 05-Nov-2020 Simon Glass <sjg@chromium.org>

smbios: Drop the unused Kconfig options

Now that we can use devicetree to specify this information, drop the old
CONFIG options.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 44c74bdd 05-Nov-2020 Simon Glass <sjg@chromium.org>

sysinfo: Provide a default driver to set SMBIOS values

Some boards want to specify the manufacturer or product name but do not
need to have their own sysinfo driver.

Add a default driver which provides a way to specify this SMBIOS
information in the devicetree, without needing any board-specific
functionality.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d2cb7a22 04-Nov-2020 Simon Glass <sjg@chromium.org>

x86: Allow putting some tables in the bloblist

At present all tables are placed starting at address f0000 in memory, and
can be up to 64KB in size. If the tables are very large, this may not
provide enough space.

Also if the tables point to other tables (such as console log or a ramoops
area) then we must allocate other memory anyway.

The bloblist is a nice place to put these tables since it is contiguous,
which makes it easy to reserve this memory for linux using the 820 tables.

Add an option to put some of the tables in the bloblist. For SMBIOS and
ACPI, create suitable pointers from the f0000 region to the new location
of the tables.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
[bmeng: squashed in http://patchwork.ozlabs.org/project/uboot/patch/
20201105062407.1.I8091ad931cbbb5e3b6f6ababdf3f8d5db0d17bb9@changeid/]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# 415eab06 03-Nov-2020 Christian Gmeiner <christian.gmeiner@gmail.com>

smbios: add parsing API

Add a very simple API to be able to access SMBIOS strings
like vendor, model and bios version.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 72eda507 27-Oct-2020 Sean Anderson <seanga2@gmail.com>

lib: Add getopt

Some commands can get very unweildy if they have too many positional
arguments. Adding options makes them easier to read, remember, and
understand.

This implementation of getopt has been taken from barebox, which has had
option support for quite a while. I have made a few modifications to their
version, such as the removal of opterr in favor of a separate getopt_silent
function. In addition, I have moved all global variables into struct
getopt_context.

The getopt from barebox also re-orders the arguments passed to it so that
non-options are placed last. This allows users to specify options anywhere.
For example, `ls -l foo/ -R` would be re-ordered to `ls -l -R foo/` as
getopt parsed the options. However, this feature conflicts with the const
argv in cmd_tbl->cmd. This was originally added in 54841ab50c ("Make sure
that argv[] argument pointers are not modified."). The reason stated in
that commit is that hush requires argv to stay unmodified. Has this
situation changed? Barebox also uses hush, and does not have this problem.
Perhaps we could use their fix?

I have assigned maintenance of getopt to Simon Glass, as it is currently
only used by the log command. I would also be fine maintaining it.

Signed-off-by: Sean Anderson <seanga2@gmail.com>

# 26637e2e 12-Sep-2020 Simon Glass <sjg@chromium.org>

lib: Allow hexdump to be used in SPL

It is sometimes useful to output hex dumps in SPL. Add a config option to
allow this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# e87dfb05 05-Aug-2020 Andrii Anisov <andrii_anisov@epam.com>

lib: sscanf: add sscanf implementation

Port sscanf implementation from mini-os and introduce new
Kconfig option to enable it: CONFIG_SSCANF. Disable by default.

Signed-off-by: Andrii Anisov <andrii_anisov@epam.com>
Signed-off-by: Anastasiia Lukianenko <anastasiia_lukianenko@epam.com>
Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>

# 81014f73 30-Jul-2020 Joao Marcos Costa <joaomarcos.costa@bootlin.com>

include/u-boot, lib/zlib: add sources for zlib decompression

Add zlib (v1.2.11) uncompr() function to U-Boot. SquashFS depends on
this function to decompress data from a raw disk image. The actual
support for zlib into SquashFS sources will be added in a follow-up
commit.

Signed-off-by: Joao Marcos Costa <joaomarcos.costa@bootlin.com>

# 69be8fd1 03-Jun-2020 Marek Szyprowski <m.szyprowski@samsung.com>

powerpc: move ADDR_MAP to Kconfig

Move ADDR_MAP related config options from include/configs/*.h to the
proper place in lib/Kconfig. This has been done using
./tools/moveconfig.py and manual inspection of the generated changes.
This is a preparation to use ADDR_MAP helper on ARM 32bit Raspberry Pi4
board for mapping the PCIe XHCI MMIO, which is above the 4GiB identity
mapping limit.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# d16b38f4 15-Apr-2020 Reuben Dowle <reubendowle0@gmail.com>

Add support for SHA384 and SHA512

The current recommendation for best security practice from the US government
is to use SHA384 for TOP SECRET [1].

This patch adds support for SHA384 and SHA512 in the hash command, and also
allows FIT images to be hashed with these algorithms, and signed with
sha384,rsaXXXX and sha512,rsaXXXX

The SHA implementation is adapted from the linux kernel implementation.

[1] Commercial National Security Algorithm Suite
http://www.iad.gov/iad/programs/iad-initiatives/cnsa-suite.cfm

Signed-off-by: Reuben Dowle <reuben.dowle@4rf.com>

# 43e442a5 26-May-2020 Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

kconfig: fix some typos

Signed-off-by: Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

# eff5a547 22-May-2020 Michael Walle <michael@walle.cc>

cmd: zip: automatically pull in gzip()

Move the CONFIG_GZIP_COMPRESSED from a config.h macro to a Kconfig menu
item. It is not selectable by a user because there is no reason to do
so. Instead it will be automatically selected by the stuff which uses
gzip(), like the zip command.

Remove it from the config_whitelist.txt. Also remove
CONFIG_GZIP_COMPRESS_DEF_SZ as this was never used on any board. The
default seems to be sane, otherwise it should be added as a Kconfig
option.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8239be61 06-May-2020 Simon Glass <sjg@chromium.org>

lib: Allow MD5 to be enabled in SPL

At present the MD5 option cannot be enabled by board configs since it has
no Kconfig name. It is generally enabled, so long as FIT support is
present. But not all boards use FIT, particularly in SPL

Fix this and add an option for SPL as well. This allows board code to call
md5() even if FIT support is not enabled.

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

# 04cb3994 21-Apr-2020 Weijie Gao <weijie.gao@mediatek.com>

lib: enable lzma decompression support for SPL build

This patch enables LZMA decompression support for SPL build

Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>

# 2a2119e1 05-Mar-2020 Atish Patra <atish.patra@wdc.com>

lib: kconfig: Add option to set BZIP2 compression method

There is no way to select BZIP2 compression method.
Add it under library/compression config where all other
compression related configs are present.

Signed-off-by: Atish Patra <atish.patra@wdc.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 805b3cac 12-Feb-2020 Keerthy <j-keerthy@ti.com>

lib: elf: Move the generic elf loading/validating functions to lib

Move the generic elf loading/validating functions to lib/
so that they can be re-used and accessed by code existing
outside cmd.

While at it remove the duplicate static version of load_elf_image_phdr
under arch/arm/mach-imx/imx_bootaux.c.

Signed-off-by: Keerthy <j-keerthy@ti.com>
Suggested-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>

# 1611235b 19-Jan-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: Kconfig dependencies for pseudo-random library

drivers/rng/sandbox_rng.c requires rand() to be defined but configuration
option CONFIG_CONFIG_LIB_RAND selected in drivers/rng/Kconfig does not
exist.

test/lib/test_aes.c requires rand() to be defined.

Fix the selection criteria for choice "Pseudo-random library support type".

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 3c10dc95 06-Dec-2019 Simon Glass <sjg@chromium.org>

binman: Add a library to access binman entries

SPL and TPL can access information about binman entries using link-time
symbols but this is not available in U-Boot proper. Of course it could be
made available, but the intention is to just read the device tree.

Add support for this, so that U-Boot can locate entries.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# b4adf627 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: crypto: add x509 parser

Imported from linux kernel v5.3:
x509.asn1 without changes
x509_akid.asn1 without changes
x509_parser.h without changes
x509_cert_parser.c with changes marked as __UBOOT__
x509_public_key.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# a9b45e6e 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add oid registry utility

Imported from linux kernel v5.3:
build_OID_registry without changes
oid_registry.h without changes
oid_registry.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# ab8a0e06 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add asn1 decoder

Imported from linux kernel v5.3:
lib/asn1_decoder.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 2b12196d 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

cmd: add asn1_compiler

Imported from linux kernel v5.3:
asn1.h without changes
asn1_ber_bytecode.h without changes
asn1_decoder.h without changes
asn1_compiler.c without changes

This host command will be used to create a ASN1 parser, for example,
for pkcs7 messages or x509 certificates. More specifically, it will
generate *byte code* which will be interpreted by asn1 decoder library.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 05429b6c 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

rtc: move date.c from drivers/rtc/ to lib/

In the next commit, rtc_mktime(), for compatibility with linux, will be
implemented using rtc_mktime(), which is no longer drivers/rtc specific.
So move this file under lib/.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 37ef1774 10-Nov-2019 Thomas Hebb <tommyhebb@gmail.com>

Kconfig: disambiguate config names for tiny printf

27084c03d36a ("spl: Allow tiny printf() to be controlled in SPL and
TPL") split this option in two for TPL and SPL, but didn't change the
Kconfig names, making them hard to set quickly.

Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>

# 0d76afc0 27-Oct-2019 Simon Glass <sjg@chromium.org>

fdt: Add Kconfig options to control code size

For better or worse libfdt recent grew a lot of code that checks the
validity of the device tree in great detail. When using unsigned or
unverified data this makes things safer, but it does add to code size.

Add some controls to select the trade-off between safety and code size.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 27084c03 25-Sep-2019 Simon Glass <sjg@chromium.org>

spl: Allow tiny printf() to be controlled in SPL and TPL

At present there is only one control for this and it is used for both SPL
and TPL. But SPL might have a lot more space than TPL so the extra cost of
a full printf() might be acceptable.

Split the option into two, providing separate SPL and TPL controls. The
TPL setting defaults to the same as SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2a51e16b 07-Jun-2019 Tom Rini <trini@konsulko.com>

configs: Make USE_TINY_PRINTF depend on SPL||TPL and be default

The USE_TINY_PRINTF symbol only changes things within SPL and TPL
builds, so make it depend on that support. Next, make it default as
within these cases we should rarely have need of more advanced print
formats outside of the debug context.

To do this, in a few cases we need to correct our Kconfig dependencies
as we had cases of non-SPL targets select'ing this symbol. Finally, in
the case of a few boards we really do need the full printf
functionality.

Signed-off-by: Tom Rini <trini@konsulko.com>

# da0fb5fd 02-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: make call depth limit customizable

Up to now we had hard coded values for the call depth up to which trace
records are created: 200 for early tracing, 15 thereafter. UEFI
applications reach a call depth of 80 or above.

Provide customizing settings for the call trace depth limit and the early
call trace depth limit. Use the old values as defaults.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8509f22a 29-Apr-2019 Marek Behún <marek.behun@nic.cz>

lib: add Zstandard decompression support

Add the zstd library from Linux kernel (only decompression support).
There are minimal changes to build with U-Boot, otherwise the files are
identical to Linux commit dc35da16 from March 2018, the files had not
been touched since in kernel. Also SPDX lincese tags were added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 83a486b6 29-Apr-2019 Marek Behún <marek.behun@nic.cz>

lib: Add xxhash support

This adds the xxhash support from Linux. Files are almost identical to
those added to Linux in commit 5d240522 ("lib: Add xxhash module") (they
haven't been touched since in Linux). The only difference is to add some
includes to be compatible with U-Boot. Also SPDX lincese tags were
added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 5132361a 29-Apr-2019 Heiko Schocher <hs@denx.de>

lib: Kconfig: fix help text for GZIP

commit 95f4bbd581cf ("lib: fdt: Allow LZO and GZIP DT compression in U-Boot")

introduced Kconfig option for gzip in U-Boot, but help text
says gzip for SPL, which is wrong. Fix this.

Signed-off-by: Heiko Schocher <hs@denx.de>
Acked-by: Marek Vasut <marex@denx.de>

# 1c6eb075 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE_BUFFER_SIZE et al to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE_BUFFER_SIZE
CONFIG_TRACE_EARLY_SIZE
CONFIG_TRACE_EARLY
CONFIG_TRACE_EARLY_ADDR

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

# a24a78d7 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE

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

# 54969b40 21-Mar-2019 Thierry Reding <treding@nvidia.com>

fdtdec: Add Kconfig symbol for tests

Runtime tests are provided as a test_fdtdec command implementation. Add
a Kconfig symbol that allows this command to be built so that the tests
can be used.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 95f4bbd5 08-Mar-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

lib: fdt: Allow LZO and GZIP DT compression in U-Boot

Add required Kconfig symbols, Makefile bits and macro fixes in a
few places to support LZO and DT compression in U-Boot. This can
save a lot of space with multi-DTB fitImages.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>

# 6e705114 13-Jan-2019 Chris Packham <judge.packham@gmail.com>

lib: Kconfig: spelling fixes

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 048c6e89 06-Nov-2018 Simon Glass <sjg@chromium.org>

spl: lz4: Allow use of lz4 compression in SPL

In some cases U-Boot is compressed and it is useful to be able to
decompress it in SPL. Add a Kconfig and Makefile change to allow this.
Note that this does not actually implement decompression.

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

# 2895c4b7 15-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

kconfig: Introduce HAVE_ARCH_IOMAP

Introduce a new Kconfig option for architecture codes to control
whether it provides io{read,write}{8,16,32} I/O accessor functions.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5592a633 01-Oct-2018 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt in TPL

In some cases (e.g. sandbox with verified boot) it is useful to support
libfdt in TPL. Update the Kconfig to handle this.

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

# 6307896c 01-Oct-2018 Simon Glass <sjg@chromium.org>

tpm: Add support for SPL and TPL

At present the tpm can only be used in U-Boot proper. Updated it to work
in SPL and TPL also.

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

# ab948cd2 19-Jul-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

fdt_support: make FDT_FIXUP_PARTITIONS depend on CMD_MTDPARTS

fdt_fixup_mtdparts() calls mtdparts_init() and device_find(),
which are defined in cmd/mtdparts.c

The combination of FDT_FIXUP_PARTITIONS=y and CMD_MTDPARTS=n
emits the following link error:

common/fdt_support.c:903: undefined reference to `mtdparts_init'
common/fdt_support.c:914: undefined reference to `device_find'

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 3330584d 03-Jun-2018 Igor Opaniuk <igor.opaniuk@gmail.com>

avb2.0: integrate avb 2.0 into the build system

Integrate libavb into the build system. Introduce CONFIG_LIBAVB
build option.

Signed-off-by: Igor Opaniuk <igor.opaniuk@linaro.org>

# f8c987f8 05-Jun-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

lib: Add hexdump

Often during debugging session it's very interesting to see
what data we were dealing with. For example what we write or read
to/from memory or peripherals.

This change introduces functions that allow to dump binary
data with one simple function invocation like:
------------------->8----------------
print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, buf, len);
------------------->8----------------

which gives us the following:
------------------->8----------------
00000000: f2 b7 c9 88 62 61 75 64 72 61 74 65 3d 31 31 35 ....baudrate=115
00000010: 32 30 30 00 62 6f 6f 74 61 72 67 73 3d 63 6f 6e 200.bootargs=con
00000020: 73 6f 6c 65 3d 74 74 79 53 33 2c 31 31 35 32 30 sole=ttyS3,11520
00000030: 30 6e 38 00 62 6f 6f 74 64 65 6c 61 79 3d 33 00 0n8.bootdelay=3.
00000040: 62 6f 6f 74 66 69 6c 65 3d 75 49 6d 61 67 65 00 bootfile=uImage.
00000050: 66 64 74 63 6f 6e 74 72 6f 6c 61 64 64 72 3d 39 fdtcontroladdr=9
00000060: 66 66 62 31 62 61 30 00 6c 6f 61 64 61 64 64 72 ffb1ba0.loadaddr
00000070: 3d 30 78 38 32 30 30 30 30 30 30 00 73 74 64 65 =0x82000000.stde
00000080: 72 72 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 rr=serial0@e0022
00000090: 30 30 30 00 73 74 64 69 6e 3d 73 65 72 69 61 6c 000.stdin=serial
000000a0: 30 40 65 30 30 32 32 30 30 30 00 73 74 64 6f 75 0@e0022000.stdou
000000b0: 74 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 30 t=serial0@e00220
000000c0: 30 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00..............
...
------------------->8----------------

Source of hexdump.c was copied from Linux kernel v4.7-rc2.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Mario Six <mario.six@gdsys.cc>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Stefan Roese <sr@denx.de>

# c232d14d 29-May-2018 Alex Kiernan <alex.kiernan@gmail.com>

mmc: Separate "mmc swrite" from fastboot

Introduce CONFIG_IMAGE_SPARSE and CONFIG_CMD_MMC_SWRITE so the "mmc
swrite" command is separated from the fastboot code.

Move image-sparse from common to lib so it's clear it's library code.

Rename CONFIG_FASTBOOT_FLASH_FILLBUF_SIZE to CONFIG_IMAGE_SPARSE_FILLBUF_SIZE
and migrate it to Kconfig.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Acked-by: Jassi Brar <jaswinder.singh@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6417572e 08-May-2018 Tom Rini <trini@konsulko.com>

lib/Kconfig: Mark OF_LIBFDT_OVERLAY as depending on OF_LIBFDT

The overlay code is only useful when OF_LIBFDT is set, so mark it as
depending on that first.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 58a46f88 25-Apr-2018 Praneeth Bajjuri <praneeth@ti.com>

configs: TI: Enable FIT Library overlay support

Enable the FDT library overlay support for all TI SOC family.

Without this option, when Loading fdt from FIT image, the
following warning is seen.

"config with overlays but CONFIG_OF_LIBFDT_OVERLAY not set".

Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
Suggested-by: Andrew F.Davis <afd@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>

# 14ad44ab 18-Apr-2018 Alex Kiernan <alex.kiernan@gmail.com>

spl: Split sprintf, strto* from SPL serial in Kconfig

When SPL serial is disabled, callers who need sprintf or strtoul fail
because their inclusion is guarded by CONFIG_SPL_SERIAL_SUPPORT/
CONFIG_TPL_SERIAL_SUPPORT.

Split printf, sprintf and strto into their own entries and then select
all of them if SERIAL_SUPPORT is enabled to match the current behaviour.

Include panic.o unconditionally as it can be called from anywhere which
uses BUG_ON().

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>

# e294ba06 04-Apr-2018 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-sunxi

Signed-off-by: Tom Rini <trini@konsulko.com>


# d14db11d 03-Apr-2018 Andre Przywara <andre.przywara@arm.com>

sunxi: revert disabling of features

In January some commits were introduced to mitigate the U-Boot image
size issues we encountered on sunxi builds.
Now with the MMC environment removed we can bring them back, as we
practically don't have a size limit anymore.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 32ce6179 13-Mar-2018 Bryan O'Donoghue <bryan.odonoghue@linaro.org>

optee: Add lib entries for sharing OPTEE code across ports

This patch adds code to lib to enable sharing of useful OPTEE code between
board-ports and architectures. The code on lib/optee/optee.c comes from the
TI omap2 port. Eventually the OMAP2 code will be patched to include the
shared code. The intention here is to add more useful OPTEE specific code
as more functionality gets added.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Cc: Harinarayan Bhatta <harinarayan@ti.com>
Cc: Andrew F. Davis <afd@ti.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Kever Yang <kever.yang@rock-chips.com>
Cc: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Cc: Peng Fan <peng.fan@nxp.com>
Tested-by: Peng Fan <peng.fan@nxp.com>

# 36c1877c 06-Feb-2018 Faiz Abbas <faiz_abbas@ti.com>

lib: Kconfig: Move DYNAMIC_CRC_TABLE to Kconfig

Add CONFIG prefix to DYNAMIC_CRC_TABLE and implement it in
Kconfig.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>

# a451bc27 05-Feb-2018 Adam Ford <aford173@gmail.com>

Convert LIB_UUID to Kconfig

config_fallback.h has some logic that checks a variety of options
and selects LIB_UUID if it hasn't already been selected. This
will all LIB_UUID in Kconfig and select this option for the list
of options to allow us to remove the logic from fallbacks

Signed-off-by: Adam Ford <aford173@gmail.com>

# a5a37567 06-Feb-2018 Adam Ford <aford173@gmail.com>

Convert CONFIG LIB_HW_RAND to Kconfig

config_fallbacks.h had some logic to automatically select
LIB_RAND if RANDOM_UUID or CMD_UUID were set if LIB_HW_RAND wasn't
already selected. By migrating LIB_HW_RAND to Kconfig, we can
remove this check from config_fallbacks.h and put it into Kconfig

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
[trini: Turn into a choice, add NET_RANDOM_ETHADDR]
Signed-off-by: Tom Rini <trini@konsulko.com>

# acd4d334 16-Jan-2018 Maxime Ripard <maxime.ripard@free-electrons.com>

net: regex: Disable by default on sunXi

The sunXi arm64 build has overflown, leading to the main U-boot binary
overwriting the environment when flashing the new image, or even worse,
overwriting itself when we're calling saveenv.

Disable this option that is not critical until we can adress the issue
properly.

Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 7e3caa81 03-Dec-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

Move CONFIG_PANIC_HANG to Kconfig

Freescale (NXP) boards have lots of defconfig files per board.
I used "imply PANIC_HANG" for them.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# da5337a6 08-Nov-2017 Nandor Han <nandor.han@ge.com>

rtc: add support for s35392a

Add support for S35392A RTC. The driver supports both U-Boot driver
models.

Signed-off-by: Nandor Han <nandor.han@ge.com>
Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
Cc: Heiko Schocher <hs@denx.de>

# f52bdf4b 14-Sep-2017 Jean-Jacques Hiblot <jjhiblot@ti.com>

lib: allow building lzo for the SPL

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 85d8bf57 03-Sep-2017 Marek Behún <marek.behun@nic.cz>

lib: Add CRC32-C

This is needed for BTRFS.

Signed-off-by: Marek Behun <marek.behun@nic.cz>

create mode 100644 lib/crc32c.c

# 7264f292 15-Aug-2017 York Sun <york.sun@nxp.com>

spl: fit: Eanble GZIP support for image decompression

Add Kconfig option SPL_GZIP and SPL_ZLIB to enable gunzip support for
SPL boot, eg. falcon boot compressed kernel image.

Signed-off-by: York Sun <york.sun@nxp.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6ef2f901 11-Aug-2017 Adam Ford <aford173@gmail.com>

Convert CONFIG_BCH to Kconfig

This converts the following to Kconfig:
CONFIG_BCH

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1a7ba1d 18-Aug-2017 Anatolij Gustschin <agust@denx.de>

Fix 'notes' typos

s/notes/nodes

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 96b9082c 03-Aug-2017 Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

rockchip: rk3188: rock: adjust for SPL/TPL split

With the changes to split SPL/TPL for the RK3368, I apparently missed
some needed adjustments to the RK3188 Kconfig and rock_defconfig.

This fixes build-issues for the rock board after applying the RK3368
enablement (and SPL/TPL) set that resulted from TPL_SERIAL_SUPPORT,
TPL_ROCKCHIP_BACK_TO_BROM and TPL_TINY_MEMSET being separate symbols
now.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d56b4b19 22-Jul-2017 Tom Rini <trini@konsulko.com>

configs: Migrate RBTREE, LZO, CMD_MTDPARTS, CMD_UBI and CMD_UBIFS

The above CONFIG options are in Kconfig, and now have correct depends and
inter-dependencies. Migrate these to configs/ from include/configs/. In the
case of CMD_UBIFS also change it to be a default y if CMD_UBI.

Signed-off-by: Tom Rini <trini@konsulko.com>

# aed998aa 17-May-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_LZMA to Kconfig

This converts the following to Kconfig:
CONFIG_LZMA

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

# b1a873df 26-Apr-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_CMD_AES et al to Kconfig

This converts the following to Kconfig:
CONFIG_CMD_AES
CONFIG_AES

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Add select AES to CMD_AES]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 173aafbf 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

cmd: Expose a Kconfig option to enable UBIFS commands

Create a new Kconfig entry to allow CMD_UBIFS selection from Kconfig and
add an hidden LZO option that can be selected by CMD_UBIFS.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>

# aa049152 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

mtd: ubi: Select RBTREE option from MTD_UBI Kconfig entry

Expose the RBTREE feature through Kconfig and select this option from the
MTD_UBI option.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>
[Rebased on master]
Signed-off-by: Jagan Teki <jagan@openedev.com>

# ab4458bd 02-Apr-2017 Simon Glass <sjg@chromium.org>

string: Provide a slimmed-down memset()

Most of the time the optimised memset() is what we want. For extreme
situations such as TPL it may be too large. For example on the 'rock'
board, using a simple loop saves a useful 48 bytes. With gcc 4.9 and
the rodata bug, this patch is enough to reduce the TPL image below the
limit.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>

# bea79d7d 14-Mar-2017 Andre Przywara <andre.przywara@arm.com>

Kconfig: introduce md5sum command selection

So far CONFIG_MD5SUM would need to be set by a board's include file.
Since the command is really generic, move it over to Kconfig to allow
it to be defined by either a board's defconfig, menuconfig or some
config snippet merged via mergeconfig.sh.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e663b350 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

smbios: Expose in efi_loader as table

We can pass SMBIOS easily as EFI configuration table to an EFI payload. This
patch adds enablement for that case.

While at it, we also enable SMBIOS generation for ARM systems, since they support
EFI_LOADER.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4b6dddc2 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

x86: Move smbios generation into arch independent directory

We will need the SMBIOS generation function on ARM as well going forward,
so let's move it into a non arch specific location.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# ebf7fff2 05-Oct-2016 Heiko Schocher <hs@denx.de>

spl: move FDT_FIXUP_PARTITIONS to Kconfig

Move FDT_FIXUP_PARTITIONS to Kconfig and cleanup existing
uses.

Signed-off-by: Heiko Schocher <hs@denx.de>

# ddf67f71 05-Jul-2016 Maxime Ripard <maxime.ripard@free-electrons.com>

libfdt: Add overlay application function

The device tree overlays are a good way to deal with user-modifyable
boards or boards with some kind of an expansion mechanism where we can
easily plug new board in (like the BBB, the Raspberry Pi or the CHIP).

Add a new function to merge overlays with a base device tree.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>

# 91b86e21 26-May-2016 Marek Vasut <marex@denx.de>

lib: Enable private libgcc by default

This patch decouples U-Boot binary from the toolchain on systems where
private libgcc is available. Instead of pulling in functions provided
by the libgcc from the toolchain, U-Boot will use it's own set of libgcc
functions. These functions are usually imported from Linux kernel, which
also uses it's own libgcc functions instead of the ones provided by the
toolchain.

This patch solves a rather common problem. The toolchain can usually
generate code for many variants of target architecture and often even
different endianness. The libgcc on the other hand is usually compiled
for one particular configuration and the functions provided by it may
or may not be suited for use in U-Boot. This can manifest in two ways,
either the U-Boot fails to compile altogether and linker will complain
or, in the much worse case, the resulting U-Boot will build, but will
misbehave in very subtle and hard to debug ways.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 67976306 30-Mar-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

cosmetic: Fix typos "privide"

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# ed980b8c 03-Mar-2016 Alexander Graf <agraf@csgraf.de>

efi_loader: hook up in build environment

Now that we have all the bits and pieces ready for EFI payload loading
support, hook them up in Makefiles and KConfigs so that we can build.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
[trini: Enable only when we of OF_LIBFDT, disable on kwb and colibri_pxa270]
Signed-off-by: Tom Rini <trini@konsulko.com>

# aa34fbc0 22-Feb-2016 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt to be used in SPL

Add an option to enable libfdt in SPL. This can be useful when decoding
FIT files in SPL.

We need to make sure this option is not enabled in SPL by this change.
Also this option needs to be enabled in host builds. Si add a new
IMAGE_USE_LIBFDT #define which can be used in files that are built on the
host but must also build for U-Boot and SPL.

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

# 69e173eb 22-Feb-2016 Simon Glass <sjg@chromium.org>

Move CONFIG_OF_LIBFDT to Kconfig

Move this option to Kconfig and tidy up existing boards.

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

# a187559e 05-Feb-2016 Bin Meng <bmeng.cn@gmail.com>

Use correct spelling of "U-Boot"

Correct spelling of "U-Boot" shall be used in all written text
(documentation, comments in source files etc.).

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Minkyu Kang <mk7.kang@samsung.com>

# 947c626d 14-Jan-2016 Tom Rini <trini@konsulko.com>

vsprintf.c: Always enable CONFIG_SYS_VSNPRINTF

Enabling this function always removes some class of string saftey issues.
The size change here in general is about 400 bytes and this seems a reasonable
trade-off.

Cc: Peng Fan <peng.fan@nxp.com>
Cc: Peter Robinson <pbrobinson@gmail.com>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Adrian Alonso <aalonso@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 7d9cde10 22-Nov-2015 Stefan Roese <sr@denx.de>

lib/tiny-printf.c: Add tiny printf function for space limited environments

This patch adds a small printf() version that supports all basic formats.
Its intented to be used in U-Boot SPL versions on platforms with very
limited internal RAM sizes.

To enable it, just define CONFIG_USE_TINY_PRINTF in your defconfig. This
will result in the SPL using this tiny function and the main U-Boot
still using the full-blown printf() function.

This code was copied from:
http://www.sparetimelabs.com/printfrevisited
With mostly only coding style related changes so that its checkpatch
clean.

The size reduction is about 2.5KiB. Here a comparison for the db-mv784mp-gp
(Marvell AXP) SPL:

Without this patch:
58963 18536 1928 79427 13643 ./spl/u-boot-spl

With this patch:
56542 18536 1956 77034 12cea ./spl/u-boot-spl

Note:
To make it possible to compile tiny-printf.c instead of vsprintf.c when
CONFIG_USE_TINY_PRINTF is defined, the functions printf() and vprintf() are
moved from common/console.c into vsprintf.c in this patch.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>

# 2419cd16 03-Oct-2015 Simon Glass <sjg@chromium.org>

dm: tpm: Drop CONFIG_DM_TPM

Now that all TPM drivers use driver model, we can drop the special driver
model CONFIG option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>

# 027b728d 06-Oct-2015 Julius Werner <jwerner@chromium.org>

Add support for LZ4 decompression algorithm

This patch adds support for LZ4-compressed FIT image contents. This
algorithm has a slightly worse compression ration than LZO while being
nearly twice as fast to decompress. When loading images from a fast
storage medium this usually results in a boot time win.

Sandbox-tested only since I don't have a U-Boot development system set
up right now. The code was imported unchanged from coreboot where it's
proven to work, though. I'm mostly interested in getting this recognized
by mkImage for use in a downstream project.

Signed-off-by: Julius Werner <jwerner@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# a7d660bc 22-Aug-2015 Simon Glass <sjg@chromium.org>

tpm: Add Kconfig options for TPMs

Add new Kconfig options for TPMs in preparation for moving boards to use
Kconfig for TPM configuration.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 867a6ac8 31-Jul-2015 Simon Glass <sjg@chromium.org>

efi: Add start-up library code

When running as an EFI application, U-Boot must request memory from EFI,
and provide access to the boot services U-Boot needs.

Add library code to perform these tasks. This includes efi_main() which is
the entry point from EFI. U-Boot is built as a shared library.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d1389403 23-Jun-2015 Simon Glass <sjg@chromium.org>

Add a dhrystone benchmark command

Drystone provides a convenient sanity check that the CPU is running at full
speed. Add this as a command which can be enabled as needed.

Note: I investigated using Coremark for this but there was a license
agreement and I could not work out if it was GPL-compatible.

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

# f7848d90 22-Jun-2015 Joe Hershberger <joe.hershberger@ni.com>

Allow CONFIG_REGEX to be disabled when CONFIG_NET

Instead of selecting REGEX when NET is enabled, make it the default, but
allow boards that are tiny to disable it and lose functionality on all
but the first Ethernet adapter.

cm-bf548, bf538f-ezkit, and bf533-stamp need this. None appear to have
more than one Ethernet interface.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# 3850dbe8 11-Jun-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

blackfin: fix undefined reference to srand and rand

Commit 9ba9e85f3f1c (net: Fix NET_RANDOM_ETHADDR dependencies)
accidentally dropped CONFIG_LIB_RAND defines for 14 Blackfin boards.

Prior to that commit, those boards defined CONFIG_LIB_RAND, but not
CONFIG_NET_RANDOM_ETHADDR. So, commit 9ba9e85f3f1c should not have
touched them, but in fact it ripped CONFIG_LIB_RAND off from all the
header files, which caused undefined reference to srand and rand.
CONFIG_LIB_RAND=y must be revived for such boards.

BTW, this commit indeed makes it better, but even with this fix,
three boards (bf533-stamp, bf538f-ezkit, cm-bf548) still can not
build due to region 'ram' overflowed error. This was cause by
commit 6eed3786c68c (net: Move the CMD_NET config to defconfigs)
because CMD_NET selects NET, and NET selects REGEX. Eventually,
some boards were newly enabled with CONFIG_REGEX, increasing the
memory footprint. A patch is expected to fix the build error.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 9ba9e85f 25-May-2015 Michal Simek <michal.simek@xilinx.com>

net: Fix NET_RANDOM_ETHADDR dependencies

NET_RANDOM_ETHADDR depends on lib/rand.c. This patch adds dependency to
Kconfig to ensure that library is also compiled.

Remove the definitions from Blackfin boards' include/configs.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 6501ff62 20-Apr-2015 Przemyslaw Marczak <p.marczak@samsung.com>

lib: Kconfig: add entry for errno_str() function

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1a60650c 21-Apr-2015 Joe Hershberger <joe.hershberger@ni.com>

kconfig: Move REGEX to Kconfig

Having this as a Kconfig allows it to be a dependent feature.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8156345d 06-Mar-2015 Simon Glass <sjg@chromium.org>

sandbox: Move CONFIG_SYS_VSNPRINTF to Kconfig

Move this over to Kconfig and tidy up.

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

# 94e3c8c4 19-Feb-2015 gaurav rana <gaurav.rana@freescale.com>

crypto/fsl - Add progressive hashing support using hardware acceleration.

Currently only normal hashing is supported using hardware acceleration.
Added support for progressive hashing using hardware.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
Signed-off-by: Gaurav Rana <gaurav.rana@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>

# d9f23c7f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

lib/rsa: Add Kconfig for devices supporting RSA Modular Exponentiation

Kconfig option added for devices which support RSA Verification.
1. RSA_SOFTWARE_EXP
Enables driver for supporting RSA Modular Exponentiation in Software
2. RSA_FREESCALE_EXP
Enables driver for supporting RSA Modular Exponentiation using Freescale specific
driver

The above drivers use RSA uclass

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
(Removed duplicate line in Kconfig comment)

Change-Id: I7663c4d5350e2bfc3dfa2696f70ef777d6ccc6f6

# c4beb22f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

FIT: Modify option FIT_SIGNATURE in Kconfig

For FIT signature based approach to work, RSA library needs to be selected.
The FIT_SIGNATURE option in Kconfig is modified to automatically select RSA.
Selecting RSA compiles the RSA library required for image verification.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 45ccec8f 23-Oct-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_USE_PRIVATE_LIBGCC to Kconfig

The private libgcc is supported only on ARM, MIPS, PowerPC, SH, x86.
Those architectures should "select" HAVE_PRIVATE_LIBGCC and
CONFIG_USE_PRIVATE_LIBGCC should depend on it.

Currently, this option is enabled on Tegra boards and x86 architecture.
Move the definition from header files to Kconfig.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Tested-by: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: Tom Warren <twarren@nvidia.com>

# 8c688bc4 23-Oct-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_SYS_HZ to lib/Kconfig

CONFIG_SYS_HZ is always defined as 1000 in config_fallbacks.h
(but some boards still have redundant definitions).

This commit moves the definition and the document in README to
Kconfig. Since lib/Kconfig can assure that CONFIG_SYS_HZ is 1000,
the sanity check in lib/time.c should be removed.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Reviewed-by: Marek Vasut <marex@denx.de>

# b0928da6 16-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED to Kconfig

If this option is enabled, the objects under lib/ directory
are compiled with speed optimization, not size optimization.
(Currently, only used by some Blackfin boards.)

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# ed36323f 16-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: add blank Kconfig files

This would be useful to start moving various config options.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# 87316da0 13-May-2021 Masahisa Kojima <masahisa.kojima@linaro.org>

lib: introduce HASH_CALCULATE option

Build error occurs when CONFIG_EFI_SECURE_BOOT or
CONFIG_EFI_CAPSULE_AUTHENTICATE is enabled,
because hash-checksum.c is not compiled.

Since hash_calculate() implemented in hash-checksum.c can be
commonly used aside from FIT image signature verification,
this commit itroduces HASH_CALCULATE option to decide
if hash-checksum.c shall be compiled.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# e2ae483c 13-May-2021 Heinrich Schuchardt <xypron.glpk@gmx.de>

hash: Kconfig option for SHA512 hardware acceleration

Commit a479f103dc1c ("hash: Allow for SHA512 hardware implementations")
defined function definitions for hardware accelerated SHA384 and SHA512.
If CONFIG_SHA_HW_ACCEL=y, these functions are used.

We already have boards using CONFIG_SHA_HW_ACCEL=y but none implements the
new functions hw_sha384() and hw_sha512().

For implementing the EFI TCG2 protocol we need SHA384 and SHA512. The
missing hardware acceleration functions lead to build errors on boards like
peach-pi_defconfig.

Introduce a new Kconfig symbol CONFIG_SHA512_HW_ACCEL to control if the
functions hw_sha384() and hw_sha512() shall be used to implement the SHA384
and SHA512 algorithms.

Fixes: a479f103dc1c ("hash: Allow for SHA512 hardware implementations")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

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

# 6d66502b 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: Add 2 config to define the max number of regions

Add 2 configs CONFIG_LMB_MEMORY_REGIONS and CONFIG_LMB_RESERVED_REGIONS
to change independently the max number of the regions in lmb
library.

When CONFIG_LMB_USE_MAX_REGIONS=y, move the lmb property arrays to
struct lmb and manage the array size with the element 'max' of struct
lmb_region; their are still allocated in stack.

When CONFIG_LMB_USE_MAX_REGIONS=n, keep the current location in
struct lmb_region to allow compiler optimization.

Increase CONFIG_LMB_RESERVED_REGIONS is useful to avoid lmb errors in
bootm when the number of reserved regions (not adjacent) is reached:
+ 1 region for relocated U-Boot
+ 1 region for initrd
+ 1 region for relocated linux device tree
+ reserved memory regions present in Linux device tree.

The current limit of 8 regions is reached with only 5 reserved regions
in DT.

see Linux kernel commit bf23c51f1f49 ("memblock: Move memblock arrays
to static storage in memblock.c and make their size a variable")

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# 4fa0150d 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: move MAX_LMB_REGIONS value in Kconfig

Move MAX_LMB_REGIONS value in Kconfig, the max number of the regions
in lmb library.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# 77b8cfef 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: move CONFIG_LMB in Kconfig

Migrate CONFIG_LMB in Kconfig.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# a479f103 16-Feb-2021 Joel Stanley <joel@jms.id.au>

hash: Allow for SHA512 hardware implementations

Similar to support for SHA1 and SHA256, allow the use of hardware hashing
engine by enabling the algorithm and setting CONFIG_SHA_HW_ACCEL /
CONFIG_SHA_PROG_HW_ACCEL.

Signed-off-by: Joel Stanley <joel@jms.id.au>

# f2c1442e 14-Mar-2021 Simon Glass <sjg@chromium.org>

bloblist: Make BLOBLIST_TABLES depend on BLOBLIST

Add an extra condition here since we cannot put x86 tables in a bloblist
when bloblists are not supported.

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

# e0103158 25-Feb-2021 Bin Meng <bmeng.cn@gmail.com>

lib: kconfig: Mention CONFIG_ADDR_MAP limitation in the help

Mention that CONFIG_ADDR_MAP only works in the post-relocation phase.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>

# 56e7257c 03-Feb-2021 Bin Meng <bmeng.cn@gmail.com>

lib: Fix BINMAN_FDT dependency

lib/binman.c references the following 3 ofnode APIs:
ofnode_first_subnode(), ofnode_path() and ofnode_read_bool().

These APIs get built only when DM is on. Fix the dependency then.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 59e4e391 18-Jan-2021 Tom Rini <trini@konsulko.com>

Merge https://gitlab.denx.de/u-boot/custodians/u-boot-riscv

- Update qemu-riscv.rst build instructions.
- Add support for SPI on Kendryte K210.
- Add Microchip PolarFire SoC Icicle Kit support.
- Add support for an early timer.
- Select TIMER_EARLY to avoid infinite recursion for Trace.


# a80f8513 17-Jan-2021 Pragnesh Patel <pragnesh.patel@sifive.com>

trace: select TIMER_EARLY to avoid infinite recursion

When tracing functions is enabled this adds calls to
__cyg_profile_func_enter() and __cyg_profile_func_exit() to the traced
functions.

__cyg_profile_func_enter() and __cyg_profile_func_exit() invoke
timer_get_us() to record the entry and exit time.

initr_dm() will make gd->dm_root = NULL and gd->timer = NULL, so
timer_get_us() -> get_ticks() -> dm_timer_init() will lead to an
indefinite recursion.

So select TIMER_EARLY when tracing got enabled.

Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Rick Chen <rick@andestech.com>

# 6205bbb1 04-Jan-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lib: cosmetic update of CONFIG_LIB_ELF description

Change 2 typo error in CONFIG_LIB_ELF description:
- Supoort => Support
- fir => for

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c589132a 02-Dec-2020 Aswath Govindraju <a-govindraju@ti.com>

fdt: Use phandle to distinguish DT nodes with same name

While assigning the sequence number to subsystem instances by reading the
aliases property, only DT nodes names are compared and not the complete
path. This causes a problem when there are two DT nodes with same name but
have different paths.

In arch/arm/dts/k3-am65-main.dtsi there are two USB controllers with the
same device tree node name but different path. When aliases are defined for
these USB controllers then fdtdec_get_alias_seq() fails to pick the correct
instance for a given index.

fdt_path_offset() function is slow and this would effect the U-Boot
startup. To avert the time penalty on all boards, apply this extra check
only when required by using a config option.

Fix it by comparing the phandles of DT nodes after the node names match,
under a config option.

Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Fix whitespace error in Kconfig:
Signed-off-by: Simon Glass <sjg@chromium.org>

# 28cef9ca 19-Nov-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

fs: fat: create correct short names

The current function set_name() used to create short names has the
following deficiencies resolved by this patch:

* Long names (e.g. FOO.TXT) are stored even if a short name is enough.
* Short names with spaces are created, e.g. "A ~1.TXT".
* Short names with illegal characters are created, e.g. "FOO++BAR".
* Debug output does not not consider that the short file name has no
concluding '\0'.

The solution for the following bug is split of into a separate patch:

* Short file names must be unique.

This patch only provides the loop over possible short file names.

Fixes: c30a15e590c ("FAT: Add FAT write feature")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# e4f8e543 05-Nov-2020 Simon Glass <sjg@chromium.org>

smbios: Drop the unused Kconfig options

Now that we can use devicetree to specify this information, drop the old
CONFIG options.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 44c74bdd 05-Nov-2020 Simon Glass <sjg@chromium.org>

sysinfo: Provide a default driver to set SMBIOS values

Some boards want to specify the manufacturer or product name but do not
need to have their own sysinfo driver.

Add a default driver which provides a way to specify this SMBIOS
information in the devicetree, without needing any board-specific
functionality.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d2cb7a22 04-Nov-2020 Simon Glass <sjg@chromium.org>

x86: Allow putting some tables in the bloblist

At present all tables are placed starting at address f0000 in memory, and
can be up to 64KB in size. If the tables are very large, this may not
provide enough space.

Also if the tables point to other tables (such as console log or a ramoops
area) then we must allocate other memory anyway.

The bloblist is a nice place to put these tables since it is contiguous,
which makes it easy to reserve this memory for linux using the 820 tables.

Add an option to put some of the tables in the bloblist. For SMBIOS and
ACPI, create suitable pointers from the f0000 region to the new location
of the tables.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
[bmeng: squashed in http://patchwork.ozlabs.org/project/uboot/patch/
20201105062407.1.I8091ad931cbbb5e3b6f6ababdf3f8d5db0d17bb9@changeid/]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# 415eab06 03-Nov-2020 Christian Gmeiner <christian.gmeiner@gmail.com>

smbios: add parsing API

Add a very simple API to be able to access SMBIOS strings
like vendor, model and bios version.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 72eda507 27-Oct-2020 Sean Anderson <seanga2@gmail.com>

lib: Add getopt

Some commands can get very unweildy if they have too many positional
arguments. Adding options makes them easier to read, remember, and
understand.

This implementation of getopt has been taken from barebox, which has had
option support for quite a while. I have made a few modifications to their
version, such as the removal of opterr in favor of a separate getopt_silent
function. In addition, I have moved all global variables into struct
getopt_context.

The getopt from barebox also re-orders the arguments passed to it so that
non-options are placed last. This allows users to specify options anywhere.
For example, `ls -l foo/ -R` would be re-ordered to `ls -l -R foo/` as
getopt parsed the options. However, this feature conflicts with the const
argv in cmd_tbl->cmd. This was originally added in 54841ab50c ("Make sure
that argv[] argument pointers are not modified."). The reason stated in
that commit is that hush requires argv to stay unmodified. Has this
situation changed? Barebox also uses hush, and does not have this problem.
Perhaps we could use their fix?

I have assigned maintenance of getopt to Simon Glass, as it is currently
only used by the log command. I would also be fine maintaining it.

Signed-off-by: Sean Anderson <seanga2@gmail.com>

# 26637e2e 12-Sep-2020 Simon Glass <sjg@chromium.org>

lib: Allow hexdump to be used in SPL

It is sometimes useful to output hex dumps in SPL. Add a config option to
allow this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# e87dfb05 05-Aug-2020 Andrii Anisov <andrii_anisov@epam.com>

lib: sscanf: add sscanf implementation

Port sscanf implementation from mini-os and introduce new
Kconfig option to enable it: CONFIG_SSCANF. Disable by default.

Signed-off-by: Andrii Anisov <andrii_anisov@epam.com>
Signed-off-by: Anastasiia Lukianenko <anastasiia_lukianenko@epam.com>
Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>

# 81014f73 30-Jul-2020 Joao Marcos Costa <joaomarcos.costa@bootlin.com>

include/u-boot, lib/zlib: add sources for zlib decompression

Add zlib (v1.2.11) uncompr() function to U-Boot. SquashFS depends on
this function to decompress data from a raw disk image. The actual
support for zlib into SquashFS sources will be added in a follow-up
commit.

Signed-off-by: Joao Marcos Costa <joaomarcos.costa@bootlin.com>

# 69be8fd1 03-Jun-2020 Marek Szyprowski <m.szyprowski@samsung.com>

powerpc: move ADDR_MAP to Kconfig

Move ADDR_MAP related config options from include/configs/*.h to the
proper place in lib/Kconfig. This has been done using
./tools/moveconfig.py and manual inspection of the generated changes.
This is a preparation to use ADDR_MAP helper on ARM 32bit Raspberry Pi4
board for mapping the PCIe XHCI MMIO, which is above the 4GiB identity
mapping limit.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# d16b38f4 15-Apr-2020 Reuben Dowle <reubendowle0@gmail.com>

Add support for SHA384 and SHA512

The current recommendation for best security practice from the US government
is to use SHA384 for TOP SECRET [1].

This patch adds support for SHA384 and SHA512 in the hash command, and also
allows FIT images to be hashed with these algorithms, and signed with
sha384,rsaXXXX and sha512,rsaXXXX

The SHA implementation is adapted from the linux kernel implementation.

[1] Commercial National Security Algorithm Suite
http://www.iad.gov/iad/programs/iad-initiatives/cnsa-suite.cfm

Signed-off-by: Reuben Dowle <reuben.dowle@4rf.com>

# 43e442a5 26-May-2020 Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

kconfig: fix some typos

Signed-off-by: Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

# eff5a547 22-May-2020 Michael Walle <michael@walle.cc>

cmd: zip: automatically pull in gzip()

Move the CONFIG_GZIP_COMPRESSED from a config.h macro to a Kconfig menu
item. It is not selectable by a user because there is no reason to do
so. Instead it will be automatically selected by the stuff which uses
gzip(), like the zip command.

Remove it from the config_whitelist.txt. Also remove
CONFIG_GZIP_COMPRESS_DEF_SZ as this was never used on any board. The
default seems to be sane, otherwise it should be added as a Kconfig
option.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8239be61 06-May-2020 Simon Glass <sjg@chromium.org>

lib: Allow MD5 to be enabled in SPL

At present the MD5 option cannot be enabled by board configs since it has
no Kconfig name. It is generally enabled, so long as FIT support is
present. But not all boards use FIT, particularly in SPL

Fix this and add an option for SPL as well. This allows board code to call
md5() even if FIT support is not enabled.

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

# 04cb3994 21-Apr-2020 Weijie Gao <weijie.gao@mediatek.com>

lib: enable lzma decompression support for SPL build

This patch enables LZMA decompression support for SPL build

Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>

# 2a2119e1 05-Mar-2020 Atish Patra <atish.patra@wdc.com>

lib: kconfig: Add option to set BZIP2 compression method

There is no way to select BZIP2 compression method.
Add it under library/compression config where all other
compression related configs are present.

Signed-off-by: Atish Patra <atish.patra@wdc.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 805b3cac 12-Feb-2020 Keerthy <j-keerthy@ti.com>

lib: elf: Move the generic elf loading/validating functions to lib

Move the generic elf loading/validating functions to lib/
so that they can be re-used and accessed by code existing
outside cmd.

While at it remove the duplicate static version of load_elf_image_phdr
under arch/arm/mach-imx/imx_bootaux.c.

Signed-off-by: Keerthy <j-keerthy@ti.com>
Suggested-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>

# 1611235b 19-Jan-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: Kconfig dependencies for pseudo-random library

drivers/rng/sandbox_rng.c requires rand() to be defined but configuration
option CONFIG_CONFIG_LIB_RAND selected in drivers/rng/Kconfig does not
exist.

test/lib/test_aes.c requires rand() to be defined.

Fix the selection criteria for choice "Pseudo-random library support type".

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 3c10dc95 06-Dec-2019 Simon Glass <sjg@chromium.org>

binman: Add a library to access binman entries

SPL and TPL can access information about binman entries using link-time
symbols but this is not available in U-Boot proper. Of course it could be
made available, but the intention is to just read the device tree.

Add support for this, so that U-Boot can locate entries.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# b4adf627 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: crypto: add x509 parser

Imported from linux kernel v5.3:
x509.asn1 without changes
x509_akid.asn1 without changes
x509_parser.h without changes
x509_cert_parser.c with changes marked as __UBOOT__
x509_public_key.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# a9b45e6e 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add oid registry utility

Imported from linux kernel v5.3:
build_OID_registry without changes
oid_registry.h without changes
oid_registry.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# ab8a0e06 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add asn1 decoder

Imported from linux kernel v5.3:
lib/asn1_decoder.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 2b12196d 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

cmd: add asn1_compiler

Imported from linux kernel v5.3:
asn1.h without changes
asn1_ber_bytecode.h without changes
asn1_decoder.h without changes
asn1_compiler.c without changes

This host command will be used to create a ASN1 parser, for example,
for pkcs7 messages or x509 certificates. More specifically, it will
generate *byte code* which will be interpreted by asn1 decoder library.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 05429b6c 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

rtc: move date.c from drivers/rtc/ to lib/

In the next commit, rtc_mktime(), for compatibility with linux, will be
implemented using rtc_mktime(), which is no longer drivers/rtc specific.
So move this file under lib/.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 37ef1774 10-Nov-2019 Thomas Hebb <tommyhebb@gmail.com>

Kconfig: disambiguate config names for tiny printf

27084c03d36a ("spl: Allow tiny printf() to be controlled in SPL and
TPL") split this option in two for TPL and SPL, but didn't change the
Kconfig names, making them hard to set quickly.

Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>

# 0d76afc0 27-Oct-2019 Simon Glass <sjg@chromium.org>

fdt: Add Kconfig options to control code size

For better or worse libfdt recent grew a lot of code that checks the
validity of the device tree in great detail. When using unsigned or
unverified data this makes things safer, but it does add to code size.

Add some controls to select the trade-off between safety and code size.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 27084c03 25-Sep-2019 Simon Glass <sjg@chromium.org>

spl: Allow tiny printf() to be controlled in SPL and TPL

At present there is only one control for this and it is used for both SPL
and TPL. But SPL might have a lot more space than TPL so the extra cost of
a full printf() might be acceptable.

Split the option into two, providing separate SPL and TPL controls. The
TPL setting defaults to the same as SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2a51e16b 07-Jun-2019 Tom Rini <trini@konsulko.com>

configs: Make USE_TINY_PRINTF depend on SPL||TPL and be default

The USE_TINY_PRINTF symbol only changes things within SPL and TPL
builds, so make it depend on that support. Next, make it default as
within these cases we should rarely have need of more advanced print
formats outside of the debug context.

To do this, in a few cases we need to correct our Kconfig dependencies
as we had cases of non-SPL targets select'ing this symbol. Finally, in
the case of a few boards we really do need the full printf
functionality.

Signed-off-by: Tom Rini <trini@konsulko.com>

# da0fb5fd 02-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: make call depth limit customizable

Up to now we had hard coded values for the call depth up to which trace
records are created: 200 for early tracing, 15 thereafter. UEFI
applications reach a call depth of 80 or above.

Provide customizing settings for the call trace depth limit and the early
call trace depth limit. Use the old values as defaults.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8509f22a 29-Apr-2019 Marek Behún <marek.behun@nic.cz>

lib: add Zstandard decompression support

Add the zstd library from Linux kernel (only decompression support).
There are minimal changes to build with U-Boot, otherwise the files are
identical to Linux commit dc35da16 from March 2018, the files had not
been touched since in kernel. Also SPDX lincese tags were added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 83a486b6 29-Apr-2019 Marek Behún <marek.behun@nic.cz>

lib: Add xxhash support

This adds the xxhash support from Linux. Files are almost identical to
those added to Linux in commit 5d240522 ("lib: Add xxhash module") (they
haven't been touched since in Linux). The only difference is to add some
includes to be compatible with U-Boot. Also SPDX lincese tags were
added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 5132361a 29-Apr-2019 Heiko Schocher <hs@denx.de>

lib: Kconfig: fix help text for GZIP

commit 95f4bbd581cf ("lib: fdt: Allow LZO and GZIP DT compression in U-Boot")

introduced Kconfig option for gzip in U-Boot, but help text
says gzip for SPL, which is wrong. Fix this.

Signed-off-by: Heiko Schocher <hs@denx.de>
Acked-by: Marek Vasut <marex@denx.de>

# 1c6eb075 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE_BUFFER_SIZE et al to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE_BUFFER_SIZE
CONFIG_TRACE_EARLY_SIZE
CONFIG_TRACE_EARLY
CONFIG_TRACE_EARLY_ADDR

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

# a24a78d7 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE

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

# 54969b40 21-Mar-2019 Thierry Reding <treding@nvidia.com>

fdtdec: Add Kconfig symbol for tests

Runtime tests are provided as a test_fdtdec command implementation. Add
a Kconfig symbol that allows this command to be built so that the tests
can be used.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 95f4bbd5 08-Mar-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

lib: fdt: Allow LZO and GZIP DT compression in U-Boot

Add required Kconfig symbols, Makefile bits and macro fixes in a
few places to support LZO and DT compression in U-Boot. This can
save a lot of space with multi-DTB fitImages.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>

# 6e705114 13-Jan-2019 Chris Packham <judge.packham@gmail.com>

lib: Kconfig: spelling fixes

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 048c6e89 06-Nov-2018 Simon Glass <sjg@chromium.org>

spl: lz4: Allow use of lz4 compression in SPL

In some cases U-Boot is compressed and it is useful to be able to
decompress it in SPL. Add a Kconfig and Makefile change to allow this.
Note that this does not actually implement decompression.

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

# 2895c4b7 15-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

kconfig: Introduce HAVE_ARCH_IOMAP

Introduce a new Kconfig option for architecture codes to control
whether it provides io{read,write}{8,16,32} I/O accessor functions.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5592a633 01-Oct-2018 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt in TPL

In some cases (e.g. sandbox with verified boot) it is useful to support
libfdt in TPL. Update the Kconfig to handle this.

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

# 6307896c 01-Oct-2018 Simon Glass <sjg@chromium.org>

tpm: Add support for SPL and TPL

At present the tpm can only be used in U-Boot proper. Updated it to work
in SPL and TPL also.

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

# ab948cd2 19-Jul-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

fdt_support: make FDT_FIXUP_PARTITIONS depend on CMD_MTDPARTS

fdt_fixup_mtdparts() calls mtdparts_init() and device_find(),
which are defined in cmd/mtdparts.c

The combination of FDT_FIXUP_PARTITIONS=y and CMD_MTDPARTS=n
emits the following link error:

common/fdt_support.c:903: undefined reference to `mtdparts_init'
common/fdt_support.c:914: undefined reference to `device_find'

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 3330584d 03-Jun-2018 Igor Opaniuk <igor.opaniuk@gmail.com>

avb2.0: integrate avb 2.0 into the build system

Integrate libavb into the build system. Introduce CONFIG_LIBAVB
build option.

Signed-off-by: Igor Opaniuk <igor.opaniuk@linaro.org>

# f8c987f8 05-Jun-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

lib: Add hexdump

Often during debugging session it's very interesting to see
what data we were dealing with. For example what we write or read
to/from memory or peripherals.

This change introduces functions that allow to dump binary
data with one simple function invocation like:
------------------->8----------------
print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, buf, len);
------------------->8----------------

which gives us the following:
------------------->8----------------
00000000: f2 b7 c9 88 62 61 75 64 72 61 74 65 3d 31 31 35 ....baudrate=115
00000010: 32 30 30 00 62 6f 6f 74 61 72 67 73 3d 63 6f 6e 200.bootargs=con
00000020: 73 6f 6c 65 3d 74 74 79 53 33 2c 31 31 35 32 30 sole=ttyS3,11520
00000030: 30 6e 38 00 62 6f 6f 74 64 65 6c 61 79 3d 33 00 0n8.bootdelay=3.
00000040: 62 6f 6f 74 66 69 6c 65 3d 75 49 6d 61 67 65 00 bootfile=uImage.
00000050: 66 64 74 63 6f 6e 74 72 6f 6c 61 64 64 72 3d 39 fdtcontroladdr=9
00000060: 66 66 62 31 62 61 30 00 6c 6f 61 64 61 64 64 72 ffb1ba0.loadaddr
00000070: 3d 30 78 38 32 30 30 30 30 30 30 00 73 74 64 65 =0x82000000.stde
00000080: 72 72 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 rr=serial0@e0022
00000090: 30 30 30 00 73 74 64 69 6e 3d 73 65 72 69 61 6c 000.stdin=serial
000000a0: 30 40 65 30 30 32 32 30 30 30 00 73 74 64 6f 75 0@e0022000.stdou
000000b0: 74 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 30 t=serial0@e00220
000000c0: 30 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00..............
...
------------------->8----------------

Source of hexdump.c was copied from Linux kernel v4.7-rc2.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Mario Six <mario.six@gdsys.cc>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Stefan Roese <sr@denx.de>

# c232d14d 29-May-2018 Alex Kiernan <alex.kiernan@gmail.com>

mmc: Separate "mmc swrite" from fastboot

Introduce CONFIG_IMAGE_SPARSE and CONFIG_CMD_MMC_SWRITE so the "mmc
swrite" command is separated from the fastboot code.

Move image-sparse from common to lib so it's clear it's library code.

Rename CONFIG_FASTBOOT_FLASH_FILLBUF_SIZE to CONFIG_IMAGE_SPARSE_FILLBUF_SIZE
and migrate it to Kconfig.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Acked-by: Jassi Brar <jaswinder.singh@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6417572e 08-May-2018 Tom Rini <trini@konsulko.com>

lib/Kconfig: Mark OF_LIBFDT_OVERLAY as depending on OF_LIBFDT

The overlay code is only useful when OF_LIBFDT is set, so mark it as
depending on that first.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 58a46f88 25-Apr-2018 Praneeth Bajjuri <praneeth@ti.com>

configs: TI: Enable FIT Library overlay support

Enable the FDT library overlay support for all TI SOC family.

Without this option, when Loading fdt from FIT image, the
following warning is seen.

"config with overlays but CONFIG_OF_LIBFDT_OVERLAY not set".

Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
Suggested-by: Andrew F.Davis <afd@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>

# 14ad44ab 18-Apr-2018 Alex Kiernan <alex.kiernan@gmail.com>

spl: Split sprintf, strto* from SPL serial in Kconfig

When SPL serial is disabled, callers who need sprintf or strtoul fail
because their inclusion is guarded by CONFIG_SPL_SERIAL_SUPPORT/
CONFIG_TPL_SERIAL_SUPPORT.

Split printf, sprintf and strto into their own entries and then select
all of them if SERIAL_SUPPORT is enabled to match the current behaviour.

Include panic.o unconditionally as it can be called from anywhere which
uses BUG_ON().

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>

# e294ba06 04-Apr-2018 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-sunxi

Signed-off-by: Tom Rini <trini@konsulko.com>


# d14db11d 03-Apr-2018 Andre Przywara <andre.przywara@arm.com>

sunxi: revert disabling of features

In January some commits were introduced to mitigate the U-Boot image
size issues we encountered on sunxi builds.
Now with the MMC environment removed we can bring them back, as we
practically don't have a size limit anymore.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 32ce6179 13-Mar-2018 Bryan O'Donoghue <bryan.odonoghue@linaro.org>

optee: Add lib entries for sharing OPTEE code across ports

This patch adds code to lib to enable sharing of useful OPTEE code between
board-ports and architectures. The code on lib/optee/optee.c comes from the
TI omap2 port. Eventually the OMAP2 code will be patched to include the
shared code. The intention here is to add more useful OPTEE specific code
as more functionality gets added.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Cc: Harinarayan Bhatta <harinarayan@ti.com>
Cc: Andrew F. Davis <afd@ti.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Kever Yang <kever.yang@rock-chips.com>
Cc: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Cc: Peng Fan <peng.fan@nxp.com>
Tested-by: Peng Fan <peng.fan@nxp.com>

# 36c1877c 06-Feb-2018 Faiz Abbas <faiz_abbas@ti.com>

lib: Kconfig: Move DYNAMIC_CRC_TABLE to Kconfig

Add CONFIG prefix to DYNAMIC_CRC_TABLE and implement it in
Kconfig.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>

# a451bc27 05-Feb-2018 Adam Ford <aford173@gmail.com>

Convert LIB_UUID to Kconfig

config_fallback.h has some logic that checks a variety of options
and selects LIB_UUID if it hasn't already been selected. This
will all LIB_UUID in Kconfig and select this option for the list
of options to allow us to remove the logic from fallbacks

Signed-off-by: Adam Ford <aford173@gmail.com>

# a5a37567 06-Feb-2018 Adam Ford <aford173@gmail.com>

Convert CONFIG LIB_HW_RAND to Kconfig

config_fallbacks.h had some logic to automatically select
LIB_RAND if RANDOM_UUID or CMD_UUID were set if LIB_HW_RAND wasn't
already selected. By migrating LIB_HW_RAND to Kconfig, we can
remove this check from config_fallbacks.h and put it into Kconfig

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
[trini: Turn into a choice, add NET_RANDOM_ETHADDR]
Signed-off-by: Tom Rini <trini@konsulko.com>

# acd4d334 16-Jan-2018 Maxime Ripard <maxime.ripard@free-electrons.com>

net: regex: Disable by default on sunXi

The sunXi arm64 build has overflown, leading to the main U-boot binary
overwriting the environment when flashing the new image, or even worse,
overwriting itself when we're calling saveenv.

Disable this option that is not critical until we can adress the issue
properly.

Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 7e3caa81 03-Dec-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

Move CONFIG_PANIC_HANG to Kconfig

Freescale (NXP) boards have lots of defconfig files per board.
I used "imply PANIC_HANG" for them.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# da5337a6 08-Nov-2017 Nandor Han <nandor.han@ge.com>

rtc: add support for s35392a

Add support for S35392A RTC. The driver supports both U-Boot driver
models.

Signed-off-by: Nandor Han <nandor.han@ge.com>
Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
Cc: Heiko Schocher <hs@denx.de>

# f52bdf4b 14-Sep-2017 Jean-Jacques Hiblot <jjhiblot@ti.com>

lib: allow building lzo for the SPL

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 85d8bf57 03-Sep-2017 Marek Behún <marek.behun@nic.cz>

lib: Add CRC32-C

This is needed for BTRFS.

Signed-off-by: Marek Behun <marek.behun@nic.cz>

create mode 100644 lib/crc32c.c

# 7264f292 15-Aug-2017 York Sun <york.sun@nxp.com>

spl: fit: Eanble GZIP support for image decompression

Add Kconfig option SPL_GZIP and SPL_ZLIB to enable gunzip support for
SPL boot, eg. falcon boot compressed kernel image.

Signed-off-by: York Sun <york.sun@nxp.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6ef2f901 11-Aug-2017 Adam Ford <aford173@gmail.com>

Convert CONFIG_BCH to Kconfig

This converts the following to Kconfig:
CONFIG_BCH

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1a7ba1d 18-Aug-2017 Anatolij Gustschin <agust@denx.de>

Fix 'notes' typos

s/notes/nodes

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 96b9082c 03-Aug-2017 Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

rockchip: rk3188: rock: adjust for SPL/TPL split

With the changes to split SPL/TPL for the RK3368, I apparently missed
some needed adjustments to the RK3188 Kconfig and rock_defconfig.

This fixes build-issues for the rock board after applying the RK3368
enablement (and SPL/TPL) set that resulted from TPL_SERIAL_SUPPORT,
TPL_ROCKCHIP_BACK_TO_BROM and TPL_TINY_MEMSET being separate symbols
now.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d56b4b19 22-Jul-2017 Tom Rini <trini@konsulko.com>

configs: Migrate RBTREE, LZO, CMD_MTDPARTS, CMD_UBI and CMD_UBIFS

The above CONFIG options are in Kconfig, and now have correct depends and
inter-dependencies. Migrate these to configs/ from include/configs/. In the
case of CMD_UBIFS also change it to be a default y if CMD_UBI.

Signed-off-by: Tom Rini <trini@konsulko.com>

# aed998aa 17-May-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_LZMA to Kconfig

This converts the following to Kconfig:
CONFIG_LZMA

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

# b1a873df 26-Apr-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_CMD_AES et al to Kconfig

This converts the following to Kconfig:
CONFIG_CMD_AES
CONFIG_AES

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Add select AES to CMD_AES]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 173aafbf 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

cmd: Expose a Kconfig option to enable UBIFS commands

Create a new Kconfig entry to allow CMD_UBIFS selection from Kconfig and
add an hidden LZO option that can be selected by CMD_UBIFS.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>

# aa049152 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

mtd: ubi: Select RBTREE option from MTD_UBI Kconfig entry

Expose the RBTREE feature through Kconfig and select this option from the
MTD_UBI option.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>
[Rebased on master]
Signed-off-by: Jagan Teki <jagan@openedev.com>

# ab4458bd 02-Apr-2017 Simon Glass <sjg@chromium.org>

string: Provide a slimmed-down memset()

Most of the time the optimised memset() is what we want. For extreme
situations such as TPL it may be too large. For example on the 'rock'
board, using a simple loop saves a useful 48 bytes. With gcc 4.9 and
the rodata bug, this patch is enough to reduce the TPL image below the
limit.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>

# bea79d7d 14-Mar-2017 Andre Przywara <andre.przywara@arm.com>

Kconfig: introduce md5sum command selection

So far CONFIG_MD5SUM would need to be set by a board's include file.
Since the command is really generic, move it over to Kconfig to allow
it to be defined by either a board's defconfig, menuconfig or some
config snippet merged via mergeconfig.sh.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e663b350 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

smbios: Expose in efi_loader as table

We can pass SMBIOS easily as EFI configuration table to an EFI payload. This
patch adds enablement for that case.

While at it, we also enable SMBIOS generation for ARM systems, since they support
EFI_LOADER.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4b6dddc2 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

x86: Move smbios generation into arch independent directory

We will need the SMBIOS generation function on ARM as well going forward,
so let's move it into a non arch specific location.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# ebf7fff2 05-Oct-2016 Heiko Schocher <hs@denx.de>

spl: move FDT_FIXUP_PARTITIONS to Kconfig

Move FDT_FIXUP_PARTITIONS to Kconfig and cleanup existing
uses.

Signed-off-by: Heiko Schocher <hs@denx.de>

# ddf67f71 05-Jul-2016 Maxime Ripard <maxime.ripard@free-electrons.com>

libfdt: Add overlay application function

The device tree overlays are a good way to deal with user-modifyable
boards or boards with some kind of an expansion mechanism where we can
easily plug new board in (like the BBB, the Raspberry Pi or the CHIP).

Add a new function to merge overlays with a base device tree.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>

# 91b86e21 26-May-2016 Marek Vasut <marex@denx.de>

lib: Enable private libgcc by default

This patch decouples U-Boot binary from the toolchain on systems where
private libgcc is available. Instead of pulling in functions provided
by the libgcc from the toolchain, U-Boot will use it's own set of libgcc
functions. These functions are usually imported from Linux kernel, which
also uses it's own libgcc functions instead of the ones provided by the
toolchain.

This patch solves a rather common problem. The toolchain can usually
generate code for many variants of target architecture and often even
different endianness. The libgcc on the other hand is usually compiled
for one particular configuration and the functions provided by it may
or may not be suited for use in U-Boot. This can manifest in two ways,
either the U-Boot fails to compile altogether and linker will complain
or, in the much worse case, the resulting U-Boot will build, but will
misbehave in very subtle and hard to debug ways.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 67976306 30-Mar-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

cosmetic: Fix typos "privide"

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# ed980b8c 03-Mar-2016 Alexander Graf <agraf@csgraf.de>

efi_loader: hook up in build environment

Now that we have all the bits and pieces ready for EFI payload loading
support, hook them up in Makefiles and KConfigs so that we can build.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
[trini: Enable only when we of OF_LIBFDT, disable on kwb and colibri_pxa270]
Signed-off-by: Tom Rini <trini@konsulko.com>

# aa34fbc0 22-Feb-2016 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt to be used in SPL

Add an option to enable libfdt in SPL. This can be useful when decoding
FIT files in SPL.

We need to make sure this option is not enabled in SPL by this change.
Also this option needs to be enabled in host builds. Si add a new
IMAGE_USE_LIBFDT #define which can be used in files that are built on the
host but must also build for U-Boot and SPL.

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

# 69e173eb 22-Feb-2016 Simon Glass <sjg@chromium.org>

Move CONFIG_OF_LIBFDT to Kconfig

Move this option to Kconfig and tidy up existing boards.

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

# a187559e 05-Feb-2016 Bin Meng <bmeng.cn@gmail.com>

Use correct spelling of "U-Boot"

Correct spelling of "U-Boot" shall be used in all written text
(documentation, comments in source files etc.).

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Minkyu Kang <mk7.kang@samsung.com>

# 947c626d 14-Jan-2016 Tom Rini <trini@konsulko.com>

vsprintf.c: Always enable CONFIG_SYS_VSNPRINTF

Enabling this function always removes some class of string saftey issues.
The size change here in general is about 400 bytes and this seems a reasonable
trade-off.

Cc: Peng Fan <peng.fan@nxp.com>
Cc: Peter Robinson <pbrobinson@gmail.com>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Adrian Alonso <aalonso@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 7d9cde10 22-Nov-2015 Stefan Roese <sr@denx.de>

lib/tiny-printf.c: Add tiny printf function for space limited environments

This patch adds a small printf() version that supports all basic formats.
Its intented to be used in U-Boot SPL versions on platforms with very
limited internal RAM sizes.

To enable it, just define CONFIG_USE_TINY_PRINTF in your defconfig. This
will result in the SPL using this tiny function and the main U-Boot
still using the full-blown printf() function.

This code was copied from:
http://www.sparetimelabs.com/printfrevisited
With mostly only coding style related changes so that its checkpatch
clean.

The size reduction is about 2.5KiB. Here a comparison for the db-mv784mp-gp
(Marvell AXP) SPL:

Without this patch:
58963 18536 1928 79427 13643 ./spl/u-boot-spl

With this patch:
56542 18536 1956 77034 12cea ./spl/u-boot-spl

Note:
To make it possible to compile tiny-printf.c instead of vsprintf.c when
CONFIG_USE_TINY_PRINTF is defined, the functions printf() and vprintf() are
moved from common/console.c into vsprintf.c in this patch.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>

# 2419cd16 03-Oct-2015 Simon Glass <sjg@chromium.org>

dm: tpm: Drop CONFIG_DM_TPM

Now that all TPM drivers use driver model, we can drop the special driver
model CONFIG option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>

# 027b728d 06-Oct-2015 Julius Werner <jwerner@chromium.org>

Add support for LZ4 decompression algorithm

This patch adds support for LZ4-compressed FIT image contents. This
algorithm has a slightly worse compression ration than LZO while being
nearly twice as fast to decompress. When loading images from a fast
storage medium this usually results in a boot time win.

Sandbox-tested only since I don't have a U-Boot development system set
up right now. The code was imported unchanged from coreboot where it's
proven to work, though. I'm mostly interested in getting this recognized
by mkImage for use in a downstream project.

Signed-off-by: Julius Werner <jwerner@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# a7d660bc 22-Aug-2015 Simon Glass <sjg@chromium.org>

tpm: Add Kconfig options for TPMs

Add new Kconfig options for TPMs in preparation for moving boards to use
Kconfig for TPM configuration.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 867a6ac8 31-Jul-2015 Simon Glass <sjg@chromium.org>

efi: Add start-up library code

When running as an EFI application, U-Boot must request memory from EFI,
and provide access to the boot services U-Boot needs.

Add library code to perform these tasks. This includes efi_main() which is
the entry point from EFI. U-Boot is built as a shared library.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d1389403 23-Jun-2015 Simon Glass <sjg@chromium.org>

Add a dhrystone benchmark command

Drystone provides a convenient sanity check that the CPU is running at full
speed. Add this as a command which can be enabled as needed.

Note: I investigated using Coremark for this but there was a license
agreement and I could not work out if it was GPL-compatible.

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

# f7848d90 22-Jun-2015 Joe Hershberger <joe.hershberger@ni.com>

Allow CONFIG_REGEX to be disabled when CONFIG_NET

Instead of selecting REGEX when NET is enabled, make it the default, but
allow boards that are tiny to disable it and lose functionality on all
but the first Ethernet adapter.

cm-bf548, bf538f-ezkit, and bf533-stamp need this. None appear to have
more than one Ethernet interface.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# 3850dbe8 11-Jun-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

blackfin: fix undefined reference to srand and rand

Commit 9ba9e85f3f1c (net: Fix NET_RANDOM_ETHADDR dependencies)
accidentally dropped CONFIG_LIB_RAND defines for 14 Blackfin boards.

Prior to that commit, those boards defined CONFIG_LIB_RAND, but not
CONFIG_NET_RANDOM_ETHADDR. So, commit 9ba9e85f3f1c should not have
touched them, but in fact it ripped CONFIG_LIB_RAND off from all the
header files, which caused undefined reference to srand and rand.
CONFIG_LIB_RAND=y must be revived for such boards.

BTW, this commit indeed makes it better, but even with this fix,
three boards (bf533-stamp, bf538f-ezkit, cm-bf548) still can not
build due to region 'ram' overflowed error. This was cause by
commit 6eed3786c68c (net: Move the CMD_NET config to defconfigs)
because CMD_NET selects NET, and NET selects REGEX. Eventually,
some boards were newly enabled with CONFIG_REGEX, increasing the
memory footprint. A patch is expected to fix the build error.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 9ba9e85f 25-May-2015 Michal Simek <michal.simek@xilinx.com>

net: Fix NET_RANDOM_ETHADDR dependencies

NET_RANDOM_ETHADDR depends on lib/rand.c. This patch adds dependency to
Kconfig to ensure that library is also compiled.

Remove the definitions from Blackfin boards' include/configs.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 6501ff62 20-Apr-2015 Przemyslaw Marczak <p.marczak@samsung.com>

lib: Kconfig: add entry for errno_str() function

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1a60650c 21-Apr-2015 Joe Hershberger <joe.hershberger@ni.com>

kconfig: Move REGEX to Kconfig

Having this as a Kconfig allows it to be a dependent feature.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8156345d 06-Mar-2015 Simon Glass <sjg@chromium.org>

sandbox: Move CONFIG_SYS_VSNPRINTF to Kconfig

Move this over to Kconfig and tidy up.

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

# 94e3c8c4 19-Feb-2015 gaurav rana <gaurav.rana@freescale.com>

crypto/fsl - Add progressive hashing support using hardware acceleration.

Currently only normal hashing is supported using hardware acceleration.
Added support for progressive hashing using hardware.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
Signed-off-by: Gaurav Rana <gaurav.rana@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>

# d9f23c7f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

lib/rsa: Add Kconfig for devices supporting RSA Modular Exponentiation

Kconfig option added for devices which support RSA Verification.
1. RSA_SOFTWARE_EXP
Enables driver for supporting RSA Modular Exponentiation in Software
2. RSA_FREESCALE_EXP
Enables driver for supporting RSA Modular Exponentiation using Freescale specific
driver

The above drivers use RSA uclass

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
(Removed duplicate line in Kconfig comment)

Change-Id: I7663c4d5350e2bfc3dfa2696f70ef777d6ccc6f6

# c4beb22f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

FIT: Modify option FIT_SIGNATURE in Kconfig

For FIT signature based approach to work, RSA library needs to be selected.
The FIT_SIGNATURE option in Kconfig is modified to automatically select RSA.
Selecting RSA compiles the RSA library required for image verification.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 45ccec8f 23-Oct-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_USE_PRIVATE_LIBGCC to Kconfig

The private libgcc is supported only on ARM, MIPS, PowerPC, SH, x86.
Those architectures should "select" HAVE_PRIVATE_LIBGCC and
CONFIG_USE_PRIVATE_LIBGCC should depend on it.

Currently, this option is enabled on Tegra boards and x86 architecture.
Move the definition from header files to Kconfig.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Tested-by: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: Tom Warren <twarren@nvidia.com>

# 8c688bc4 23-Oct-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_SYS_HZ to lib/Kconfig

CONFIG_SYS_HZ is always defined as 1000 in config_fallbacks.h
(but some boards still have redundant definitions).

This commit moves the definition and the document in README to
Kconfig. Since lib/Kconfig can assure that CONFIG_SYS_HZ is 1000,
the sanity check in lib/time.c should be removed.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Reviewed-by: Marek Vasut <marex@denx.de>

# b0928da6 16-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED to Kconfig

If this option is enabled, the objects under lib/ directory
are compiled with speed optimization, not size optimization.
(Currently, only used by some Blackfin boards.)

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# ed36323f 16-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: add blank Kconfig files

This would be useful to start moving various config options.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# 6d66502b 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: Add 2 config to define the max number of regions

Add 2 configs CONFIG_LMB_MEMORY_REGIONS and CONFIG_LMB_RESERVED_REGIONS
to change independently the max number of the regions in lmb
library.

When CONFIG_LMB_USE_MAX_REGIONS=y, move the lmb property arrays to
struct lmb and manage the array size with the element 'max' of struct
lmb_region; their are still allocated in stack.

When CONFIG_LMB_USE_MAX_REGIONS=n, keep the current location in
struct lmb_region to allow compiler optimization.

Increase CONFIG_LMB_RESERVED_REGIONS is useful to avoid lmb errors in
bootm when the number of reserved regions (not adjacent) is reached:
+ 1 region for relocated U-Boot
+ 1 region for initrd
+ 1 region for relocated linux device tree
+ reserved memory regions present in Linux device tree.

The current limit of 8 regions is reached with only 5 reserved regions
in DT.

see Linux kernel commit bf23c51f1f49 ("memblock: Move memblock arrays
to static storage in memblock.c and make their size a variable")

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# 4fa0150d 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: move MAX_LMB_REGIONS value in Kconfig

Move MAX_LMB_REGIONS value in Kconfig, the max number of the regions
in lmb library.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# 77b8cfef 10-Mar-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lmb: move CONFIG_LMB in Kconfig

Migrate CONFIG_LMB in Kconfig.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

# a479f103 16-Feb-2021 Joel Stanley <joel@jms.id.au>

hash: Allow for SHA512 hardware implementations

Similar to support for SHA1 and SHA256, allow the use of hardware hashing
engine by enabling the algorithm and setting CONFIG_SHA_HW_ACCEL /
CONFIG_SHA_PROG_HW_ACCEL.

Signed-off-by: Joel Stanley <joel@jms.id.au>

# f2c1442e 14-Mar-2021 Simon Glass <sjg@chromium.org>

bloblist: Make BLOBLIST_TABLES depend on BLOBLIST

Add an extra condition here since we cannot put x86 tables in a bloblist
when bloblists are not supported.

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

# e0103158 25-Feb-2021 Bin Meng <bmeng.cn@gmail.com>

lib: kconfig: Mention CONFIG_ADDR_MAP limitation in the help

Mention that CONFIG_ADDR_MAP only works in the post-relocation phase.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>

# 56e7257c 03-Feb-2021 Bin Meng <bmeng.cn@gmail.com>

lib: Fix BINMAN_FDT dependency

lib/binman.c references the following 3 ofnode APIs:
ofnode_first_subnode(), ofnode_path() and ofnode_read_bool().

These APIs get built only when DM is on. Fix the dependency then.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 59e4e391 18-Jan-2021 Tom Rini <trini@konsulko.com>

Merge https://gitlab.denx.de/u-boot/custodians/u-boot-riscv

- Update qemu-riscv.rst build instructions.
- Add support for SPI on Kendryte K210.
- Add Microchip PolarFire SoC Icicle Kit support.
- Add support for an early timer.
- Select TIMER_EARLY to avoid infinite recursion for Trace.


# a80f8513 17-Jan-2021 Pragnesh Patel <pragnesh.patel@sifive.com>

trace: select TIMER_EARLY to avoid infinite recursion

When tracing functions is enabled this adds calls to
__cyg_profile_func_enter() and __cyg_profile_func_exit() to the traced
functions.

__cyg_profile_func_enter() and __cyg_profile_func_exit() invoke
timer_get_us() to record the entry and exit time.

initr_dm() will make gd->dm_root = NULL and gd->timer = NULL, so
timer_get_us() -> get_ticks() -> dm_timer_init() will lead to an
indefinite recursion.

So select TIMER_EARLY when tracing got enabled.

Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Rick Chen <rick@andestech.com>

# 6205bbb1 04-Jan-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lib: cosmetic update of CONFIG_LIB_ELF description

Change 2 typo error in CONFIG_LIB_ELF description:
- Supoort => Support
- fir => for

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c589132a 02-Dec-2020 Aswath Govindraju <a-govindraju@ti.com>

fdt: Use phandle to distinguish DT nodes with same name

While assigning the sequence number to subsystem instances by reading the
aliases property, only DT nodes names are compared and not the complete
path. This causes a problem when there are two DT nodes with same name but
have different paths.

In arch/arm/dts/k3-am65-main.dtsi there are two USB controllers with the
same device tree node name but different path. When aliases are defined for
these USB controllers then fdtdec_get_alias_seq() fails to pick the correct
instance for a given index.

fdt_path_offset() function is slow and this would effect the U-Boot
startup. To avert the time penalty on all boards, apply this extra check
only when required by using a config option.

Fix it by comparing the phandles of DT nodes after the node names match,
under a config option.

Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Fix whitespace error in Kconfig:
Signed-off-by: Simon Glass <sjg@chromium.org>

# 28cef9ca 19-Nov-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

fs: fat: create correct short names

The current function set_name() used to create short names has the
following deficiencies resolved by this patch:

* Long names (e.g. FOO.TXT) are stored even if a short name is enough.
* Short names with spaces are created, e.g. "A ~1.TXT".
* Short names with illegal characters are created, e.g. "FOO++BAR".
* Debug output does not not consider that the short file name has no
concluding '\0'.

The solution for the following bug is split of into a separate patch:

* Short file names must be unique.

This patch only provides the loop over possible short file names.

Fixes: c30a15e590c ("FAT: Add FAT write feature")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# e4f8e543 05-Nov-2020 Simon Glass <sjg@chromium.org>

smbios: Drop the unused Kconfig options

Now that we can use devicetree to specify this information, drop the old
CONFIG options.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 44c74bdd 05-Nov-2020 Simon Glass <sjg@chromium.org>

sysinfo: Provide a default driver to set SMBIOS values

Some boards want to specify the manufacturer or product name but do not
need to have their own sysinfo driver.

Add a default driver which provides a way to specify this SMBIOS
information in the devicetree, without needing any board-specific
functionality.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d2cb7a22 04-Nov-2020 Simon Glass <sjg@chromium.org>

x86: Allow putting some tables in the bloblist

At present all tables are placed starting at address f0000 in memory, and
can be up to 64KB in size. If the tables are very large, this may not
provide enough space.

Also if the tables point to other tables (such as console log or a ramoops
area) then we must allocate other memory anyway.

The bloblist is a nice place to put these tables since it is contiguous,
which makes it easy to reserve this memory for linux using the 820 tables.

Add an option to put some of the tables in the bloblist. For SMBIOS and
ACPI, create suitable pointers from the f0000 region to the new location
of the tables.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
[bmeng: squashed in http://patchwork.ozlabs.org/project/uboot/patch/
20201105062407.1.I8091ad931cbbb5e3b6f6ababdf3f8d5db0d17bb9@changeid/]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# 415eab06 03-Nov-2020 Christian Gmeiner <christian.gmeiner@gmail.com>

smbios: add parsing API

Add a very simple API to be able to access SMBIOS strings
like vendor, model and bios version.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 72eda507 27-Oct-2020 Sean Anderson <seanga2@gmail.com>

lib: Add getopt

Some commands can get very unweildy if they have too many positional
arguments. Adding options makes them easier to read, remember, and
understand.

This implementation of getopt has been taken from barebox, which has had
option support for quite a while. I have made a few modifications to their
version, such as the removal of opterr in favor of a separate getopt_silent
function. In addition, I have moved all global variables into struct
getopt_context.

The getopt from barebox also re-orders the arguments passed to it so that
non-options are placed last. This allows users to specify options anywhere.
For example, `ls -l foo/ -R` would be re-ordered to `ls -l -R foo/` as
getopt parsed the options. However, this feature conflicts with the const
argv in cmd_tbl->cmd. This was originally added in 54841ab50c ("Make sure
that argv[] argument pointers are not modified."). The reason stated in
that commit is that hush requires argv to stay unmodified. Has this
situation changed? Barebox also uses hush, and does not have this problem.
Perhaps we could use their fix?

I have assigned maintenance of getopt to Simon Glass, as it is currently
only used by the log command. I would also be fine maintaining it.

Signed-off-by: Sean Anderson <seanga2@gmail.com>

# 26637e2e 12-Sep-2020 Simon Glass <sjg@chromium.org>

lib: Allow hexdump to be used in SPL

It is sometimes useful to output hex dumps in SPL. Add a config option to
allow this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# e87dfb05 05-Aug-2020 Andrii Anisov <andrii_anisov@epam.com>

lib: sscanf: add sscanf implementation

Port sscanf implementation from mini-os and introduce new
Kconfig option to enable it: CONFIG_SSCANF. Disable by default.

Signed-off-by: Andrii Anisov <andrii_anisov@epam.com>
Signed-off-by: Anastasiia Lukianenko <anastasiia_lukianenko@epam.com>
Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>

# 81014f73 30-Jul-2020 Joao Marcos Costa <joaomarcos.costa@bootlin.com>

include/u-boot, lib/zlib: add sources for zlib decompression

Add zlib (v1.2.11) uncompr() function to U-Boot. SquashFS depends on
this function to decompress data from a raw disk image. The actual
support for zlib into SquashFS sources will be added in a follow-up
commit.

Signed-off-by: Joao Marcos Costa <joaomarcos.costa@bootlin.com>

# 69be8fd1 03-Jun-2020 Marek Szyprowski <m.szyprowski@samsung.com>

powerpc: move ADDR_MAP to Kconfig

Move ADDR_MAP related config options from include/configs/*.h to the
proper place in lib/Kconfig. This has been done using
./tools/moveconfig.py and manual inspection of the generated changes.
This is a preparation to use ADDR_MAP helper on ARM 32bit Raspberry Pi4
board for mapping the PCIe XHCI MMIO, which is above the 4GiB identity
mapping limit.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# d16b38f4 15-Apr-2020 Reuben Dowle <reubendowle0@gmail.com>

Add support for SHA384 and SHA512

The current recommendation for best security practice from the US government
is to use SHA384 for TOP SECRET [1].

This patch adds support for SHA384 and SHA512 in the hash command, and also
allows FIT images to be hashed with these algorithms, and signed with
sha384,rsaXXXX and sha512,rsaXXXX

The SHA implementation is adapted from the linux kernel implementation.

[1] Commercial National Security Algorithm Suite
http://www.iad.gov/iad/programs/iad-initiatives/cnsa-suite.cfm

Signed-off-by: Reuben Dowle <reuben.dowle@4rf.com>

# 43e442a5 26-May-2020 Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

kconfig: fix some typos

Signed-off-by: Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

# eff5a547 22-May-2020 Michael Walle <michael@walle.cc>

cmd: zip: automatically pull in gzip()

Move the CONFIG_GZIP_COMPRESSED from a config.h macro to a Kconfig menu
item. It is not selectable by a user because there is no reason to do
so. Instead it will be automatically selected by the stuff which uses
gzip(), like the zip command.

Remove it from the config_whitelist.txt. Also remove
CONFIG_GZIP_COMPRESS_DEF_SZ as this was never used on any board. The
default seems to be sane, otherwise it should be added as a Kconfig
option.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8239be61 06-May-2020 Simon Glass <sjg@chromium.org>

lib: Allow MD5 to be enabled in SPL

At present the MD5 option cannot be enabled by board configs since it has
no Kconfig name. It is generally enabled, so long as FIT support is
present. But not all boards use FIT, particularly in SPL

Fix this and add an option for SPL as well. This allows board code to call
md5() even if FIT support is not enabled.

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

# 04cb3994 21-Apr-2020 Weijie Gao <weijie.gao@mediatek.com>

lib: enable lzma decompression support for SPL build

This patch enables LZMA decompression support for SPL build

Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>

# 2a2119e1 05-Mar-2020 Atish Patra <atish.patra@wdc.com>

lib: kconfig: Add option to set BZIP2 compression method

There is no way to select BZIP2 compression method.
Add it under library/compression config where all other
compression related configs are present.

Signed-off-by: Atish Patra <atish.patra@wdc.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 805b3cac 12-Feb-2020 Keerthy <j-keerthy@ti.com>

lib: elf: Move the generic elf loading/validating functions to lib

Move the generic elf loading/validating functions to lib/
so that they can be re-used and accessed by code existing
outside cmd.

While at it remove the duplicate static version of load_elf_image_phdr
under arch/arm/mach-imx/imx_bootaux.c.

Signed-off-by: Keerthy <j-keerthy@ti.com>
Suggested-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>

# 1611235b 19-Jan-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: Kconfig dependencies for pseudo-random library

drivers/rng/sandbox_rng.c requires rand() to be defined but configuration
option CONFIG_CONFIG_LIB_RAND selected in drivers/rng/Kconfig does not
exist.

test/lib/test_aes.c requires rand() to be defined.

Fix the selection criteria for choice "Pseudo-random library support type".

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 3c10dc95 06-Dec-2019 Simon Glass <sjg@chromium.org>

binman: Add a library to access binman entries

SPL and TPL can access information about binman entries using link-time
symbols but this is not available in U-Boot proper. Of course it could be
made available, but the intention is to just read the device tree.

Add support for this, so that U-Boot can locate entries.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# b4adf627 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: crypto: add x509 parser

Imported from linux kernel v5.3:
x509.asn1 without changes
x509_akid.asn1 without changes
x509_parser.h without changes
x509_cert_parser.c with changes marked as __UBOOT__
x509_public_key.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# a9b45e6e 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add oid registry utility

Imported from linux kernel v5.3:
build_OID_registry without changes
oid_registry.h without changes
oid_registry.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# ab8a0e06 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add asn1 decoder

Imported from linux kernel v5.3:
lib/asn1_decoder.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 2b12196d 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

cmd: add asn1_compiler

Imported from linux kernel v5.3:
asn1.h without changes
asn1_ber_bytecode.h without changes
asn1_decoder.h without changes
asn1_compiler.c without changes

This host command will be used to create a ASN1 parser, for example,
for pkcs7 messages or x509 certificates. More specifically, it will
generate *byte code* which will be interpreted by asn1 decoder library.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 05429b6c 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

rtc: move date.c from drivers/rtc/ to lib/

In the next commit, rtc_mktime(), for compatibility with linux, will be
implemented using rtc_mktime(), which is no longer drivers/rtc specific.
So move this file under lib/.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 37ef1774 10-Nov-2019 Thomas Hebb <tommyhebb@gmail.com>

Kconfig: disambiguate config names for tiny printf

27084c03d36a ("spl: Allow tiny printf() to be controlled in SPL and
TPL") split this option in two for TPL and SPL, but didn't change the
Kconfig names, making them hard to set quickly.

Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>

# 0d76afc0 27-Oct-2019 Simon Glass <sjg@chromium.org>

fdt: Add Kconfig options to control code size

For better or worse libfdt recent grew a lot of code that checks the
validity of the device tree in great detail. When using unsigned or
unverified data this makes things safer, but it does add to code size.

Add some controls to select the trade-off between safety and code size.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 27084c03 25-Sep-2019 Simon Glass <sjg@chromium.org>

spl: Allow tiny printf() to be controlled in SPL and TPL

At present there is only one control for this and it is used for both SPL
and TPL. But SPL might have a lot more space than TPL so the extra cost of
a full printf() might be acceptable.

Split the option into two, providing separate SPL and TPL controls. The
TPL setting defaults to the same as SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2a51e16b 07-Jun-2019 Tom Rini <trini@konsulko.com>

configs: Make USE_TINY_PRINTF depend on SPL||TPL and be default

The USE_TINY_PRINTF symbol only changes things within SPL and TPL
builds, so make it depend on that support. Next, make it default as
within these cases we should rarely have need of more advanced print
formats outside of the debug context.

To do this, in a few cases we need to correct our Kconfig dependencies
as we had cases of non-SPL targets select'ing this symbol. Finally, in
the case of a few boards we really do need the full printf
functionality.

Signed-off-by: Tom Rini <trini@konsulko.com>

# da0fb5fd 02-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: make call depth limit customizable

Up to now we had hard coded values for the call depth up to which trace
records are created: 200 for early tracing, 15 thereafter. UEFI
applications reach a call depth of 80 or above.

Provide customizing settings for the call trace depth limit and the early
call trace depth limit. Use the old values as defaults.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8509f22a 29-Apr-2019 Marek Behún <marek.behun@nic.cz>

lib: add Zstandard decompression support

Add the zstd library from Linux kernel (only decompression support).
There are minimal changes to build with U-Boot, otherwise the files are
identical to Linux commit dc35da16 from March 2018, the files had not
been touched since in kernel. Also SPDX lincese tags were added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 83a486b6 29-Apr-2019 Marek Behún <marek.behun@nic.cz>

lib: Add xxhash support

This adds the xxhash support from Linux. Files are almost identical to
those added to Linux in commit 5d240522 ("lib: Add xxhash module") (they
haven't been touched since in Linux). The only difference is to add some
includes to be compatible with U-Boot. Also SPDX lincese tags were
added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 5132361a 29-Apr-2019 Heiko Schocher <hs@denx.de>

lib: Kconfig: fix help text for GZIP

commit 95f4bbd581cf ("lib: fdt: Allow LZO and GZIP DT compression in U-Boot")

introduced Kconfig option for gzip in U-Boot, but help text
says gzip for SPL, which is wrong. Fix this.

Signed-off-by: Heiko Schocher <hs@denx.de>
Acked-by: Marek Vasut <marex@denx.de>

# 1c6eb075 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE_BUFFER_SIZE et al to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE_BUFFER_SIZE
CONFIG_TRACE_EARLY_SIZE
CONFIG_TRACE_EARLY
CONFIG_TRACE_EARLY_ADDR

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

# a24a78d7 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE

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

# 54969b40 21-Mar-2019 Thierry Reding <treding@nvidia.com>

fdtdec: Add Kconfig symbol for tests

Runtime tests are provided as a test_fdtdec command implementation. Add
a Kconfig symbol that allows this command to be built so that the tests
can be used.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 95f4bbd5 08-Mar-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

lib: fdt: Allow LZO and GZIP DT compression in U-Boot

Add required Kconfig symbols, Makefile bits and macro fixes in a
few places to support LZO and DT compression in U-Boot. This can
save a lot of space with multi-DTB fitImages.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>

# 6e705114 13-Jan-2019 Chris Packham <judge.packham@gmail.com>

lib: Kconfig: spelling fixes

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 048c6e89 06-Nov-2018 Simon Glass <sjg@chromium.org>

spl: lz4: Allow use of lz4 compression in SPL

In some cases U-Boot is compressed and it is useful to be able to
decompress it in SPL. Add a Kconfig and Makefile change to allow this.
Note that this does not actually implement decompression.

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

# 2895c4b7 15-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

kconfig: Introduce HAVE_ARCH_IOMAP

Introduce a new Kconfig option for architecture codes to control
whether it provides io{read,write}{8,16,32} I/O accessor functions.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5592a633 01-Oct-2018 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt in TPL

In some cases (e.g. sandbox with verified boot) it is useful to support
libfdt in TPL. Update the Kconfig to handle this.

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

# 6307896c 01-Oct-2018 Simon Glass <sjg@chromium.org>

tpm: Add support for SPL and TPL

At present the tpm can only be used in U-Boot proper. Updated it to work
in SPL and TPL also.

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

# ab948cd2 19-Jul-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

fdt_support: make FDT_FIXUP_PARTITIONS depend on CMD_MTDPARTS

fdt_fixup_mtdparts() calls mtdparts_init() and device_find(),
which are defined in cmd/mtdparts.c

The combination of FDT_FIXUP_PARTITIONS=y and CMD_MTDPARTS=n
emits the following link error:

common/fdt_support.c:903: undefined reference to `mtdparts_init'
common/fdt_support.c:914: undefined reference to `device_find'

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 3330584d 03-Jun-2018 Igor Opaniuk <igor.opaniuk@gmail.com>

avb2.0: integrate avb 2.0 into the build system

Integrate libavb into the build system. Introduce CONFIG_LIBAVB
build option.

Signed-off-by: Igor Opaniuk <igor.opaniuk@linaro.org>

# f8c987f8 05-Jun-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

lib: Add hexdump

Often during debugging session it's very interesting to see
what data we were dealing with. For example what we write or read
to/from memory or peripherals.

This change introduces functions that allow to dump binary
data with one simple function invocation like:
------------------->8----------------
print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, buf, len);
------------------->8----------------

which gives us the following:
------------------->8----------------
00000000: f2 b7 c9 88 62 61 75 64 72 61 74 65 3d 31 31 35 ....baudrate=115
00000010: 32 30 30 00 62 6f 6f 74 61 72 67 73 3d 63 6f 6e 200.bootargs=con
00000020: 73 6f 6c 65 3d 74 74 79 53 33 2c 31 31 35 32 30 sole=ttyS3,11520
00000030: 30 6e 38 00 62 6f 6f 74 64 65 6c 61 79 3d 33 00 0n8.bootdelay=3.
00000040: 62 6f 6f 74 66 69 6c 65 3d 75 49 6d 61 67 65 00 bootfile=uImage.
00000050: 66 64 74 63 6f 6e 74 72 6f 6c 61 64 64 72 3d 39 fdtcontroladdr=9
00000060: 66 66 62 31 62 61 30 00 6c 6f 61 64 61 64 64 72 ffb1ba0.loadaddr
00000070: 3d 30 78 38 32 30 30 30 30 30 30 00 73 74 64 65 =0x82000000.stde
00000080: 72 72 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 rr=serial0@e0022
00000090: 30 30 30 00 73 74 64 69 6e 3d 73 65 72 69 61 6c 000.stdin=serial
000000a0: 30 40 65 30 30 32 32 30 30 30 00 73 74 64 6f 75 0@e0022000.stdou
000000b0: 74 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 30 t=serial0@e00220
000000c0: 30 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00..............
...
------------------->8----------------

Source of hexdump.c was copied from Linux kernel v4.7-rc2.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Mario Six <mario.six@gdsys.cc>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Stefan Roese <sr@denx.de>

# c232d14d 29-May-2018 Alex Kiernan <alex.kiernan@gmail.com>

mmc: Separate "mmc swrite" from fastboot

Introduce CONFIG_IMAGE_SPARSE and CONFIG_CMD_MMC_SWRITE so the "mmc
swrite" command is separated from the fastboot code.

Move image-sparse from common to lib so it's clear it's library code.

Rename CONFIG_FASTBOOT_FLASH_FILLBUF_SIZE to CONFIG_IMAGE_SPARSE_FILLBUF_SIZE
and migrate it to Kconfig.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Acked-by: Jassi Brar <jaswinder.singh@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6417572e 08-May-2018 Tom Rini <trini@konsulko.com>

lib/Kconfig: Mark OF_LIBFDT_OVERLAY as depending on OF_LIBFDT

The overlay code is only useful when OF_LIBFDT is set, so mark it as
depending on that first.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 58a46f88 25-Apr-2018 Praneeth Bajjuri <praneeth@ti.com>

configs: TI: Enable FIT Library overlay support

Enable the FDT library overlay support for all TI SOC family.

Without this option, when Loading fdt from FIT image, the
following warning is seen.

"config with overlays but CONFIG_OF_LIBFDT_OVERLAY not set".

Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
Suggested-by: Andrew F.Davis <afd@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>

# 14ad44ab 18-Apr-2018 Alex Kiernan <alex.kiernan@gmail.com>

spl: Split sprintf, strto* from SPL serial in Kconfig

When SPL serial is disabled, callers who need sprintf or strtoul fail
because their inclusion is guarded by CONFIG_SPL_SERIAL_SUPPORT/
CONFIG_TPL_SERIAL_SUPPORT.

Split printf, sprintf and strto into their own entries and then select
all of them if SERIAL_SUPPORT is enabled to match the current behaviour.

Include panic.o unconditionally as it can be called from anywhere which
uses BUG_ON().

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>

# e294ba06 04-Apr-2018 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-sunxi

Signed-off-by: Tom Rini <trini@konsulko.com>


# d14db11d 03-Apr-2018 Andre Przywara <andre.przywara@arm.com>

sunxi: revert disabling of features

In January some commits were introduced to mitigate the U-Boot image
size issues we encountered on sunxi builds.
Now with the MMC environment removed we can bring them back, as we
practically don't have a size limit anymore.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 32ce6179 13-Mar-2018 Bryan O'Donoghue <bryan.odonoghue@linaro.org>

optee: Add lib entries for sharing OPTEE code across ports

This patch adds code to lib to enable sharing of useful OPTEE code between
board-ports and architectures. The code on lib/optee/optee.c comes from the
TI omap2 port. Eventually the OMAP2 code will be patched to include the
shared code. The intention here is to add more useful OPTEE specific code
as more functionality gets added.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Cc: Harinarayan Bhatta <harinarayan@ti.com>
Cc: Andrew F. Davis <afd@ti.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Kever Yang <kever.yang@rock-chips.com>
Cc: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Cc: Peng Fan <peng.fan@nxp.com>
Tested-by: Peng Fan <peng.fan@nxp.com>

# 36c1877c 06-Feb-2018 Faiz Abbas <faiz_abbas@ti.com>

lib: Kconfig: Move DYNAMIC_CRC_TABLE to Kconfig

Add CONFIG prefix to DYNAMIC_CRC_TABLE and implement it in
Kconfig.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>

# a451bc27 05-Feb-2018 Adam Ford <aford173@gmail.com>

Convert LIB_UUID to Kconfig

config_fallback.h has some logic that checks a variety of options
and selects LIB_UUID if it hasn't already been selected. This
will all LIB_UUID in Kconfig and select this option for the list
of options to allow us to remove the logic from fallbacks

Signed-off-by: Adam Ford <aford173@gmail.com>

# a5a37567 06-Feb-2018 Adam Ford <aford173@gmail.com>

Convert CONFIG LIB_HW_RAND to Kconfig

config_fallbacks.h had some logic to automatically select
LIB_RAND if RANDOM_UUID or CMD_UUID were set if LIB_HW_RAND wasn't
already selected. By migrating LIB_HW_RAND to Kconfig, we can
remove this check from config_fallbacks.h and put it into Kconfig

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
[trini: Turn into a choice, add NET_RANDOM_ETHADDR]
Signed-off-by: Tom Rini <trini@konsulko.com>

# acd4d334 16-Jan-2018 Maxime Ripard <maxime.ripard@free-electrons.com>

net: regex: Disable by default on sunXi

The sunXi arm64 build has overflown, leading to the main U-boot binary
overwriting the environment when flashing the new image, or even worse,
overwriting itself when we're calling saveenv.

Disable this option that is not critical until we can adress the issue
properly.

Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 7e3caa81 03-Dec-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

Move CONFIG_PANIC_HANG to Kconfig

Freescale (NXP) boards have lots of defconfig files per board.
I used "imply PANIC_HANG" for them.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# da5337a6 08-Nov-2017 Nandor Han <nandor.han@ge.com>

rtc: add support for s35392a

Add support for S35392A RTC. The driver supports both U-Boot driver
models.

Signed-off-by: Nandor Han <nandor.han@ge.com>
Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
Cc: Heiko Schocher <hs@denx.de>

# f52bdf4b 14-Sep-2017 Jean-Jacques Hiblot <jjhiblot@ti.com>

lib: allow building lzo for the SPL

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 85d8bf57 03-Sep-2017 Marek Behún <marek.behun@nic.cz>

lib: Add CRC32-C

This is needed for BTRFS.

Signed-off-by: Marek Behun <marek.behun@nic.cz>

create mode 100644 lib/crc32c.c

# 7264f292 15-Aug-2017 York Sun <york.sun@nxp.com>

spl: fit: Eanble GZIP support for image decompression

Add Kconfig option SPL_GZIP and SPL_ZLIB to enable gunzip support for
SPL boot, eg. falcon boot compressed kernel image.

Signed-off-by: York Sun <york.sun@nxp.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6ef2f901 11-Aug-2017 Adam Ford <aford173@gmail.com>

Convert CONFIG_BCH to Kconfig

This converts the following to Kconfig:
CONFIG_BCH

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1a7ba1d 18-Aug-2017 Anatolij Gustschin <agust@denx.de>

Fix 'notes' typos

s/notes/nodes

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 96b9082c 03-Aug-2017 Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

rockchip: rk3188: rock: adjust for SPL/TPL split

With the changes to split SPL/TPL for the RK3368, I apparently missed
some needed adjustments to the RK3188 Kconfig and rock_defconfig.

This fixes build-issues for the rock board after applying the RK3368
enablement (and SPL/TPL) set that resulted from TPL_SERIAL_SUPPORT,
TPL_ROCKCHIP_BACK_TO_BROM and TPL_TINY_MEMSET being separate symbols
now.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d56b4b19 22-Jul-2017 Tom Rini <trini@konsulko.com>

configs: Migrate RBTREE, LZO, CMD_MTDPARTS, CMD_UBI and CMD_UBIFS

The above CONFIG options are in Kconfig, and now have correct depends and
inter-dependencies. Migrate these to configs/ from include/configs/. In the
case of CMD_UBIFS also change it to be a default y if CMD_UBI.

Signed-off-by: Tom Rini <trini@konsulko.com>

# aed998aa 17-May-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_LZMA to Kconfig

This converts the following to Kconfig:
CONFIG_LZMA

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

# b1a873df 26-Apr-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_CMD_AES et al to Kconfig

This converts the following to Kconfig:
CONFIG_CMD_AES
CONFIG_AES

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Add select AES to CMD_AES]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 173aafbf 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

cmd: Expose a Kconfig option to enable UBIFS commands

Create a new Kconfig entry to allow CMD_UBIFS selection from Kconfig and
add an hidden LZO option that can be selected by CMD_UBIFS.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>

# aa049152 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

mtd: ubi: Select RBTREE option from MTD_UBI Kconfig entry

Expose the RBTREE feature through Kconfig and select this option from the
MTD_UBI option.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>
[Rebased on master]
Signed-off-by: Jagan Teki <jagan@openedev.com>

# ab4458bd 02-Apr-2017 Simon Glass <sjg@chromium.org>

string: Provide a slimmed-down memset()

Most of the time the optimised memset() is what we want. For extreme
situations such as TPL it may be too large. For example on the 'rock'
board, using a simple loop saves a useful 48 bytes. With gcc 4.9 and
the rodata bug, this patch is enough to reduce the TPL image below the
limit.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>

# bea79d7d 14-Mar-2017 Andre Przywara <andre.przywara@arm.com>

Kconfig: introduce md5sum command selection

So far CONFIG_MD5SUM would need to be set by a board's include file.
Since the command is really generic, move it over to Kconfig to allow
it to be defined by either a board's defconfig, menuconfig or some
config snippet merged via mergeconfig.sh.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e663b350 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

smbios: Expose in efi_loader as table

We can pass SMBIOS easily as EFI configuration table to an EFI payload. This
patch adds enablement for that case.

While at it, we also enable SMBIOS generation for ARM systems, since they support
EFI_LOADER.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4b6dddc2 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

x86: Move smbios generation into arch independent directory

We will need the SMBIOS generation function on ARM as well going forward,
so let's move it into a non arch specific location.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# ebf7fff2 05-Oct-2016 Heiko Schocher <hs@denx.de>

spl: move FDT_FIXUP_PARTITIONS to Kconfig

Move FDT_FIXUP_PARTITIONS to Kconfig and cleanup existing
uses.

Signed-off-by: Heiko Schocher <hs@denx.de>

# ddf67f71 05-Jul-2016 Maxime Ripard <maxime.ripard@free-electrons.com>

libfdt: Add overlay application function

The device tree overlays are a good way to deal with user-modifyable
boards or boards with some kind of an expansion mechanism where we can
easily plug new board in (like the BBB, the Raspberry Pi or the CHIP).

Add a new function to merge overlays with a base device tree.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>

# 91b86e21 26-May-2016 Marek Vasut <marex@denx.de>

lib: Enable private libgcc by default

This patch decouples U-Boot binary from the toolchain on systems where
private libgcc is available. Instead of pulling in functions provided
by the libgcc from the toolchain, U-Boot will use it's own set of libgcc
functions. These functions are usually imported from Linux kernel, which
also uses it's own libgcc functions instead of the ones provided by the
toolchain.

This patch solves a rather common problem. The toolchain can usually
generate code for many variants of target architecture and often even
different endianness. The libgcc on the other hand is usually compiled
for one particular configuration and the functions provided by it may
or may not be suited for use in U-Boot. This can manifest in two ways,
either the U-Boot fails to compile altogether and linker will complain
or, in the much worse case, the resulting U-Boot will build, but will
misbehave in very subtle and hard to debug ways.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 67976306 30-Mar-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

cosmetic: Fix typos "privide"

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# ed980b8c 03-Mar-2016 Alexander Graf <agraf@csgraf.de>

efi_loader: hook up in build environment

Now that we have all the bits and pieces ready for EFI payload loading
support, hook them up in Makefiles and KConfigs so that we can build.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
[trini: Enable only when we of OF_LIBFDT, disable on kwb and colibri_pxa270]
Signed-off-by: Tom Rini <trini@konsulko.com>

# aa34fbc0 22-Feb-2016 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt to be used in SPL

Add an option to enable libfdt in SPL. This can be useful when decoding
FIT files in SPL.

We need to make sure this option is not enabled in SPL by this change.
Also this option needs to be enabled in host builds. Si add a new
IMAGE_USE_LIBFDT #define which can be used in files that are built on the
host but must also build for U-Boot and SPL.

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

# 69e173eb 22-Feb-2016 Simon Glass <sjg@chromium.org>

Move CONFIG_OF_LIBFDT to Kconfig

Move this option to Kconfig and tidy up existing boards.

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

# a187559e 05-Feb-2016 Bin Meng <bmeng.cn@gmail.com>

Use correct spelling of "U-Boot"

Correct spelling of "U-Boot" shall be used in all written text
(documentation, comments in source files etc.).

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Minkyu Kang <mk7.kang@samsung.com>

# 947c626d 14-Jan-2016 Tom Rini <trini@konsulko.com>

vsprintf.c: Always enable CONFIG_SYS_VSNPRINTF

Enabling this function always removes some class of string saftey issues.
The size change here in general is about 400 bytes and this seems a reasonable
trade-off.

Cc: Peng Fan <peng.fan@nxp.com>
Cc: Peter Robinson <pbrobinson@gmail.com>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Adrian Alonso <aalonso@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 7d9cde10 22-Nov-2015 Stefan Roese <sr@denx.de>

lib/tiny-printf.c: Add tiny printf function for space limited environments

This patch adds a small printf() version that supports all basic formats.
Its intented to be used in U-Boot SPL versions on platforms with very
limited internal RAM sizes.

To enable it, just define CONFIG_USE_TINY_PRINTF in your defconfig. This
will result in the SPL using this tiny function and the main U-Boot
still using the full-blown printf() function.

This code was copied from:
http://www.sparetimelabs.com/printfrevisited
With mostly only coding style related changes so that its checkpatch
clean.

The size reduction is about 2.5KiB. Here a comparison for the db-mv784mp-gp
(Marvell AXP) SPL:

Without this patch:
58963 18536 1928 79427 13643 ./spl/u-boot-spl

With this patch:
56542 18536 1956 77034 12cea ./spl/u-boot-spl

Note:
To make it possible to compile tiny-printf.c instead of vsprintf.c when
CONFIG_USE_TINY_PRINTF is defined, the functions printf() and vprintf() are
moved from common/console.c into vsprintf.c in this patch.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>

# 2419cd16 03-Oct-2015 Simon Glass <sjg@chromium.org>

dm: tpm: Drop CONFIG_DM_TPM

Now that all TPM drivers use driver model, we can drop the special driver
model CONFIG option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>

# 027b728d 06-Oct-2015 Julius Werner <jwerner@chromium.org>

Add support for LZ4 decompression algorithm

This patch adds support for LZ4-compressed FIT image contents. This
algorithm has a slightly worse compression ration than LZO while being
nearly twice as fast to decompress. When loading images from a fast
storage medium this usually results in a boot time win.

Sandbox-tested only since I don't have a U-Boot development system set
up right now. The code was imported unchanged from coreboot where it's
proven to work, though. I'm mostly interested in getting this recognized
by mkImage for use in a downstream project.

Signed-off-by: Julius Werner <jwerner@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# a7d660bc 22-Aug-2015 Simon Glass <sjg@chromium.org>

tpm: Add Kconfig options for TPMs

Add new Kconfig options for TPMs in preparation for moving boards to use
Kconfig for TPM configuration.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 867a6ac8 31-Jul-2015 Simon Glass <sjg@chromium.org>

efi: Add start-up library code

When running as an EFI application, U-Boot must request memory from EFI,
and provide access to the boot services U-Boot needs.

Add library code to perform these tasks. This includes efi_main() which is
the entry point from EFI. U-Boot is built as a shared library.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d1389403 23-Jun-2015 Simon Glass <sjg@chromium.org>

Add a dhrystone benchmark command

Drystone provides a convenient sanity check that the CPU is running at full
speed. Add this as a command which can be enabled as needed.

Note: I investigated using Coremark for this but there was a license
agreement and I could not work out if it was GPL-compatible.

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

# f7848d90 22-Jun-2015 Joe Hershberger <joe.hershberger@ni.com>

Allow CONFIG_REGEX to be disabled when CONFIG_NET

Instead of selecting REGEX when NET is enabled, make it the default, but
allow boards that are tiny to disable it and lose functionality on all
but the first Ethernet adapter.

cm-bf548, bf538f-ezkit, and bf533-stamp need this. None appear to have
more than one Ethernet interface.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# 3850dbe8 11-Jun-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

blackfin: fix undefined reference to srand and rand

Commit 9ba9e85f3f1c (net: Fix NET_RANDOM_ETHADDR dependencies)
accidentally dropped CONFIG_LIB_RAND defines for 14 Blackfin boards.

Prior to that commit, those boards defined CONFIG_LIB_RAND, but not
CONFIG_NET_RANDOM_ETHADDR. So, commit 9ba9e85f3f1c should not have
touched them, but in fact it ripped CONFIG_LIB_RAND off from all the
header files, which caused undefined reference to srand and rand.
CONFIG_LIB_RAND=y must be revived for such boards.

BTW, this commit indeed makes it better, but even with this fix,
three boards (bf533-stamp, bf538f-ezkit, cm-bf548) still can not
build due to region 'ram' overflowed error. This was cause by
commit 6eed3786c68c (net: Move the CMD_NET config to defconfigs)
because CMD_NET selects NET, and NET selects REGEX. Eventually,
some boards were newly enabled with CONFIG_REGEX, increasing the
memory footprint. A patch is expected to fix the build error.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 9ba9e85f 25-May-2015 Michal Simek <michal.simek@xilinx.com>

net: Fix NET_RANDOM_ETHADDR dependencies

NET_RANDOM_ETHADDR depends on lib/rand.c. This patch adds dependency to
Kconfig to ensure that library is also compiled.

Remove the definitions from Blackfin boards' include/configs.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 6501ff62 20-Apr-2015 Przemyslaw Marczak <p.marczak@samsung.com>

lib: Kconfig: add entry for errno_str() function

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1a60650c 21-Apr-2015 Joe Hershberger <joe.hershberger@ni.com>

kconfig: Move REGEX to Kconfig

Having this as a Kconfig allows it to be a dependent feature.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8156345d 06-Mar-2015 Simon Glass <sjg@chromium.org>

sandbox: Move CONFIG_SYS_VSNPRINTF to Kconfig

Move this over to Kconfig and tidy up.

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

# 94e3c8c4 19-Feb-2015 gaurav rana <gaurav.rana@freescale.com>

crypto/fsl - Add progressive hashing support using hardware acceleration.

Currently only normal hashing is supported using hardware acceleration.
Added support for progressive hashing using hardware.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
Signed-off-by: Gaurav Rana <gaurav.rana@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>

# d9f23c7f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

lib/rsa: Add Kconfig for devices supporting RSA Modular Exponentiation

Kconfig option added for devices which support RSA Verification.
1. RSA_SOFTWARE_EXP
Enables driver for supporting RSA Modular Exponentiation in Software
2. RSA_FREESCALE_EXP
Enables driver for supporting RSA Modular Exponentiation using Freescale specific
driver

The above drivers use RSA uclass

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
(Removed duplicate line in Kconfig comment)

Change-Id: I7663c4d5350e2bfc3dfa2696f70ef777d6ccc6f6

# c4beb22f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

FIT: Modify option FIT_SIGNATURE in Kconfig

For FIT signature based approach to work, RSA library needs to be selected.
The FIT_SIGNATURE option in Kconfig is modified to automatically select RSA.
Selecting RSA compiles the RSA library required for image verification.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 45ccec8f 23-Oct-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_USE_PRIVATE_LIBGCC to Kconfig

The private libgcc is supported only on ARM, MIPS, PowerPC, SH, x86.
Those architectures should "select" HAVE_PRIVATE_LIBGCC and
CONFIG_USE_PRIVATE_LIBGCC should depend on it.

Currently, this option is enabled on Tegra boards and x86 architecture.
Move the definition from header files to Kconfig.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Tested-by: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: Tom Warren <twarren@nvidia.com>

# 8c688bc4 23-Oct-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_SYS_HZ to lib/Kconfig

CONFIG_SYS_HZ is always defined as 1000 in config_fallbacks.h
(but some boards still have redundant definitions).

This commit moves the definition and the document in README to
Kconfig. Since lib/Kconfig can assure that CONFIG_SYS_HZ is 1000,
the sanity check in lib/time.c should be removed.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Reviewed-by: Marek Vasut <marex@denx.de>

# b0928da6 16-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED to Kconfig

If this option is enabled, the objects under lib/ directory
are compiled with speed optimization, not size optimization.
(Currently, only used by some Blackfin boards.)

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# ed36323f 16-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: add blank Kconfig files

This would be useful to start moving various config options.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# a479f103 16-Feb-2021 Joel Stanley <joel@jms.id.au>

hash: Allow for SHA512 hardware implementations

Similar to support for SHA1 and SHA256, allow the use of hardware hashing
engine by enabling the algorithm and setting CONFIG_SHA_HW_ACCEL /
CONFIG_SHA_PROG_HW_ACCEL.

Signed-off-by: Joel Stanley <joel@jms.id.au>

# f2c1442e 14-Mar-2021 Simon Glass <sjg@chromium.org>

bloblist: Make BLOBLIST_TABLES depend on BLOBLIST

Add an extra condition here since we cannot put x86 tables in a bloblist
when bloblists are not supported.

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

# e0103158 25-Feb-2021 Bin Meng <bmeng.cn@gmail.com>

lib: kconfig: Mention CONFIG_ADDR_MAP limitation in the help

Mention that CONFIG_ADDR_MAP only works in the post-relocation phase.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>

# 56e7257c 03-Feb-2021 Bin Meng <bmeng.cn@gmail.com>

lib: Fix BINMAN_FDT dependency

lib/binman.c references the following 3 ofnode APIs:
ofnode_first_subnode(), ofnode_path() and ofnode_read_bool().

These APIs get built only when DM is on. Fix the dependency then.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 59e4e391 18-Jan-2021 Tom Rini <trini@konsulko.com>

Merge https://gitlab.denx.de/u-boot/custodians/u-boot-riscv

- Update qemu-riscv.rst build instructions.
- Add support for SPI on Kendryte K210.
- Add Microchip PolarFire SoC Icicle Kit support.
- Add support for an early timer.
- Select TIMER_EARLY to avoid infinite recursion for Trace.


# a80f8513 17-Jan-2021 Pragnesh Patel <pragnesh.patel@sifive.com>

trace: select TIMER_EARLY to avoid infinite recursion

When tracing functions is enabled this adds calls to
__cyg_profile_func_enter() and __cyg_profile_func_exit() to the traced
functions.

__cyg_profile_func_enter() and __cyg_profile_func_exit() invoke
timer_get_us() to record the entry and exit time.

initr_dm() will make gd->dm_root = NULL and gd->timer = NULL, so
timer_get_us() -> get_ticks() -> dm_timer_init() will lead to an
indefinite recursion.

So select TIMER_EARLY when tracing got enabled.

Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Rick Chen <rick@andestech.com>

# 6205bbb1 04-Jan-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lib: cosmetic update of CONFIG_LIB_ELF description

Change 2 typo error in CONFIG_LIB_ELF description:
- Supoort => Support
- fir => for

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c589132a 02-Dec-2020 Aswath Govindraju <a-govindraju@ti.com>

fdt: Use phandle to distinguish DT nodes with same name

While assigning the sequence number to subsystem instances by reading the
aliases property, only DT nodes names are compared and not the complete
path. This causes a problem when there are two DT nodes with same name but
have different paths.

In arch/arm/dts/k3-am65-main.dtsi there are two USB controllers with the
same device tree node name but different path. When aliases are defined for
these USB controllers then fdtdec_get_alias_seq() fails to pick the correct
instance for a given index.

fdt_path_offset() function is slow and this would effect the U-Boot
startup. To avert the time penalty on all boards, apply this extra check
only when required by using a config option.

Fix it by comparing the phandles of DT nodes after the node names match,
under a config option.

Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Fix whitespace error in Kconfig:
Signed-off-by: Simon Glass <sjg@chromium.org>

# 28cef9ca 19-Nov-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

fs: fat: create correct short names

The current function set_name() used to create short names has the
following deficiencies resolved by this patch:

* Long names (e.g. FOO.TXT) are stored even if a short name is enough.
* Short names with spaces are created, e.g. "A ~1.TXT".
* Short names with illegal characters are created, e.g. "FOO++BAR".
* Debug output does not not consider that the short file name has no
concluding '\0'.

The solution for the following bug is split of into a separate patch:

* Short file names must be unique.

This patch only provides the loop over possible short file names.

Fixes: c30a15e590c ("FAT: Add FAT write feature")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# e4f8e543 05-Nov-2020 Simon Glass <sjg@chromium.org>

smbios: Drop the unused Kconfig options

Now that we can use devicetree to specify this information, drop the old
CONFIG options.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 44c74bdd 05-Nov-2020 Simon Glass <sjg@chromium.org>

sysinfo: Provide a default driver to set SMBIOS values

Some boards want to specify the manufacturer or product name but do not
need to have their own sysinfo driver.

Add a default driver which provides a way to specify this SMBIOS
information in the devicetree, without needing any board-specific
functionality.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d2cb7a22 04-Nov-2020 Simon Glass <sjg@chromium.org>

x86: Allow putting some tables in the bloblist

At present all tables are placed starting at address f0000 in memory, and
can be up to 64KB in size. If the tables are very large, this may not
provide enough space.

Also if the tables point to other tables (such as console log or a ramoops
area) then we must allocate other memory anyway.

The bloblist is a nice place to put these tables since it is contiguous,
which makes it easy to reserve this memory for linux using the 820 tables.

Add an option to put some of the tables in the bloblist. For SMBIOS and
ACPI, create suitable pointers from the f0000 region to the new location
of the tables.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
[bmeng: squashed in http://patchwork.ozlabs.org/project/uboot/patch/
20201105062407.1.I8091ad931cbbb5e3b6f6ababdf3f8d5db0d17bb9@changeid/]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# 415eab06 03-Nov-2020 Christian Gmeiner <christian.gmeiner@gmail.com>

smbios: add parsing API

Add a very simple API to be able to access SMBIOS strings
like vendor, model and bios version.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 72eda507 27-Oct-2020 Sean Anderson <seanga2@gmail.com>

lib: Add getopt

Some commands can get very unweildy if they have too many positional
arguments. Adding options makes them easier to read, remember, and
understand.

This implementation of getopt has been taken from barebox, which has had
option support for quite a while. I have made a few modifications to their
version, such as the removal of opterr in favor of a separate getopt_silent
function. In addition, I have moved all global variables into struct
getopt_context.

The getopt from barebox also re-orders the arguments passed to it so that
non-options are placed last. This allows users to specify options anywhere.
For example, `ls -l foo/ -R` would be re-ordered to `ls -l -R foo/` as
getopt parsed the options. However, this feature conflicts with the const
argv in cmd_tbl->cmd. This was originally added in 54841ab50c ("Make sure
that argv[] argument pointers are not modified."). The reason stated in
that commit is that hush requires argv to stay unmodified. Has this
situation changed? Barebox also uses hush, and does not have this problem.
Perhaps we could use their fix?

I have assigned maintenance of getopt to Simon Glass, as it is currently
only used by the log command. I would also be fine maintaining it.

Signed-off-by: Sean Anderson <seanga2@gmail.com>

# 26637e2e 12-Sep-2020 Simon Glass <sjg@chromium.org>

lib: Allow hexdump to be used in SPL

It is sometimes useful to output hex dumps in SPL. Add a config option to
allow this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# e87dfb05 05-Aug-2020 Andrii Anisov <andrii_anisov@epam.com>

lib: sscanf: add sscanf implementation

Port sscanf implementation from mini-os and introduce new
Kconfig option to enable it: CONFIG_SSCANF. Disable by default.

Signed-off-by: Andrii Anisov <andrii_anisov@epam.com>
Signed-off-by: Anastasiia Lukianenko <anastasiia_lukianenko@epam.com>
Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>

# 81014f73 30-Jul-2020 Joao Marcos Costa <joaomarcos.costa@bootlin.com>

include/u-boot, lib/zlib: add sources for zlib decompression

Add zlib (v1.2.11) uncompr() function to U-Boot. SquashFS depends on
this function to decompress data from a raw disk image. The actual
support for zlib into SquashFS sources will be added in a follow-up
commit.

Signed-off-by: Joao Marcos Costa <joaomarcos.costa@bootlin.com>

# 69be8fd1 03-Jun-2020 Marek Szyprowski <m.szyprowski@samsung.com>

powerpc: move ADDR_MAP to Kconfig

Move ADDR_MAP related config options from include/configs/*.h to the
proper place in lib/Kconfig. This has been done using
./tools/moveconfig.py and manual inspection of the generated changes.
This is a preparation to use ADDR_MAP helper on ARM 32bit Raspberry Pi4
board for mapping the PCIe XHCI MMIO, which is above the 4GiB identity
mapping limit.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# d16b38f4 15-Apr-2020 Reuben Dowle <reubendowle0@gmail.com>

Add support for SHA384 and SHA512

The current recommendation for best security practice from the US government
is to use SHA384 for TOP SECRET [1].

This patch adds support for SHA384 and SHA512 in the hash command, and also
allows FIT images to be hashed with these algorithms, and signed with
sha384,rsaXXXX and sha512,rsaXXXX

The SHA implementation is adapted from the linux kernel implementation.

[1] Commercial National Security Algorithm Suite
http://www.iad.gov/iad/programs/iad-initiatives/cnsa-suite.cfm

Signed-off-by: Reuben Dowle <reuben.dowle@4rf.com>

# 43e442a5 26-May-2020 Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

kconfig: fix some typos

Signed-off-by: Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

# eff5a547 22-May-2020 Michael Walle <michael@walle.cc>

cmd: zip: automatically pull in gzip()

Move the CONFIG_GZIP_COMPRESSED from a config.h macro to a Kconfig menu
item. It is not selectable by a user because there is no reason to do
so. Instead it will be automatically selected by the stuff which uses
gzip(), like the zip command.

Remove it from the config_whitelist.txt. Also remove
CONFIG_GZIP_COMPRESS_DEF_SZ as this was never used on any board. The
default seems to be sane, otherwise it should be added as a Kconfig
option.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8239be61 06-May-2020 Simon Glass <sjg@chromium.org>

lib: Allow MD5 to be enabled in SPL

At present the MD5 option cannot be enabled by board configs since it has
no Kconfig name. It is generally enabled, so long as FIT support is
present. But not all boards use FIT, particularly in SPL

Fix this and add an option for SPL as well. This allows board code to call
md5() even if FIT support is not enabled.

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

# 04cb3994 21-Apr-2020 Weijie Gao <weijie.gao@mediatek.com>

lib: enable lzma decompression support for SPL build

This patch enables LZMA decompression support for SPL build

Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>

# 2a2119e1 05-Mar-2020 Atish Patra <atish.patra@wdc.com>

lib: kconfig: Add option to set BZIP2 compression method

There is no way to select BZIP2 compression method.
Add it under library/compression config where all other
compression related configs are present.

Signed-off-by: Atish Patra <atish.patra@wdc.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 805b3cac 12-Feb-2020 Keerthy <j-keerthy@ti.com>

lib: elf: Move the generic elf loading/validating functions to lib

Move the generic elf loading/validating functions to lib/
so that they can be re-used and accessed by code existing
outside cmd.

While at it remove the duplicate static version of load_elf_image_phdr
under arch/arm/mach-imx/imx_bootaux.c.

Signed-off-by: Keerthy <j-keerthy@ti.com>
Suggested-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>

# 1611235b 19-Jan-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: Kconfig dependencies for pseudo-random library

drivers/rng/sandbox_rng.c requires rand() to be defined but configuration
option CONFIG_CONFIG_LIB_RAND selected in drivers/rng/Kconfig does not
exist.

test/lib/test_aes.c requires rand() to be defined.

Fix the selection criteria for choice "Pseudo-random library support type".

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 3c10dc95 06-Dec-2019 Simon Glass <sjg@chromium.org>

binman: Add a library to access binman entries

SPL and TPL can access information about binman entries using link-time
symbols but this is not available in U-Boot proper. Of course it could be
made available, but the intention is to just read the device tree.

Add support for this, so that U-Boot can locate entries.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# b4adf627 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: crypto: add x509 parser

Imported from linux kernel v5.3:
x509.asn1 without changes
x509_akid.asn1 without changes
x509_parser.h without changes
x509_cert_parser.c with changes marked as __UBOOT__
x509_public_key.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# a9b45e6e 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add oid registry utility

Imported from linux kernel v5.3:
build_OID_registry without changes
oid_registry.h without changes
oid_registry.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# ab8a0e06 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add asn1 decoder

Imported from linux kernel v5.3:
lib/asn1_decoder.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 2b12196d 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

cmd: add asn1_compiler

Imported from linux kernel v5.3:
asn1.h without changes
asn1_ber_bytecode.h without changes
asn1_decoder.h without changes
asn1_compiler.c without changes

This host command will be used to create a ASN1 parser, for example,
for pkcs7 messages or x509 certificates. More specifically, it will
generate *byte code* which will be interpreted by asn1 decoder library.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 05429b6c 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

rtc: move date.c from drivers/rtc/ to lib/

In the next commit, rtc_mktime(), for compatibility with linux, will be
implemented using rtc_mktime(), which is no longer drivers/rtc specific.
So move this file under lib/.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 37ef1774 10-Nov-2019 Thomas Hebb <tommyhebb@gmail.com>

Kconfig: disambiguate config names for tiny printf

27084c03d36a ("spl: Allow tiny printf() to be controlled in SPL and
TPL") split this option in two for TPL and SPL, but didn't change the
Kconfig names, making them hard to set quickly.

Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>

# 0d76afc0 27-Oct-2019 Simon Glass <sjg@chromium.org>

fdt: Add Kconfig options to control code size

For better or worse libfdt recent grew a lot of code that checks the
validity of the device tree in great detail. When using unsigned or
unverified data this makes things safer, but it does add to code size.

Add some controls to select the trade-off between safety and code size.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 27084c03 25-Sep-2019 Simon Glass <sjg@chromium.org>

spl: Allow tiny printf() to be controlled in SPL and TPL

At present there is only one control for this and it is used for both SPL
and TPL. But SPL might have a lot more space than TPL so the extra cost of
a full printf() might be acceptable.

Split the option into two, providing separate SPL and TPL controls. The
TPL setting defaults to the same as SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2a51e16b 07-Jun-2019 Tom Rini <trini@konsulko.com>

configs: Make USE_TINY_PRINTF depend on SPL||TPL and be default

The USE_TINY_PRINTF symbol only changes things within SPL and TPL
builds, so make it depend on that support. Next, make it default as
within these cases we should rarely have need of more advanced print
formats outside of the debug context.

To do this, in a few cases we need to correct our Kconfig dependencies
as we had cases of non-SPL targets select'ing this symbol. Finally, in
the case of a few boards we really do need the full printf
functionality.

Signed-off-by: Tom Rini <trini@konsulko.com>

# da0fb5fd 02-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: make call depth limit customizable

Up to now we had hard coded values for the call depth up to which trace
records are created: 200 for early tracing, 15 thereafter. UEFI
applications reach a call depth of 80 or above.

Provide customizing settings for the call trace depth limit and the early
call trace depth limit. Use the old values as defaults.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8509f22a 29-Apr-2019 Marek Behún <marek.behun@nic.cz>

lib: add Zstandard decompression support

Add the zstd library from Linux kernel (only decompression support).
There are minimal changes to build with U-Boot, otherwise the files are
identical to Linux commit dc35da16 from March 2018, the files had not
been touched since in kernel. Also SPDX lincese tags were added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 83a486b6 29-Apr-2019 Marek Behún <marek.behun@nic.cz>

lib: Add xxhash support

This adds the xxhash support from Linux. Files are almost identical to
those added to Linux in commit 5d240522 ("lib: Add xxhash module") (they
haven't been touched since in Linux). The only difference is to add some
includes to be compatible with U-Boot. Also SPDX lincese tags were
added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 5132361a 29-Apr-2019 Heiko Schocher <hs@denx.de>

lib: Kconfig: fix help text for GZIP

commit 95f4bbd581cf ("lib: fdt: Allow LZO and GZIP DT compression in U-Boot")

introduced Kconfig option for gzip in U-Boot, but help text
says gzip for SPL, which is wrong. Fix this.

Signed-off-by: Heiko Schocher <hs@denx.de>
Acked-by: Marek Vasut <marex@denx.de>

# 1c6eb075 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE_BUFFER_SIZE et al to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE_BUFFER_SIZE
CONFIG_TRACE_EARLY_SIZE
CONFIG_TRACE_EARLY
CONFIG_TRACE_EARLY_ADDR

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

# a24a78d7 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE

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

# 54969b40 21-Mar-2019 Thierry Reding <treding@nvidia.com>

fdtdec: Add Kconfig symbol for tests

Runtime tests are provided as a test_fdtdec command implementation. Add
a Kconfig symbol that allows this command to be built so that the tests
can be used.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 95f4bbd5 08-Mar-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

lib: fdt: Allow LZO and GZIP DT compression in U-Boot

Add required Kconfig symbols, Makefile bits and macro fixes in a
few places to support LZO and DT compression in U-Boot. This can
save a lot of space with multi-DTB fitImages.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>

# 6e705114 13-Jan-2019 Chris Packham <judge.packham@gmail.com>

lib: Kconfig: spelling fixes

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 048c6e89 06-Nov-2018 Simon Glass <sjg@chromium.org>

spl: lz4: Allow use of lz4 compression in SPL

In some cases U-Boot is compressed and it is useful to be able to
decompress it in SPL. Add a Kconfig and Makefile change to allow this.
Note that this does not actually implement decompression.

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

# 2895c4b7 15-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

kconfig: Introduce HAVE_ARCH_IOMAP

Introduce a new Kconfig option for architecture codes to control
whether it provides io{read,write}{8,16,32} I/O accessor functions.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5592a633 01-Oct-2018 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt in TPL

In some cases (e.g. sandbox with verified boot) it is useful to support
libfdt in TPL. Update the Kconfig to handle this.

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

# 6307896c 01-Oct-2018 Simon Glass <sjg@chromium.org>

tpm: Add support for SPL and TPL

At present the tpm can only be used in U-Boot proper. Updated it to work
in SPL and TPL also.

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

# ab948cd2 19-Jul-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

fdt_support: make FDT_FIXUP_PARTITIONS depend on CMD_MTDPARTS

fdt_fixup_mtdparts() calls mtdparts_init() and device_find(),
which are defined in cmd/mtdparts.c

The combination of FDT_FIXUP_PARTITIONS=y and CMD_MTDPARTS=n
emits the following link error:

common/fdt_support.c:903: undefined reference to `mtdparts_init'
common/fdt_support.c:914: undefined reference to `device_find'

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 3330584d 03-Jun-2018 Igor Opaniuk <igor.opaniuk@gmail.com>

avb2.0: integrate avb 2.0 into the build system

Integrate libavb into the build system. Introduce CONFIG_LIBAVB
build option.

Signed-off-by: Igor Opaniuk <igor.opaniuk@linaro.org>

# f8c987f8 05-Jun-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

lib: Add hexdump

Often during debugging session it's very interesting to see
what data we were dealing with. For example what we write or read
to/from memory or peripherals.

This change introduces functions that allow to dump binary
data with one simple function invocation like:
------------------->8----------------
print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, buf, len);
------------------->8----------------

which gives us the following:
------------------->8----------------
00000000: f2 b7 c9 88 62 61 75 64 72 61 74 65 3d 31 31 35 ....baudrate=115
00000010: 32 30 30 00 62 6f 6f 74 61 72 67 73 3d 63 6f 6e 200.bootargs=con
00000020: 73 6f 6c 65 3d 74 74 79 53 33 2c 31 31 35 32 30 sole=ttyS3,11520
00000030: 30 6e 38 00 62 6f 6f 74 64 65 6c 61 79 3d 33 00 0n8.bootdelay=3.
00000040: 62 6f 6f 74 66 69 6c 65 3d 75 49 6d 61 67 65 00 bootfile=uImage.
00000050: 66 64 74 63 6f 6e 74 72 6f 6c 61 64 64 72 3d 39 fdtcontroladdr=9
00000060: 66 66 62 31 62 61 30 00 6c 6f 61 64 61 64 64 72 ffb1ba0.loadaddr
00000070: 3d 30 78 38 32 30 30 30 30 30 30 00 73 74 64 65 =0x82000000.stde
00000080: 72 72 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 rr=serial0@e0022
00000090: 30 30 30 00 73 74 64 69 6e 3d 73 65 72 69 61 6c 000.stdin=serial
000000a0: 30 40 65 30 30 32 32 30 30 30 00 73 74 64 6f 75 0@e0022000.stdou
000000b0: 74 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 30 t=serial0@e00220
000000c0: 30 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00..............
...
------------------->8----------------

Source of hexdump.c was copied from Linux kernel v4.7-rc2.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Mario Six <mario.six@gdsys.cc>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Stefan Roese <sr@denx.de>

# c232d14d 29-May-2018 Alex Kiernan <alex.kiernan@gmail.com>

mmc: Separate "mmc swrite" from fastboot

Introduce CONFIG_IMAGE_SPARSE and CONFIG_CMD_MMC_SWRITE so the "mmc
swrite" command is separated from the fastboot code.

Move image-sparse from common to lib so it's clear it's library code.

Rename CONFIG_FASTBOOT_FLASH_FILLBUF_SIZE to CONFIG_IMAGE_SPARSE_FILLBUF_SIZE
and migrate it to Kconfig.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Acked-by: Jassi Brar <jaswinder.singh@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6417572e 08-May-2018 Tom Rini <trini@konsulko.com>

lib/Kconfig: Mark OF_LIBFDT_OVERLAY as depending on OF_LIBFDT

The overlay code is only useful when OF_LIBFDT is set, so mark it as
depending on that first.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 58a46f88 25-Apr-2018 Praneeth Bajjuri <praneeth@ti.com>

configs: TI: Enable FIT Library overlay support

Enable the FDT library overlay support for all TI SOC family.

Without this option, when Loading fdt from FIT image, the
following warning is seen.

"config with overlays but CONFIG_OF_LIBFDT_OVERLAY not set".

Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
Suggested-by: Andrew F.Davis <afd@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>

# 14ad44ab 18-Apr-2018 Alex Kiernan <alex.kiernan@gmail.com>

spl: Split sprintf, strto* from SPL serial in Kconfig

When SPL serial is disabled, callers who need sprintf or strtoul fail
because their inclusion is guarded by CONFIG_SPL_SERIAL_SUPPORT/
CONFIG_TPL_SERIAL_SUPPORT.

Split printf, sprintf and strto into their own entries and then select
all of them if SERIAL_SUPPORT is enabled to match the current behaviour.

Include panic.o unconditionally as it can be called from anywhere which
uses BUG_ON().

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>

# e294ba06 04-Apr-2018 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-sunxi

Signed-off-by: Tom Rini <trini@konsulko.com>


# d14db11d 03-Apr-2018 Andre Przywara <andre.przywara@arm.com>

sunxi: revert disabling of features

In January some commits were introduced to mitigate the U-Boot image
size issues we encountered on sunxi builds.
Now with the MMC environment removed we can bring them back, as we
practically don't have a size limit anymore.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 32ce6179 13-Mar-2018 Bryan O'Donoghue <bryan.odonoghue@linaro.org>

optee: Add lib entries for sharing OPTEE code across ports

This patch adds code to lib to enable sharing of useful OPTEE code between
board-ports and architectures. The code on lib/optee/optee.c comes from the
TI omap2 port. Eventually the OMAP2 code will be patched to include the
shared code. The intention here is to add more useful OPTEE specific code
as more functionality gets added.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Cc: Harinarayan Bhatta <harinarayan@ti.com>
Cc: Andrew F. Davis <afd@ti.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Kever Yang <kever.yang@rock-chips.com>
Cc: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Cc: Peng Fan <peng.fan@nxp.com>
Tested-by: Peng Fan <peng.fan@nxp.com>

# 36c1877c 06-Feb-2018 Faiz Abbas <faiz_abbas@ti.com>

lib: Kconfig: Move DYNAMIC_CRC_TABLE to Kconfig

Add CONFIG prefix to DYNAMIC_CRC_TABLE and implement it in
Kconfig.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>

# a451bc27 05-Feb-2018 Adam Ford <aford173@gmail.com>

Convert LIB_UUID to Kconfig

config_fallback.h has some logic that checks a variety of options
and selects LIB_UUID if it hasn't already been selected. This
will all LIB_UUID in Kconfig and select this option for the list
of options to allow us to remove the logic from fallbacks

Signed-off-by: Adam Ford <aford173@gmail.com>

# a5a37567 06-Feb-2018 Adam Ford <aford173@gmail.com>

Convert CONFIG LIB_HW_RAND to Kconfig

config_fallbacks.h had some logic to automatically select
LIB_RAND if RANDOM_UUID or CMD_UUID were set if LIB_HW_RAND wasn't
already selected. By migrating LIB_HW_RAND to Kconfig, we can
remove this check from config_fallbacks.h and put it into Kconfig

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
[trini: Turn into a choice, add NET_RANDOM_ETHADDR]
Signed-off-by: Tom Rini <trini@konsulko.com>

# acd4d334 16-Jan-2018 Maxime Ripard <maxime.ripard@free-electrons.com>

net: regex: Disable by default on sunXi

The sunXi arm64 build has overflown, leading to the main U-boot binary
overwriting the environment when flashing the new image, or even worse,
overwriting itself when we're calling saveenv.

Disable this option that is not critical until we can adress the issue
properly.

Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 7e3caa81 03-Dec-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

Move CONFIG_PANIC_HANG to Kconfig

Freescale (NXP) boards have lots of defconfig files per board.
I used "imply PANIC_HANG" for them.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# da5337a6 08-Nov-2017 Nandor Han <nandor.han@ge.com>

rtc: add support for s35392a

Add support for S35392A RTC. The driver supports both U-Boot driver
models.

Signed-off-by: Nandor Han <nandor.han@ge.com>
Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
Cc: Heiko Schocher <hs@denx.de>

# f52bdf4b 14-Sep-2017 Jean-Jacques Hiblot <jjhiblot@ti.com>

lib: allow building lzo for the SPL

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 85d8bf57 03-Sep-2017 Marek Behún <marek.behun@nic.cz>

lib: Add CRC32-C

This is needed for BTRFS.

Signed-off-by: Marek Behun <marek.behun@nic.cz>

create mode 100644 lib/crc32c.c

# 7264f292 15-Aug-2017 York Sun <york.sun@nxp.com>

spl: fit: Eanble GZIP support for image decompression

Add Kconfig option SPL_GZIP and SPL_ZLIB to enable gunzip support for
SPL boot, eg. falcon boot compressed kernel image.

Signed-off-by: York Sun <york.sun@nxp.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6ef2f901 11-Aug-2017 Adam Ford <aford173@gmail.com>

Convert CONFIG_BCH to Kconfig

This converts the following to Kconfig:
CONFIG_BCH

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1a7ba1d 18-Aug-2017 Anatolij Gustschin <agust@denx.de>

Fix 'notes' typos

s/notes/nodes

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 96b9082c 03-Aug-2017 Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

rockchip: rk3188: rock: adjust for SPL/TPL split

With the changes to split SPL/TPL for the RK3368, I apparently missed
some needed adjustments to the RK3188 Kconfig and rock_defconfig.

This fixes build-issues for the rock board after applying the RK3368
enablement (and SPL/TPL) set that resulted from TPL_SERIAL_SUPPORT,
TPL_ROCKCHIP_BACK_TO_BROM and TPL_TINY_MEMSET being separate symbols
now.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d56b4b19 22-Jul-2017 Tom Rini <trini@konsulko.com>

configs: Migrate RBTREE, LZO, CMD_MTDPARTS, CMD_UBI and CMD_UBIFS

The above CONFIG options are in Kconfig, and now have correct depends and
inter-dependencies. Migrate these to configs/ from include/configs/. In the
case of CMD_UBIFS also change it to be a default y if CMD_UBI.

Signed-off-by: Tom Rini <trini@konsulko.com>

# aed998aa 17-May-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_LZMA to Kconfig

This converts the following to Kconfig:
CONFIG_LZMA

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

# b1a873df 26-Apr-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_CMD_AES et al to Kconfig

This converts the following to Kconfig:
CONFIG_CMD_AES
CONFIG_AES

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Add select AES to CMD_AES]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 173aafbf 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

cmd: Expose a Kconfig option to enable UBIFS commands

Create a new Kconfig entry to allow CMD_UBIFS selection from Kconfig and
add an hidden LZO option that can be selected by CMD_UBIFS.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>

# aa049152 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

mtd: ubi: Select RBTREE option from MTD_UBI Kconfig entry

Expose the RBTREE feature through Kconfig and select this option from the
MTD_UBI option.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>
[Rebased on master]
Signed-off-by: Jagan Teki <jagan@openedev.com>

# ab4458bd 02-Apr-2017 Simon Glass <sjg@chromium.org>

string: Provide a slimmed-down memset()

Most of the time the optimised memset() is what we want. For extreme
situations such as TPL it may be too large. For example on the 'rock'
board, using a simple loop saves a useful 48 bytes. With gcc 4.9 and
the rodata bug, this patch is enough to reduce the TPL image below the
limit.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>

# bea79d7d 14-Mar-2017 Andre Przywara <andre.przywara@arm.com>

Kconfig: introduce md5sum command selection

So far CONFIG_MD5SUM would need to be set by a board's include file.
Since the command is really generic, move it over to Kconfig to allow
it to be defined by either a board's defconfig, menuconfig or some
config snippet merged via mergeconfig.sh.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e663b350 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

smbios: Expose in efi_loader as table

We can pass SMBIOS easily as EFI configuration table to an EFI payload. This
patch adds enablement for that case.

While at it, we also enable SMBIOS generation for ARM systems, since they support
EFI_LOADER.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4b6dddc2 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

x86: Move smbios generation into arch independent directory

We will need the SMBIOS generation function on ARM as well going forward,
so let's move it into a non arch specific location.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# ebf7fff2 05-Oct-2016 Heiko Schocher <hs@denx.de>

spl: move FDT_FIXUP_PARTITIONS to Kconfig

Move FDT_FIXUP_PARTITIONS to Kconfig and cleanup existing
uses.

Signed-off-by: Heiko Schocher <hs@denx.de>

# ddf67f71 05-Jul-2016 Maxime Ripard <maxime.ripard@free-electrons.com>

libfdt: Add overlay application function

The device tree overlays are a good way to deal with user-modifyable
boards or boards with some kind of an expansion mechanism where we can
easily plug new board in (like the BBB, the Raspberry Pi or the CHIP).

Add a new function to merge overlays with a base device tree.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>

# 91b86e21 26-May-2016 Marek Vasut <marex@denx.de>

lib: Enable private libgcc by default

This patch decouples U-Boot binary from the toolchain on systems where
private libgcc is available. Instead of pulling in functions provided
by the libgcc from the toolchain, U-Boot will use it's own set of libgcc
functions. These functions are usually imported from Linux kernel, which
also uses it's own libgcc functions instead of the ones provided by the
toolchain.

This patch solves a rather common problem. The toolchain can usually
generate code for many variants of target architecture and often even
different endianness. The libgcc on the other hand is usually compiled
for one particular configuration and the functions provided by it may
or may not be suited for use in U-Boot. This can manifest in two ways,
either the U-Boot fails to compile altogether and linker will complain
or, in the much worse case, the resulting U-Boot will build, but will
misbehave in very subtle and hard to debug ways.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 67976306 30-Mar-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

cosmetic: Fix typos "privide"

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# ed980b8c 03-Mar-2016 Alexander Graf <agraf@csgraf.de>

efi_loader: hook up in build environment

Now that we have all the bits and pieces ready for EFI payload loading
support, hook them up in Makefiles and KConfigs so that we can build.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
[trini: Enable only when we of OF_LIBFDT, disable on kwb and colibri_pxa270]
Signed-off-by: Tom Rini <trini@konsulko.com>

# aa34fbc0 22-Feb-2016 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt to be used in SPL

Add an option to enable libfdt in SPL. This can be useful when decoding
FIT files in SPL.

We need to make sure this option is not enabled in SPL by this change.
Also this option needs to be enabled in host builds. Si add a new
IMAGE_USE_LIBFDT #define which can be used in files that are built on the
host but must also build for U-Boot and SPL.

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

# 69e173eb 22-Feb-2016 Simon Glass <sjg@chromium.org>

Move CONFIG_OF_LIBFDT to Kconfig

Move this option to Kconfig and tidy up existing boards.

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

# a187559e 05-Feb-2016 Bin Meng <bmeng.cn@gmail.com>

Use correct spelling of "U-Boot"

Correct spelling of "U-Boot" shall be used in all written text
(documentation, comments in source files etc.).

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Minkyu Kang <mk7.kang@samsung.com>

# 947c626d 14-Jan-2016 Tom Rini <trini@konsulko.com>

vsprintf.c: Always enable CONFIG_SYS_VSNPRINTF

Enabling this function always removes some class of string saftey issues.
The size change here in general is about 400 bytes and this seems a reasonable
trade-off.

Cc: Peng Fan <peng.fan@nxp.com>
Cc: Peter Robinson <pbrobinson@gmail.com>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Adrian Alonso <aalonso@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 7d9cde10 22-Nov-2015 Stefan Roese <sr@denx.de>

lib/tiny-printf.c: Add tiny printf function for space limited environments

This patch adds a small printf() version that supports all basic formats.
Its intented to be used in U-Boot SPL versions on platforms with very
limited internal RAM sizes.

To enable it, just define CONFIG_USE_TINY_PRINTF in your defconfig. This
will result in the SPL using this tiny function and the main U-Boot
still using the full-blown printf() function.

This code was copied from:
http://www.sparetimelabs.com/printfrevisited
With mostly only coding style related changes so that its checkpatch
clean.

The size reduction is about 2.5KiB. Here a comparison for the db-mv784mp-gp
(Marvell AXP) SPL:

Without this patch:
58963 18536 1928 79427 13643 ./spl/u-boot-spl

With this patch:
56542 18536 1956 77034 12cea ./spl/u-boot-spl

Note:
To make it possible to compile tiny-printf.c instead of vsprintf.c when
CONFIG_USE_TINY_PRINTF is defined, the functions printf() and vprintf() are
moved from common/console.c into vsprintf.c in this patch.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>

# 2419cd16 03-Oct-2015 Simon Glass <sjg@chromium.org>

dm: tpm: Drop CONFIG_DM_TPM

Now that all TPM drivers use driver model, we can drop the special driver
model CONFIG option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>

# 027b728d 06-Oct-2015 Julius Werner <jwerner@chromium.org>

Add support for LZ4 decompression algorithm

This patch adds support for LZ4-compressed FIT image contents. This
algorithm has a slightly worse compression ration than LZO while being
nearly twice as fast to decompress. When loading images from a fast
storage medium this usually results in a boot time win.

Sandbox-tested only since I don't have a U-Boot development system set
up right now. The code was imported unchanged from coreboot where it's
proven to work, though. I'm mostly interested in getting this recognized
by mkImage for use in a downstream project.

Signed-off-by: Julius Werner <jwerner@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# a7d660bc 22-Aug-2015 Simon Glass <sjg@chromium.org>

tpm: Add Kconfig options for TPMs

Add new Kconfig options for TPMs in preparation for moving boards to use
Kconfig for TPM configuration.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 867a6ac8 31-Jul-2015 Simon Glass <sjg@chromium.org>

efi: Add start-up library code

When running as an EFI application, U-Boot must request memory from EFI,
and provide access to the boot services U-Boot needs.

Add library code to perform these tasks. This includes efi_main() which is
the entry point from EFI. U-Boot is built as a shared library.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d1389403 23-Jun-2015 Simon Glass <sjg@chromium.org>

Add a dhrystone benchmark command

Drystone provides a convenient sanity check that the CPU is running at full
speed. Add this as a command which can be enabled as needed.

Note: I investigated using Coremark for this but there was a license
agreement and I could not work out if it was GPL-compatible.

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

# f7848d90 22-Jun-2015 Joe Hershberger <joe.hershberger@ni.com>

Allow CONFIG_REGEX to be disabled when CONFIG_NET

Instead of selecting REGEX when NET is enabled, make it the default, but
allow boards that are tiny to disable it and lose functionality on all
but the first Ethernet adapter.

cm-bf548, bf538f-ezkit, and bf533-stamp need this. None appear to have
more than one Ethernet interface.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# 3850dbe8 11-Jun-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

blackfin: fix undefined reference to srand and rand

Commit 9ba9e85f3f1c (net: Fix NET_RANDOM_ETHADDR dependencies)
accidentally dropped CONFIG_LIB_RAND defines for 14 Blackfin boards.

Prior to that commit, those boards defined CONFIG_LIB_RAND, but not
CONFIG_NET_RANDOM_ETHADDR. So, commit 9ba9e85f3f1c should not have
touched them, but in fact it ripped CONFIG_LIB_RAND off from all the
header files, which caused undefined reference to srand and rand.
CONFIG_LIB_RAND=y must be revived for such boards.

BTW, this commit indeed makes it better, but even with this fix,
three boards (bf533-stamp, bf538f-ezkit, cm-bf548) still can not
build due to region 'ram' overflowed error. This was cause by
commit 6eed3786c68c (net: Move the CMD_NET config to defconfigs)
because CMD_NET selects NET, and NET selects REGEX. Eventually,
some boards were newly enabled with CONFIG_REGEX, increasing the
memory footprint. A patch is expected to fix the build error.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 9ba9e85f 25-May-2015 Michal Simek <michal.simek@xilinx.com>

net: Fix NET_RANDOM_ETHADDR dependencies

NET_RANDOM_ETHADDR depends on lib/rand.c. This patch adds dependency to
Kconfig to ensure that library is also compiled.

Remove the definitions from Blackfin boards' include/configs.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 6501ff62 20-Apr-2015 Przemyslaw Marczak <p.marczak@samsung.com>

lib: Kconfig: add entry for errno_str() function

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1a60650c 21-Apr-2015 Joe Hershberger <joe.hershberger@ni.com>

kconfig: Move REGEX to Kconfig

Having this as a Kconfig allows it to be a dependent feature.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8156345d 06-Mar-2015 Simon Glass <sjg@chromium.org>

sandbox: Move CONFIG_SYS_VSNPRINTF to Kconfig

Move this over to Kconfig and tidy up.

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

# 94e3c8c4 19-Feb-2015 gaurav rana <gaurav.rana@freescale.com>

crypto/fsl - Add progressive hashing support using hardware acceleration.

Currently only normal hashing is supported using hardware acceleration.
Added support for progressive hashing using hardware.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
Signed-off-by: Gaurav Rana <gaurav.rana@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>

# d9f23c7f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

lib/rsa: Add Kconfig for devices supporting RSA Modular Exponentiation

Kconfig option added for devices which support RSA Verification.
1. RSA_SOFTWARE_EXP
Enables driver for supporting RSA Modular Exponentiation in Software
2. RSA_FREESCALE_EXP
Enables driver for supporting RSA Modular Exponentiation using Freescale specific
driver

The above drivers use RSA uclass

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
(Removed duplicate line in Kconfig comment)

Change-Id: I7663c4d5350e2bfc3dfa2696f70ef777d6ccc6f6

# c4beb22f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

FIT: Modify option FIT_SIGNATURE in Kconfig

For FIT signature based approach to work, RSA library needs to be selected.
The FIT_SIGNATURE option in Kconfig is modified to automatically select RSA.
Selecting RSA compiles the RSA library required for image verification.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 45ccec8f 23-Oct-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_USE_PRIVATE_LIBGCC to Kconfig

The private libgcc is supported only on ARM, MIPS, PowerPC, SH, x86.
Those architectures should "select" HAVE_PRIVATE_LIBGCC and
CONFIG_USE_PRIVATE_LIBGCC should depend on it.

Currently, this option is enabled on Tegra boards and x86 architecture.
Move the definition from header files to Kconfig.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Tested-by: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: Tom Warren <twarren@nvidia.com>

# 8c688bc4 23-Oct-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_SYS_HZ to lib/Kconfig

CONFIG_SYS_HZ is always defined as 1000 in config_fallbacks.h
(but some boards still have redundant definitions).

This commit moves the definition and the document in README to
Kconfig. Since lib/Kconfig can assure that CONFIG_SYS_HZ is 1000,
the sanity check in lib/time.c should be removed.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Reviewed-by: Marek Vasut <marex@denx.de>

# b0928da6 16-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED to Kconfig

If this option is enabled, the objects under lib/ directory
are compiled with speed optimization, not size optimization.
(Currently, only used by some Blackfin boards.)

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# ed36323f 16-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: add blank Kconfig files

This would be useful to start moving various config options.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# f2c1442e 14-Mar-2021 Simon Glass <sjg@chromium.org>

bloblist: Make BLOBLIST_TABLES depend on BLOBLIST

Add an extra condition here since we cannot put x86 tables in a bloblist
when bloblists are not supported.

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

# e0103158 25-Feb-2021 Bin Meng <bmeng.cn@gmail.com>

lib: kconfig: Mention CONFIG_ADDR_MAP limitation in the help

Mention that CONFIG_ADDR_MAP only works in the post-relocation phase.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>

# 56e7257c 03-Feb-2021 Bin Meng <bmeng.cn@gmail.com>

lib: Fix BINMAN_FDT dependency

lib/binman.c references the following 3 ofnode APIs:
ofnode_first_subnode(), ofnode_path() and ofnode_read_bool().

These APIs get built only when DM is on. Fix the dependency then.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 59e4e391 18-Jan-2021 Tom Rini <trini@konsulko.com>

Merge https://gitlab.denx.de/u-boot/custodians/u-boot-riscv

- Update qemu-riscv.rst build instructions.
- Add support for SPI on Kendryte K210.
- Add Microchip PolarFire SoC Icicle Kit support.
- Add support for an early timer.
- Select TIMER_EARLY to avoid infinite recursion for Trace.


# a80f8513 17-Jan-2021 Pragnesh Patel <pragnesh.patel@sifive.com>

trace: select TIMER_EARLY to avoid infinite recursion

When tracing functions is enabled this adds calls to
__cyg_profile_func_enter() and __cyg_profile_func_exit() to the traced
functions.

__cyg_profile_func_enter() and __cyg_profile_func_exit() invoke
timer_get_us() to record the entry and exit time.

initr_dm() will make gd->dm_root = NULL and gd->timer = NULL, so
timer_get_us() -> get_ticks() -> dm_timer_init() will lead to an
indefinite recursion.

So select TIMER_EARLY when tracing got enabled.

Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Rick Chen <rick@andestech.com>

# 6205bbb1 04-Jan-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lib: cosmetic update of CONFIG_LIB_ELF description

Change 2 typo error in CONFIG_LIB_ELF description:
- Supoort => Support
- fir => for

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c589132a 02-Dec-2020 Aswath Govindraju <a-govindraju@ti.com>

fdt: Use phandle to distinguish DT nodes with same name

While assigning the sequence number to subsystem instances by reading the
aliases property, only DT nodes names are compared and not the complete
path. This causes a problem when there are two DT nodes with same name but
have different paths.

In arch/arm/dts/k3-am65-main.dtsi there are two USB controllers with the
same device tree node name but different path. When aliases are defined for
these USB controllers then fdtdec_get_alias_seq() fails to pick the correct
instance for a given index.

fdt_path_offset() function is slow and this would effect the U-Boot
startup. To avert the time penalty on all boards, apply this extra check
only when required by using a config option.

Fix it by comparing the phandles of DT nodes after the node names match,
under a config option.

Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Fix whitespace error in Kconfig:
Signed-off-by: Simon Glass <sjg@chromium.org>

# 28cef9ca 19-Nov-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

fs: fat: create correct short names

The current function set_name() used to create short names has the
following deficiencies resolved by this patch:

* Long names (e.g. FOO.TXT) are stored even if a short name is enough.
* Short names with spaces are created, e.g. "A ~1.TXT".
* Short names with illegal characters are created, e.g. "FOO++BAR".
* Debug output does not not consider that the short file name has no
concluding '\0'.

The solution for the following bug is split of into a separate patch:

* Short file names must be unique.

This patch only provides the loop over possible short file names.

Fixes: c30a15e590c ("FAT: Add FAT write feature")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# e4f8e543 05-Nov-2020 Simon Glass <sjg@chromium.org>

smbios: Drop the unused Kconfig options

Now that we can use devicetree to specify this information, drop the old
CONFIG options.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 44c74bdd 05-Nov-2020 Simon Glass <sjg@chromium.org>

sysinfo: Provide a default driver to set SMBIOS values

Some boards want to specify the manufacturer or product name but do not
need to have their own sysinfo driver.

Add a default driver which provides a way to specify this SMBIOS
information in the devicetree, without needing any board-specific
functionality.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d2cb7a22 04-Nov-2020 Simon Glass <sjg@chromium.org>

x86: Allow putting some tables in the bloblist

At present all tables are placed starting at address f0000 in memory, and
can be up to 64KB in size. If the tables are very large, this may not
provide enough space.

Also if the tables point to other tables (such as console log or a ramoops
area) then we must allocate other memory anyway.

The bloblist is a nice place to put these tables since it is contiguous,
which makes it easy to reserve this memory for linux using the 820 tables.

Add an option to put some of the tables in the bloblist. For SMBIOS and
ACPI, create suitable pointers from the f0000 region to the new location
of the tables.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
[bmeng: squashed in http://patchwork.ozlabs.org/project/uboot/patch/
20201105062407.1.I8091ad931cbbb5e3b6f6ababdf3f8d5db0d17bb9@changeid/]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# 415eab06 03-Nov-2020 Christian Gmeiner <christian.gmeiner@gmail.com>

smbios: add parsing API

Add a very simple API to be able to access SMBIOS strings
like vendor, model and bios version.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 72eda507 27-Oct-2020 Sean Anderson <seanga2@gmail.com>

lib: Add getopt

Some commands can get very unweildy if they have too many positional
arguments. Adding options makes them easier to read, remember, and
understand.

This implementation of getopt has been taken from barebox, which has had
option support for quite a while. I have made a few modifications to their
version, such as the removal of opterr in favor of a separate getopt_silent
function. In addition, I have moved all global variables into struct
getopt_context.

The getopt from barebox also re-orders the arguments passed to it so that
non-options are placed last. This allows users to specify options anywhere.
For example, `ls -l foo/ -R` would be re-ordered to `ls -l -R foo/` as
getopt parsed the options. However, this feature conflicts with the const
argv in cmd_tbl->cmd. This was originally added in 54841ab50c ("Make sure
that argv[] argument pointers are not modified."). The reason stated in
that commit is that hush requires argv to stay unmodified. Has this
situation changed? Barebox also uses hush, and does not have this problem.
Perhaps we could use their fix?

I have assigned maintenance of getopt to Simon Glass, as it is currently
only used by the log command. I would also be fine maintaining it.

Signed-off-by: Sean Anderson <seanga2@gmail.com>

# 26637e2e 12-Sep-2020 Simon Glass <sjg@chromium.org>

lib: Allow hexdump to be used in SPL

It is sometimes useful to output hex dumps in SPL. Add a config option to
allow this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# e87dfb05 05-Aug-2020 Andrii Anisov <andrii_anisov@epam.com>

lib: sscanf: add sscanf implementation

Port sscanf implementation from mini-os and introduce new
Kconfig option to enable it: CONFIG_SSCANF. Disable by default.

Signed-off-by: Andrii Anisov <andrii_anisov@epam.com>
Signed-off-by: Anastasiia Lukianenko <anastasiia_lukianenko@epam.com>
Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>

# 81014f73 30-Jul-2020 Joao Marcos Costa <joaomarcos.costa@bootlin.com>

include/u-boot, lib/zlib: add sources for zlib decompression

Add zlib (v1.2.11) uncompr() function to U-Boot. SquashFS depends on
this function to decompress data from a raw disk image. The actual
support for zlib into SquashFS sources will be added in a follow-up
commit.

Signed-off-by: Joao Marcos Costa <joaomarcos.costa@bootlin.com>

# 69be8fd1 03-Jun-2020 Marek Szyprowski <m.szyprowski@samsung.com>

powerpc: move ADDR_MAP to Kconfig

Move ADDR_MAP related config options from include/configs/*.h to the
proper place in lib/Kconfig. This has been done using
./tools/moveconfig.py and manual inspection of the generated changes.
This is a preparation to use ADDR_MAP helper on ARM 32bit Raspberry Pi4
board for mapping the PCIe XHCI MMIO, which is above the 4GiB identity
mapping limit.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# d16b38f4 15-Apr-2020 Reuben Dowle <reubendowle0@gmail.com>

Add support for SHA384 and SHA512

The current recommendation for best security practice from the US government
is to use SHA384 for TOP SECRET [1].

This patch adds support for SHA384 and SHA512 in the hash command, and also
allows FIT images to be hashed with these algorithms, and signed with
sha384,rsaXXXX and sha512,rsaXXXX

The SHA implementation is adapted from the linux kernel implementation.

[1] Commercial National Security Algorithm Suite
http://www.iad.gov/iad/programs/iad-initiatives/cnsa-suite.cfm

Signed-off-by: Reuben Dowle <reuben.dowle@4rf.com>

# 43e442a5 26-May-2020 Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

kconfig: fix some typos

Signed-off-by: Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

# eff5a547 22-May-2020 Michael Walle <michael@walle.cc>

cmd: zip: automatically pull in gzip()

Move the CONFIG_GZIP_COMPRESSED from a config.h macro to a Kconfig menu
item. It is not selectable by a user because there is no reason to do
so. Instead it will be automatically selected by the stuff which uses
gzip(), like the zip command.

Remove it from the config_whitelist.txt. Also remove
CONFIG_GZIP_COMPRESS_DEF_SZ as this was never used on any board. The
default seems to be sane, otherwise it should be added as a Kconfig
option.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8239be61 06-May-2020 Simon Glass <sjg@chromium.org>

lib: Allow MD5 to be enabled in SPL

At present the MD5 option cannot be enabled by board configs since it has
no Kconfig name. It is generally enabled, so long as FIT support is
present. But not all boards use FIT, particularly in SPL

Fix this and add an option for SPL as well. This allows board code to call
md5() even if FIT support is not enabled.

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

# 04cb3994 21-Apr-2020 Weijie Gao <weijie.gao@mediatek.com>

lib: enable lzma decompression support for SPL build

This patch enables LZMA decompression support for SPL build

Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>

# 2a2119e1 05-Mar-2020 Atish Patra <atish.patra@wdc.com>

lib: kconfig: Add option to set BZIP2 compression method

There is no way to select BZIP2 compression method.
Add it under library/compression config where all other
compression related configs are present.

Signed-off-by: Atish Patra <atish.patra@wdc.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 805b3cac 12-Feb-2020 Keerthy <j-keerthy@ti.com>

lib: elf: Move the generic elf loading/validating functions to lib

Move the generic elf loading/validating functions to lib/
so that they can be re-used and accessed by code existing
outside cmd.

While at it remove the duplicate static version of load_elf_image_phdr
under arch/arm/mach-imx/imx_bootaux.c.

Signed-off-by: Keerthy <j-keerthy@ti.com>
Suggested-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>

# 1611235b 19-Jan-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: Kconfig dependencies for pseudo-random library

drivers/rng/sandbox_rng.c requires rand() to be defined but configuration
option CONFIG_CONFIG_LIB_RAND selected in drivers/rng/Kconfig does not
exist.

test/lib/test_aes.c requires rand() to be defined.

Fix the selection criteria for choice "Pseudo-random library support type".

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 3c10dc95 06-Dec-2019 Simon Glass <sjg@chromium.org>

binman: Add a library to access binman entries

SPL and TPL can access information about binman entries using link-time
symbols but this is not available in U-Boot proper. Of course it could be
made available, but the intention is to just read the device tree.

Add support for this, so that U-Boot can locate entries.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# b4adf627 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: crypto: add x509 parser

Imported from linux kernel v5.3:
x509.asn1 without changes
x509_akid.asn1 without changes
x509_parser.h without changes
x509_cert_parser.c with changes marked as __UBOOT__
x509_public_key.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# a9b45e6e 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add oid registry utility

Imported from linux kernel v5.3:
build_OID_registry without changes
oid_registry.h without changes
oid_registry.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# ab8a0e06 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add asn1 decoder

Imported from linux kernel v5.3:
lib/asn1_decoder.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 2b12196d 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

cmd: add asn1_compiler

Imported from linux kernel v5.3:
asn1.h without changes
asn1_ber_bytecode.h without changes
asn1_decoder.h without changes
asn1_compiler.c without changes

This host command will be used to create a ASN1 parser, for example,
for pkcs7 messages or x509 certificates. More specifically, it will
generate *byte code* which will be interpreted by asn1 decoder library.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 05429b6c 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

rtc: move date.c from drivers/rtc/ to lib/

In the next commit, rtc_mktime(), for compatibility with linux, will be
implemented using rtc_mktime(), which is no longer drivers/rtc specific.
So move this file under lib/.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 37ef1774 10-Nov-2019 Thomas Hebb <tommyhebb@gmail.com>

Kconfig: disambiguate config names for tiny printf

27084c03d36a ("spl: Allow tiny printf() to be controlled in SPL and
TPL") split this option in two for TPL and SPL, but didn't change the
Kconfig names, making them hard to set quickly.

Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>

# 0d76afc0 27-Oct-2019 Simon Glass <sjg@chromium.org>

fdt: Add Kconfig options to control code size

For better or worse libfdt recent grew a lot of code that checks the
validity of the device tree in great detail. When using unsigned or
unverified data this makes things safer, but it does add to code size.

Add some controls to select the trade-off between safety and code size.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 27084c03 25-Sep-2019 Simon Glass <sjg@chromium.org>

spl: Allow tiny printf() to be controlled in SPL and TPL

At present there is only one control for this and it is used for both SPL
and TPL. But SPL might have a lot more space than TPL so the extra cost of
a full printf() might be acceptable.

Split the option into two, providing separate SPL and TPL controls. The
TPL setting defaults to the same as SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2a51e16b 07-Jun-2019 Tom Rini <trini@konsulko.com>

configs: Make USE_TINY_PRINTF depend on SPL||TPL and be default

The USE_TINY_PRINTF symbol only changes things within SPL and TPL
builds, so make it depend on that support. Next, make it default as
within these cases we should rarely have need of more advanced print
formats outside of the debug context.

To do this, in a few cases we need to correct our Kconfig dependencies
as we had cases of non-SPL targets select'ing this symbol. Finally, in
the case of a few boards we really do need the full printf
functionality.

Signed-off-by: Tom Rini <trini@konsulko.com>

# da0fb5fd 02-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: make call depth limit customizable

Up to now we had hard coded values for the call depth up to which trace
records are created: 200 for early tracing, 15 thereafter. UEFI
applications reach a call depth of 80 or above.

Provide customizing settings for the call trace depth limit and the early
call trace depth limit. Use the old values as defaults.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8509f22a 29-Apr-2019 Marek Behún <marek.behun@nic.cz>

lib: add Zstandard decompression support

Add the zstd library from Linux kernel (only decompression support).
There are minimal changes to build with U-Boot, otherwise the files are
identical to Linux commit dc35da16 from March 2018, the files had not
been touched since in kernel. Also SPDX lincese tags were added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 83a486b6 29-Apr-2019 Marek Behún <marek.behun@nic.cz>

lib: Add xxhash support

This adds the xxhash support from Linux. Files are almost identical to
those added to Linux in commit 5d240522 ("lib: Add xxhash module") (they
haven't been touched since in Linux). The only difference is to add some
includes to be compatible with U-Boot. Also SPDX lincese tags were
added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 5132361a 29-Apr-2019 Heiko Schocher <hs@denx.de>

lib: Kconfig: fix help text for GZIP

commit 95f4bbd581cf ("lib: fdt: Allow LZO and GZIP DT compression in U-Boot")

introduced Kconfig option for gzip in U-Boot, but help text
says gzip for SPL, which is wrong. Fix this.

Signed-off-by: Heiko Schocher <hs@denx.de>
Acked-by: Marek Vasut <marex@denx.de>

# 1c6eb075 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE_BUFFER_SIZE et al to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE_BUFFER_SIZE
CONFIG_TRACE_EARLY_SIZE
CONFIG_TRACE_EARLY
CONFIG_TRACE_EARLY_ADDR

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

# a24a78d7 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE

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

# 54969b40 21-Mar-2019 Thierry Reding <treding@nvidia.com>

fdtdec: Add Kconfig symbol for tests

Runtime tests are provided as a test_fdtdec command implementation. Add
a Kconfig symbol that allows this command to be built so that the tests
can be used.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 95f4bbd5 08-Mar-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

lib: fdt: Allow LZO and GZIP DT compression in U-Boot

Add required Kconfig symbols, Makefile bits and macro fixes in a
few places to support LZO and DT compression in U-Boot. This can
save a lot of space with multi-DTB fitImages.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>

# 6e705114 13-Jan-2019 Chris Packham <judge.packham@gmail.com>

lib: Kconfig: spelling fixes

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 048c6e89 06-Nov-2018 Simon Glass <sjg@chromium.org>

spl: lz4: Allow use of lz4 compression in SPL

In some cases U-Boot is compressed and it is useful to be able to
decompress it in SPL. Add a Kconfig and Makefile change to allow this.
Note that this does not actually implement decompression.

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

# 2895c4b7 15-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

kconfig: Introduce HAVE_ARCH_IOMAP

Introduce a new Kconfig option for architecture codes to control
whether it provides io{read,write}{8,16,32} I/O accessor functions.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5592a633 01-Oct-2018 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt in TPL

In some cases (e.g. sandbox with verified boot) it is useful to support
libfdt in TPL. Update the Kconfig to handle this.

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

# 6307896c 01-Oct-2018 Simon Glass <sjg@chromium.org>

tpm: Add support for SPL and TPL

At present the tpm can only be used in U-Boot proper. Updated it to work
in SPL and TPL also.

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

# ab948cd2 19-Jul-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

fdt_support: make FDT_FIXUP_PARTITIONS depend on CMD_MTDPARTS

fdt_fixup_mtdparts() calls mtdparts_init() and device_find(),
which are defined in cmd/mtdparts.c

The combination of FDT_FIXUP_PARTITIONS=y and CMD_MTDPARTS=n
emits the following link error:

common/fdt_support.c:903: undefined reference to `mtdparts_init'
common/fdt_support.c:914: undefined reference to `device_find'

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 3330584d 03-Jun-2018 Igor Opaniuk <igor.opaniuk@gmail.com>

avb2.0: integrate avb 2.0 into the build system

Integrate libavb into the build system. Introduce CONFIG_LIBAVB
build option.

Signed-off-by: Igor Opaniuk <igor.opaniuk@linaro.org>

# f8c987f8 05-Jun-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

lib: Add hexdump

Often during debugging session it's very interesting to see
what data we were dealing with. For example what we write or read
to/from memory or peripherals.

This change introduces functions that allow to dump binary
data with one simple function invocation like:
------------------->8----------------
print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, buf, len);
------------------->8----------------

which gives us the following:
------------------->8----------------
00000000: f2 b7 c9 88 62 61 75 64 72 61 74 65 3d 31 31 35 ....baudrate=115
00000010: 32 30 30 00 62 6f 6f 74 61 72 67 73 3d 63 6f 6e 200.bootargs=con
00000020: 73 6f 6c 65 3d 74 74 79 53 33 2c 31 31 35 32 30 sole=ttyS3,11520
00000030: 30 6e 38 00 62 6f 6f 74 64 65 6c 61 79 3d 33 00 0n8.bootdelay=3.
00000040: 62 6f 6f 74 66 69 6c 65 3d 75 49 6d 61 67 65 00 bootfile=uImage.
00000050: 66 64 74 63 6f 6e 74 72 6f 6c 61 64 64 72 3d 39 fdtcontroladdr=9
00000060: 66 66 62 31 62 61 30 00 6c 6f 61 64 61 64 64 72 ffb1ba0.loadaddr
00000070: 3d 30 78 38 32 30 30 30 30 30 30 00 73 74 64 65 =0x82000000.stde
00000080: 72 72 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 rr=serial0@e0022
00000090: 30 30 30 00 73 74 64 69 6e 3d 73 65 72 69 61 6c 000.stdin=serial
000000a0: 30 40 65 30 30 32 32 30 30 30 00 73 74 64 6f 75 0@e0022000.stdou
000000b0: 74 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 30 t=serial0@e00220
000000c0: 30 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00..............
...
------------------->8----------------

Source of hexdump.c was copied from Linux kernel v4.7-rc2.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Mario Six <mario.six@gdsys.cc>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Stefan Roese <sr@denx.de>

# c232d14d 29-May-2018 Alex Kiernan <alex.kiernan@gmail.com>

mmc: Separate "mmc swrite" from fastboot

Introduce CONFIG_IMAGE_SPARSE and CONFIG_CMD_MMC_SWRITE so the "mmc
swrite" command is separated from the fastboot code.

Move image-sparse from common to lib so it's clear it's library code.

Rename CONFIG_FASTBOOT_FLASH_FILLBUF_SIZE to CONFIG_IMAGE_SPARSE_FILLBUF_SIZE
and migrate it to Kconfig.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Acked-by: Jassi Brar <jaswinder.singh@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6417572e 08-May-2018 Tom Rini <trini@konsulko.com>

lib/Kconfig: Mark OF_LIBFDT_OVERLAY as depending on OF_LIBFDT

The overlay code is only useful when OF_LIBFDT is set, so mark it as
depending on that first.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 58a46f88 25-Apr-2018 Praneeth Bajjuri <praneeth@ti.com>

configs: TI: Enable FIT Library overlay support

Enable the FDT library overlay support for all TI SOC family.

Without this option, when Loading fdt from FIT image, the
following warning is seen.

"config with overlays but CONFIG_OF_LIBFDT_OVERLAY not set".

Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
Suggested-by: Andrew F.Davis <afd@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>

# 14ad44ab 18-Apr-2018 Alex Kiernan <alex.kiernan@gmail.com>

spl: Split sprintf, strto* from SPL serial in Kconfig

When SPL serial is disabled, callers who need sprintf or strtoul fail
because their inclusion is guarded by CONFIG_SPL_SERIAL_SUPPORT/
CONFIG_TPL_SERIAL_SUPPORT.

Split printf, sprintf and strto into their own entries and then select
all of them if SERIAL_SUPPORT is enabled to match the current behaviour.

Include panic.o unconditionally as it can be called from anywhere which
uses BUG_ON().

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>

# e294ba06 04-Apr-2018 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-sunxi

Signed-off-by: Tom Rini <trini@konsulko.com>


# d14db11d 03-Apr-2018 Andre Przywara <andre.przywara@arm.com>

sunxi: revert disabling of features

In January some commits were introduced to mitigate the U-Boot image
size issues we encountered on sunxi builds.
Now with the MMC environment removed we can bring them back, as we
practically don't have a size limit anymore.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 32ce6179 13-Mar-2018 Bryan O'Donoghue <bryan.odonoghue@linaro.org>

optee: Add lib entries for sharing OPTEE code across ports

This patch adds code to lib to enable sharing of useful OPTEE code between
board-ports and architectures. The code on lib/optee/optee.c comes from the
TI omap2 port. Eventually the OMAP2 code will be patched to include the
shared code. The intention here is to add more useful OPTEE specific code
as more functionality gets added.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Cc: Harinarayan Bhatta <harinarayan@ti.com>
Cc: Andrew F. Davis <afd@ti.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Kever Yang <kever.yang@rock-chips.com>
Cc: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Cc: Peng Fan <peng.fan@nxp.com>
Tested-by: Peng Fan <peng.fan@nxp.com>

# 36c1877c 06-Feb-2018 Faiz Abbas <faiz_abbas@ti.com>

lib: Kconfig: Move DYNAMIC_CRC_TABLE to Kconfig

Add CONFIG prefix to DYNAMIC_CRC_TABLE and implement it in
Kconfig.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>

# a451bc27 05-Feb-2018 Adam Ford <aford173@gmail.com>

Convert LIB_UUID to Kconfig

config_fallback.h has some logic that checks a variety of options
and selects LIB_UUID if it hasn't already been selected. This
will all LIB_UUID in Kconfig and select this option for the list
of options to allow us to remove the logic from fallbacks

Signed-off-by: Adam Ford <aford173@gmail.com>

# a5a37567 06-Feb-2018 Adam Ford <aford173@gmail.com>

Convert CONFIG LIB_HW_RAND to Kconfig

config_fallbacks.h had some logic to automatically select
LIB_RAND if RANDOM_UUID or CMD_UUID were set if LIB_HW_RAND wasn't
already selected. By migrating LIB_HW_RAND to Kconfig, we can
remove this check from config_fallbacks.h and put it into Kconfig

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
[trini: Turn into a choice, add NET_RANDOM_ETHADDR]
Signed-off-by: Tom Rini <trini@konsulko.com>

# acd4d334 16-Jan-2018 Maxime Ripard <maxime.ripard@free-electrons.com>

net: regex: Disable by default on sunXi

The sunXi arm64 build has overflown, leading to the main U-boot binary
overwriting the environment when flashing the new image, or even worse,
overwriting itself when we're calling saveenv.

Disable this option that is not critical until we can adress the issue
properly.

Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 7e3caa81 03-Dec-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

Move CONFIG_PANIC_HANG to Kconfig

Freescale (NXP) boards have lots of defconfig files per board.
I used "imply PANIC_HANG" for them.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# da5337a6 08-Nov-2017 Nandor Han <nandor.han@ge.com>

rtc: add support for s35392a

Add support for S35392A RTC. The driver supports both U-Boot driver
models.

Signed-off-by: Nandor Han <nandor.han@ge.com>
Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
Cc: Heiko Schocher <hs@denx.de>

# f52bdf4b 14-Sep-2017 Jean-Jacques Hiblot <jjhiblot@ti.com>

lib: allow building lzo for the SPL

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 85d8bf57 03-Sep-2017 Marek Behún <marek.behun@nic.cz>

lib: Add CRC32-C

This is needed for BTRFS.

Signed-off-by: Marek Behun <marek.behun@nic.cz>

create mode 100644 lib/crc32c.c

# 7264f292 15-Aug-2017 York Sun <york.sun@nxp.com>

spl: fit: Eanble GZIP support for image decompression

Add Kconfig option SPL_GZIP and SPL_ZLIB to enable gunzip support for
SPL boot, eg. falcon boot compressed kernel image.

Signed-off-by: York Sun <york.sun@nxp.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6ef2f901 11-Aug-2017 Adam Ford <aford173@gmail.com>

Convert CONFIG_BCH to Kconfig

This converts the following to Kconfig:
CONFIG_BCH

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1a7ba1d 18-Aug-2017 Anatolij Gustschin <agust@denx.de>

Fix 'notes' typos

s/notes/nodes

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 96b9082c 03-Aug-2017 Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

rockchip: rk3188: rock: adjust for SPL/TPL split

With the changes to split SPL/TPL for the RK3368, I apparently missed
some needed adjustments to the RK3188 Kconfig and rock_defconfig.

This fixes build-issues for the rock board after applying the RK3368
enablement (and SPL/TPL) set that resulted from TPL_SERIAL_SUPPORT,
TPL_ROCKCHIP_BACK_TO_BROM and TPL_TINY_MEMSET being separate symbols
now.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d56b4b19 22-Jul-2017 Tom Rini <trini@konsulko.com>

configs: Migrate RBTREE, LZO, CMD_MTDPARTS, CMD_UBI and CMD_UBIFS

The above CONFIG options are in Kconfig, and now have correct depends and
inter-dependencies. Migrate these to configs/ from include/configs/. In the
case of CMD_UBIFS also change it to be a default y if CMD_UBI.

Signed-off-by: Tom Rini <trini@konsulko.com>

# aed998aa 17-May-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_LZMA to Kconfig

This converts the following to Kconfig:
CONFIG_LZMA

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

# b1a873df 26-Apr-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_CMD_AES et al to Kconfig

This converts the following to Kconfig:
CONFIG_CMD_AES
CONFIG_AES

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Add select AES to CMD_AES]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 173aafbf 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

cmd: Expose a Kconfig option to enable UBIFS commands

Create a new Kconfig entry to allow CMD_UBIFS selection from Kconfig and
add an hidden LZO option that can be selected by CMD_UBIFS.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>

# aa049152 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

mtd: ubi: Select RBTREE option from MTD_UBI Kconfig entry

Expose the RBTREE feature through Kconfig and select this option from the
MTD_UBI option.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>
[Rebased on master]
Signed-off-by: Jagan Teki <jagan@openedev.com>

# ab4458bd 02-Apr-2017 Simon Glass <sjg@chromium.org>

string: Provide a slimmed-down memset()

Most of the time the optimised memset() is what we want. For extreme
situations such as TPL it may be too large. For example on the 'rock'
board, using a simple loop saves a useful 48 bytes. With gcc 4.9 and
the rodata bug, this patch is enough to reduce the TPL image below the
limit.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>

# bea79d7d 14-Mar-2017 Andre Przywara <andre.przywara@arm.com>

Kconfig: introduce md5sum command selection

So far CONFIG_MD5SUM would need to be set by a board's include file.
Since the command is really generic, move it over to Kconfig to allow
it to be defined by either a board's defconfig, menuconfig or some
config snippet merged via mergeconfig.sh.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e663b350 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

smbios: Expose in efi_loader as table

We can pass SMBIOS easily as EFI configuration table to an EFI payload. This
patch adds enablement for that case.

While at it, we also enable SMBIOS generation for ARM systems, since they support
EFI_LOADER.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4b6dddc2 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

x86: Move smbios generation into arch independent directory

We will need the SMBIOS generation function on ARM as well going forward,
so let's move it into a non arch specific location.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# ebf7fff2 05-Oct-2016 Heiko Schocher <hs@denx.de>

spl: move FDT_FIXUP_PARTITIONS to Kconfig

Move FDT_FIXUP_PARTITIONS to Kconfig and cleanup existing
uses.

Signed-off-by: Heiko Schocher <hs@denx.de>

# ddf67f71 05-Jul-2016 Maxime Ripard <maxime.ripard@free-electrons.com>

libfdt: Add overlay application function

The device tree overlays are a good way to deal with user-modifyable
boards or boards with some kind of an expansion mechanism where we can
easily plug new board in (like the BBB, the Raspberry Pi or the CHIP).

Add a new function to merge overlays with a base device tree.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>

# 91b86e21 26-May-2016 Marek Vasut <marex@denx.de>

lib: Enable private libgcc by default

This patch decouples U-Boot binary from the toolchain on systems where
private libgcc is available. Instead of pulling in functions provided
by the libgcc from the toolchain, U-Boot will use it's own set of libgcc
functions. These functions are usually imported from Linux kernel, which
also uses it's own libgcc functions instead of the ones provided by the
toolchain.

This patch solves a rather common problem. The toolchain can usually
generate code for many variants of target architecture and often even
different endianness. The libgcc on the other hand is usually compiled
for one particular configuration and the functions provided by it may
or may not be suited for use in U-Boot. This can manifest in two ways,
either the U-Boot fails to compile altogether and linker will complain
or, in the much worse case, the resulting U-Boot will build, but will
misbehave in very subtle and hard to debug ways.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 67976306 30-Mar-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

cosmetic: Fix typos "privide"

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# ed980b8c 03-Mar-2016 Alexander Graf <agraf@csgraf.de>

efi_loader: hook up in build environment

Now that we have all the bits and pieces ready for EFI payload loading
support, hook them up in Makefiles and KConfigs so that we can build.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
[trini: Enable only when we of OF_LIBFDT, disable on kwb and colibri_pxa270]
Signed-off-by: Tom Rini <trini@konsulko.com>

# aa34fbc0 22-Feb-2016 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt to be used in SPL

Add an option to enable libfdt in SPL. This can be useful when decoding
FIT files in SPL.

We need to make sure this option is not enabled in SPL by this change.
Also this option needs to be enabled in host builds. Si add a new
IMAGE_USE_LIBFDT #define which can be used in files that are built on the
host but must also build for U-Boot and SPL.

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

# 69e173eb 22-Feb-2016 Simon Glass <sjg@chromium.org>

Move CONFIG_OF_LIBFDT to Kconfig

Move this option to Kconfig and tidy up existing boards.

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

# a187559e 05-Feb-2016 Bin Meng <bmeng.cn@gmail.com>

Use correct spelling of "U-Boot"

Correct spelling of "U-Boot" shall be used in all written text
(documentation, comments in source files etc.).

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Minkyu Kang <mk7.kang@samsung.com>

# 947c626d 14-Jan-2016 Tom Rini <trini@konsulko.com>

vsprintf.c: Always enable CONFIG_SYS_VSNPRINTF

Enabling this function always removes some class of string saftey issues.
The size change here in general is about 400 bytes and this seems a reasonable
trade-off.

Cc: Peng Fan <peng.fan@nxp.com>
Cc: Peter Robinson <pbrobinson@gmail.com>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Adrian Alonso <aalonso@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 7d9cde10 22-Nov-2015 Stefan Roese <sr@denx.de>

lib/tiny-printf.c: Add tiny printf function for space limited environments

This patch adds a small printf() version that supports all basic formats.
Its intented to be used in U-Boot SPL versions on platforms with very
limited internal RAM sizes.

To enable it, just define CONFIG_USE_TINY_PRINTF in your defconfig. This
will result in the SPL using this tiny function and the main U-Boot
still using the full-blown printf() function.

This code was copied from:
http://www.sparetimelabs.com/printfrevisited
With mostly only coding style related changes so that its checkpatch
clean.

The size reduction is about 2.5KiB. Here a comparison for the db-mv784mp-gp
(Marvell AXP) SPL:

Without this patch:
58963 18536 1928 79427 13643 ./spl/u-boot-spl

With this patch:
56542 18536 1956 77034 12cea ./spl/u-boot-spl

Note:
To make it possible to compile tiny-printf.c instead of vsprintf.c when
CONFIG_USE_TINY_PRINTF is defined, the functions printf() and vprintf() are
moved from common/console.c into vsprintf.c in this patch.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>

# 2419cd16 03-Oct-2015 Simon Glass <sjg@chromium.org>

dm: tpm: Drop CONFIG_DM_TPM

Now that all TPM drivers use driver model, we can drop the special driver
model CONFIG option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>

# 027b728d 06-Oct-2015 Julius Werner <jwerner@chromium.org>

Add support for LZ4 decompression algorithm

This patch adds support for LZ4-compressed FIT image contents. This
algorithm has a slightly worse compression ration than LZO while being
nearly twice as fast to decompress. When loading images from a fast
storage medium this usually results in a boot time win.

Sandbox-tested only since I don't have a U-Boot development system set
up right now. The code was imported unchanged from coreboot where it's
proven to work, though. I'm mostly interested in getting this recognized
by mkImage for use in a downstream project.

Signed-off-by: Julius Werner <jwerner@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# a7d660bc 22-Aug-2015 Simon Glass <sjg@chromium.org>

tpm: Add Kconfig options for TPMs

Add new Kconfig options for TPMs in preparation for moving boards to use
Kconfig for TPM configuration.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 867a6ac8 31-Jul-2015 Simon Glass <sjg@chromium.org>

efi: Add start-up library code

When running as an EFI application, U-Boot must request memory from EFI,
and provide access to the boot services U-Boot needs.

Add library code to perform these tasks. This includes efi_main() which is
the entry point from EFI. U-Boot is built as a shared library.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d1389403 23-Jun-2015 Simon Glass <sjg@chromium.org>

Add a dhrystone benchmark command

Drystone provides a convenient sanity check that the CPU is running at full
speed. Add this as a command which can be enabled as needed.

Note: I investigated using Coremark for this but there was a license
agreement and I could not work out if it was GPL-compatible.

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

# f7848d90 22-Jun-2015 Joe Hershberger <joe.hershberger@ni.com>

Allow CONFIG_REGEX to be disabled when CONFIG_NET

Instead of selecting REGEX when NET is enabled, make it the default, but
allow boards that are tiny to disable it and lose functionality on all
but the first Ethernet adapter.

cm-bf548, bf538f-ezkit, and bf533-stamp need this. None appear to have
more than one Ethernet interface.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# 3850dbe8 11-Jun-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

blackfin: fix undefined reference to srand and rand

Commit 9ba9e85f3f1c (net: Fix NET_RANDOM_ETHADDR dependencies)
accidentally dropped CONFIG_LIB_RAND defines for 14 Blackfin boards.

Prior to that commit, those boards defined CONFIG_LIB_RAND, but not
CONFIG_NET_RANDOM_ETHADDR. So, commit 9ba9e85f3f1c should not have
touched them, but in fact it ripped CONFIG_LIB_RAND off from all the
header files, which caused undefined reference to srand and rand.
CONFIG_LIB_RAND=y must be revived for such boards.

BTW, this commit indeed makes it better, but even with this fix,
three boards (bf533-stamp, bf538f-ezkit, cm-bf548) still can not
build due to region 'ram' overflowed error. This was cause by
commit 6eed3786c68c (net: Move the CMD_NET config to defconfigs)
because CMD_NET selects NET, and NET selects REGEX. Eventually,
some boards were newly enabled with CONFIG_REGEX, increasing the
memory footprint. A patch is expected to fix the build error.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 9ba9e85f 25-May-2015 Michal Simek <michal.simek@xilinx.com>

net: Fix NET_RANDOM_ETHADDR dependencies

NET_RANDOM_ETHADDR depends on lib/rand.c. This patch adds dependency to
Kconfig to ensure that library is also compiled.

Remove the definitions from Blackfin boards' include/configs.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 6501ff62 20-Apr-2015 Przemyslaw Marczak <p.marczak@samsung.com>

lib: Kconfig: add entry for errno_str() function

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1a60650c 21-Apr-2015 Joe Hershberger <joe.hershberger@ni.com>

kconfig: Move REGEX to Kconfig

Having this as a Kconfig allows it to be a dependent feature.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8156345d 06-Mar-2015 Simon Glass <sjg@chromium.org>

sandbox: Move CONFIG_SYS_VSNPRINTF to Kconfig

Move this over to Kconfig and tidy up.

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

# 94e3c8c4 19-Feb-2015 gaurav rana <gaurav.rana@freescale.com>

crypto/fsl - Add progressive hashing support using hardware acceleration.

Currently only normal hashing is supported using hardware acceleration.
Added support for progressive hashing using hardware.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
Signed-off-by: Gaurav Rana <gaurav.rana@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>

# d9f23c7f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

lib/rsa: Add Kconfig for devices supporting RSA Modular Exponentiation

Kconfig option added for devices which support RSA Verification.
1. RSA_SOFTWARE_EXP
Enables driver for supporting RSA Modular Exponentiation in Software
2. RSA_FREESCALE_EXP
Enables driver for supporting RSA Modular Exponentiation using Freescale specific
driver

The above drivers use RSA uclass

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
(Removed duplicate line in Kconfig comment)

Change-Id: I7663c4d5350e2bfc3dfa2696f70ef777d6ccc6f6

# c4beb22f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

FIT: Modify option FIT_SIGNATURE in Kconfig

For FIT signature based approach to work, RSA library needs to be selected.
The FIT_SIGNATURE option in Kconfig is modified to automatically select RSA.
Selecting RSA compiles the RSA library required for image verification.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 45ccec8f 23-Oct-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_USE_PRIVATE_LIBGCC to Kconfig

The private libgcc is supported only on ARM, MIPS, PowerPC, SH, x86.
Those architectures should "select" HAVE_PRIVATE_LIBGCC and
CONFIG_USE_PRIVATE_LIBGCC should depend on it.

Currently, this option is enabled on Tegra boards and x86 architecture.
Move the definition from header files to Kconfig.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Tested-by: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: Tom Warren <twarren@nvidia.com>

# 8c688bc4 23-Oct-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_SYS_HZ to lib/Kconfig

CONFIG_SYS_HZ is always defined as 1000 in config_fallbacks.h
(but some boards still have redundant definitions).

This commit moves the definition and the document in README to
Kconfig. Since lib/Kconfig can assure that CONFIG_SYS_HZ is 1000,
the sanity check in lib/time.c should be removed.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Reviewed-by: Marek Vasut <marex@denx.de>

# b0928da6 16-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED to Kconfig

If this option is enabled, the objects under lib/ directory
are compiled with speed optimization, not size optimization.
(Currently, only used by some Blackfin boards.)

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# ed36323f 16-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: add blank Kconfig files

This would be useful to start moving various config options.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# e0103158 25-Feb-2021 Bin Meng <bmeng.cn@gmail.com>

lib: kconfig: Mention CONFIG_ADDR_MAP limitation in the help

Mention that CONFIG_ADDR_MAP only works in the post-relocation phase.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>

# 56e7257c 03-Feb-2021 Bin Meng <bmeng.cn@gmail.com>

lib: Fix BINMAN_FDT dependency

lib/binman.c references the following 3 ofnode APIs:
ofnode_first_subnode(), ofnode_path() and ofnode_read_bool().

These APIs get built only when DM is on. Fix the dependency then.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 59e4e391 18-Jan-2021 Tom Rini <trini@konsulko.com>

Merge https://gitlab.denx.de/u-boot/custodians/u-boot-riscv

- Update qemu-riscv.rst build instructions.
- Add support for SPI on Kendryte K210.
- Add Microchip PolarFire SoC Icicle Kit support.
- Add support for an early timer.
- Select TIMER_EARLY to avoid infinite recursion for Trace.


# a80f8513 17-Jan-2021 Pragnesh Patel <pragnesh.patel@sifive.com>

trace: select TIMER_EARLY to avoid infinite recursion

When tracing functions is enabled this adds calls to
__cyg_profile_func_enter() and __cyg_profile_func_exit() to the traced
functions.

__cyg_profile_func_enter() and __cyg_profile_func_exit() invoke
timer_get_us() to record the entry and exit time.

initr_dm() will make gd->dm_root = NULL and gd->timer = NULL, so
timer_get_us() -> get_ticks() -> dm_timer_init() will lead to an
indefinite recursion.

So select TIMER_EARLY when tracing got enabled.

Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Rick Chen <rick@andestech.com>

# 6205bbb1 04-Jan-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lib: cosmetic update of CONFIG_LIB_ELF description

Change 2 typo error in CONFIG_LIB_ELF description:
- Supoort => Support
- fir => for

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c589132a 02-Dec-2020 Aswath Govindraju <a-govindraju@ti.com>

fdt: Use phandle to distinguish DT nodes with same name

While assigning the sequence number to subsystem instances by reading the
aliases property, only DT nodes names are compared and not the complete
path. This causes a problem when there are two DT nodes with same name but
have different paths.

In arch/arm/dts/k3-am65-main.dtsi there are two USB controllers with the
same device tree node name but different path. When aliases are defined for
these USB controllers then fdtdec_get_alias_seq() fails to pick the correct
instance for a given index.

fdt_path_offset() function is slow and this would effect the U-Boot
startup. To avert the time penalty on all boards, apply this extra check
only when required by using a config option.

Fix it by comparing the phandles of DT nodes after the node names match,
under a config option.

Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Fix whitespace error in Kconfig:
Signed-off-by: Simon Glass <sjg@chromium.org>

# 28cef9ca 19-Nov-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

fs: fat: create correct short names

The current function set_name() used to create short names has the
following deficiencies resolved by this patch:

* Long names (e.g. FOO.TXT) are stored even if a short name is enough.
* Short names with spaces are created, e.g. "A ~1.TXT".
* Short names with illegal characters are created, e.g. "FOO++BAR".
* Debug output does not not consider that the short file name has no
concluding '\0'.

The solution for the following bug is split of into a separate patch:

* Short file names must be unique.

This patch only provides the loop over possible short file names.

Fixes: c30a15e590c ("FAT: Add FAT write feature")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# e4f8e543 05-Nov-2020 Simon Glass <sjg@chromium.org>

smbios: Drop the unused Kconfig options

Now that we can use devicetree to specify this information, drop the old
CONFIG options.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 44c74bdd 05-Nov-2020 Simon Glass <sjg@chromium.org>

sysinfo: Provide a default driver to set SMBIOS values

Some boards want to specify the manufacturer or product name but do not
need to have their own sysinfo driver.

Add a default driver which provides a way to specify this SMBIOS
information in the devicetree, without needing any board-specific
functionality.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d2cb7a22 04-Nov-2020 Simon Glass <sjg@chromium.org>

x86: Allow putting some tables in the bloblist

At present all tables are placed starting at address f0000 in memory, and
can be up to 64KB in size. If the tables are very large, this may not
provide enough space.

Also if the tables point to other tables (such as console log or a ramoops
area) then we must allocate other memory anyway.

The bloblist is a nice place to put these tables since it is contiguous,
which makes it easy to reserve this memory for linux using the 820 tables.

Add an option to put some of the tables in the bloblist. For SMBIOS and
ACPI, create suitable pointers from the f0000 region to the new location
of the tables.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
[bmeng: squashed in http://patchwork.ozlabs.org/project/uboot/patch/
20201105062407.1.I8091ad931cbbb5e3b6f6ababdf3f8d5db0d17bb9@changeid/]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# 415eab06 03-Nov-2020 Christian Gmeiner <christian.gmeiner@gmail.com>

smbios: add parsing API

Add a very simple API to be able to access SMBIOS strings
like vendor, model and bios version.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 72eda507 27-Oct-2020 Sean Anderson <seanga2@gmail.com>

lib: Add getopt

Some commands can get very unweildy if they have too many positional
arguments. Adding options makes them easier to read, remember, and
understand.

This implementation of getopt has been taken from barebox, which has had
option support for quite a while. I have made a few modifications to their
version, such as the removal of opterr in favor of a separate getopt_silent
function. In addition, I have moved all global variables into struct
getopt_context.

The getopt from barebox also re-orders the arguments passed to it so that
non-options are placed last. This allows users to specify options anywhere.
For example, `ls -l foo/ -R` would be re-ordered to `ls -l -R foo/` as
getopt parsed the options. However, this feature conflicts with the const
argv in cmd_tbl->cmd. This was originally added in 54841ab50c ("Make sure
that argv[] argument pointers are not modified."). The reason stated in
that commit is that hush requires argv to stay unmodified. Has this
situation changed? Barebox also uses hush, and does not have this problem.
Perhaps we could use their fix?

I have assigned maintenance of getopt to Simon Glass, as it is currently
only used by the log command. I would also be fine maintaining it.

Signed-off-by: Sean Anderson <seanga2@gmail.com>

# 26637e2e 12-Sep-2020 Simon Glass <sjg@chromium.org>

lib: Allow hexdump to be used in SPL

It is sometimes useful to output hex dumps in SPL. Add a config option to
allow this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# e87dfb05 05-Aug-2020 Andrii Anisov <andrii_anisov@epam.com>

lib: sscanf: add sscanf implementation

Port sscanf implementation from mini-os and introduce new
Kconfig option to enable it: CONFIG_SSCANF. Disable by default.

Signed-off-by: Andrii Anisov <andrii_anisov@epam.com>
Signed-off-by: Anastasiia Lukianenko <anastasiia_lukianenko@epam.com>
Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>

# 81014f73 30-Jul-2020 Joao Marcos Costa <joaomarcos.costa@bootlin.com>

include/u-boot, lib/zlib: add sources for zlib decompression

Add zlib (v1.2.11) uncompr() function to U-Boot. SquashFS depends on
this function to decompress data from a raw disk image. The actual
support for zlib into SquashFS sources will be added in a follow-up
commit.

Signed-off-by: Joao Marcos Costa <joaomarcos.costa@bootlin.com>

# 69be8fd1 03-Jun-2020 Marek Szyprowski <m.szyprowski@samsung.com>

powerpc: move ADDR_MAP to Kconfig

Move ADDR_MAP related config options from include/configs/*.h to the
proper place in lib/Kconfig. This has been done using
./tools/moveconfig.py and manual inspection of the generated changes.
This is a preparation to use ADDR_MAP helper on ARM 32bit Raspberry Pi4
board for mapping the PCIe XHCI MMIO, which is above the 4GiB identity
mapping limit.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# d16b38f4 15-Apr-2020 Reuben Dowle <reubendowle0@gmail.com>

Add support for SHA384 and SHA512

The current recommendation for best security practice from the US government
is to use SHA384 for TOP SECRET [1].

This patch adds support for SHA384 and SHA512 in the hash command, and also
allows FIT images to be hashed with these algorithms, and signed with
sha384,rsaXXXX and sha512,rsaXXXX

The SHA implementation is adapted from the linux kernel implementation.

[1] Commercial National Security Algorithm Suite
http://www.iad.gov/iad/programs/iad-initiatives/cnsa-suite.cfm

Signed-off-by: Reuben Dowle <reuben.dowle@4rf.com>

# 43e442a5 26-May-2020 Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

kconfig: fix some typos

Signed-off-by: Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

# eff5a547 22-May-2020 Michael Walle <michael@walle.cc>

cmd: zip: automatically pull in gzip()

Move the CONFIG_GZIP_COMPRESSED from a config.h macro to a Kconfig menu
item. It is not selectable by a user because there is no reason to do
so. Instead it will be automatically selected by the stuff which uses
gzip(), like the zip command.

Remove it from the config_whitelist.txt. Also remove
CONFIG_GZIP_COMPRESS_DEF_SZ as this was never used on any board. The
default seems to be sane, otherwise it should be added as a Kconfig
option.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8239be61 06-May-2020 Simon Glass <sjg@chromium.org>

lib: Allow MD5 to be enabled in SPL

At present the MD5 option cannot be enabled by board configs since it has
no Kconfig name. It is generally enabled, so long as FIT support is
present. But not all boards use FIT, particularly in SPL

Fix this and add an option for SPL as well. This allows board code to call
md5() even if FIT support is not enabled.

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

# 04cb3994 21-Apr-2020 Weijie Gao <weijie.gao@mediatek.com>

lib: enable lzma decompression support for SPL build

This patch enables LZMA decompression support for SPL build

Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>

# 2a2119e1 05-Mar-2020 Atish Patra <atish.patra@wdc.com>

lib: kconfig: Add option to set BZIP2 compression method

There is no way to select BZIP2 compression method.
Add it under library/compression config where all other
compression related configs are present.

Signed-off-by: Atish Patra <atish.patra@wdc.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 805b3cac 12-Feb-2020 Keerthy <j-keerthy@ti.com>

lib: elf: Move the generic elf loading/validating functions to lib

Move the generic elf loading/validating functions to lib/
so that they can be re-used and accessed by code existing
outside cmd.

While at it remove the duplicate static version of load_elf_image_phdr
under arch/arm/mach-imx/imx_bootaux.c.

Signed-off-by: Keerthy <j-keerthy@ti.com>
Suggested-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>

# 1611235b 19-Jan-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: Kconfig dependencies for pseudo-random library

drivers/rng/sandbox_rng.c requires rand() to be defined but configuration
option CONFIG_CONFIG_LIB_RAND selected in drivers/rng/Kconfig does not
exist.

test/lib/test_aes.c requires rand() to be defined.

Fix the selection criteria for choice "Pseudo-random library support type".

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 3c10dc95 06-Dec-2019 Simon Glass <sjg@chromium.org>

binman: Add a library to access binman entries

SPL and TPL can access information about binman entries using link-time
symbols but this is not available in U-Boot proper. Of course it could be
made available, but the intention is to just read the device tree.

Add support for this, so that U-Boot can locate entries.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# b4adf627 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: crypto: add x509 parser

Imported from linux kernel v5.3:
x509.asn1 without changes
x509_akid.asn1 without changes
x509_parser.h without changes
x509_cert_parser.c with changes marked as __UBOOT__
x509_public_key.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# a9b45e6e 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add oid registry utility

Imported from linux kernel v5.3:
build_OID_registry without changes
oid_registry.h without changes
oid_registry.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# ab8a0e06 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add asn1 decoder

Imported from linux kernel v5.3:
lib/asn1_decoder.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 2b12196d 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

cmd: add asn1_compiler

Imported from linux kernel v5.3:
asn1.h without changes
asn1_ber_bytecode.h without changes
asn1_decoder.h without changes
asn1_compiler.c without changes

This host command will be used to create a ASN1 parser, for example,
for pkcs7 messages or x509 certificates. More specifically, it will
generate *byte code* which will be interpreted by asn1 decoder library.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 05429b6c 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

rtc: move date.c from drivers/rtc/ to lib/

In the next commit, rtc_mktime(), for compatibility with linux, will be
implemented using rtc_mktime(), which is no longer drivers/rtc specific.
So move this file under lib/.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 37ef1774 10-Nov-2019 Thomas Hebb <tommyhebb@gmail.com>

Kconfig: disambiguate config names for tiny printf

27084c03d36a ("spl: Allow tiny printf() to be controlled in SPL and
TPL") split this option in two for TPL and SPL, but didn't change the
Kconfig names, making them hard to set quickly.

Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>

# 0d76afc0 27-Oct-2019 Simon Glass <sjg@chromium.org>

fdt: Add Kconfig options to control code size

For better or worse libfdt recent grew a lot of code that checks the
validity of the device tree in great detail. When using unsigned or
unverified data this makes things safer, but it does add to code size.

Add some controls to select the trade-off between safety and code size.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 27084c03 25-Sep-2019 Simon Glass <sjg@chromium.org>

spl: Allow tiny printf() to be controlled in SPL and TPL

At present there is only one control for this and it is used for both SPL
and TPL. But SPL might have a lot more space than TPL so the extra cost of
a full printf() might be acceptable.

Split the option into two, providing separate SPL and TPL controls. The
TPL setting defaults to the same as SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2a51e16b 07-Jun-2019 Tom Rini <trini@konsulko.com>

configs: Make USE_TINY_PRINTF depend on SPL||TPL and be default

The USE_TINY_PRINTF symbol only changes things within SPL and TPL
builds, so make it depend on that support. Next, make it default as
within these cases we should rarely have need of more advanced print
formats outside of the debug context.

To do this, in a few cases we need to correct our Kconfig dependencies
as we had cases of non-SPL targets select'ing this symbol. Finally, in
the case of a few boards we really do need the full printf
functionality.

Signed-off-by: Tom Rini <trini@konsulko.com>

# da0fb5fd 02-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: make call depth limit customizable

Up to now we had hard coded values for the call depth up to which trace
records are created: 200 for early tracing, 15 thereafter. UEFI
applications reach a call depth of 80 or above.

Provide customizing settings for the call trace depth limit and the early
call trace depth limit. Use the old values as defaults.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8509f22a 29-Apr-2019 Marek Behún <marek.behun@nic.cz>

lib: add Zstandard decompression support

Add the zstd library from Linux kernel (only decompression support).
There are minimal changes to build with U-Boot, otherwise the files are
identical to Linux commit dc35da16 from March 2018, the files had not
been touched since in kernel. Also SPDX lincese tags were added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 83a486b6 29-Apr-2019 Marek Behún <marek.behun@nic.cz>

lib: Add xxhash support

This adds the xxhash support from Linux. Files are almost identical to
those added to Linux in commit 5d240522 ("lib: Add xxhash module") (they
haven't been touched since in Linux). The only difference is to add some
includes to be compatible with U-Boot. Also SPDX lincese tags were
added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 5132361a 29-Apr-2019 Heiko Schocher <hs@denx.de>

lib: Kconfig: fix help text for GZIP

commit 95f4bbd581cf ("lib: fdt: Allow LZO and GZIP DT compression in U-Boot")

introduced Kconfig option for gzip in U-Boot, but help text
says gzip for SPL, which is wrong. Fix this.

Signed-off-by: Heiko Schocher <hs@denx.de>
Acked-by: Marek Vasut <marex@denx.de>

# 1c6eb075 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE_BUFFER_SIZE et al to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE_BUFFER_SIZE
CONFIG_TRACE_EARLY_SIZE
CONFIG_TRACE_EARLY
CONFIG_TRACE_EARLY_ADDR

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

# a24a78d7 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE

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

# 54969b40 21-Mar-2019 Thierry Reding <treding@nvidia.com>

fdtdec: Add Kconfig symbol for tests

Runtime tests are provided as a test_fdtdec command implementation. Add
a Kconfig symbol that allows this command to be built so that the tests
can be used.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 95f4bbd5 08-Mar-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

lib: fdt: Allow LZO and GZIP DT compression in U-Boot

Add required Kconfig symbols, Makefile bits and macro fixes in a
few places to support LZO and DT compression in U-Boot. This can
save a lot of space with multi-DTB fitImages.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>

# 6e705114 13-Jan-2019 Chris Packham <judge.packham@gmail.com>

lib: Kconfig: spelling fixes

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 048c6e89 06-Nov-2018 Simon Glass <sjg@chromium.org>

spl: lz4: Allow use of lz4 compression in SPL

In some cases U-Boot is compressed and it is useful to be able to
decompress it in SPL. Add a Kconfig and Makefile change to allow this.
Note that this does not actually implement decompression.

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

# 2895c4b7 15-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

kconfig: Introduce HAVE_ARCH_IOMAP

Introduce a new Kconfig option for architecture codes to control
whether it provides io{read,write}{8,16,32} I/O accessor functions.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5592a633 01-Oct-2018 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt in TPL

In some cases (e.g. sandbox with verified boot) it is useful to support
libfdt in TPL. Update the Kconfig to handle this.

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

# 6307896c 01-Oct-2018 Simon Glass <sjg@chromium.org>

tpm: Add support for SPL and TPL

At present the tpm can only be used in U-Boot proper. Updated it to work
in SPL and TPL also.

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

# ab948cd2 19-Jul-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

fdt_support: make FDT_FIXUP_PARTITIONS depend on CMD_MTDPARTS

fdt_fixup_mtdparts() calls mtdparts_init() and device_find(),
which are defined in cmd/mtdparts.c

The combination of FDT_FIXUP_PARTITIONS=y and CMD_MTDPARTS=n
emits the following link error:

common/fdt_support.c:903: undefined reference to `mtdparts_init'
common/fdt_support.c:914: undefined reference to `device_find'

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 3330584d 03-Jun-2018 Igor Opaniuk <igor.opaniuk@gmail.com>

avb2.0: integrate avb 2.0 into the build system

Integrate libavb into the build system. Introduce CONFIG_LIBAVB
build option.

Signed-off-by: Igor Opaniuk <igor.opaniuk@linaro.org>

# f8c987f8 05-Jun-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

lib: Add hexdump

Often during debugging session it's very interesting to see
what data we were dealing with. For example what we write or read
to/from memory or peripherals.

This change introduces functions that allow to dump binary
data with one simple function invocation like:
------------------->8----------------
print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, buf, len);
------------------->8----------------

which gives us the following:
------------------->8----------------
00000000: f2 b7 c9 88 62 61 75 64 72 61 74 65 3d 31 31 35 ....baudrate=115
00000010: 32 30 30 00 62 6f 6f 74 61 72 67 73 3d 63 6f 6e 200.bootargs=con
00000020: 73 6f 6c 65 3d 74 74 79 53 33 2c 31 31 35 32 30 sole=ttyS3,11520
00000030: 30 6e 38 00 62 6f 6f 74 64 65 6c 61 79 3d 33 00 0n8.bootdelay=3.
00000040: 62 6f 6f 74 66 69 6c 65 3d 75 49 6d 61 67 65 00 bootfile=uImage.
00000050: 66 64 74 63 6f 6e 74 72 6f 6c 61 64 64 72 3d 39 fdtcontroladdr=9
00000060: 66 66 62 31 62 61 30 00 6c 6f 61 64 61 64 64 72 ffb1ba0.loadaddr
00000070: 3d 30 78 38 32 30 30 30 30 30 30 00 73 74 64 65 =0x82000000.stde
00000080: 72 72 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 rr=serial0@e0022
00000090: 30 30 30 00 73 74 64 69 6e 3d 73 65 72 69 61 6c 000.stdin=serial
000000a0: 30 40 65 30 30 32 32 30 30 30 00 73 74 64 6f 75 0@e0022000.stdou
000000b0: 74 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 30 t=serial0@e00220
000000c0: 30 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00..............
...
------------------->8----------------

Source of hexdump.c was copied from Linux kernel v4.7-rc2.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Mario Six <mario.six@gdsys.cc>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Stefan Roese <sr@denx.de>

# c232d14d 29-May-2018 Alex Kiernan <alex.kiernan@gmail.com>

mmc: Separate "mmc swrite" from fastboot

Introduce CONFIG_IMAGE_SPARSE and CONFIG_CMD_MMC_SWRITE so the "mmc
swrite" command is separated from the fastboot code.

Move image-sparse from common to lib so it's clear it's library code.

Rename CONFIG_FASTBOOT_FLASH_FILLBUF_SIZE to CONFIG_IMAGE_SPARSE_FILLBUF_SIZE
and migrate it to Kconfig.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Acked-by: Jassi Brar <jaswinder.singh@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6417572e 08-May-2018 Tom Rini <trini@konsulko.com>

lib/Kconfig: Mark OF_LIBFDT_OVERLAY as depending on OF_LIBFDT

The overlay code is only useful when OF_LIBFDT is set, so mark it as
depending on that first.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 58a46f88 25-Apr-2018 Praneeth Bajjuri <praneeth@ti.com>

configs: TI: Enable FIT Library overlay support

Enable the FDT library overlay support for all TI SOC family.

Without this option, when Loading fdt from FIT image, the
following warning is seen.

"config with overlays but CONFIG_OF_LIBFDT_OVERLAY not set".

Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
Suggested-by: Andrew F.Davis <afd@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>

# 14ad44ab 18-Apr-2018 Alex Kiernan <alex.kiernan@gmail.com>

spl: Split sprintf, strto* from SPL serial in Kconfig

When SPL serial is disabled, callers who need sprintf or strtoul fail
because their inclusion is guarded by CONFIG_SPL_SERIAL_SUPPORT/
CONFIG_TPL_SERIAL_SUPPORT.

Split printf, sprintf and strto into their own entries and then select
all of them if SERIAL_SUPPORT is enabled to match the current behaviour.

Include panic.o unconditionally as it can be called from anywhere which
uses BUG_ON().

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>

# e294ba06 04-Apr-2018 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-sunxi

Signed-off-by: Tom Rini <trini@konsulko.com>


# d14db11d 03-Apr-2018 Andre Przywara <andre.przywara@arm.com>

sunxi: revert disabling of features

In January some commits were introduced to mitigate the U-Boot image
size issues we encountered on sunxi builds.
Now with the MMC environment removed we can bring them back, as we
practically don't have a size limit anymore.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 32ce6179 13-Mar-2018 Bryan O'Donoghue <bryan.odonoghue@linaro.org>

optee: Add lib entries for sharing OPTEE code across ports

This patch adds code to lib to enable sharing of useful OPTEE code between
board-ports and architectures. The code on lib/optee/optee.c comes from the
TI omap2 port. Eventually the OMAP2 code will be patched to include the
shared code. The intention here is to add more useful OPTEE specific code
as more functionality gets added.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Cc: Harinarayan Bhatta <harinarayan@ti.com>
Cc: Andrew F. Davis <afd@ti.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Kever Yang <kever.yang@rock-chips.com>
Cc: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Cc: Peng Fan <peng.fan@nxp.com>
Tested-by: Peng Fan <peng.fan@nxp.com>

# 36c1877c 06-Feb-2018 Faiz Abbas <faiz_abbas@ti.com>

lib: Kconfig: Move DYNAMIC_CRC_TABLE to Kconfig

Add CONFIG prefix to DYNAMIC_CRC_TABLE and implement it in
Kconfig.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>

# a451bc27 05-Feb-2018 Adam Ford <aford173@gmail.com>

Convert LIB_UUID to Kconfig

config_fallback.h has some logic that checks a variety of options
and selects LIB_UUID if it hasn't already been selected. This
will all LIB_UUID in Kconfig and select this option for the list
of options to allow us to remove the logic from fallbacks

Signed-off-by: Adam Ford <aford173@gmail.com>

# a5a37567 06-Feb-2018 Adam Ford <aford173@gmail.com>

Convert CONFIG LIB_HW_RAND to Kconfig

config_fallbacks.h had some logic to automatically select
LIB_RAND if RANDOM_UUID or CMD_UUID were set if LIB_HW_RAND wasn't
already selected. By migrating LIB_HW_RAND to Kconfig, we can
remove this check from config_fallbacks.h and put it into Kconfig

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
[trini: Turn into a choice, add NET_RANDOM_ETHADDR]
Signed-off-by: Tom Rini <trini@konsulko.com>

# acd4d334 16-Jan-2018 Maxime Ripard <maxime.ripard@free-electrons.com>

net: regex: Disable by default on sunXi

The sunXi arm64 build has overflown, leading to the main U-boot binary
overwriting the environment when flashing the new image, or even worse,
overwriting itself when we're calling saveenv.

Disable this option that is not critical until we can adress the issue
properly.

Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 7e3caa81 03-Dec-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

Move CONFIG_PANIC_HANG to Kconfig

Freescale (NXP) boards have lots of defconfig files per board.
I used "imply PANIC_HANG" for them.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# da5337a6 08-Nov-2017 Nandor Han <nandor.han@ge.com>

rtc: add support for s35392a

Add support for S35392A RTC. The driver supports both U-Boot driver
models.

Signed-off-by: Nandor Han <nandor.han@ge.com>
Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
Cc: Heiko Schocher <hs@denx.de>

# f52bdf4b 14-Sep-2017 Jean-Jacques Hiblot <jjhiblot@ti.com>

lib: allow building lzo for the SPL

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 85d8bf57 03-Sep-2017 Marek Behún <marek.behun@nic.cz>

lib: Add CRC32-C

This is needed for BTRFS.

Signed-off-by: Marek Behun <marek.behun@nic.cz>

create mode 100644 lib/crc32c.c

# 7264f292 15-Aug-2017 York Sun <york.sun@nxp.com>

spl: fit: Eanble GZIP support for image decompression

Add Kconfig option SPL_GZIP and SPL_ZLIB to enable gunzip support for
SPL boot, eg. falcon boot compressed kernel image.

Signed-off-by: York Sun <york.sun@nxp.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6ef2f901 11-Aug-2017 Adam Ford <aford173@gmail.com>

Convert CONFIG_BCH to Kconfig

This converts the following to Kconfig:
CONFIG_BCH

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1a7ba1d 18-Aug-2017 Anatolij Gustschin <agust@denx.de>

Fix 'notes' typos

s/notes/nodes

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 96b9082c 03-Aug-2017 Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

rockchip: rk3188: rock: adjust for SPL/TPL split

With the changes to split SPL/TPL for the RK3368, I apparently missed
some needed adjustments to the RK3188 Kconfig and rock_defconfig.

This fixes build-issues for the rock board after applying the RK3368
enablement (and SPL/TPL) set that resulted from TPL_SERIAL_SUPPORT,
TPL_ROCKCHIP_BACK_TO_BROM and TPL_TINY_MEMSET being separate symbols
now.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d56b4b19 22-Jul-2017 Tom Rini <trini@konsulko.com>

configs: Migrate RBTREE, LZO, CMD_MTDPARTS, CMD_UBI and CMD_UBIFS

The above CONFIG options are in Kconfig, and now have correct depends and
inter-dependencies. Migrate these to configs/ from include/configs/. In the
case of CMD_UBIFS also change it to be a default y if CMD_UBI.

Signed-off-by: Tom Rini <trini@konsulko.com>

# aed998aa 17-May-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_LZMA to Kconfig

This converts the following to Kconfig:
CONFIG_LZMA

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

# b1a873df 26-Apr-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_CMD_AES et al to Kconfig

This converts the following to Kconfig:
CONFIG_CMD_AES
CONFIG_AES

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Add select AES to CMD_AES]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 173aafbf 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

cmd: Expose a Kconfig option to enable UBIFS commands

Create a new Kconfig entry to allow CMD_UBIFS selection from Kconfig and
add an hidden LZO option that can be selected by CMD_UBIFS.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>

# aa049152 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

mtd: ubi: Select RBTREE option from MTD_UBI Kconfig entry

Expose the RBTREE feature through Kconfig and select this option from the
MTD_UBI option.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>
[Rebased on master]
Signed-off-by: Jagan Teki <jagan@openedev.com>

# ab4458bd 02-Apr-2017 Simon Glass <sjg@chromium.org>

string: Provide a slimmed-down memset()

Most of the time the optimised memset() is what we want. For extreme
situations such as TPL it may be too large. For example on the 'rock'
board, using a simple loop saves a useful 48 bytes. With gcc 4.9 and
the rodata bug, this patch is enough to reduce the TPL image below the
limit.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>

# bea79d7d 14-Mar-2017 Andre Przywara <andre.przywara@arm.com>

Kconfig: introduce md5sum command selection

So far CONFIG_MD5SUM would need to be set by a board's include file.
Since the command is really generic, move it over to Kconfig to allow
it to be defined by either a board's defconfig, menuconfig or some
config snippet merged via mergeconfig.sh.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e663b350 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

smbios: Expose in efi_loader as table

We can pass SMBIOS easily as EFI configuration table to an EFI payload. This
patch adds enablement for that case.

While at it, we also enable SMBIOS generation for ARM systems, since they support
EFI_LOADER.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4b6dddc2 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

x86: Move smbios generation into arch independent directory

We will need the SMBIOS generation function on ARM as well going forward,
so let's move it into a non arch specific location.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# ebf7fff2 05-Oct-2016 Heiko Schocher <hs@denx.de>

spl: move FDT_FIXUP_PARTITIONS to Kconfig

Move FDT_FIXUP_PARTITIONS to Kconfig and cleanup existing
uses.

Signed-off-by: Heiko Schocher <hs@denx.de>

# ddf67f71 05-Jul-2016 Maxime Ripard <maxime.ripard@free-electrons.com>

libfdt: Add overlay application function

The device tree overlays are a good way to deal with user-modifyable
boards or boards with some kind of an expansion mechanism where we can
easily plug new board in (like the BBB, the Raspberry Pi or the CHIP).

Add a new function to merge overlays with a base device tree.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>

# 91b86e21 26-May-2016 Marek Vasut <marex@denx.de>

lib: Enable private libgcc by default

This patch decouples U-Boot binary from the toolchain on systems where
private libgcc is available. Instead of pulling in functions provided
by the libgcc from the toolchain, U-Boot will use it's own set of libgcc
functions. These functions are usually imported from Linux kernel, which
also uses it's own libgcc functions instead of the ones provided by the
toolchain.

This patch solves a rather common problem. The toolchain can usually
generate code for many variants of target architecture and often even
different endianness. The libgcc on the other hand is usually compiled
for one particular configuration and the functions provided by it may
or may not be suited for use in U-Boot. This can manifest in two ways,
either the U-Boot fails to compile altogether and linker will complain
or, in the much worse case, the resulting U-Boot will build, but will
misbehave in very subtle and hard to debug ways.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 67976306 30-Mar-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

cosmetic: Fix typos "privide"

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# ed980b8c 03-Mar-2016 Alexander Graf <agraf@csgraf.de>

efi_loader: hook up in build environment

Now that we have all the bits and pieces ready for EFI payload loading
support, hook them up in Makefiles and KConfigs so that we can build.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
[trini: Enable only when we of OF_LIBFDT, disable on kwb and colibri_pxa270]
Signed-off-by: Tom Rini <trini@konsulko.com>

# aa34fbc0 22-Feb-2016 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt to be used in SPL

Add an option to enable libfdt in SPL. This can be useful when decoding
FIT files in SPL.

We need to make sure this option is not enabled in SPL by this change.
Also this option needs to be enabled in host builds. Si add a new
IMAGE_USE_LIBFDT #define which can be used in files that are built on the
host but must also build for U-Boot and SPL.

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

# 69e173eb 22-Feb-2016 Simon Glass <sjg@chromium.org>

Move CONFIG_OF_LIBFDT to Kconfig

Move this option to Kconfig and tidy up existing boards.

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

# a187559e 05-Feb-2016 Bin Meng <bmeng.cn@gmail.com>

Use correct spelling of "U-Boot"

Correct spelling of "U-Boot" shall be used in all written text
(documentation, comments in source files etc.).

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Minkyu Kang <mk7.kang@samsung.com>

# 947c626d 14-Jan-2016 Tom Rini <trini@konsulko.com>

vsprintf.c: Always enable CONFIG_SYS_VSNPRINTF

Enabling this function always removes some class of string saftey issues.
The size change here in general is about 400 bytes and this seems a reasonable
trade-off.

Cc: Peng Fan <peng.fan@nxp.com>
Cc: Peter Robinson <pbrobinson@gmail.com>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Adrian Alonso <aalonso@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 7d9cde10 22-Nov-2015 Stefan Roese <sr@denx.de>

lib/tiny-printf.c: Add tiny printf function for space limited environments

This patch adds a small printf() version that supports all basic formats.
Its intented to be used in U-Boot SPL versions on platforms with very
limited internal RAM sizes.

To enable it, just define CONFIG_USE_TINY_PRINTF in your defconfig. This
will result in the SPL using this tiny function and the main U-Boot
still using the full-blown printf() function.

This code was copied from:
http://www.sparetimelabs.com/printfrevisited
With mostly only coding style related changes so that its checkpatch
clean.

The size reduction is about 2.5KiB. Here a comparison for the db-mv784mp-gp
(Marvell AXP) SPL:

Without this patch:
58963 18536 1928 79427 13643 ./spl/u-boot-spl

With this patch:
56542 18536 1956 77034 12cea ./spl/u-boot-spl

Note:
To make it possible to compile tiny-printf.c instead of vsprintf.c when
CONFIG_USE_TINY_PRINTF is defined, the functions printf() and vprintf() are
moved from common/console.c into vsprintf.c in this patch.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>

# 2419cd16 03-Oct-2015 Simon Glass <sjg@chromium.org>

dm: tpm: Drop CONFIG_DM_TPM

Now that all TPM drivers use driver model, we can drop the special driver
model CONFIG option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>

# 027b728d 06-Oct-2015 Julius Werner <jwerner@chromium.org>

Add support for LZ4 decompression algorithm

This patch adds support for LZ4-compressed FIT image contents. This
algorithm has a slightly worse compression ration than LZO while being
nearly twice as fast to decompress. When loading images from a fast
storage medium this usually results in a boot time win.

Sandbox-tested only since I don't have a U-Boot development system set
up right now. The code was imported unchanged from coreboot where it's
proven to work, though. I'm mostly interested in getting this recognized
by mkImage for use in a downstream project.

Signed-off-by: Julius Werner <jwerner@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# a7d660bc 22-Aug-2015 Simon Glass <sjg@chromium.org>

tpm: Add Kconfig options for TPMs

Add new Kconfig options for TPMs in preparation for moving boards to use
Kconfig for TPM configuration.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 867a6ac8 31-Jul-2015 Simon Glass <sjg@chromium.org>

efi: Add start-up library code

When running as an EFI application, U-Boot must request memory from EFI,
and provide access to the boot services U-Boot needs.

Add library code to perform these tasks. This includes efi_main() which is
the entry point from EFI. U-Boot is built as a shared library.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d1389403 23-Jun-2015 Simon Glass <sjg@chromium.org>

Add a dhrystone benchmark command

Drystone provides a convenient sanity check that the CPU is running at full
speed. Add this as a command which can be enabled as needed.

Note: I investigated using Coremark for this but there was a license
agreement and I could not work out if it was GPL-compatible.

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

# f7848d90 22-Jun-2015 Joe Hershberger <joe.hershberger@ni.com>

Allow CONFIG_REGEX to be disabled when CONFIG_NET

Instead of selecting REGEX when NET is enabled, make it the default, but
allow boards that are tiny to disable it and lose functionality on all
but the first Ethernet adapter.

cm-bf548, bf538f-ezkit, and bf533-stamp need this. None appear to have
more than one Ethernet interface.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# 3850dbe8 11-Jun-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

blackfin: fix undefined reference to srand and rand

Commit 9ba9e85f3f1c (net: Fix NET_RANDOM_ETHADDR dependencies)
accidentally dropped CONFIG_LIB_RAND defines for 14 Blackfin boards.

Prior to that commit, those boards defined CONFIG_LIB_RAND, but not
CONFIG_NET_RANDOM_ETHADDR. So, commit 9ba9e85f3f1c should not have
touched them, but in fact it ripped CONFIG_LIB_RAND off from all the
header files, which caused undefined reference to srand and rand.
CONFIG_LIB_RAND=y must be revived for such boards.

BTW, this commit indeed makes it better, but even with this fix,
three boards (bf533-stamp, bf538f-ezkit, cm-bf548) still can not
build due to region 'ram' overflowed error. This was cause by
commit 6eed3786c68c (net: Move the CMD_NET config to defconfigs)
because CMD_NET selects NET, and NET selects REGEX. Eventually,
some boards were newly enabled with CONFIG_REGEX, increasing the
memory footprint. A patch is expected to fix the build error.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 9ba9e85f 25-May-2015 Michal Simek <michal.simek@xilinx.com>

net: Fix NET_RANDOM_ETHADDR dependencies

NET_RANDOM_ETHADDR depends on lib/rand.c. This patch adds dependency to
Kconfig to ensure that library is also compiled.

Remove the definitions from Blackfin boards' include/configs.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 6501ff62 20-Apr-2015 Przemyslaw Marczak <p.marczak@samsung.com>

lib: Kconfig: add entry for errno_str() function

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1a60650c 21-Apr-2015 Joe Hershberger <joe.hershberger@ni.com>

kconfig: Move REGEX to Kconfig

Having this as a Kconfig allows it to be a dependent feature.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8156345d 06-Mar-2015 Simon Glass <sjg@chromium.org>

sandbox: Move CONFIG_SYS_VSNPRINTF to Kconfig

Move this over to Kconfig and tidy up.

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

# 94e3c8c4 19-Feb-2015 gaurav rana <gaurav.rana@freescale.com>

crypto/fsl - Add progressive hashing support using hardware acceleration.

Currently only normal hashing is supported using hardware acceleration.
Added support for progressive hashing using hardware.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
Signed-off-by: Gaurav Rana <gaurav.rana@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>

# d9f23c7f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

lib/rsa: Add Kconfig for devices supporting RSA Modular Exponentiation

Kconfig option added for devices which support RSA Verification.
1. RSA_SOFTWARE_EXP
Enables driver for supporting RSA Modular Exponentiation in Software
2. RSA_FREESCALE_EXP
Enables driver for supporting RSA Modular Exponentiation using Freescale specific
driver

The above drivers use RSA uclass

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
(Removed duplicate line in Kconfig comment)

Change-Id: I7663c4d5350e2bfc3dfa2696f70ef777d6ccc6f6

# c4beb22f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

FIT: Modify option FIT_SIGNATURE in Kconfig

For FIT signature based approach to work, RSA library needs to be selected.
The FIT_SIGNATURE option in Kconfig is modified to automatically select RSA.
Selecting RSA compiles the RSA library required for image verification.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 45ccec8f 23-Oct-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_USE_PRIVATE_LIBGCC to Kconfig

The private libgcc is supported only on ARM, MIPS, PowerPC, SH, x86.
Those architectures should "select" HAVE_PRIVATE_LIBGCC and
CONFIG_USE_PRIVATE_LIBGCC should depend on it.

Currently, this option is enabled on Tegra boards and x86 architecture.
Move the definition from header files to Kconfig.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Tested-by: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: Tom Warren <twarren@nvidia.com>

# 8c688bc4 23-Oct-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_SYS_HZ to lib/Kconfig

CONFIG_SYS_HZ is always defined as 1000 in config_fallbacks.h
(but some boards still have redundant definitions).

This commit moves the definition and the document in README to
Kconfig. Since lib/Kconfig can assure that CONFIG_SYS_HZ is 1000,
the sanity check in lib/time.c should be removed.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Reviewed-by: Marek Vasut <marex@denx.de>

# b0928da6 16-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED to Kconfig

If this option is enabled, the objects under lib/ directory
are compiled with speed optimization, not size optimization.
(Currently, only used by some Blackfin boards.)

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# ed36323f 16-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: add blank Kconfig files

This would be useful to start moving various config options.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# 56e7257c 03-Feb-2021 Bin Meng <bmeng.cn@gmail.com>

lib: Fix BINMAN_FDT dependency

lib/binman.c references the following 3 ofnode APIs:
ofnode_first_subnode(), ofnode_path() and ofnode_read_bool().

These APIs get built only when DM is on. Fix the dependency then.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 59e4e391 18-Jan-2021 Tom Rini <trini@konsulko.com>

Merge https://gitlab.denx.de/u-boot/custodians/u-boot-riscv

- Update qemu-riscv.rst build instructions.
- Add support for SPI on Kendryte K210.
- Add Microchip PolarFire SoC Icicle Kit support.
- Add support for an early timer.
- Select TIMER_EARLY to avoid infinite recursion for Trace.


# a80f8513 17-Jan-2021 Pragnesh Patel <pragnesh.patel@sifive.com>

trace: select TIMER_EARLY to avoid infinite recursion

When tracing functions is enabled this adds calls to
__cyg_profile_func_enter() and __cyg_profile_func_exit() to the traced
functions.

__cyg_profile_func_enter() and __cyg_profile_func_exit() invoke
timer_get_us() to record the entry and exit time.

initr_dm() will make gd->dm_root = NULL and gd->timer = NULL, so
timer_get_us() -> get_ticks() -> dm_timer_init() will lead to an
indefinite recursion.

So select TIMER_EARLY when tracing got enabled.

Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Rick Chen <rick@andestech.com>

# 6205bbb1 04-Jan-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lib: cosmetic update of CONFIG_LIB_ELF description

Change 2 typo error in CONFIG_LIB_ELF description:
- Supoort => Support
- fir => for

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c589132a 02-Dec-2020 Aswath Govindraju <a-govindraju@ti.com>

fdt: Use phandle to distinguish DT nodes with same name

While assigning the sequence number to subsystem instances by reading the
aliases property, only DT nodes names are compared and not the complete
path. This causes a problem when there are two DT nodes with same name but
have different paths.

In arch/arm/dts/k3-am65-main.dtsi there are two USB controllers with the
same device tree node name but different path. When aliases are defined for
these USB controllers then fdtdec_get_alias_seq() fails to pick the correct
instance for a given index.

fdt_path_offset() function is slow and this would effect the U-Boot
startup. To avert the time penalty on all boards, apply this extra check
only when required by using a config option.

Fix it by comparing the phandles of DT nodes after the node names match,
under a config option.

Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Fix whitespace error in Kconfig:
Signed-off-by: Simon Glass <sjg@chromium.org>

# 28cef9ca 19-Nov-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

fs: fat: create correct short names

The current function set_name() used to create short names has the
following deficiencies resolved by this patch:

* Long names (e.g. FOO.TXT) are stored even if a short name is enough.
* Short names with spaces are created, e.g. "A ~1.TXT".
* Short names with illegal characters are created, e.g. "FOO++BAR".
* Debug output does not not consider that the short file name has no
concluding '\0'.

The solution for the following bug is split of into a separate patch:

* Short file names must be unique.

This patch only provides the loop over possible short file names.

Fixes: c30a15e590c ("FAT: Add FAT write feature")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# e4f8e543 05-Nov-2020 Simon Glass <sjg@chromium.org>

smbios: Drop the unused Kconfig options

Now that we can use devicetree to specify this information, drop the old
CONFIG options.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 44c74bdd 05-Nov-2020 Simon Glass <sjg@chromium.org>

sysinfo: Provide a default driver to set SMBIOS values

Some boards want to specify the manufacturer or product name but do not
need to have their own sysinfo driver.

Add a default driver which provides a way to specify this SMBIOS
information in the devicetree, without needing any board-specific
functionality.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d2cb7a22 04-Nov-2020 Simon Glass <sjg@chromium.org>

x86: Allow putting some tables in the bloblist

At present all tables are placed starting at address f0000 in memory, and
can be up to 64KB in size. If the tables are very large, this may not
provide enough space.

Also if the tables point to other tables (such as console log or a ramoops
area) then we must allocate other memory anyway.

The bloblist is a nice place to put these tables since it is contiguous,
which makes it easy to reserve this memory for linux using the 820 tables.

Add an option to put some of the tables in the bloblist. For SMBIOS and
ACPI, create suitable pointers from the f0000 region to the new location
of the tables.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
[bmeng: squashed in http://patchwork.ozlabs.org/project/uboot/patch/
20201105062407.1.I8091ad931cbbb5e3b6f6ababdf3f8d5db0d17bb9@changeid/]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# 415eab06 03-Nov-2020 Christian Gmeiner <christian.gmeiner@gmail.com>

smbios: add parsing API

Add a very simple API to be able to access SMBIOS strings
like vendor, model and bios version.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 72eda507 27-Oct-2020 Sean Anderson <seanga2@gmail.com>

lib: Add getopt

Some commands can get very unweildy if they have too many positional
arguments. Adding options makes them easier to read, remember, and
understand.

This implementation of getopt has been taken from barebox, which has had
option support for quite a while. I have made a few modifications to their
version, such as the removal of opterr in favor of a separate getopt_silent
function. In addition, I have moved all global variables into struct
getopt_context.

The getopt from barebox also re-orders the arguments passed to it so that
non-options are placed last. This allows users to specify options anywhere.
For example, `ls -l foo/ -R` would be re-ordered to `ls -l -R foo/` as
getopt parsed the options. However, this feature conflicts with the const
argv in cmd_tbl->cmd. This was originally added in 54841ab50c ("Make sure
that argv[] argument pointers are not modified."). The reason stated in
that commit is that hush requires argv to stay unmodified. Has this
situation changed? Barebox also uses hush, and does not have this problem.
Perhaps we could use their fix?

I have assigned maintenance of getopt to Simon Glass, as it is currently
only used by the log command. I would also be fine maintaining it.

Signed-off-by: Sean Anderson <seanga2@gmail.com>

# 26637e2e 12-Sep-2020 Simon Glass <sjg@chromium.org>

lib: Allow hexdump to be used in SPL

It is sometimes useful to output hex dumps in SPL. Add a config option to
allow this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# e87dfb05 05-Aug-2020 Andrii Anisov <andrii_anisov@epam.com>

lib: sscanf: add sscanf implementation

Port sscanf implementation from mini-os and introduce new
Kconfig option to enable it: CONFIG_SSCANF. Disable by default.

Signed-off-by: Andrii Anisov <andrii_anisov@epam.com>
Signed-off-by: Anastasiia Lukianenko <anastasiia_lukianenko@epam.com>
Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>

# 81014f73 30-Jul-2020 Joao Marcos Costa <joaomarcos.costa@bootlin.com>

include/u-boot, lib/zlib: add sources for zlib decompression

Add zlib (v1.2.11) uncompr() function to U-Boot. SquashFS depends on
this function to decompress data from a raw disk image. The actual
support for zlib into SquashFS sources will be added in a follow-up
commit.

Signed-off-by: Joao Marcos Costa <joaomarcos.costa@bootlin.com>

# 69be8fd1 03-Jun-2020 Marek Szyprowski <m.szyprowski@samsung.com>

powerpc: move ADDR_MAP to Kconfig

Move ADDR_MAP related config options from include/configs/*.h to the
proper place in lib/Kconfig. This has been done using
./tools/moveconfig.py and manual inspection of the generated changes.
This is a preparation to use ADDR_MAP helper on ARM 32bit Raspberry Pi4
board for mapping the PCIe XHCI MMIO, which is above the 4GiB identity
mapping limit.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# d16b38f4 15-Apr-2020 Reuben Dowle <reubendowle0@gmail.com>

Add support for SHA384 and SHA512

The current recommendation for best security practice from the US government
is to use SHA384 for TOP SECRET [1].

This patch adds support for SHA384 and SHA512 in the hash command, and also
allows FIT images to be hashed with these algorithms, and signed with
sha384,rsaXXXX and sha512,rsaXXXX

The SHA implementation is adapted from the linux kernel implementation.

[1] Commercial National Security Algorithm Suite
http://www.iad.gov/iad/programs/iad-initiatives/cnsa-suite.cfm

Signed-off-by: Reuben Dowle <reuben.dowle@4rf.com>

# 43e442a5 26-May-2020 Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

kconfig: fix some typos

Signed-off-by: Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

# eff5a547 22-May-2020 Michael Walle <michael@walle.cc>

cmd: zip: automatically pull in gzip()

Move the CONFIG_GZIP_COMPRESSED from a config.h macro to a Kconfig menu
item. It is not selectable by a user because there is no reason to do
so. Instead it will be automatically selected by the stuff which uses
gzip(), like the zip command.

Remove it from the config_whitelist.txt. Also remove
CONFIG_GZIP_COMPRESS_DEF_SZ as this was never used on any board. The
default seems to be sane, otherwise it should be added as a Kconfig
option.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8239be61 06-May-2020 Simon Glass <sjg@chromium.org>

lib: Allow MD5 to be enabled in SPL

At present the MD5 option cannot be enabled by board configs since it has
no Kconfig name. It is generally enabled, so long as FIT support is
present. But not all boards use FIT, particularly in SPL

Fix this and add an option for SPL as well. This allows board code to call
md5() even if FIT support is not enabled.

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

# 04cb3994 21-Apr-2020 Weijie Gao <weijie.gao@mediatek.com>

lib: enable lzma decompression support for SPL build

This patch enables LZMA decompression support for SPL build

Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>

# 2a2119e1 05-Mar-2020 Atish Patra <atish.patra@wdc.com>

lib: kconfig: Add option to set BZIP2 compression method

There is no way to select BZIP2 compression method.
Add it under library/compression config where all other
compression related configs are present.

Signed-off-by: Atish Patra <atish.patra@wdc.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 805b3cac 12-Feb-2020 Keerthy <j-keerthy@ti.com>

lib: elf: Move the generic elf loading/validating functions to lib

Move the generic elf loading/validating functions to lib/
so that they can be re-used and accessed by code existing
outside cmd.

While at it remove the duplicate static version of load_elf_image_phdr
under arch/arm/mach-imx/imx_bootaux.c.

Signed-off-by: Keerthy <j-keerthy@ti.com>
Suggested-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>

# 1611235b 19-Jan-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: Kconfig dependencies for pseudo-random library

drivers/rng/sandbox_rng.c requires rand() to be defined but configuration
option CONFIG_CONFIG_LIB_RAND selected in drivers/rng/Kconfig does not
exist.

test/lib/test_aes.c requires rand() to be defined.

Fix the selection criteria for choice "Pseudo-random library support type".

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 3c10dc95 06-Dec-2019 Simon Glass <sjg@chromium.org>

binman: Add a library to access binman entries

SPL and TPL can access information about binman entries using link-time
symbols but this is not available in U-Boot proper. Of course it could be
made available, but the intention is to just read the device tree.

Add support for this, so that U-Boot can locate entries.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# b4adf627 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: crypto: add x509 parser

Imported from linux kernel v5.3:
x509.asn1 without changes
x509_akid.asn1 without changes
x509_parser.h without changes
x509_cert_parser.c with changes marked as __UBOOT__
x509_public_key.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# a9b45e6e 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add oid registry utility

Imported from linux kernel v5.3:
build_OID_registry without changes
oid_registry.h without changes
oid_registry.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# ab8a0e06 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add asn1 decoder

Imported from linux kernel v5.3:
lib/asn1_decoder.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 2b12196d 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

cmd: add asn1_compiler

Imported from linux kernel v5.3:
asn1.h without changes
asn1_ber_bytecode.h without changes
asn1_decoder.h without changes
asn1_compiler.c without changes

This host command will be used to create a ASN1 parser, for example,
for pkcs7 messages or x509 certificates. More specifically, it will
generate *byte code* which will be interpreted by asn1 decoder library.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 05429b6c 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

rtc: move date.c from drivers/rtc/ to lib/

In the next commit, rtc_mktime(), for compatibility with linux, will be
implemented using rtc_mktime(), which is no longer drivers/rtc specific.
So move this file under lib/.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 37ef1774 10-Nov-2019 Thomas Hebb <tommyhebb@gmail.com>

Kconfig: disambiguate config names for tiny printf

27084c03d36a ("spl: Allow tiny printf() to be controlled in SPL and
TPL") split this option in two for TPL and SPL, but didn't change the
Kconfig names, making them hard to set quickly.

Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>

# 0d76afc0 27-Oct-2019 Simon Glass <sjg@chromium.org>

fdt: Add Kconfig options to control code size

For better or worse libfdt recent grew a lot of code that checks the
validity of the device tree in great detail. When using unsigned or
unverified data this makes things safer, but it does add to code size.

Add some controls to select the trade-off between safety and code size.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 27084c03 25-Sep-2019 Simon Glass <sjg@chromium.org>

spl: Allow tiny printf() to be controlled in SPL and TPL

At present there is only one control for this and it is used for both SPL
and TPL. But SPL might have a lot more space than TPL so the extra cost of
a full printf() might be acceptable.

Split the option into two, providing separate SPL and TPL controls. The
TPL setting defaults to the same as SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2a51e16b 07-Jun-2019 Tom Rini <trini@konsulko.com>

configs: Make USE_TINY_PRINTF depend on SPL||TPL and be default

The USE_TINY_PRINTF symbol only changes things within SPL and TPL
builds, so make it depend on that support. Next, make it default as
within these cases we should rarely have need of more advanced print
formats outside of the debug context.

To do this, in a few cases we need to correct our Kconfig dependencies
as we had cases of non-SPL targets select'ing this symbol. Finally, in
the case of a few boards we really do need the full printf
functionality.

Signed-off-by: Tom Rini <trini@konsulko.com>

# da0fb5fd 02-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: make call depth limit customizable

Up to now we had hard coded values for the call depth up to which trace
records are created: 200 for early tracing, 15 thereafter. UEFI
applications reach a call depth of 80 or above.

Provide customizing settings for the call trace depth limit and the early
call trace depth limit. Use the old values as defaults.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8509f22a 29-Apr-2019 Marek Behún <marek.behun@nic.cz>

lib: add Zstandard decompression support

Add the zstd library from Linux kernel (only decompression support).
There are minimal changes to build with U-Boot, otherwise the files are
identical to Linux commit dc35da16 from March 2018, the files had not
been touched since in kernel. Also SPDX lincese tags were added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 83a486b6 29-Apr-2019 Marek Behún <marek.behun@nic.cz>

lib: Add xxhash support

This adds the xxhash support from Linux. Files are almost identical to
those added to Linux in commit 5d240522 ("lib: Add xxhash module") (they
haven't been touched since in Linux). The only difference is to add some
includes to be compatible with U-Boot. Also SPDX lincese tags were
added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 5132361a 29-Apr-2019 Heiko Schocher <hs@denx.de>

lib: Kconfig: fix help text for GZIP

commit 95f4bbd581cf ("lib: fdt: Allow LZO and GZIP DT compression in U-Boot")

introduced Kconfig option for gzip in U-Boot, but help text
says gzip for SPL, which is wrong. Fix this.

Signed-off-by: Heiko Schocher <hs@denx.de>
Acked-by: Marek Vasut <marex@denx.de>

# 1c6eb075 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE_BUFFER_SIZE et al to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE_BUFFER_SIZE
CONFIG_TRACE_EARLY_SIZE
CONFIG_TRACE_EARLY
CONFIG_TRACE_EARLY_ADDR

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

# a24a78d7 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE

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

# 54969b40 21-Mar-2019 Thierry Reding <treding@nvidia.com>

fdtdec: Add Kconfig symbol for tests

Runtime tests are provided as a test_fdtdec command implementation. Add
a Kconfig symbol that allows this command to be built so that the tests
can be used.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 95f4bbd5 08-Mar-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

lib: fdt: Allow LZO and GZIP DT compression in U-Boot

Add required Kconfig symbols, Makefile bits and macro fixes in a
few places to support LZO and DT compression in U-Boot. This can
save a lot of space with multi-DTB fitImages.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>

# 6e705114 13-Jan-2019 Chris Packham <judge.packham@gmail.com>

lib: Kconfig: spelling fixes

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 048c6e89 06-Nov-2018 Simon Glass <sjg@chromium.org>

spl: lz4: Allow use of lz4 compression in SPL

In some cases U-Boot is compressed and it is useful to be able to
decompress it in SPL. Add a Kconfig and Makefile change to allow this.
Note that this does not actually implement decompression.

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

# 2895c4b7 15-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

kconfig: Introduce HAVE_ARCH_IOMAP

Introduce a new Kconfig option for architecture codes to control
whether it provides io{read,write}{8,16,32} I/O accessor functions.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5592a633 01-Oct-2018 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt in TPL

In some cases (e.g. sandbox with verified boot) it is useful to support
libfdt in TPL. Update the Kconfig to handle this.

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

# 6307896c 01-Oct-2018 Simon Glass <sjg@chromium.org>

tpm: Add support for SPL and TPL

At present the tpm can only be used in U-Boot proper. Updated it to work
in SPL and TPL also.

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

# ab948cd2 19-Jul-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

fdt_support: make FDT_FIXUP_PARTITIONS depend on CMD_MTDPARTS

fdt_fixup_mtdparts() calls mtdparts_init() and device_find(),
which are defined in cmd/mtdparts.c

The combination of FDT_FIXUP_PARTITIONS=y and CMD_MTDPARTS=n
emits the following link error:

common/fdt_support.c:903: undefined reference to `mtdparts_init'
common/fdt_support.c:914: undefined reference to `device_find'

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 3330584d 03-Jun-2018 Igor Opaniuk <igor.opaniuk@gmail.com>

avb2.0: integrate avb 2.0 into the build system

Integrate libavb into the build system. Introduce CONFIG_LIBAVB
build option.

Signed-off-by: Igor Opaniuk <igor.opaniuk@linaro.org>

# f8c987f8 05-Jun-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

lib: Add hexdump

Often during debugging session it's very interesting to see
what data we were dealing with. For example what we write or read
to/from memory or peripherals.

This change introduces functions that allow to dump binary
data with one simple function invocation like:
------------------->8----------------
print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, buf, len);
------------------->8----------------

which gives us the following:
------------------->8----------------
00000000: f2 b7 c9 88 62 61 75 64 72 61 74 65 3d 31 31 35 ....baudrate=115
00000010: 32 30 30 00 62 6f 6f 74 61 72 67 73 3d 63 6f 6e 200.bootargs=con
00000020: 73 6f 6c 65 3d 74 74 79 53 33 2c 31 31 35 32 30 sole=ttyS3,11520
00000030: 30 6e 38 00 62 6f 6f 74 64 65 6c 61 79 3d 33 00 0n8.bootdelay=3.
00000040: 62 6f 6f 74 66 69 6c 65 3d 75 49 6d 61 67 65 00 bootfile=uImage.
00000050: 66 64 74 63 6f 6e 74 72 6f 6c 61 64 64 72 3d 39 fdtcontroladdr=9
00000060: 66 66 62 31 62 61 30 00 6c 6f 61 64 61 64 64 72 ffb1ba0.loadaddr
00000070: 3d 30 78 38 32 30 30 30 30 30 30 00 73 74 64 65 =0x82000000.stde
00000080: 72 72 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 rr=serial0@e0022
00000090: 30 30 30 00 73 74 64 69 6e 3d 73 65 72 69 61 6c 000.stdin=serial
000000a0: 30 40 65 30 30 32 32 30 30 30 00 73 74 64 6f 75 0@e0022000.stdou
000000b0: 74 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 30 t=serial0@e00220
000000c0: 30 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00..............
...
------------------->8----------------

Source of hexdump.c was copied from Linux kernel v4.7-rc2.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Mario Six <mario.six@gdsys.cc>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Stefan Roese <sr@denx.de>

# c232d14d 29-May-2018 Alex Kiernan <alex.kiernan@gmail.com>

mmc: Separate "mmc swrite" from fastboot

Introduce CONFIG_IMAGE_SPARSE and CONFIG_CMD_MMC_SWRITE so the "mmc
swrite" command is separated from the fastboot code.

Move image-sparse from common to lib so it's clear it's library code.

Rename CONFIG_FASTBOOT_FLASH_FILLBUF_SIZE to CONFIG_IMAGE_SPARSE_FILLBUF_SIZE
and migrate it to Kconfig.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Acked-by: Jassi Brar <jaswinder.singh@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6417572e 08-May-2018 Tom Rini <trini@konsulko.com>

lib/Kconfig: Mark OF_LIBFDT_OVERLAY as depending on OF_LIBFDT

The overlay code is only useful when OF_LIBFDT is set, so mark it as
depending on that first.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 58a46f88 25-Apr-2018 Praneeth Bajjuri <praneeth@ti.com>

configs: TI: Enable FIT Library overlay support

Enable the FDT library overlay support for all TI SOC family.

Without this option, when Loading fdt from FIT image, the
following warning is seen.

"config with overlays but CONFIG_OF_LIBFDT_OVERLAY not set".

Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
Suggested-by: Andrew F.Davis <afd@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>

# 14ad44ab 18-Apr-2018 Alex Kiernan <alex.kiernan@gmail.com>

spl: Split sprintf, strto* from SPL serial in Kconfig

When SPL serial is disabled, callers who need sprintf or strtoul fail
because their inclusion is guarded by CONFIG_SPL_SERIAL_SUPPORT/
CONFIG_TPL_SERIAL_SUPPORT.

Split printf, sprintf and strto into their own entries and then select
all of them if SERIAL_SUPPORT is enabled to match the current behaviour.

Include panic.o unconditionally as it can be called from anywhere which
uses BUG_ON().

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>

# e294ba06 04-Apr-2018 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-sunxi

Signed-off-by: Tom Rini <trini@konsulko.com>


# d14db11d 03-Apr-2018 Andre Przywara <andre.przywara@arm.com>

sunxi: revert disabling of features

In January some commits were introduced to mitigate the U-Boot image
size issues we encountered on sunxi builds.
Now with the MMC environment removed we can bring them back, as we
practically don't have a size limit anymore.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 32ce6179 13-Mar-2018 Bryan O'Donoghue <bryan.odonoghue@linaro.org>

optee: Add lib entries for sharing OPTEE code across ports

This patch adds code to lib to enable sharing of useful OPTEE code between
board-ports and architectures. The code on lib/optee/optee.c comes from the
TI omap2 port. Eventually the OMAP2 code will be patched to include the
shared code. The intention here is to add more useful OPTEE specific code
as more functionality gets added.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Cc: Harinarayan Bhatta <harinarayan@ti.com>
Cc: Andrew F. Davis <afd@ti.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Kever Yang <kever.yang@rock-chips.com>
Cc: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Cc: Peng Fan <peng.fan@nxp.com>
Tested-by: Peng Fan <peng.fan@nxp.com>

# 36c1877c 06-Feb-2018 Faiz Abbas <faiz_abbas@ti.com>

lib: Kconfig: Move DYNAMIC_CRC_TABLE to Kconfig

Add CONFIG prefix to DYNAMIC_CRC_TABLE and implement it in
Kconfig.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>

# a451bc27 05-Feb-2018 Adam Ford <aford173@gmail.com>

Convert LIB_UUID to Kconfig

config_fallback.h has some logic that checks a variety of options
and selects LIB_UUID if it hasn't already been selected. This
will all LIB_UUID in Kconfig and select this option for the list
of options to allow us to remove the logic from fallbacks

Signed-off-by: Adam Ford <aford173@gmail.com>

# a5a37567 06-Feb-2018 Adam Ford <aford173@gmail.com>

Convert CONFIG LIB_HW_RAND to Kconfig

config_fallbacks.h had some logic to automatically select
LIB_RAND if RANDOM_UUID or CMD_UUID were set if LIB_HW_RAND wasn't
already selected. By migrating LIB_HW_RAND to Kconfig, we can
remove this check from config_fallbacks.h and put it into Kconfig

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
[trini: Turn into a choice, add NET_RANDOM_ETHADDR]
Signed-off-by: Tom Rini <trini@konsulko.com>

# acd4d334 16-Jan-2018 Maxime Ripard <maxime.ripard@free-electrons.com>

net: regex: Disable by default on sunXi

The sunXi arm64 build has overflown, leading to the main U-boot binary
overwriting the environment when flashing the new image, or even worse,
overwriting itself when we're calling saveenv.

Disable this option that is not critical until we can adress the issue
properly.

Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 7e3caa81 03-Dec-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

Move CONFIG_PANIC_HANG to Kconfig

Freescale (NXP) boards have lots of defconfig files per board.
I used "imply PANIC_HANG" for them.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# da5337a6 08-Nov-2017 Nandor Han <nandor.han@ge.com>

rtc: add support for s35392a

Add support for S35392A RTC. The driver supports both U-Boot driver
models.

Signed-off-by: Nandor Han <nandor.han@ge.com>
Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
Cc: Heiko Schocher <hs@denx.de>

# f52bdf4b 14-Sep-2017 Jean-Jacques Hiblot <jjhiblot@ti.com>

lib: allow building lzo for the SPL

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 85d8bf57 03-Sep-2017 Marek Behún <marek.behun@nic.cz>

lib: Add CRC32-C

This is needed for BTRFS.

Signed-off-by: Marek Behun <marek.behun@nic.cz>

create mode 100644 lib/crc32c.c

# 7264f292 15-Aug-2017 York Sun <york.sun@nxp.com>

spl: fit: Eanble GZIP support for image decompression

Add Kconfig option SPL_GZIP and SPL_ZLIB to enable gunzip support for
SPL boot, eg. falcon boot compressed kernel image.

Signed-off-by: York Sun <york.sun@nxp.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6ef2f901 11-Aug-2017 Adam Ford <aford173@gmail.com>

Convert CONFIG_BCH to Kconfig

This converts the following to Kconfig:
CONFIG_BCH

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1a7ba1d 18-Aug-2017 Anatolij Gustschin <agust@denx.de>

Fix 'notes' typos

s/notes/nodes

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 96b9082c 03-Aug-2017 Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

rockchip: rk3188: rock: adjust for SPL/TPL split

With the changes to split SPL/TPL for the RK3368, I apparently missed
some needed adjustments to the RK3188 Kconfig and rock_defconfig.

This fixes build-issues for the rock board after applying the RK3368
enablement (and SPL/TPL) set that resulted from TPL_SERIAL_SUPPORT,
TPL_ROCKCHIP_BACK_TO_BROM and TPL_TINY_MEMSET being separate symbols
now.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d56b4b19 22-Jul-2017 Tom Rini <trini@konsulko.com>

configs: Migrate RBTREE, LZO, CMD_MTDPARTS, CMD_UBI and CMD_UBIFS

The above CONFIG options are in Kconfig, and now have correct depends and
inter-dependencies. Migrate these to configs/ from include/configs/. In the
case of CMD_UBIFS also change it to be a default y if CMD_UBI.

Signed-off-by: Tom Rini <trini@konsulko.com>

# aed998aa 17-May-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_LZMA to Kconfig

This converts the following to Kconfig:
CONFIG_LZMA

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

# b1a873df 26-Apr-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_CMD_AES et al to Kconfig

This converts the following to Kconfig:
CONFIG_CMD_AES
CONFIG_AES

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Add select AES to CMD_AES]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 173aafbf 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

cmd: Expose a Kconfig option to enable UBIFS commands

Create a new Kconfig entry to allow CMD_UBIFS selection from Kconfig and
add an hidden LZO option that can be selected by CMD_UBIFS.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>

# aa049152 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

mtd: ubi: Select RBTREE option from MTD_UBI Kconfig entry

Expose the RBTREE feature through Kconfig and select this option from the
MTD_UBI option.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>
[Rebased on master]
Signed-off-by: Jagan Teki <jagan@openedev.com>

# ab4458bd 02-Apr-2017 Simon Glass <sjg@chromium.org>

string: Provide a slimmed-down memset()

Most of the time the optimised memset() is what we want. For extreme
situations such as TPL it may be too large. For example on the 'rock'
board, using a simple loop saves a useful 48 bytes. With gcc 4.9 and
the rodata bug, this patch is enough to reduce the TPL image below the
limit.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>

# bea79d7d 14-Mar-2017 Andre Przywara <andre.przywara@arm.com>

Kconfig: introduce md5sum command selection

So far CONFIG_MD5SUM would need to be set by a board's include file.
Since the command is really generic, move it over to Kconfig to allow
it to be defined by either a board's defconfig, menuconfig or some
config snippet merged via mergeconfig.sh.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e663b350 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

smbios: Expose in efi_loader as table

We can pass SMBIOS easily as EFI configuration table to an EFI payload. This
patch adds enablement for that case.

While at it, we also enable SMBIOS generation for ARM systems, since they support
EFI_LOADER.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4b6dddc2 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

x86: Move smbios generation into arch independent directory

We will need the SMBIOS generation function on ARM as well going forward,
so let's move it into a non arch specific location.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# ebf7fff2 05-Oct-2016 Heiko Schocher <hs@denx.de>

spl: move FDT_FIXUP_PARTITIONS to Kconfig

Move FDT_FIXUP_PARTITIONS to Kconfig and cleanup existing
uses.

Signed-off-by: Heiko Schocher <hs@denx.de>

# ddf67f71 05-Jul-2016 Maxime Ripard <maxime.ripard@free-electrons.com>

libfdt: Add overlay application function

The device tree overlays are a good way to deal with user-modifyable
boards or boards with some kind of an expansion mechanism where we can
easily plug new board in (like the BBB, the Raspberry Pi or the CHIP).

Add a new function to merge overlays with a base device tree.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>

# 91b86e21 26-May-2016 Marek Vasut <marex@denx.de>

lib: Enable private libgcc by default

This patch decouples U-Boot binary from the toolchain on systems where
private libgcc is available. Instead of pulling in functions provided
by the libgcc from the toolchain, U-Boot will use it's own set of libgcc
functions. These functions are usually imported from Linux kernel, which
also uses it's own libgcc functions instead of the ones provided by the
toolchain.

This patch solves a rather common problem. The toolchain can usually
generate code for many variants of target architecture and often even
different endianness. The libgcc on the other hand is usually compiled
for one particular configuration and the functions provided by it may
or may not be suited for use in U-Boot. This can manifest in two ways,
either the U-Boot fails to compile altogether and linker will complain
or, in the much worse case, the resulting U-Boot will build, but will
misbehave in very subtle and hard to debug ways.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 67976306 30-Mar-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

cosmetic: Fix typos "privide"

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# ed980b8c 03-Mar-2016 Alexander Graf <agraf@csgraf.de>

efi_loader: hook up in build environment

Now that we have all the bits and pieces ready for EFI payload loading
support, hook them up in Makefiles and KConfigs so that we can build.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
[trini: Enable only when we of OF_LIBFDT, disable on kwb and colibri_pxa270]
Signed-off-by: Tom Rini <trini@konsulko.com>

# aa34fbc0 22-Feb-2016 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt to be used in SPL

Add an option to enable libfdt in SPL. This can be useful when decoding
FIT files in SPL.

We need to make sure this option is not enabled in SPL by this change.
Also this option needs to be enabled in host builds. Si add a new
IMAGE_USE_LIBFDT #define which can be used in files that are built on the
host but must also build for U-Boot and SPL.

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

# 69e173eb 22-Feb-2016 Simon Glass <sjg@chromium.org>

Move CONFIG_OF_LIBFDT to Kconfig

Move this option to Kconfig and tidy up existing boards.

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

# a187559e 05-Feb-2016 Bin Meng <bmeng.cn@gmail.com>

Use correct spelling of "U-Boot"

Correct spelling of "U-Boot" shall be used in all written text
(documentation, comments in source files etc.).

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Minkyu Kang <mk7.kang@samsung.com>

# 947c626d 14-Jan-2016 Tom Rini <trini@konsulko.com>

vsprintf.c: Always enable CONFIG_SYS_VSNPRINTF

Enabling this function always removes some class of string saftey issues.
The size change here in general is about 400 bytes and this seems a reasonable
trade-off.

Cc: Peng Fan <peng.fan@nxp.com>
Cc: Peter Robinson <pbrobinson@gmail.com>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Adrian Alonso <aalonso@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 7d9cde10 22-Nov-2015 Stefan Roese <sr@denx.de>

lib/tiny-printf.c: Add tiny printf function for space limited environments

This patch adds a small printf() version that supports all basic formats.
Its intented to be used in U-Boot SPL versions on platforms with very
limited internal RAM sizes.

To enable it, just define CONFIG_USE_TINY_PRINTF in your defconfig. This
will result in the SPL using this tiny function and the main U-Boot
still using the full-blown printf() function.

This code was copied from:
http://www.sparetimelabs.com/printfrevisited
With mostly only coding style related changes so that its checkpatch
clean.

The size reduction is about 2.5KiB. Here a comparison for the db-mv784mp-gp
(Marvell AXP) SPL:

Without this patch:
58963 18536 1928 79427 13643 ./spl/u-boot-spl

With this patch:
56542 18536 1956 77034 12cea ./spl/u-boot-spl

Note:
To make it possible to compile tiny-printf.c instead of vsprintf.c when
CONFIG_USE_TINY_PRINTF is defined, the functions printf() and vprintf() are
moved from common/console.c into vsprintf.c in this patch.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>

# 2419cd16 03-Oct-2015 Simon Glass <sjg@chromium.org>

dm: tpm: Drop CONFIG_DM_TPM

Now that all TPM drivers use driver model, we can drop the special driver
model CONFIG option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>

# 027b728d 06-Oct-2015 Julius Werner <jwerner@chromium.org>

Add support for LZ4 decompression algorithm

This patch adds support for LZ4-compressed FIT image contents. This
algorithm has a slightly worse compression ration than LZO while being
nearly twice as fast to decompress. When loading images from a fast
storage medium this usually results in a boot time win.

Sandbox-tested only since I don't have a U-Boot development system set
up right now. The code was imported unchanged from coreboot where it's
proven to work, though. I'm mostly interested in getting this recognized
by mkImage for use in a downstream project.

Signed-off-by: Julius Werner <jwerner@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# a7d660bc 22-Aug-2015 Simon Glass <sjg@chromium.org>

tpm: Add Kconfig options for TPMs

Add new Kconfig options for TPMs in preparation for moving boards to use
Kconfig for TPM configuration.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 867a6ac8 31-Jul-2015 Simon Glass <sjg@chromium.org>

efi: Add start-up library code

When running as an EFI application, U-Boot must request memory from EFI,
and provide access to the boot services U-Boot needs.

Add library code to perform these tasks. This includes efi_main() which is
the entry point from EFI. U-Boot is built as a shared library.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d1389403 23-Jun-2015 Simon Glass <sjg@chromium.org>

Add a dhrystone benchmark command

Drystone provides a convenient sanity check that the CPU is running at full
speed. Add this as a command which can be enabled as needed.

Note: I investigated using Coremark for this but there was a license
agreement and I could not work out if it was GPL-compatible.

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

# f7848d90 22-Jun-2015 Joe Hershberger <joe.hershberger@ni.com>

Allow CONFIG_REGEX to be disabled when CONFIG_NET

Instead of selecting REGEX when NET is enabled, make it the default, but
allow boards that are tiny to disable it and lose functionality on all
but the first Ethernet adapter.

cm-bf548, bf538f-ezkit, and bf533-stamp need this. None appear to have
more than one Ethernet interface.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# 3850dbe8 11-Jun-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

blackfin: fix undefined reference to srand and rand

Commit 9ba9e85f3f1c (net: Fix NET_RANDOM_ETHADDR dependencies)
accidentally dropped CONFIG_LIB_RAND defines for 14 Blackfin boards.

Prior to that commit, those boards defined CONFIG_LIB_RAND, but not
CONFIG_NET_RANDOM_ETHADDR. So, commit 9ba9e85f3f1c should not have
touched them, but in fact it ripped CONFIG_LIB_RAND off from all the
header files, which caused undefined reference to srand and rand.
CONFIG_LIB_RAND=y must be revived for such boards.

BTW, this commit indeed makes it better, but even with this fix,
three boards (bf533-stamp, bf538f-ezkit, cm-bf548) still can not
build due to region 'ram' overflowed error. This was cause by
commit 6eed3786c68c (net: Move the CMD_NET config to defconfigs)
because CMD_NET selects NET, and NET selects REGEX. Eventually,
some boards were newly enabled with CONFIG_REGEX, increasing the
memory footprint. A patch is expected to fix the build error.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 9ba9e85f 25-May-2015 Michal Simek <michal.simek@xilinx.com>

net: Fix NET_RANDOM_ETHADDR dependencies

NET_RANDOM_ETHADDR depends on lib/rand.c. This patch adds dependency to
Kconfig to ensure that library is also compiled.

Remove the definitions from Blackfin boards' include/configs.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 6501ff62 20-Apr-2015 Przemyslaw Marczak <p.marczak@samsung.com>

lib: Kconfig: add entry for errno_str() function

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1a60650c 21-Apr-2015 Joe Hershberger <joe.hershberger@ni.com>

kconfig: Move REGEX to Kconfig

Having this as a Kconfig allows it to be a dependent feature.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8156345d 06-Mar-2015 Simon Glass <sjg@chromium.org>

sandbox: Move CONFIG_SYS_VSNPRINTF to Kconfig

Move this over to Kconfig and tidy up.

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

# 94e3c8c4 19-Feb-2015 gaurav rana <gaurav.rana@freescale.com>

crypto/fsl - Add progressive hashing support using hardware acceleration.

Currently only normal hashing is supported using hardware acceleration.
Added support for progressive hashing using hardware.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
Signed-off-by: Gaurav Rana <gaurav.rana@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>

# d9f23c7f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

lib/rsa: Add Kconfig for devices supporting RSA Modular Exponentiation

Kconfig option added for devices which support RSA Verification.
1. RSA_SOFTWARE_EXP
Enables driver for supporting RSA Modular Exponentiation in Software
2. RSA_FREESCALE_EXP
Enables driver for supporting RSA Modular Exponentiation using Freescale specific
driver

The above drivers use RSA uclass

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
(Removed duplicate line in Kconfig comment)

Change-Id: I7663c4d5350e2bfc3dfa2696f70ef777d6ccc6f6

# c4beb22f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

FIT: Modify option FIT_SIGNATURE in Kconfig

For FIT signature based approach to work, RSA library needs to be selected.
The FIT_SIGNATURE option in Kconfig is modified to automatically select RSA.
Selecting RSA compiles the RSA library required for image verification.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 45ccec8f 23-Oct-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_USE_PRIVATE_LIBGCC to Kconfig

The private libgcc is supported only on ARM, MIPS, PowerPC, SH, x86.
Those architectures should "select" HAVE_PRIVATE_LIBGCC and
CONFIG_USE_PRIVATE_LIBGCC should depend on it.

Currently, this option is enabled on Tegra boards and x86 architecture.
Move the definition from header files to Kconfig.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Tested-by: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: Tom Warren <twarren@nvidia.com>

# 8c688bc4 23-Oct-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_SYS_HZ to lib/Kconfig

CONFIG_SYS_HZ is always defined as 1000 in config_fallbacks.h
(but some boards still have redundant definitions).

This commit moves the definition and the document in README to
Kconfig. Since lib/Kconfig can assure that CONFIG_SYS_HZ is 1000,
the sanity check in lib/time.c should be removed.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Reviewed-by: Marek Vasut <marex@denx.de>

# b0928da6 16-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED to Kconfig

If this option is enabled, the objects under lib/ directory
are compiled with speed optimization, not size optimization.
(Currently, only used by some Blackfin boards.)

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# ed36323f 16-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: add blank Kconfig files

This would be useful to start moving various config options.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# 59e4e391 18-Jan-2021 Tom Rini <trini@konsulko.com>

Merge https://gitlab.denx.de/u-boot/custodians/u-boot-riscv

- Update qemu-riscv.rst build instructions.
- Add support for SPI on Kendryte K210.
- Add Microchip PolarFire SoC Icicle Kit support.
- Add support for an early timer.
- Select TIMER_EARLY to avoid infinite recursion for Trace.


# a80f8513 17-Jan-2021 Pragnesh Patel <pragnesh.patel@sifive.com>

trace: select TIMER_EARLY to avoid infinite recursion

When tracing functions is enabled this adds calls to
__cyg_profile_func_enter() and __cyg_profile_func_exit() to the traced
functions.

__cyg_profile_func_enter() and __cyg_profile_func_exit() invoke
timer_get_us() to record the entry and exit time.

initr_dm() will make gd->dm_root = NULL and gd->timer = NULL, so
timer_get_us() -> get_ticks() -> dm_timer_init() will lead to an
indefinite recursion.

So select TIMER_EARLY when tracing got enabled.

Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Rick Chen <rick@andestech.com>

# 6205bbb1 04-Jan-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

lib: cosmetic update of CONFIG_LIB_ELF description

Change 2 typo error in CONFIG_LIB_ELF description:
- Supoort => Support
- fir => for

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c589132a 02-Dec-2020 Aswath Govindraju <a-govindraju@ti.com>

fdt: Use phandle to distinguish DT nodes with same name

While assigning the sequence number to subsystem instances by reading the
aliases property, only DT nodes names are compared and not the complete
path. This causes a problem when there are two DT nodes with same name but
have different paths.

In arch/arm/dts/k3-am65-main.dtsi there are two USB controllers with the
same device tree node name but different path. When aliases are defined for
these USB controllers then fdtdec_get_alias_seq() fails to pick the correct
instance for a given index.

fdt_path_offset() function is slow and this would effect the U-Boot
startup. To avert the time penalty on all boards, apply this extra check
only when required by using a config option.

Fix it by comparing the phandles of DT nodes after the node names match,
under a config option.

Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Fix whitespace error in Kconfig:
Signed-off-by: Simon Glass <sjg@chromium.org>

# 28cef9ca 19-Nov-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

fs: fat: create correct short names

The current function set_name() used to create short names has the
following deficiencies resolved by this patch:

* Long names (e.g. FOO.TXT) are stored even if a short name is enough.
* Short names with spaces are created, e.g. "A ~1.TXT".
* Short names with illegal characters are created, e.g. "FOO++BAR".
* Debug output does not not consider that the short file name has no
concluding '\0'.

The solution for the following bug is split of into a separate patch:

* Short file names must be unique.

This patch only provides the loop over possible short file names.

Fixes: c30a15e590c ("FAT: Add FAT write feature")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# e4f8e543 05-Nov-2020 Simon Glass <sjg@chromium.org>

smbios: Drop the unused Kconfig options

Now that we can use devicetree to specify this information, drop the old
CONFIG options.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 44c74bdd 05-Nov-2020 Simon Glass <sjg@chromium.org>

sysinfo: Provide a default driver to set SMBIOS values

Some boards want to specify the manufacturer or product name but do not
need to have their own sysinfo driver.

Add a default driver which provides a way to specify this SMBIOS
information in the devicetree, without needing any board-specific
functionality.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d2cb7a22 04-Nov-2020 Simon Glass <sjg@chromium.org>

x86: Allow putting some tables in the bloblist

At present all tables are placed starting at address f0000 in memory, and
can be up to 64KB in size. If the tables are very large, this may not
provide enough space.

Also if the tables point to other tables (such as console log or a ramoops
area) then we must allocate other memory anyway.

The bloblist is a nice place to put these tables since it is contiguous,
which makes it easy to reserve this memory for linux using the 820 tables.

Add an option to put some of the tables in the bloblist. For SMBIOS and
ACPI, create suitable pointers from the f0000 region to the new location
of the tables.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
[bmeng: squashed in http://patchwork.ozlabs.org/project/uboot/patch/
20201105062407.1.I8091ad931cbbb5e3b6f6ababdf3f8d5db0d17bb9@changeid/]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# 415eab06 03-Nov-2020 Christian Gmeiner <christian.gmeiner@gmail.com>

smbios: add parsing API

Add a very simple API to be able to access SMBIOS strings
like vendor, model and bios version.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 72eda507 27-Oct-2020 Sean Anderson <seanga2@gmail.com>

lib: Add getopt

Some commands can get very unweildy if they have too many positional
arguments. Adding options makes them easier to read, remember, and
understand.

This implementation of getopt has been taken from barebox, which has had
option support for quite a while. I have made a few modifications to their
version, such as the removal of opterr in favor of a separate getopt_silent
function. In addition, I have moved all global variables into struct
getopt_context.

The getopt from barebox also re-orders the arguments passed to it so that
non-options are placed last. This allows users to specify options anywhere.
For example, `ls -l foo/ -R` would be re-ordered to `ls -l -R foo/` as
getopt parsed the options. However, this feature conflicts with the const
argv in cmd_tbl->cmd. This was originally added in 54841ab50c ("Make sure
that argv[] argument pointers are not modified."). The reason stated in
that commit is that hush requires argv to stay unmodified. Has this
situation changed? Barebox also uses hush, and does not have this problem.
Perhaps we could use their fix?

I have assigned maintenance of getopt to Simon Glass, as it is currently
only used by the log command. I would also be fine maintaining it.

Signed-off-by: Sean Anderson <seanga2@gmail.com>

# 26637e2e 12-Sep-2020 Simon Glass <sjg@chromium.org>

lib: Allow hexdump to be used in SPL

It is sometimes useful to output hex dumps in SPL. Add a config option to
allow this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# e87dfb05 05-Aug-2020 Andrii Anisov <andrii_anisov@epam.com>

lib: sscanf: add sscanf implementation

Port sscanf implementation from mini-os and introduce new
Kconfig option to enable it: CONFIG_SSCANF. Disable by default.

Signed-off-by: Andrii Anisov <andrii_anisov@epam.com>
Signed-off-by: Anastasiia Lukianenko <anastasiia_lukianenko@epam.com>
Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>

# 81014f73 30-Jul-2020 Joao Marcos Costa <joaomarcos.costa@bootlin.com>

include/u-boot, lib/zlib: add sources for zlib decompression

Add zlib (v1.2.11) uncompr() function to U-Boot. SquashFS depends on
this function to decompress data from a raw disk image. The actual
support for zlib into SquashFS sources will be added in a follow-up
commit.

Signed-off-by: Joao Marcos Costa <joaomarcos.costa@bootlin.com>

# 69be8fd1 03-Jun-2020 Marek Szyprowski <m.szyprowski@samsung.com>

powerpc: move ADDR_MAP to Kconfig

Move ADDR_MAP related config options from include/configs/*.h to the
proper place in lib/Kconfig. This has been done using
./tools/moveconfig.py and manual inspection of the generated changes.
This is a preparation to use ADDR_MAP helper on ARM 32bit Raspberry Pi4
board for mapping the PCIe XHCI MMIO, which is above the 4GiB identity
mapping limit.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# d16b38f4 15-Apr-2020 Reuben Dowle <reubendowle0@gmail.com>

Add support for SHA384 and SHA512

The current recommendation for best security practice from the US government
is to use SHA384 for TOP SECRET [1].

This patch adds support for SHA384 and SHA512 in the hash command, and also
allows FIT images to be hashed with these algorithms, and signed with
sha384,rsaXXXX and sha512,rsaXXXX

The SHA implementation is adapted from the linux kernel implementation.

[1] Commercial National Security Algorithm Suite
http://www.iad.gov/iad/programs/iad-initiatives/cnsa-suite.cfm

Signed-off-by: Reuben Dowle <reuben.dowle@4rf.com>

# 43e442a5 26-May-2020 Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

kconfig: fix some typos

Signed-off-by: Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

# eff5a547 22-May-2020 Michael Walle <michael@walle.cc>

cmd: zip: automatically pull in gzip()

Move the CONFIG_GZIP_COMPRESSED from a config.h macro to a Kconfig menu
item. It is not selectable by a user because there is no reason to do
so. Instead it will be automatically selected by the stuff which uses
gzip(), like the zip command.

Remove it from the config_whitelist.txt. Also remove
CONFIG_GZIP_COMPRESS_DEF_SZ as this was never used on any board. The
default seems to be sane, otherwise it should be added as a Kconfig
option.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8239be61 06-May-2020 Simon Glass <sjg@chromium.org>

lib: Allow MD5 to be enabled in SPL

At present the MD5 option cannot be enabled by board configs since it has
no Kconfig name. It is generally enabled, so long as FIT support is
present. But not all boards use FIT, particularly in SPL

Fix this and add an option for SPL as well. This allows board code to call
md5() even if FIT support is not enabled.

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

# 04cb3994 21-Apr-2020 Weijie Gao <weijie.gao@mediatek.com>

lib: enable lzma decompression support for SPL build

This patch enables LZMA decompression support for SPL build

Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>

# 2a2119e1 05-Mar-2020 Atish Patra <atish.patra@wdc.com>

lib: kconfig: Add option to set BZIP2 compression method

There is no way to select BZIP2 compression method.
Add it under library/compression config where all other
compression related configs are present.

Signed-off-by: Atish Patra <atish.patra@wdc.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 805b3cac 12-Feb-2020 Keerthy <j-keerthy@ti.com>

lib: elf: Move the generic elf loading/validating functions to lib

Move the generic elf loading/validating functions to lib/
so that they can be re-used and accessed by code existing
outside cmd.

While at it remove the duplicate static version of load_elf_image_phdr
under arch/arm/mach-imx/imx_bootaux.c.

Signed-off-by: Keerthy <j-keerthy@ti.com>
Suggested-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>

# 1611235b 19-Jan-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: Kconfig dependencies for pseudo-random library

drivers/rng/sandbox_rng.c requires rand() to be defined but configuration
option CONFIG_CONFIG_LIB_RAND selected in drivers/rng/Kconfig does not
exist.

test/lib/test_aes.c requires rand() to be defined.

Fix the selection criteria for choice "Pseudo-random library support type".

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 3c10dc95 06-Dec-2019 Simon Glass <sjg@chromium.org>

binman: Add a library to access binman entries

SPL and TPL can access information about binman entries using link-time
symbols but this is not available in U-Boot proper. Of course it could be
made available, but the intention is to just read the device tree.

Add support for this, so that U-Boot can locate entries.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# b4adf627 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: crypto: add x509 parser

Imported from linux kernel v5.3:
x509.asn1 without changes
x509_akid.asn1 without changes
x509_parser.h without changes
x509_cert_parser.c with changes marked as __UBOOT__
x509_public_key.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# a9b45e6e 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add oid registry utility

Imported from linux kernel v5.3:
build_OID_registry without changes
oid_registry.h without changes
oid_registry.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# ab8a0e06 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add asn1 decoder

Imported from linux kernel v5.3:
lib/asn1_decoder.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 2b12196d 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

cmd: add asn1_compiler

Imported from linux kernel v5.3:
asn1.h without changes
asn1_ber_bytecode.h without changes
asn1_decoder.h without changes
asn1_compiler.c without changes

This host command will be used to create a ASN1 parser, for example,
for pkcs7 messages or x509 certificates. More specifically, it will
generate *byte code* which will be interpreted by asn1 decoder library.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 05429b6c 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

rtc: move date.c from drivers/rtc/ to lib/

In the next commit, rtc_mktime(), for compatibility with linux, will be
implemented using rtc_mktime(), which is no longer drivers/rtc specific.
So move this file under lib/.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 37ef1774 10-Nov-2019 Thomas Hebb <tommyhebb@gmail.com>

Kconfig: disambiguate config names for tiny printf

27084c03d36a ("spl: Allow tiny printf() to be controlled in SPL and
TPL") split this option in two for TPL and SPL, but didn't change the
Kconfig names, making them hard to set quickly.

Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>

# 0d76afc0 27-Oct-2019 Simon Glass <sjg@chromium.org>

fdt: Add Kconfig options to control code size

For better or worse libfdt recent grew a lot of code that checks the
validity of the device tree in great detail. When using unsigned or
unverified data this makes things safer, but it does add to code size.

Add some controls to select the trade-off between safety and code size.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 27084c03 25-Sep-2019 Simon Glass <sjg@chromium.org>

spl: Allow tiny printf() to be controlled in SPL and TPL

At present there is only one control for this and it is used for both SPL
and TPL. But SPL might have a lot more space than TPL so the extra cost of
a full printf() might be acceptable.

Split the option into two, providing separate SPL and TPL controls. The
TPL setting defaults to the same as SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2a51e16b 07-Jun-2019 Tom Rini <trini@konsulko.com>

configs: Make USE_TINY_PRINTF depend on SPL||TPL and be default

The USE_TINY_PRINTF symbol only changes things within SPL and TPL
builds, so make it depend on that support. Next, make it default as
within these cases we should rarely have need of more advanced print
formats outside of the debug context.

To do this, in a few cases we need to correct our Kconfig dependencies
as we had cases of non-SPL targets select'ing this symbol. Finally, in
the case of a few boards we really do need the full printf
functionality.

Signed-off-by: Tom Rini <trini@konsulko.com>

# da0fb5fd 02-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: make call depth limit customizable

Up to now we had hard coded values for the call depth up to which trace
records are created: 200 for early tracing, 15 thereafter. UEFI
applications reach a call depth of 80 or above.

Provide customizing settings for the call trace depth limit and the early
call trace depth limit. Use the old values as defaults.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8509f22a 29-Apr-2019 Marek Behún <marek.behun@nic.cz>

lib: add Zstandard decompression support

Add the zstd library from Linux kernel (only decompression support).
There are minimal changes to build with U-Boot, otherwise the files are
identical to Linux commit dc35da16 from March 2018, the files had not
been touched since in kernel. Also SPDX lincese tags were added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 83a486b6 29-Apr-2019 Marek Behún <marek.behun@nic.cz>

lib: Add xxhash support

This adds the xxhash support from Linux. Files are almost identical to
those added to Linux in commit 5d240522 ("lib: Add xxhash module") (they
haven't been touched since in Linux). The only difference is to add some
includes to be compatible with U-Boot. Also SPDX lincese tags were
added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 5132361a 29-Apr-2019 Heiko Schocher <hs@denx.de>

lib: Kconfig: fix help text for GZIP

commit 95f4bbd581cf ("lib: fdt: Allow LZO and GZIP DT compression in U-Boot")

introduced Kconfig option for gzip in U-Boot, but help text
says gzip for SPL, which is wrong. Fix this.

Signed-off-by: Heiko Schocher <hs@denx.de>
Acked-by: Marek Vasut <marex@denx.de>

# 1c6eb075 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE_BUFFER_SIZE et al to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE_BUFFER_SIZE
CONFIG_TRACE_EARLY_SIZE
CONFIG_TRACE_EARLY
CONFIG_TRACE_EARLY_ADDR

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

# a24a78d7 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE

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

# 54969b40 21-Mar-2019 Thierry Reding <treding@nvidia.com>

fdtdec: Add Kconfig symbol for tests

Runtime tests are provided as a test_fdtdec command implementation. Add
a Kconfig symbol that allows this command to be built so that the tests
can be used.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 95f4bbd5 08-Mar-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

lib: fdt: Allow LZO and GZIP DT compression in U-Boot

Add required Kconfig symbols, Makefile bits and macro fixes in a
few places to support LZO and DT compression in U-Boot. This can
save a lot of space with multi-DTB fitImages.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>

# 6e705114 13-Jan-2019 Chris Packham <judge.packham@gmail.com>

lib: Kconfig: spelling fixes

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 048c6e89 06-Nov-2018 Simon Glass <sjg@chromium.org>

spl: lz4: Allow use of lz4 compression in SPL

In some cases U-Boot is compressed and it is useful to be able to
decompress it in SPL. Add a Kconfig and Makefile change to allow this.
Note that this does not actually implement decompression.

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

# 2895c4b7 15-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

kconfig: Introduce HAVE_ARCH_IOMAP

Introduce a new Kconfig option for architecture codes to control
whether it provides io{read,write}{8,16,32} I/O accessor functions.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5592a633 01-Oct-2018 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt in TPL

In some cases (e.g. sandbox with verified boot) it is useful to support
libfdt in TPL. Update the Kconfig to handle this.

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

# 6307896c 01-Oct-2018 Simon Glass <sjg@chromium.org>

tpm: Add support for SPL and TPL

At present the tpm can only be used in U-Boot proper. Updated it to work
in SPL and TPL also.

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

# ab948cd2 19-Jul-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

fdt_support: make FDT_FIXUP_PARTITIONS depend on CMD_MTDPARTS

fdt_fixup_mtdparts() calls mtdparts_init() and device_find(),
which are defined in cmd/mtdparts.c

The combination of FDT_FIXUP_PARTITIONS=y and CMD_MTDPARTS=n
emits the following link error:

common/fdt_support.c:903: undefined reference to `mtdparts_init'
common/fdt_support.c:914: undefined reference to `device_find'

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 3330584d 03-Jun-2018 Igor Opaniuk <igor.opaniuk@gmail.com>

avb2.0: integrate avb 2.0 into the build system

Integrate libavb into the build system. Introduce CONFIG_LIBAVB
build option.

Signed-off-by: Igor Opaniuk <igor.opaniuk@linaro.org>

# f8c987f8 05-Jun-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

lib: Add hexdump

Often during debugging session it's very interesting to see
what data we were dealing with. For example what we write or read
to/from memory or peripherals.

This change introduces functions that allow to dump binary
data with one simple function invocation like:
------------------->8----------------
print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, buf, len);
------------------->8----------------

which gives us the following:
------------------->8----------------
00000000: f2 b7 c9 88 62 61 75 64 72 61 74 65 3d 31 31 35 ....baudrate=115
00000010: 32 30 30 00 62 6f 6f 74 61 72 67 73 3d 63 6f 6e 200.bootargs=con
00000020: 73 6f 6c 65 3d 74 74 79 53 33 2c 31 31 35 32 30 sole=ttyS3,11520
00000030: 30 6e 38 00 62 6f 6f 74 64 65 6c 61 79 3d 33 00 0n8.bootdelay=3.
00000040: 62 6f 6f 74 66 69 6c 65 3d 75 49 6d 61 67 65 00 bootfile=uImage.
00000050: 66 64 74 63 6f 6e 74 72 6f 6c 61 64 64 72 3d 39 fdtcontroladdr=9
00000060: 66 66 62 31 62 61 30 00 6c 6f 61 64 61 64 64 72 ffb1ba0.loadaddr
00000070: 3d 30 78 38 32 30 30 30 30 30 30 00 73 74 64 65 =0x82000000.stde
00000080: 72 72 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 rr=serial0@e0022
00000090: 30 30 30 00 73 74 64 69 6e 3d 73 65 72 69 61 6c 000.stdin=serial
000000a0: 30 40 65 30 30 32 32 30 30 30 00 73 74 64 6f 75 0@e0022000.stdou
000000b0: 74 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 30 t=serial0@e00220
000000c0: 30 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00..............
...
------------------->8----------------

Source of hexdump.c was copied from Linux kernel v4.7-rc2.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Mario Six <mario.six@gdsys.cc>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Stefan Roese <sr@denx.de>

# c232d14d 29-May-2018 Alex Kiernan <alex.kiernan@gmail.com>

mmc: Separate "mmc swrite" from fastboot

Introduce CONFIG_IMAGE_SPARSE and CONFIG_CMD_MMC_SWRITE so the "mmc
swrite" command is separated from the fastboot code.

Move image-sparse from common to lib so it's clear it's library code.

Rename CONFIG_FASTBOOT_FLASH_FILLBUF_SIZE to CONFIG_IMAGE_SPARSE_FILLBUF_SIZE
and migrate it to Kconfig.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Acked-by: Jassi Brar <jaswinder.singh@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6417572e 08-May-2018 Tom Rini <trini@konsulko.com>

lib/Kconfig: Mark OF_LIBFDT_OVERLAY as depending on OF_LIBFDT

The overlay code is only useful when OF_LIBFDT is set, so mark it as
depending on that first.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 58a46f88 25-Apr-2018 Praneeth Bajjuri <praneeth@ti.com>

configs: TI: Enable FIT Library overlay support

Enable the FDT library overlay support for all TI SOC family.

Without this option, when Loading fdt from FIT image, the
following warning is seen.

"config with overlays but CONFIG_OF_LIBFDT_OVERLAY not set".

Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
Suggested-by: Andrew F.Davis <afd@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>

# 14ad44ab 18-Apr-2018 Alex Kiernan <alex.kiernan@gmail.com>

spl: Split sprintf, strto* from SPL serial in Kconfig

When SPL serial is disabled, callers who need sprintf or strtoul fail
because their inclusion is guarded by CONFIG_SPL_SERIAL_SUPPORT/
CONFIG_TPL_SERIAL_SUPPORT.

Split printf, sprintf and strto into their own entries and then select
all of them if SERIAL_SUPPORT is enabled to match the current behaviour.

Include panic.o unconditionally as it can be called from anywhere which
uses BUG_ON().

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>

# e294ba06 04-Apr-2018 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-sunxi

Signed-off-by: Tom Rini <trini@konsulko.com>


# d14db11d 03-Apr-2018 Andre Przywara <andre.przywara@arm.com>

sunxi: revert disabling of features

In January some commits were introduced to mitigate the U-Boot image
size issues we encountered on sunxi builds.
Now with the MMC environment removed we can bring them back, as we
practically don't have a size limit anymore.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 32ce6179 13-Mar-2018 Bryan O'Donoghue <bryan.odonoghue@linaro.org>

optee: Add lib entries for sharing OPTEE code across ports

This patch adds code to lib to enable sharing of useful OPTEE code between
board-ports and architectures. The code on lib/optee/optee.c comes from the
TI omap2 port. Eventually the OMAP2 code will be patched to include the
shared code. The intention here is to add more useful OPTEE specific code
as more functionality gets added.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Cc: Harinarayan Bhatta <harinarayan@ti.com>
Cc: Andrew F. Davis <afd@ti.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Kever Yang <kever.yang@rock-chips.com>
Cc: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Cc: Peng Fan <peng.fan@nxp.com>
Tested-by: Peng Fan <peng.fan@nxp.com>

# 36c1877c 06-Feb-2018 Faiz Abbas <faiz_abbas@ti.com>

lib: Kconfig: Move DYNAMIC_CRC_TABLE to Kconfig

Add CONFIG prefix to DYNAMIC_CRC_TABLE and implement it in
Kconfig.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>

# a451bc27 05-Feb-2018 Adam Ford <aford173@gmail.com>

Convert LIB_UUID to Kconfig

config_fallback.h has some logic that checks a variety of options
and selects LIB_UUID if it hasn't already been selected. This
will all LIB_UUID in Kconfig and select this option for the list
of options to allow us to remove the logic from fallbacks

Signed-off-by: Adam Ford <aford173@gmail.com>

# a5a37567 06-Feb-2018 Adam Ford <aford173@gmail.com>

Convert CONFIG LIB_HW_RAND to Kconfig

config_fallbacks.h had some logic to automatically select
LIB_RAND if RANDOM_UUID or CMD_UUID were set if LIB_HW_RAND wasn't
already selected. By migrating LIB_HW_RAND to Kconfig, we can
remove this check from config_fallbacks.h and put it into Kconfig

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
[trini: Turn into a choice, add NET_RANDOM_ETHADDR]
Signed-off-by: Tom Rini <trini@konsulko.com>

# acd4d334 16-Jan-2018 Maxime Ripard <maxime.ripard@free-electrons.com>

net: regex: Disable by default on sunXi

The sunXi arm64 build has overflown, leading to the main U-boot binary
overwriting the environment when flashing the new image, or even worse,
overwriting itself when we're calling saveenv.

Disable this option that is not critical until we can adress the issue
properly.

Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 7e3caa81 03-Dec-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

Move CONFIG_PANIC_HANG to Kconfig

Freescale (NXP) boards have lots of defconfig files per board.
I used "imply PANIC_HANG" for them.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# da5337a6 08-Nov-2017 Nandor Han <nandor.han@ge.com>

rtc: add support for s35392a

Add support for S35392A RTC. The driver supports both U-Boot driver
models.

Signed-off-by: Nandor Han <nandor.han@ge.com>
Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
Cc: Heiko Schocher <hs@denx.de>

# f52bdf4b 14-Sep-2017 Jean-Jacques Hiblot <jjhiblot@ti.com>

lib: allow building lzo for the SPL

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 85d8bf57 03-Sep-2017 Marek Behún <marek.behun@nic.cz>

lib: Add CRC32-C

This is needed for BTRFS.

Signed-off-by: Marek Behun <marek.behun@nic.cz>

create mode 100644 lib/crc32c.c

# 7264f292 15-Aug-2017 York Sun <york.sun@nxp.com>

spl: fit: Eanble GZIP support for image decompression

Add Kconfig option SPL_GZIP and SPL_ZLIB to enable gunzip support for
SPL boot, eg. falcon boot compressed kernel image.

Signed-off-by: York Sun <york.sun@nxp.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6ef2f901 11-Aug-2017 Adam Ford <aford173@gmail.com>

Convert CONFIG_BCH to Kconfig

This converts the following to Kconfig:
CONFIG_BCH

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1a7ba1d 18-Aug-2017 Anatolij Gustschin <agust@denx.de>

Fix 'notes' typos

s/notes/nodes

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 96b9082c 03-Aug-2017 Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

rockchip: rk3188: rock: adjust for SPL/TPL split

With the changes to split SPL/TPL for the RK3368, I apparently missed
some needed adjustments to the RK3188 Kconfig and rock_defconfig.

This fixes build-issues for the rock board after applying the RK3368
enablement (and SPL/TPL) set that resulted from TPL_SERIAL_SUPPORT,
TPL_ROCKCHIP_BACK_TO_BROM and TPL_TINY_MEMSET being separate symbols
now.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d56b4b19 22-Jul-2017 Tom Rini <trini@konsulko.com>

configs: Migrate RBTREE, LZO, CMD_MTDPARTS, CMD_UBI and CMD_UBIFS

The above CONFIG options are in Kconfig, and now have correct depends and
inter-dependencies. Migrate these to configs/ from include/configs/. In the
case of CMD_UBIFS also change it to be a default y if CMD_UBI.

Signed-off-by: Tom Rini <trini@konsulko.com>

# aed998aa 17-May-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_LZMA to Kconfig

This converts the following to Kconfig:
CONFIG_LZMA

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

# b1a873df 26-Apr-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_CMD_AES et al to Kconfig

This converts the following to Kconfig:
CONFIG_CMD_AES
CONFIG_AES

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Add select AES to CMD_AES]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 173aafbf 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

cmd: Expose a Kconfig option to enable UBIFS commands

Create a new Kconfig entry to allow CMD_UBIFS selection from Kconfig and
add an hidden LZO option that can be selected by CMD_UBIFS.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>

# aa049152 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

mtd: ubi: Select RBTREE option from MTD_UBI Kconfig entry

Expose the RBTREE feature through Kconfig and select this option from the
MTD_UBI option.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>
[Rebased on master]
Signed-off-by: Jagan Teki <jagan@openedev.com>

# ab4458bd 02-Apr-2017 Simon Glass <sjg@chromium.org>

string: Provide a slimmed-down memset()

Most of the time the optimised memset() is what we want. For extreme
situations such as TPL it may be too large. For example on the 'rock'
board, using a simple loop saves a useful 48 bytes. With gcc 4.9 and
the rodata bug, this patch is enough to reduce the TPL image below the
limit.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>

# bea79d7d 14-Mar-2017 Andre Przywara <andre.przywara@arm.com>

Kconfig: introduce md5sum command selection

So far CONFIG_MD5SUM would need to be set by a board's include file.
Since the command is really generic, move it over to Kconfig to allow
it to be defined by either a board's defconfig, menuconfig or some
config snippet merged via mergeconfig.sh.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e663b350 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

smbios: Expose in efi_loader as table

We can pass SMBIOS easily as EFI configuration table to an EFI payload. This
patch adds enablement for that case.

While at it, we also enable SMBIOS generation for ARM systems, since they support
EFI_LOADER.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4b6dddc2 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

x86: Move smbios generation into arch independent directory

We will need the SMBIOS generation function on ARM as well going forward,
so let's move it into a non arch specific location.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# ebf7fff2 05-Oct-2016 Heiko Schocher <hs@denx.de>

spl: move FDT_FIXUP_PARTITIONS to Kconfig

Move FDT_FIXUP_PARTITIONS to Kconfig and cleanup existing
uses.

Signed-off-by: Heiko Schocher <hs@denx.de>

# ddf67f71 05-Jul-2016 Maxime Ripard <maxime.ripard@free-electrons.com>

libfdt: Add overlay application function

The device tree overlays are a good way to deal with user-modifyable
boards or boards with some kind of an expansion mechanism where we can
easily plug new board in (like the BBB, the Raspberry Pi or the CHIP).

Add a new function to merge overlays with a base device tree.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>

# 91b86e21 26-May-2016 Marek Vasut <marex@denx.de>

lib: Enable private libgcc by default

This patch decouples U-Boot binary from the toolchain on systems where
private libgcc is available. Instead of pulling in functions provided
by the libgcc from the toolchain, U-Boot will use it's own set of libgcc
functions. These functions are usually imported from Linux kernel, which
also uses it's own libgcc functions instead of the ones provided by the
toolchain.

This patch solves a rather common problem. The toolchain can usually
generate code for many variants of target architecture and often even
different endianness. The libgcc on the other hand is usually compiled
for one particular configuration and the functions provided by it may
or may not be suited for use in U-Boot. This can manifest in two ways,
either the U-Boot fails to compile altogether and linker will complain
or, in the much worse case, the resulting U-Boot will build, but will
misbehave in very subtle and hard to debug ways.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 67976306 30-Mar-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

cosmetic: Fix typos "privide"

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# ed980b8c 03-Mar-2016 Alexander Graf <agraf@csgraf.de>

efi_loader: hook up in build environment

Now that we have all the bits and pieces ready for EFI payload loading
support, hook them up in Makefiles and KConfigs so that we can build.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
[trini: Enable only when we of OF_LIBFDT, disable on kwb and colibri_pxa270]
Signed-off-by: Tom Rini <trini@konsulko.com>

# aa34fbc0 22-Feb-2016 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt to be used in SPL

Add an option to enable libfdt in SPL. This can be useful when decoding
FIT files in SPL.

We need to make sure this option is not enabled in SPL by this change.
Also this option needs to be enabled in host builds. Si add a new
IMAGE_USE_LIBFDT #define which can be used in files that are built on the
host but must also build for U-Boot and SPL.

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

# 69e173eb 22-Feb-2016 Simon Glass <sjg@chromium.org>

Move CONFIG_OF_LIBFDT to Kconfig

Move this option to Kconfig and tidy up existing boards.

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

# a187559e 05-Feb-2016 Bin Meng <bmeng.cn@gmail.com>

Use correct spelling of "U-Boot"

Correct spelling of "U-Boot" shall be used in all written text
(documentation, comments in source files etc.).

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Minkyu Kang <mk7.kang@samsung.com>

# 947c626d 14-Jan-2016 Tom Rini <trini@konsulko.com>

vsprintf.c: Always enable CONFIG_SYS_VSNPRINTF

Enabling this function always removes some class of string saftey issues.
The size change here in general is about 400 bytes and this seems a reasonable
trade-off.

Cc: Peng Fan <peng.fan@nxp.com>
Cc: Peter Robinson <pbrobinson@gmail.com>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Adrian Alonso <aalonso@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 7d9cde10 22-Nov-2015 Stefan Roese <sr@denx.de>

lib/tiny-printf.c: Add tiny printf function for space limited environments

This patch adds a small printf() version that supports all basic formats.
Its intented to be used in U-Boot SPL versions on platforms with very
limited internal RAM sizes.

To enable it, just define CONFIG_USE_TINY_PRINTF in your defconfig. This
will result in the SPL using this tiny function and the main U-Boot
still using the full-blown printf() function.

This code was copied from:
http://www.sparetimelabs.com/printfrevisited
With mostly only coding style related changes so that its checkpatch
clean.

The size reduction is about 2.5KiB. Here a comparison for the db-mv784mp-gp
(Marvell AXP) SPL:

Without this patch:
58963 18536 1928 79427 13643 ./spl/u-boot-spl

With this patch:
56542 18536 1956 77034 12cea ./spl/u-boot-spl

Note:
To make it possible to compile tiny-printf.c instead of vsprintf.c when
CONFIG_USE_TINY_PRINTF is defined, the functions printf() and vprintf() are
moved from common/console.c into vsprintf.c in this patch.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>

# 2419cd16 03-Oct-2015 Simon Glass <sjg@chromium.org>

dm: tpm: Drop CONFIG_DM_TPM

Now that all TPM drivers use driver model, we can drop the special driver
model CONFIG option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>

# 027b728d 06-Oct-2015 Julius Werner <jwerner@chromium.org>

Add support for LZ4 decompression algorithm

This patch adds support for LZ4-compressed FIT image contents. This
algorithm has a slightly worse compression ration than LZO while being
nearly twice as fast to decompress. When loading images from a fast
storage medium this usually results in a boot time win.

Sandbox-tested only since I don't have a U-Boot development system set
up right now. The code was imported unchanged from coreboot where it's
proven to work, though. I'm mostly interested in getting this recognized
by mkImage for use in a downstream project.

Signed-off-by: Julius Werner <jwerner@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# a7d660bc 22-Aug-2015 Simon Glass <sjg@chromium.org>

tpm: Add Kconfig options for TPMs

Add new Kconfig options for TPMs in preparation for moving boards to use
Kconfig for TPM configuration.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 867a6ac8 31-Jul-2015 Simon Glass <sjg@chromium.org>

efi: Add start-up library code

When running as an EFI application, U-Boot must request memory from EFI,
and provide access to the boot services U-Boot needs.

Add library code to perform these tasks. This includes efi_main() which is
the entry point from EFI. U-Boot is built as a shared library.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d1389403 23-Jun-2015 Simon Glass <sjg@chromium.org>

Add a dhrystone benchmark command

Drystone provides a convenient sanity check that the CPU is running at full
speed. Add this as a command which can be enabled as needed.

Note: I investigated using Coremark for this but there was a license
agreement and I could not work out if it was GPL-compatible.

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

# f7848d90 22-Jun-2015 Joe Hershberger <joe.hershberger@ni.com>

Allow CONFIG_REGEX to be disabled when CONFIG_NET

Instead of selecting REGEX when NET is enabled, make it the default, but
allow boards that are tiny to disable it and lose functionality on all
but the first Ethernet adapter.

cm-bf548, bf538f-ezkit, and bf533-stamp need this. None appear to have
more than one Ethernet interface.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# 3850dbe8 11-Jun-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

blackfin: fix undefined reference to srand and rand

Commit 9ba9e85f3f1c (net: Fix NET_RANDOM_ETHADDR dependencies)
accidentally dropped CONFIG_LIB_RAND defines for 14 Blackfin boards.

Prior to that commit, those boards defined CONFIG_LIB_RAND, but not
CONFIG_NET_RANDOM_ETHADDR. So, commit 9ba9e85f3f1c should not have
touched them, but in fact it ripped CONFIG_LIB_RAND off from all the
header files, which caused undefined reference to srand and rand.
CONFIG_LIB_RAND=y must be revived for such boards.

BTW, this commit indeed makes it better, but even with this fix,
three boards (bf533-stamp, bf538f-ezkit, cm-bf548) still can not
build due to region 'ram' overflowed error. This was cause by
commit 6eed3786c68c (net: Move the CMD_NET config to defconfigs)
because CMD_NET selects NET, and NET selects REGEX. Eventually,
some boards were newly enabled with CONFIG_REGEX, increasing the
memory footprint. A patch is expected to fix the build error.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 9ba9e85f 25-May-2015 Michal Simek <michal.simek@xilinx.com>

net: Fix NET_RANDOM_ETHADDR dependencies

NET_RANDOM_ETHADDR depends on lib/rand.c. This patch adds dependency to
Kconfig to ensure that library is also compiled.

Remove the definitions from Blackfin boards' include/configs.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 6501ff62 20-Apr-2015 Przemyslaw Marczak <p.marczak@samsung.com>

lib: Kconfig: add entry for errno_str() function

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1a60650c 21-Apr-2015 Joe Hershberger <joe.hershberger@ni.com>

kconfig: Move REGEX to Kconfig

Having this as a Kconfig allows it to be a dependent feature.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8156345d 06-Mar-2015 Simon Glass <sjg@chromium.org>

sandbox: Move CONFIG_SYS_VSNPRINTF to Kconfig

Move this over to Kconfig and tidy up.

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

# 94e3c8c4 19-Feb-2015 gaurav rana <gaurav.rana@freescale.com>

crypto/fsl - Add progressive hashing support using hardware acceleration.

Currently only normal hashing is supported using hardware acceleration.
Added support for progressive hashing using hardware.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
Signed-off-by: Gaurav Rana <gaurav.rana@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>

# d9f23c7f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

lib/rsa: Add Kconfig for devices supporting RSA Modular Exponentiation

Kconfig option added for devices which support RSA Verification.
1. RSA_SOFTWARE_EXP
Enables driver for supporting RSA Modular Exponentiation in Software
2. RSA_FREESCALE_EXP
Enables driver for supporting RSA Modular Exponentiation using Freescale specific
driver

The above drivers use RSA uclass

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
(Removed duplicate line in Kconfig comment)

Change-Id: I7663c4d5350e2bfc3dfa2696f70ef777d6ccc6f6

# c4beb22f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

FIT: Modify option FIT_SIGNATURE in Kconfig

For FIT signature based approach to work, RSA library needs to be selected.
The FIT_SIGNATURE option in Kconfig is modified to automatically select RSA.
Selecting RSA compiles the RSA library required for image verification.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 45ccec8f 23-Oct-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_USE_PRIVATE_LIBGCC to Kconfig

The private libgcc is supported only on ARM, MIPS, PowerPC, SH, x86.
Those architectures should "select" HAVE_PRIVATE_LIBGCC and
CONFIG_USE_PRIVATE_LIBGCC should depend on it.

Currently, this option is enabled on Tegra boards and x86 architecture.
Move the definition from header files to Kconfig.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Tested-by: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: Tom Warren <twarren@nvidia.com>

# 8c688bc4 23-Oct-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_SYS_HZ to lib/Kconfig

CONFIG_SYS_HZ is always defined as 1000 in config_fallbacks.h
(but some boards still have redundant definitions).

This commit moves the definition and the document in README to
Kconfig. Since lib/Kconfig can assure that CONFIG_SYS_HZ is 1000,
the sanity check in lib/time.c should be removed.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Reviewed-by: Marek Vasut <marex@denx.de>

# b0928da6 16-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED to Kconfig

If this option is enabled, the objects under lib/ directory
are compiled with speed optimization, not size optimization.
(Currently, only used by some Blackfin boards.)

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# ed36323f 16-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: add blank Kconfig files

This would be useful to start moving various config options.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# c589132a 02-Dec-2020 Aswath Govindraju <a-govindraju@ti.com>

fdt: Use phandle to distinguish DT nodes with same name

While assigning the sequence number to subsystem instances by reading the
aliases property, only DT nodes names are compared and not the complete
path. This causes a problem when there are two DT nodes with same name but
have different paths.

In arch/arm/dts/k3-am65-main.dtsi there are two USB controllers with the
same device tree node name but different path. When aliases are defined for
these USB controllers then fdtdec_get_alias_seq() fails to pick the correct
instance for a given index.

fdt_path_offset() function is slow and this would effect the U-Boot
startup. To avert the time penalty on all boards, apply this extra check
only when required by using a config option.

Fix it by comparing the phandles of DT nodes after the node names match,
under a config option.

Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Fix whitespace error in Kconfig:
Signed-off-by: Simon Glass <sjg@chromium.org>

# 28cef9ca 19-Nov-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

fs: fat: create correct short names

The current function set_name() used to create short names has the
following deficiencies resolved by this patch:

* Long names (e.g. FOO.TXT) are stored even if a short name is enough.
* Short names with spaces are created, e.g. "A ~1.TXT".
* Short names with illegal characters are created, e.g. "FOO++BAR".
* Debug output does not not consider that the short file name has no
concluding '\0'.

The solution for the following bug is split of into a separate patch:

* Short file names must be unique.

This patch only provides the loop over possible short file names.

Fixes: c30a15e590c ("FAT: Add FAT write feature")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# e4f8e543 05-Nov-2020 Simon Glass <sjg@chromium.org>

smbios: Drop the unused Kconfig options

Now that we can use devicetree to specify this information, drop the old
CONFIG options.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 44c74bdd 05-Nov-2020 Simon Glass <sjg@chromium.org>

sysinfo: Provide a default driver to set SMBIOS values

Some boards want to specify the manufacturer or product name but do not
need to have their own sysinfo driver.

Add a default driver which provides a way to specify this SMBIOS
information in the devicetree, without needing any board-specific
functionality.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d2cb7a22 04-Nov-2020 Simon Glass <sjg@chromium.org>

x86: Allow putting some tables in the bloblist

At present all tables are placed starting at address f0000 in memory, and
can be up to 64KB in size. If the tables are very large, this may not
provide enough space.

Also if the tables point to other tables (such as console log or a ramoops
area) then we must allocate other memory anyway.

The bloblist is a nice place to put these tables since it is contiguous,
which makes it easy to reserve this memory for linux using the 820 tables.

Add an option to put some of the tables in the bloblist. For SMBIOS and
ACPI, create suitable pointers from the f0000 region to the new location
of the tables.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
[bmeng: squashed in http://patchwork.ozlabs.org/project/uboot/patch/
20201105062407.1.I8091ad931cbbb5e3b6f6ababdf3f8d5db0d17bb9@changeid/]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# 415eab06 03-Nov-2020 Christian Gmeiner <christian.gmeiner@gmail.com>

smbios: add parsing API

Add a very simple API to be able to access SMBIOS strings
like vendor, model and bios version.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 72eda507 27-Oct-2020 Sean Anderson <seanga2@gmail.com>

lib: Add getopt

Some commands can get very unweildy if they have too many positional
arguments. Adding options makes them easier to read, remember, and
understand.

This implementation of getopt has been taken from barebox, which has had
option support for quite a while. I have made a few modifications to their
version, such as the removal of opterr in favor of a separate getopt_silent
function. In addition, I have moved all global variables into struct
getopt_context.

The getopt from barebox also re-orders the arguments passed to it so that
non-options are placed last. This allows users to specify options anywhere.
For example, `ls -l foo/ -R` would be re-ordered to `ls -l -R foo/` as
getopt parsed the options. However, this feature conflicts with the const
argv in cmd_tbl->cmd. This was originally added in 54841ab50c ("Make sure
that argv[] argument pointers are not modified."). The reason stated in
that commit is that hush requires argv to stay unmodified. Has this
situation changed? Barebox also uses hush, and does not have this problem.
Perhaps we could use their fix?

I have assigned maintenance of getopt to Simon Glass, as it is currently
only used by the log command. I would also be fine maintaining it.

Signed-off-by: Sean Anderson <seanga2@gmail.com>

# 26637e2e 12-Sep-2020 Simon Glass <sjg@chromium.org>

lib: Allow hexdump to be used in SPL

It is sometimes useful to output hex dumps in SPL. Add a config option to
allow this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# e87dfb05 05-Aug-2020 Andrii Anisov <andrii_anisov@epam.com>

lib: sscanf: add sscanf implementation

Port sscanf implementation from mini-os and introduce new
Kconfig option to enable it: CONFIG_SSCANF. Disable by default.

Signed-off-by: Andrii Anisov <andrii_anisov@epam.com>
Signed-off-by: Anastasiia Lukianenko <anastasiia_lukianenko@epam.com>
Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>

# 81014f73 30-Jul-2020 Joao Marcos Costa <joaomarcos.costa@bootlin.com>

include/u-boot, lib/zlib: add sources for zlib decompression

Add zlib (v1.2.11) uncompr() function to U-Boot. SquashFS depends on
this function to decompress data from a raw disk image. The actual
support for zlib into SquashFS sources will be added in a follow-up
commit.

Signed-off-by: Joao Marcos Costa <joaomarcos.costa@bootlin.com>

# 69be8fd1 03-Jun-2020 Marek Szyprowski <m.szyprowski@samsung.com>

powerpc: move ADDR_MAP to Kconfig

Move ADDR_MAP related config options from include/configs/*.h to the
proper place in lib/Kconfig. This has been done using
./tools/moveconfig.py and manual inspection of the generated changes.
This is a preparation to use ADDR_MAP helper on ARM 32bit Raspberry Pi4
board for mapping the PCIe XHCI MMIO, which is above the 4GiB identity
mapping limit.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# d16b38f4 15-Apr-2020 Reuben Dowle <reubendowle0@gmail.com>

Add support for SHA384 and SHA512

The current recommendation for best security practice from the US government
is to use SHA384 for TOP SECRET [1].

This patch adds support for SHA384 and SHA512 in the hash command, and also
allows FIT images to be hashed with these algorithms, and signed with
sha384,rsaXXXX and sha512,rsaXXXX

The SHA implementation is adapted from the linux kernel implementation.

[1] Commercial National Security Algorithm Suite
http://www.iad.gov/iad/programs/iad-initiatives/cnsa-suite.cfm

Signed-off-by: Reuben Dowle <reuben.dowle@4rf.com>

# 43e442a5 26-May-2020 Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

kconfig: fix some typos

Signed-off-by: Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

# eff5a547 22-May-2020 Michael Walle <michael@walle.cc>

cmd: zip: automatically pull in gzip()

Move the CONFIG_GZIP_COMPRESSED from a config.h macro to a Kconfig menu
item. It is not selectable by a user because there is no reason to do
so. Instead it will be automatically selected by the stuff which uses
gzip(), like the zip command.

Remove it from the config_whitelist.txt. Also remove
CONFIG_GZIP_COMPRESS_DEF_SZ as this was never used on any board. The
default seems to be sane, otherwise it should be added as a Kconfig
option.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8239be61 06-May-2020 Simon Glass <sjg@chromium.org>

lib: Allow MD5 to be enabled in SPL

At present the MD5 option cannot be enabled by board configs since it has
no Kconfig name. It is generally enabled, so long as FIT support is
present. But not all boards use FIT, particularly in SPL

Fix this and add an option for SPL as well. This allows board code to call
md5() even if FIT support is not enabled.

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

# 04cb3994 21-Apr-2020 Weijie Gao <weijie.gao@mediatek.com>

lib: enable lzma decompression support for SPL build

This patch enables LZMA decompression support for SPL build

Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>

# 2a2119e1 05-Mar-2020 Atish Patra <atish.patra@wdc.com>

lib: kconfig: Add option to set BZIP2 compression method

There is no way to select BZIP2 compression method.
Add it under library/compression config where all other
compression related configs are present.

Signed-off-by: Atish Patra <atish.patra@wdc.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 805b3cac 12-Feb-2020 Keerthy <j-keerthy@ti.com>

lib: elf: Move the generic elf loading/validating functions to lib

Move the generic elf loading/validating functions to lib/
so that they can be re-used and accessed by code existing
outside cmd.

While at it remove the duplicate static version of load_elf_image_phdr
under arch/arm/mach-imx/imx_bootaux.c.

Signed-off-by: Keerthy <j-keerthy@ti.com>
Suggested-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>

# 1611235b 19-Jan-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: Kconfig dependencies for pseudo-random library

drivers/rng/sandbox_rng.c requires rand() to be defined but configuration
option CONFIG_CONFIG_LIB_RAND selected in drivers/rng/Kconfig does not
exist.

test/lib/test_aes.c requires rand() to be defined.

Fix the selection criteria for choice "Pseudo-random library support type".

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 3c10dc95 06-Dec-2019 Simon Glass <sjg@chromium.org>

binman: Add a library to access binman entries

SPL and TPL can access information about binman entries using link-time
symbols but this is not available in U-Boot proper. Of course it could be
made available, but the intention is to just read the device tree.

Add support for this, so that U-Boot can locate entries.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# b4adf627 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: crypto: add x509 parser

Imported from linux kernel v5.3:
x509.asn1 without changes
x509_akid.asn1 without changes
x509_parser.h without changes
x509_cert_parser.c with changes marked as __UBOOT__
x509_public_key.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# a9b45e6e 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add oid registry utility

Imported from linux kernel v5.3:
build_OID_registry without changes
oid_registry.h without changes
oid_registry.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# ab8a0e06 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add asn1 decoder

Imported from linux kernel v5.3:
lib/asn1_decoder.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 2b12196d 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

cmd: add asn1_compiler

Imported from linux kernel v5.3:
asn1.h without changes
asn1_ber_bytecode.h without changes
asn1_decoder.h without changes
asn1_compiler.c without changes

This host command will be used to create a ASN1 parser, for example,
for pkcs7 messages or x509 certificates. More specifically, it will
generate *byte code* which will be interpreted by asn1 decoder library.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 05429b6c 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

rtc: move date.c from drivers/rtc/ to lib/

In the next commit, rtc_mktime(), for compatibility with linux, will be
implemented using rtc_mktime(), which is no longer drivers/rtc specific.
So move this file under lib/.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 37ef1774 10-Nov-2019 Thomas Hebb <tommyhebb@gmail.com>

Kconfig: disambiguate config names for tiny printf

27084c03d36a ("spl: Allow tiny printf() to be controlled in SPL and
TPL") split this option in two for TPL and SPL, but didn't change the
Kconfig names, making them hard to set quickly.

Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>

# 0d76afc0 27-Oct-2019 Simon Glass <sjg@chromium.org>

fdt: Add Kconfig options to control code size

For better or worse libfdt recent grew a lot of code that checks the
validity of the device tree in great detail. When using unsigned or
unverified data this makes things safer, but it does add to code size.

Add some controls to select the trade-off between safety and code size.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 27084c03 25-Sep-2019 Simon Glass <sjg@chromium.org>

spl: Allow tiny printf() to be controlled in SPL and TPL

At present there is only one control for this and it is used for both SPL
and TPL. But SPL might have a lot more space than TPL so the extra cost of
a full printf() might be acceptable.

Split the option into two, providing separate SPL and TPL controls. The
TPL setting defaults to the same as SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2a51e16b 07-Jun-2019 Tom Rini <trini@konsulko.com>

configs: Make USE_TINY_PRINTF depend on SPL||TPL and be default

The USE_TINY_PRINTF symbol only changes things within SPL and TPL
builds, so make it depend on that support. Next, make it default as
within these cases we should rarely have need of more advanced print
formats outside of the debug context.

To do this, in a few cases we need to correct our Kconfig dependencies
as we had cases of non-SPL targets select'ing this symbol. Finally, in
the case of a few boards we really do need the full printf
functionality.

Signed-off-by: Tom Rini <trini@konsulko.com>

# da0fb5fd 02-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: make call depth limit customizable

Up to now we had hard coded values for the call depth up to which trace
records are created: 200 for early tracing, 15 thereafter. UEFI
applications reach a call depth of 80 or above.

Provide customizing settings for the call trace depth limit and the early
call trace depth limit. Use the old values as defaults.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8509f22a 29-Apr-2019 Marek Behún <marek.behun@nic.cz>

lib: add Zstandard decompression support

Add the zstd library from Linux kernel (only decompression support).
There are minimal changes to build with U-Boot, otherwise the files are
identical to Linux commit dc35da16 from March 2018, the files had not
been touched since in kernel. Also SPDX lincese tags were added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 83a486b6 29-Apr-2019 Marek Behún <marek.behun@nic.cz>

lib: Add xxhash support

This adds the xxhash support from Linux. Files are almost identical to
those added to Linux in commit 5d240522 ("lib: Add xxhash module") (they
haven't been touched since in Linux). The only difference is to add some
includes to be compatible with U-Boot. Also SPDX lincese tags were
added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 5132361a 29-Apr-2019 Heiko Schocher <hs@denx.de>

lib: Kconfig: fix help text for GZIP

commit 95f4bbd581cf ("lib: fdt: Allow LZO and GZIP DT compression in U-Boot")

introduced Kconfig option for gzip in U-Boot, but help text
says gzip for SPL, which is wrong. Fix this.

Signed-off-by: Heiko Schocher <hs@denx.de>
Acked-by: Marek Vasut <marex@denx.de>

# 1c6eb075 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE_BUFFER_SIZE et al to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE_BUFFER_SIZE
CONFIG_TRACE_EARLY_SIZE
CONFIG_TRACE_EARLY
CONFIG_TRACE_EARLY_ADDR

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

# a24a78d7 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE

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

# 54969b40 21-Mar-2019 Thierry Reding <treding@nvidia.com>

fdtdec: Add Kconfig symbol for tests

Runtime tests are provided as a test_fdtdec command implementation. Add
a Kconfig symbol that allows this command to be built so that the tests
can be used.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 95f4bbd5 08-Mar-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

lib: fdt: Allow LZO and GZIP DT compression in U-Boot

Add required Kconfig symbols, Makefile bits and macro fixes in a
few places to support LZO and DT compression in U-Boot. This can
save a lot of space with multi-DTB fitImages.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>

# 6e705114 13-Jan-2019 Chris Packham <judge.packham@gmail.com>

lib: Kconfig: spelling fixes

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 048c6e89 06-Nov-2018 Simon Glass <sjg@chromium.org>

spl: lz4: Allow use of lz4 compression in SPL

In some cases U-Boot is compressed and it is useful to be able to
decompress it in SPL. Add a Kconfig and Makefile change to allow this.
Note that this does not actually implement decompression.

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

# 2895c4b7 15-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

kconfig: Introduce HAVE_ARCH_IOMAP

Introduce a new Kconfig option for architecture codes to control
whether it provides io{read,write}{8,16,32} I/O accessor functions.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5592a633 01-Oct-2018 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt in TPL

In some cases (e.g. sandbox with verified boot) it is useful to support
libfdt in TPL. Update the Kconfig to handle this.

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

# 6307896c 01-Oct-2018 Simon Glass <sjg@chromium.org>

tpm: Add support for SPL and TPL

At present the tpm can only be used in U-Boot proper. Updated it to work
in SPL and TPL also.

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

# ab948cd2 19-Jul-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

fdt_support: make FDT_FIXUP_PARTITIONS depend on CMD_MTDPARTS

fdt_fixup_mtdparts() calls mtdparts_init() and device_find(),
which are defined in cmd/mtdparts.c

The combination of FDT_FIXUP_PARTITIONS=y and CMD_MTDPARTS=n
emits the following link error:

common/fdt_support.c:903: undefined reference to `mtdparts_init'
common/fdt_support.c:914: undefined reference to `device_find'

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 3330584d 03-Jun-2018 Igor Opaniuk <igor.opaniuk@gmail.com>

avb2.0: integrate avb 2.0 into the build system

Integrate libavb into the build system. Introduce CONFIG_LIBAVB
build option.

Signed-off-by: Igor Opaniuk <igor.opaniuk@linaro.org>

# f8c987f8 05-Jun-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

lib: Add hexdump

Often during debugging session it's very interesting to see
what data we were dealing with. For example what we write or read
to/from memory or peripherals.

This change introduces functions that allow to dump binary
data with one simple function invocation like:
------------------->8----------------
print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, buf, len);
------------------->8----------------

which gives us the following:
------------------->8----------------
00000000: f2 b7 c9 88 62 61 75 64 72 61 74 65 3d 31 31 35 ....baudrate=115
00000010: 32 30 30 00 62 6f 6f 74 61 72 67 73 3d 63 6f 6e 200.bootargs=con
00000020: 73 6f 6c 65 3d 74 74 79 53 33 2c 31 31 35 32 30 sole=ttyS3,11520
00000030: 30 6e 38 00 62 6f 6f 74 64 65 6c 61 79 3d 33 00 0n8.bootdelay=3.
00000040: 62 6f 6f 74 66 69 6c 65 3d 75 49 6d 61 67 65 00 bootfile=uImage.
00000050: 66 64 74 63 6f 6e 74 72 6f 6c 61 64 64 72 3d 39 fdtcontroladdr=9
00000060: 66 66 62 31 62 61 30 00 6c 6f 61 64 61 64 64 72 ffb1ba0.loadaddr
00000070: 3d 30 78 38 32 30 30 30 30 30 30 00 73 74 64 65 =0x82000000.stde
00000080: 72 72 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 rr=serial0@e0022
00000090: 30 30 30 00 73 74 64 69 6e 3d 73 65 72 69 61 6c 000.stdin=serial
000000a0: 30 40 65 30 30 32 32 30 30 30 00 73 74 64 6f 75 0@e0022000.stdou
000000b0: 74 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 30 t=serial0@e00220
000000c0: 30 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00..............
...
------------------->8----------------

Source of hexdump.c was copied from Linux kernel v4.7-rc2.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Mario Six <mario.six@gdsys.cc>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Stefan Roese <sr@denx.de>

# c232d14d 29-May-2018 Alex Kiernan <alex.kiernan@gmail.com>

mmc: Separate "mmc swrite" from fastboot

Introduce CONFIG_IMAGE_SPARSE and CONFIG_CMD_MMC_SWRITE so the "mmc
swrite" command is separated from the fastboot code.

Move image-sparse from common to lib so it's clear it's library code.

Rename CONFIG_FASTBOOT_FLASH_FILLBUF_SIZE to CONFIG_IMAGE_SPARSE_FILLBUF_SIZE
and migrate it to Kconfig.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Acked-by: Jassi Brar <jaswinder.singh@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6417572e 08-May-2018 Tom Rini <trini@konsulko.com>

lib/Kconfig: Mark OF_LIBFDT_OVERLAY as depending on OF_LIBFDT

The overlay code is only useful when OF_LIBFDT is set, so mark it as
depending on that first.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 58a46f88 25-Apr-2018 Praneeth Bajjuri <praneeth@ti.com>

configs: TI: Enable FIT Library overlay support

Enable the FDT library overlay support for all TI SOC family.

Without this option, when Loading fdt from FIT image, the
following warning is seen.

"config with overlays but CONFIG_OF_LIBFDT_OVERLAY not set".

Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
Suggested-by: Andrew F.Davis <afd@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>

# 14ad44ab 18-Apr-2018 Alex Kiernan <alex.kiernan@gmail.com>

spl: Split sprintf, strto* from SPL serial in Kconfig

When SPL serial is disabled, callers who need sprintf or strtoul fail
because their inclusion is guarded by CONFIG_SPL_SERIAL_SUPPORT/
CONFIG_TPL_SERIAL_SUPPORT.

Split printf, sprintf and strto into their own entries and then select
all of them if SERIAL_SUPPORT is enabled to match the current behaviour.

Include panic.o unconditionally as it can be called from anywhere which
uses BUG_ON().

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>

# e294ba06 04-Apr-2018 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-sunxi

Signed-off-by: Tom Rini <trini@konsulko.com>


# d14db11d 03-Apr-2018 Andre Przywara <andre.przywara@arm.com>

sunxi: revert disabling of features

In January some commits were introduced to mitigate the U-Boot image
size issues we encountered on sunxi builds.
Now with the MMC environment removed we can bring them back, as we
practically don't have a size limit anymore.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 32ce6179 13-Mar-2018 Bryan O'Donoghue <bryan.odonoghue@linaro.org>

optee: Add lib entries for sharing OPTEE code across ports

This patch adds code to lib to enable sharing of useful OPTEE code between
board-ports and architectures. The code on lib/optee/optee.c comes from the
TI omap2 port. Eventually the OMAP2 code will be patched to include the
shared code. The intention here is to add more useful OPTEE specific code
as more functionality gets added.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Cc: Harinarayan Bhatta <harinarayan@ti.com>
Cc: Andrew F. Davis <afd@ti.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Kever Yang <kever.yang@rock-chips.com>
Cc: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Cc: Peng Fan <peng.fan@nxp.com>
Tested-by: Peng Fan <peng.fan@nxp.com>

# 36c1877c 06-Feb-2018 Faiz Abbas <faiz_abbas@ti.com>

lib: Kconfig: Move DYNAMIC_CRC_TABLE to Kconfig

Add CONFIG prefix to DYNAMIC_CRC_TABLE and implement it in
Kconfig.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>

# a451bc27 05-Feb-2018 Adam Ford <aford173@gmail.com>

Convert LIB_UUID to Kconfig

config_fallback.h has some logic that checks a variety of options
and selects LIB_UUID if it hasn't already been selected. This
will all LIB_UUID in Kconfig and select this option for the list
of options to allow us to remove the logic from fallbacks

Signed-off-by: Adam Ford <aford173@gmail.com>

# a5a37567 06-Feb-2018 Adam Ford <aford173@gmail.com>

Convert CONFIG LIB_HW_RAND to Kconfig

config_fallbacks.h had some logic to automatically select
LIB_RAND if RANDOM_UUID or CMD_UUID were set if LIB_HW_RAND wasn't
already selected. By migrating LIB_HW_RAND to Kconfig, we can
remove this check from config_fallbacks.h and put it into Kconfig

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
[trini: Turn into a choice, add NET_RANDOM_ETHADDR]
Signed-off-by: Tom Rini <trini@konsulko.com>

# acd4d334 16-Jan-2018 Maxime Ripard <maxime.ripard@free-electrons.com>

net: regex: Disable by default on sunXi

The sunXi arm64 build has overflown, leading to the main U-boot binary
overwriting the environment when flashing the new image, or even worse,
overwriting itself when we're calling saveenv.

Disable this option that is not critical until we can adress the issue
properly.

Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 7e3caa81 03-Dec-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

Move CONFIG_PANIC_HANG to Kconfig

Freescale (NXP) boards have lots of defconfig files per board.
I used "imply PANIC_HANG" for them.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# da5337a6 08-Nov-2017 Nandor Han <nandor.han@ge.com>

rtc: add support for s35392a

Add support for S35392A RTC. The driver supports both U-Boot driver
models.

Signed-off-by: Nandor Han <nandor.han@ge.com>
Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
Cc: Heiko Schocher <hs@denx.de>

# f52bdf4b 14-Sep-2017 Jean-Jacques Hiblot <jjhiblot@ti.com>

lib: allow building lzo for the SPL

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 85d8bf57 03-Sep-2017 Marek Behún <marek.behun@nic.cz>

lib: Add CRC32-C

This is needed for BTRFS.

Signed-off-by: Marek Behun <marek.behun@nic.cz>

create mode 100644 lib/crc32c.c

# 7264f292 15-Aug-2017 York Sun <york.sun@nxp.com>

spl: fit: Eanble GZIP support for image decompression

Add Kconfig option SPL_GZIP and SPL_ZLIB to enable gunzip support for
SPL boot, eg. falcon boot compressed kernel image.

Signed-off-by: York Sun <york.sun@nxp.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6ef2f901 11-Aug-2017 Adam Ford <aford173@gmail.com>

Convert CONFIG_BCH to Kconfig

This converts the following to Kconfig:
CONFIG_BCH

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1a7ba1d 18-Aug-2017 Anatolij Gustschin <agust@denx.de>

Fix 'notes' typos

s/notes/nodes

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 96b9082c 03-Aug-2017 Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

rockchip: rk3188: rock: adjust for SPL/TPL split

With the changes to split SPL/TPL for the RK3368, I apparently missed
some needed adjustments to the RK3188 Kconfig and rock_defconfig.

This fixes build-issues for the rock board after applying the RK3368
enablement (and SPL/TPL) set that resulted from TPL_SERIAL_SUPPORT,
TPL_ROCKCHIP_BACK_TO_BROM and TPL_TINY_MEMSET being separate symbols
now.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d56b4b19 22-Jul-2017 Tom Rini <trini@konsulko.com>

configs: Migrate RBTREE, LZO, CMD_MTDPARTS, CMD_UBI and CMD_UBIFS

The above CONFIG options are in Kconfig, and now have correct depends and
inter-dependencies. Migrate these to configs/ from include/configs/. In the
case of CMD_UBIFS also change it to be a default y if CMD_UBI.

Signed-off-by: Tom Rini <trini@konsulko.com>

# aed998aa 17-May-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_LZMA to Kconfig

This converts the following to Kconfig:
CONFIG_LZMA

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

# b1a873df 26-Apr-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_CMD_AES et al to Kconfig

This converts the following to Kconfig:
CONFIG_CMD_AES
CONFIG_AES

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Add select AES to CMD_AES]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 173aafbf 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

cmd: Expose a Kconfig option to enable UBIFS commands

Create a new Kconfig entry to allow CMD_UBIFS selection from Kconfig and
add an hidden LZO option that can be selected by CMD_UBIFS.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>

# aa049152 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

mtd: ubi: Select RBTREE option from MTD_UBI Kconfig entry

Expose the RBTREE feature through Kconfig and select this option from the
MTD_UBI option.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>
[Rebased on master]
Signed-off-by: Jagan Teki <jagan@openedev.com>

# ab4458bd 02-Apr-2017 Simon Glass <sjg@chromium.org>

string: Provide a slimmed-down memset()

Most of the time the optimised memset() is what we want. For extreme
situations such as TPL it may be too large. For example on the 'rock'
board, using a simple loop saves a useful 48 bytes. With gcc 4.9 and
the rodata bug, this patch is enough to reduce the TPL image below the
limit.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>

# bea79d7d 14-Mar-2017 Andre Przywara <andre.przywara@arm.com>

Kconfig: introduce md5sum command selection

So far CONFIG_MD5SUM would need to be set by a board's include file.
Since the command is really generic, move it over to Kconfig to allow
it to be defined by either a board's defconfig, menuconfig or some
config snippet merged via mergeconfig.sh.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e663b350 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

smbios: Expose in efi_loader as table

We can pass SMBIOS easily as EFI configuration table to an EFI payload. This
patch adds enablement for that case.

While at it, we also enable SMBIOS generation for ARM systems, since they support
EFI_LOADER.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4b6dddc2 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

x86: Move smbios generation into arch independent directory

We will need the SMBIOS generation function on ARM as well going forward,
so let's move it into a non arch specific location.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# ebf7fff2 05-Oct-2016 Heiko Schocher <hs@denx.de>

spl: move FDT_FIXUP_PARTITIONS to Kconfig

Move FDT_FIXUP_PARTITIONS to Kconfig and cleanup existing
uses.

Signed-off-by: Heiko Schocher <hs@denx.de>

# ddf67f71 05-Jul-2016 Maxime Ripard <maxime.ripard@free-electrons.com>

libfdt: Add overlay application function

The device tree overlays are a good way to deal with user-modifyable
boards or boards with some kind of an expansion mechanism where we can
easily plug new board in (like the BBB, the Raspberry Pi or the CHIP).

Add a new function to merge overlays with a base device tree.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>

# 91b86e21 26-May-2016 Marek Vasut <marex@denx.de>

lib: Enable private libgcc by default

This patch decouples U-Boot binary from the toolchain on systems where
private libgcc is available. Instead of pulling in functions provided
by the libgcc from the toolchain, U-Boot will use it's own set of libgcc
functions. These functions are usually imported from Linux kernel, which
also uses it's own libgcc functions instead of the ones provided by the
toolchain.

This patch solves a rather common problem. The toolchain can usually
generate code for many variants of target architecture and often even
different endianness. The libgcc on the other hand is usually compiled
for one particular configuration and the functions provided by it may
or may not be suited for use in U-Boot. This can manifest in two ways,
either the U-Boot fails to compile altogether and linker will complain
or, in the much worse case, the resulting U-Boot will build, but will
misbehave in very subtle and hard to debug ways.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 67976306 30-Mar-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

cosmetic: Fix typos "privide"

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# ed980b8c 03-Mar-2016 Alexander Graf <agraf@csgraf.de>

efi_loader: hook up in build environment

Now that we have all the bits and pieces ready for EFI payload loading
support, hook them up in Makefiles and KConfigs so that we can build.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
[trini: Enable only when we of OF_LIBFDT, disable on kwb and colibri_pxa270]
Signed-off-by: Tom Rini <trini@konsulko.com>

# aa34fbc0 22-Feb-2016 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt to be used in SPL

Add an option to enable libfdt in SPL. This can be useful when decoding
FIT files in SPL.

We need to make sure this option is not enabled in SPL by this change.
Also this option needs to be enabled in host builds. Si add a new
IMAGE_USE_LIBFDT #define which can be used in files that are built on the
host but must also build for U-Boot and SPL.

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

# 69e173eb 22-Feb-2016 Simon Glass <sjg@chromium.org>

Move CONFIG_OF_LIBFDT to Kconfig

Move this option to Kconfig and tidy up existing boards.

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

# a187559e 05-Feb-2016 Bin Meng <bmeng.cn@gmail.com>

Use correct spelling of "U-Boot"

Correct spelling of "U-Boot" shall be used in all written text
(documentation, comments in source files etc.).

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Minkyu Kang <mk7.kang@samsung.com>

# 947c626d 14-Jan-2016 Tom Rini <trini@konsulko.com>

vsprintf.c: Always enable CONFIG_SYS_VSNPRINTF

Enabling this function always removes some class of string saftey issues.
The size change here in general is about 400 bytes and this seems a reasonable
trade-off.

Cc: Peng Fan <peng.fan@nxp.com>
Cc: Peter Robinson <pbrobinson@gmail.com>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Adrian Alonso <aalonso@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 7d9cde10 22-Nov-2015 Stefan Roese <sr@denx.de>

lib/tiny-printf.c: Add tiny printf function for space limited environments

This patch adds a small printf() version that supports all basic formats.
Its intented to be used in U-Boot SPL versions on platforms with very
limited internal RAM sizes.

To enable it, just define CONFIG_USE_TINY_PRINTF in your defconfig. This
will result in the SPL using this tiny function and the main U-Boot
still using the full-blown printf() function.

This code was copied from:
http://www.sparetimelabs.com/printfrevisited
With mostly only coding style related changes so that its checkpatch
clean.

The size reduction is about 2.5KiB. Here a comparison for the db-mv784mp-gp
(Marvell AXP) SPL:

Without this patch:
58963 18536 1928 79427 13643 ./spl/u-boot-spl

With this patch:
56542 18536 1956 77034 12cea ./spl/u-boot-spl

Note:
To make it possible to compile tiny-printf.c instead of vsprintf.c when
CONFIG_USE_TINY_PRINTF is defined, the functions printf() and vprintf() are
moved from common/console.c into vsprintf.c in this patch.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>

# 2419cd16 03-Oct-2015 Simon Glass <sjg@chromium.org>

dm: tpm: Drop CONFIG_DM_TPM

Now that all TPM drivers use driver model, we can drop the special driver
model CONFIG option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>

# 027b728d 06-Oct-2015 Julius Werner <jwerner@chromium.org>

Add support for LZ4 decompression algorithm

This patch adds support for LZ4-compressed FIT image contents. This
algorithm has a slightly worse compression ration than LZO while being
nearly twice as fast to decompress. When loading images from a fast
storage medium this usually results in a boot time win.

Sandbox-tested only since I don't have a U-Boot development system set
up right now. The code was imported unchanged from coreboot where it's
proven to work, though. I'm mostly interested in getting this recognized
by mkImage for use in a downstream project.

Signed-off-by: Julius Werner <jwerner@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# a7d660bc 22-Aug-2015 Simon Glass <sjg@chromium.org>

tpm: Add Kconfig options for TPMs

Add new Kconfig options for TPMs in preparation for moving boards to use
Kconfig for TPM configuration.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 867a6ac8 31-Jul-2015 Simon Glass <sjg@chromium.org>

efi: Add start-up library code

When running as an EFI application, U-Boot must request memory from EFI,
and provide access to the boot services U-Boot needs.

Add library code to perform these tasks. This includes efi_main() which is
the entry point from EFI. U-Boot is built as a shared library.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d1389403 23-Jun-2015 Simon Glass <sjg@chromium.org>

Add a dhrystone benchmark command

Drystone provides a convenient sanity check that the CPU is running at full
speed. Add this as a command which can be enabled as needed.

Note: I investigated using Coremark for this but there was a license
agreement and I could not work out if it was GPL-compatible.

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

# f7848d90 22-Jun-2015 Joe Hershberger <joe.hershberger@ni.com>

Allow CONFIG_REGEX to be disabled when CONFIG_NET

Instead of selecting REGEX when NET is enabled, make it the default, but
allow boards that are tiny to disable it and lose functionality on all
but the first Ethernet adapter.

cm-bf548, bf538f-ezkit, and bf533-stamp need this. None appear to have
more than one Ethernet interface.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# 3850dbe8 11-Jun-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

blackfin: fix undefined reference to srand and rand

Commit 9ba9e85f3f1c (net: Fix NET_RANDOM_ETHADDR dependencies)
accidentally dropped CONFIG_LIB_RAND defines for 14 Blackfin boards.

Prior to that commit, those boards defined CONFIG_LIB_RAND, but not
CONFIG_NET_RANDOM_ETHADDR. So, commit 9ba9e85f3f1c should not have
touched them, but in fact it ripped CONFIG_LIB_RAND off from all the
header files, which caused undefined reference to srand and rand.
CONFIG_LIB_RAND=y must be revived for such boards.

BTW, this commit indeed makes it better, but even with this fix,
three boards (bf533-stamp, bf538f-ezkit, cm-bf548) still can not
build due to region 'ram' overflowed error. This was cause by
commit 6eed3786c68c (net: Move the CMD_NET config to defconfigs)
because CMD_NET selects NET, and NET selects REGEX. Eventually,
some boards were newly enabled with CONFIG_REGEX, increasing the
memory footprint. A patch is expected to fix the build error.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 9ba9e85f 25-May-2015 Michal Simek <michal.simek@xilinx.com>

net: Fix NET_RANDOM_ETHADDR dependencies

NET_RANDOM_ETHADDR depends on lib/rand.c. This patch adds dependency to
Kconfig to ensure that library is also compiled.

Remove the definitions from Blackfin boards' include/configs.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 6501ff62 20-Apr-2015 Przemyslaw Marczak <p.marczak@samsung.com>

lib: Kconfig: add entry for errno_str() function

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1a60650c 21-Apr-2015 Joe Hershberger <joe.hershberger@ni.com>

kconfig: Move REGEX to Kconfig

Having this as a Kconfig allows it to be a dependent feature.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8156345d 06-Mar-2015 Simon Glass <sjg@chromium.org>

sandbox: Move CONFIG_SYS_VSNPRINTF to Kconfig

Move this over to Kconfig and tidy up.

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

# 94e3c8c4 19-Feb-2015 gaurav rana <gaurav.rana@freescale.com>

crypto/fsl - Add progressive hashing support using hardware acceleration.

Currently only normal hashing is supported using hardware acceleration.
Added support for progressive hashing using hardware.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
Signed-off-by: Gaurav Rana <gaurav.rana@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>

# d9f23c7f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

lib/rsa: Add Kconfig for devices supporting RSA Modular Exponentiation

Kconfig option added for devices which support RSA Verification.
1. RSA_SOFTWARE_EXP
Enables driver for supporting RSA Modular Exponentiation in Software
2. RSA_FREESCALE_EXP
Enables driver for supporting RSA Modular Exponentiation using Freescale specific
driver

The above drivers use RSA uclass

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
(Removed duplicate line in Kconfig comment)

Change-Id: I7663c4d5350e2bfc3dfa2696f70ef777d6ccc6f6

# c4beb22f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

FIT: Modify option FIT_SIGNATURE in Kconfig

For FIT signature based approach to work, RSA library needs to be selected.
The FIT_SIGNATURE option in Kconfig is modified to automatically select RSA.
Selecting RSA compiles the RSA library required for image verification.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 45ccec8f 23-Oct-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_USE_PRIVATE_LIBGCC to Kconfig

The private libgcc is supported only on ARM, MIPS, PowerPC, SH, x86.
Those architectures should "select" HAVE_PRIVATE_LIBGCC and
CONFIG_USE_PRIVATE_LIBGCC should depend on it.

Currently, this option is enabled on Tegra boards and x86 architecture.
Move the definition from header files to Kconfig.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Tested-by: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: Tom Warren <twarren@nvidia.com>

# 8c688bc4 23-Oct-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_SYS_HZ to lib/Kconfig

CONFIG_SYS_HZ is always defined as 1000 in config_fallbacks.h
(but some boards still have redundant definitions).

This commit moves the definition and the document in README to
Kconfig. Since lib/Kconfig can assure that CONFIG_SYS_HZ is 1000,
the sanity check in lib/time.c should be removed.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Reviewed-by: Marek Vasut <marex@denx.de>

# b0928da6 16-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED to Kconfig

If this option is enabled, the objects under lib/ directory
are compiled with speed optimization, not size optimization.
(Currently, only used by some Blackfin boards.)

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# ed36323f 16-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: add blank Kconfig files

This would be useful to start moving various config options.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# e4f8e543 05-Nov-2020 Simon Glass <sjg@chromium.org>

smbios: Drop the unused Kconfig options

Now that we can use devicetree to specify this information, drop the old
CONFIG options.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 44c74bdd 05-Nov-2020 Simon Glass <sjg@chromium.org>

sysinfo: Provide a default driver to set SMBIOS values

Some boards want to specify the manufacturer or product name but do not
need to have their own sysinfo driver.

Add a default driver which provides a way to specify this SMBIOS
information in the devicetree, without needing any board-specific
functionality.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d2cb7a22 04-Nov-2020 Simon Glass <sjg@chromium.org>

x86: Allow putting some tables in the bloblist

At present all tables are placed starting at address f0000 in memory, and
can be up to 64KB in size. If the tables are very large, this may not
provide enough space.

Also if the tables point to other tables (such as console log or a ramoops
area) then we must allocate other memory anyway.

The bloblist is a nice place to put these tables since it is contiguous,
which makes it easy to reserve this memory for linux using the 820 tables.

Add an option to put some of the tables in the bloblist. For SMBIOS and
ACPI, create suitable pointers from the f0000 region to the new location
of the tables.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
[bmeng: squashed in http://patchwork.ozlabs.org/project/uboot/patch/
20201105062407.1.I8091ad931cbbb5e3b6f6ababdf3f8d5db0d17bb9@changeid/]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

# 415eab06 03-Nov-2020 Christian Gmeiner <christian.gmeiner@gmail.com>

smbios: add parsing API

Add a very simple API to be able to access SMBIOS strings
like vendor, model and bios version.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 72eda507 27-Oct-2020 Sean Anderson <seanga2@gmail.com>

lib: Add getopt

Some commands can get very unweildy if they have too many positional
arguments. Adding options makes them easier to read, remember, and
understand.

This implementation of getopt has been taken from barebox, which has had
option support for quite a while. I have made a few modifications to their
version, such as the removal of opterr in favor of a separate getopt_silent
function. In addition, I have moved all global variables into struct
getopt_context.

The getopt from barebox also re-orders the arguments passed to it so that
non-options are placed last. This allows users to specify options anywhere.
For example, `ls -l foo/ -R` would be re-ordered to `ls -l -R foo/` as
getopt parsed the options. However, this feature conflicts with the const
argv in cmd_tbl->cmd. This was originally added in 54841ab50c ("Make sure
that argv[] argument pointers are not modified."). The reason stated in
that commit is that hush requires argv to stay unmodified. Has this
situation changed? Barebox also uses hush, and does not have this problem.
Perhaps we could use their fix?

I have assigned maintenance of getopt to Simon Glass, as it is currently
only used by the log command. I would also be fine maintaining it.

Signed-off-by: Sean Anderson <seanga2@gmail.com>

# 26637e2e 12-Sep-2020 Simon Glass <sjg@chromium.org>

lib: Allow hexdump to be used in SPL

It is sometimes useful to output hex dumps in SPL. Add a config option to
allow this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>

# e87dfb05 05-Aug-2020 Andrii Anisov <andrii_anisov@epam.com>

lib: sscanf: add sscanf implementation

Port sscanf implementation from mini-os and introduce new
Kconfig option to enable it: CONFIG_SSCANF. Disable by default.

Signed-off-by: Andrii Anisov <andrii_anisov@epam.com>
Signed-off-by: Anastasiia Lukianenko <anastasiia_lukianenko@epam.com>
Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>

# 81014f73 30-Jul-2020 Joao Marcos Costa <joaomarcos.costa@bootlin.com>

include/u-boot, lib/zlib: add sources for zlib decompression

Add zlib (v1.2.11) uncompr() function to U-Boot. SquashFS depends on
this function to decompress data from a raw disk image. The actual
support for zlib into SquashFS sources will be added in a follow-up
commit.

Signed-off-by: Joao Marcos Costa <joaomarcos.costa@bootlin.com>

# 69be8fd1 03-Jun-2020 Marek Szyprowski <m.szyprowski@samsung.com>

powerpc: move ADDR_MAP to Kconfig

Move ADDR_MAP related config options from include/configs/*.h to the
proper place in lib/Kconfig. This has been done using
./tools/moveconfig.py and manual inspection of the generated changes.
This is a preparation to use ADDR_MAP helper on ARM 32bit Raspberry Pi4
board for mapping the PCIe XHCI MMIO, which is above the 4GiB identity
mapping limit.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# d16b38f4 15-Apr-2020 Reuben Dowle <reubendowle0@gmail.com>

Add support for SHA384 and SHA512

The current recommendation for best security practice from the US government
is to use SHA384 for TOP SECRET [1].

This patch adds support for SHA384 and SHA512 in the hash command, and also
allows FIT images to be hashed with these algorithms, and signed with
sha384,rsaXXXX and sha512,rsaXXXX

The SHA implementation is adapted from the linux kernel implementation.

[1] Commercial National Security Algorithm Suite
http://www.iad.gov/iad/programs/iad-initiatives/cnsa-suite.cfm

Signed-off-by: Reuben Dowle <reuben.dowle@4rf.com>

# 43e442a5 26-May-2020 Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

kconfig: fix some typos

Signed-off-by: Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

# eff5a547 22-May-2020 Michael Walle <michael@walle.cc>

cmd: zip: automatically pull in gzip()

Move the CONFIG_GZIP_COMPRESSED from a config.h macro to a Kconfig menu
item. It is not selectable by a user because there is no reason to do
so. Instead it will be automatically selected by the stuff which uses
gzip(), like the zip command.

Remove it from the config_whitelist.txt. Also remove
CONFIG_GZIP_COMPRESS_DEF_SZ as this was never used on any board. The
default seems to be sane, otherwise it should be added as a Kconfig
option.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8239be61 06-May-2020 Simon Glass <sjg@chromium.org>

lib: Allow MD5 to be enabled in SPL

At present the MD5 option cannot be enabled by board configs since it has
no Kconfig name. It is generally enabled, so long as FIT support is
present. But not all boards use FIT, particularly in SPL

Fix this and add an option for SPL as well. This allows board code to call
md5() even if FIT support is not enabled.

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

# 04cb3994 21-Apr-2020 Weijie Gao <weijie.gao@mediatek.com>

lib: enable lzma decompression support for SPL build

This patch enables LZMA decompression support for SPL build

Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>

# 2a2119e1 05-Mar-2020 Atish Patra <atish.patra@wdc.com>

lib: kconfig: Add option to set BZIP2 compression method

There is no way to select BZIP2 compression method.
Add it under library/compression config where all other
compression related configs are present.

Signed-off-by: Atish Patra <atish.patra@wdc.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 805b3cac 12-Feb-2020 Keerthy <j-keerthy@ti.com>

lib: elf: Move the generic elf loading/validating functions to lib

Move the generic elf loading/validating functions to lib/
so that they can be re-used and accessed by code existing
outside cmd.

While at it remove the duplicate static version of load_elf_image_phdr
under arch/arm/mach-imx/imx_bootaux.c.

Signed-off-by: Keerthy <j-keerthy@ti.com>
Suggested-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>

# 1611235b 19-Jan-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: Kconfig dependencies for pseudo-random library

drivers/rng/sandbox_rng.c requires rand() to be defined but configuration
option CONFIG_CONFIG_LIB_RAND selected in drivers/rng/Kconfig does not
exist.

test/lib/test_aes.c requires rand() to be defined.

Fix the selection criteria for choice "Pseudo-random library support type".

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 3c10dc95 06-Dec-2019 Simon Glass <sjg@chromium.org>

binman: Add a library to access binman entries

SPL and TPL can access information about binman entries using link-time
symbols but this is not available in U-Boot proper. Of course it could be
made available, but the intention is to just read the device tree.

Add support for this, so that U-Boot can locate entries.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# b4adf627 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: crypto: add x509 parser

Imported from linux kernel v5.3:
x509.asn1 without changes
x509_akid.asn1 without changes
x509_parser.h without changes
x509_cert_parser.c with changes marked as __UBOOT__
x509_public_key.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# a9b45e6e 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add oid registry utility

Imported from linux kernel v5.3:
build_OID_registry without changes
oid_registry.h without changes
oid_registry.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# ab8a0e06 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add asn1 decoder

Imported from linux kernel v5.3:
lib/asn1_decoder.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 2b12196d 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

cmd: add asn1_compiler

Imported from linux kernel v5.3:
asn1.h without changes
asn1_ber_bytecode.h without changes
asn1_decoder.h without changes
asn1_compiler.c without changes

This host command will be used to create a ASN1 parser, for example,
for pkcs7 messages or x509 certificates. More specifically, it will
generate *byte code* which will be interpreted by asn1 decoder library.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 05429b6c 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

rtc: move date.c from drivers/rtc/ to lib/

In the next commit, rtc_mktime(), for compatibility with linux, will be
implemented using rtc_mktime(), which is no longer drivers/rtc specific.
So move this file under lib/.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 37ef1774 10-Nov-2019 Thomas Hebb <tommyhebb@gmail.com>

Kconfig: disambiguate config names for tiny printf

27084c03d36a ("spl: Allow tiny printf() to be controlled in SPL and
TPL") split this option in two for TPL and SPL, but didn't change the
Kconfig names, making them hard to set quickly.

Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>

# 0d76afc0 27-Oct-2019 Simon Glass <sjg@chromium.org>

fdt: Add Kconfig options to control code size

For better or worse libfdt recent grew a lot of code that checks the
validity of the device tree in great detail. When using unsigned or
unverified data this makes things safer, but it does add to code size.

Add some controls to select the trade-off between safety and code size.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 27084c03 25-Sep-2019 Simon Glass <sjg@chromium.org>

spl: Allow tiny printf() to be controlled in SPL and TPL

At present there is only one control for this and it is used for both SPL
and TPL. But SPL might have a lot more space than TPL so the extra cost of
a full printf() might be acceptable.

Split the option into two, providing separate SPL and TPL controls. The
TPL setting defaults to the same as SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2a51e16b 07-Jun-2019 Tom Rini <trini@konsulko.com>

configs: Make USE_TINY_PRINTF depend on SPL||TPL and be default

The USE_TINY_PRINTF symbol only changes things within SPL and TPL
builds, so make it depend on that support. Next, make it default as
within these cases we should rarely have need of more advanced print
formats outside of the debug context.

To do this, in a few cases we need to correct our Kconfig dependencies
as we had cases of non-SPL targets select'ing this symbol. Finally, in
the case of a few boards we really do need the full printf
functionality.

Signed-off-by: Tom Rini <trini@konsulko.com>

# da0fb5fd 02-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: make call depth limit customizable

Up to now we had hard coded values for the call depth up to which trace
records are created: 200 for early tracing, 15 thereafter. UEFI
applications reach a call depth of 80 or above.

Provide customizing settings for the call trace depth limit and the early
call trace depth limit. Use the old values as defaults.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8509f22a 29-Apr-2019 Marek Behún <marek.behun@nic.cz>

lib: add Zstandard decompression support

Add the zstd library from Linux kernel (only decompression support).
There are minimal changes to build with U-Boot, otherwise the files are
identical to Linux commit dc35da16 from March 2018, the files had not
been touched since in kernel. Also SPDX lincese tags were added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 83a486b6 29-Apr-2019 Marek Behún <marek.behun@nic.cz>

lib: Add xxhash support

This adds the xxhash support from Linux. Files are almost identical to
those added to Linux in commit 5d240522 ("lib: Add xxhash module") (they
haven't been touched since in Linux). The only difference is to add some
includes to be compatible with U-Boot. Also SPDX lincese tags were
added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 5132361a 29-Apr-2019 Heiko Schocher <hs@denx.de>

lib: Kconfig: fix help text for GZIP

commit 95f4bbd581cf ("lib: fdt: Allow LZO and GZIP DT compression in U-Boot")

introduced Kconfig option for gzip in U-Boot, but help text
says gzip for SPL, which is wrong. Fix this.

Signed-off-by: Heiko Schocher <hs@denx.de>
Acked-by: Marek Vasut <marex@denx.de>

# 1c6eb075 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE_BUFFER_SIZE et al to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE_BUFFER_SIZE
CONFIG_TRACE_EARLY_SIZE
CONFIG_TRACE_EARLY
CONFIG_TRACE_EARLY_ADDR

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

# a24a78d7 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE

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

# 54969b40 21-Mar-2019 Thierry Reding <treding@nvidia.com>

fdtdec: Add Kconfig symbol for tests

Runtime tests are provided as a test_fdtdec command implementation. Add
a Kconfig symbol that allows this command to be built so that the tests
can be used.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 95f4bbd5 08-Mar-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

lib: fdt: Allow LZO and GZIP DT compression in U-Boot

Add required Kconfig symbols, Makefile bits and macro fixes in a
few places to support LZO and DT compression in U-Boot. This can
save a lot of space with multi-DTB fitImages.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>

# 6e705114 13-Jan-2019 Chris Packham <judge.packham@gmail.com>

lib: Kconfig: spelling fixes

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 048c6e89 06-Nov-2018 Simon Glass <sjg@chromium.org>

spl: lz4: Allow use of lz4 compression in SPL

In some cases U-Boot is compressed and it is useful to be able to
decompress it in SPL. Add a Kconfig and Makefile change to allow this.
Note that this does not actually implement decompression.

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

# 2895c4b7 15-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

kconfig: Introduce HAVE_ARCH_IOMAP

Introduce a new Kconfig option for architecture codes to control
whether it provides io{read,write}{8,16,32} I/O accessor functions.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5592a633 01-Oct-2018 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt in TPL

In some cases (e.g. sandbox with verified boot) it is useful to support
libfdt in TPL. Update the Kconfig to handle this.

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

# 6307896c 01-Oct-2018 Simon Glass <sjg@chromium.org>

tpm: Add support for SPL and TPL

At present the tpm can only be used in U-Boot proper. Updated it to work
in SPL and TPL also.

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

# ab948cd2 19-Jul-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

fdt_support: make FDT_FIXUP_PARTITIONS depend on CMD_MTDPARTS

fdt_fixup_mtdparts() calls mtdparts_init() and device_find(),
which are defined in cmd/mtdparts.c

The combination of FDT_FIXUP_PARTITIONS=y and CMD_MTDPARTS=n
emits the following link error:

common/fdt_support.c:903: undefined reference to `mtdparts_init'
common/fdt_support.c:914: undefined reference to `device_find'

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 3330584d 03-Jun-2018 Igor Opaniuk <igor.opaniuk@gmail.com>

avb2.0: integrate avb 2.0 into the build system

Integrate libavb into the build system. Introduce CONFIG_LIBAVB
build option.

Signed-off-by: Igor Opaniuk <igor.opaniuk@linaro.org>

# f8c987f8 05-Jun-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

lib: Add hexdump

Often during debugging session it's very interesting to see
what data we were dealing with. For example what we write or read
to/from memory or peripherals.

This change introduces functions that allow to dump binary
data with one simple function invocation like:
------------------->8----------------
print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, buf, len);
------------------->8----------------

which gives us the following:
------------------->8----------------
00000000: f2 b7 c9 88 62 61 75 64 72 61 74 65 3d 31 31 35 ....baudrate=115
00000010: 32 30 30 00 62 6f 6f 74 61 72 67 73 3d 63 6f 6e 200.bootargs=con
00000020: 73 6f 6c 65 3d 74 74 79 53 33 2c 31 31 35 32 30 sole=ttyS3,11520
00000030: 30 6e 38 00 62 6f 6f 74 64 65 6c 61 79 3d 33 00 0n8.bootdelay=3.
00000040: 62 6f 6f 74 66 69 6c 65 3d 75 49 6d 61 67 65 00 bootfile=uImage.
00000050: 66 64 74 63 6f 6e 74 72 6f 6c 61 64 64 72 3d 39 fdtcontroladdr=9
00000060: 66 66 62 31 62 61 30 00 6c 6f 61 64 61 64 64 72 ffb1ba0.loadaddr
00000070: 3d 30 78 38 32 30 30 30 30 30 30 00 73 74 64 65 =0x82000000.stde
00000080: 72 72 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 rr=serial0@e0022
00000090: 30 30 30 00 73 74 64 69 6e 3d 73 65 72 69 61 6c 000.stdin=serial
000000a0: 30 40 65 30 30 32 32 30 30 30 00 73 74 64 6f 75 0@e0022000.stdou
000000b0: 74 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 30 t=serial0@e00220
000000c0: 30 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00..............
...
------------------->8----------------

Source of hexdump.c was copied from Linux kernel v4.7-rc2.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Mario Six <mario.six@gdsys.cc>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Stefan Roese <sr@denx.de>

# c232d14d 29-May-2018 Alex Kiernan <alex.kiernan@gmail.com>

mmc: Separate "mmc swrite" from fastboot

Introduce CONFIG_IMAGE_SPARSE and CONFIG_CMD_MMC_SWRITE so the "mmc
swrite" command is separated from the fastboot code.

Move image-sparse from common to lib so it's clear it's library code.

Rename CONFIG_FASTBOOT_FLASH_FILLBUF_SIZE to CONFIG_IMAGE_SPARSE_FILLBUF_SIZE
and migrate it to Kconfig.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Acked-by: Jassi Brar <jaswinder.singh@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6417572e 08-May-2018 Tom Rini <trini@konsulko.com>

lib/Kconfig: Mark OF_LIBFDT_OVERLAY as depending on OF_LIBFDT

The overlay code is only useful when OF_LIBFDT is set, so mark it as
depending on that first.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 58a46f88 25-Apr-2018 Praneeth Bajjuri <praneeth@ti.com>

configs: TI: Enable FIT Library overlay support

Enable the FDT library overlay support for all TI SOC family.

Without this option, when Loading fdt from FIT image, the
following warning is seen.

"config with overlays but CONFIG_OF_LIBFDT_OVERLAY not set".

Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
Suggested-by: Andrew F.Davis <afd@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>

# 14ad44ab 18-Apr-2018 Alex Kiernan <alex.kiernan@gmail.com>

spl: Split sprintf, strto* from SPL serial in Kconfig

When SPL serial is disabled, callers who need sprintf or strtoul fail
because their inclusion is guarded by CONFIG_SPL_SERIAL_SUPPORT/
CONFIG_TPL_SERIAL_SUPPORT.

Split printf, sprintf and strto into their own entries and then select
all of them if SERIAL_SUPPORT is enabled to match the current behaviour.

Include panic.o unconditionally as it can be called from anywhere which
uses BUG_ON().

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>

# e294ba06 04-Apr-2018 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-sunxi

Signed-off-by: Tom Rini <trini@konsulko.com>


# d14db11d 03-Apr-2018 Andre Przywara <andre.przywara@arm.com>

sunxi: revert disabling of features

In January some commits were introduced to mitigate the U-Boot image
size issues we encountered on sunxi builds.
Now with the MMC environment removed we can bring them back, as we
practically don't have a size limit anymore.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 32ce6179 13-Mar-2018 Bryan O'Donoghue <bryan.odonoghue@linaro.org>

optee: Add lib entries for sharing OPTEE code across ports

This patch adds code to lib to enable sharing of useful OPTEE code between
board-ports and architectures. The code on lib/optee/optee.c comes from the
TI omap2 port. Eventually the OMAP2 code will be patched to include the
shared code. The intention here is to add more useful OPTEE specific code
as more functionality gets added.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Cc: Harinarayan Bhatta <harinarayan@ti.com>
Cc: Andrew F. Davis <afd@ti.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Kever Yang <kever.yang@rock-chips.com>
Cc: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Cc: Peng Fan <peng.fan@nxp.com>
Tested-by: Peng Fan <peng.fan@nxp.com>

# 36c1877c 06-Feb-2018 Faiz Abbas <faiz_abbas@ti.com>

lib: Kconfig: Move DYNAMIC_CRC_TABLE to Kconfig

Add CONFIG prefix to DYNAMIC_CRC_TABLE and implement it in
Kconfig.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>

# a451bc27 05-Feb-2018 Adam Ford <aford173@gmail.com>

Convert LIB_UUID to Kconfig

config_fallback.h has some logic that checks a variety of options
and selects LIB_UUID if it hasn't already been selected. This
will all LIB_UUID in Kconfig and select this option for the list
of options to allow us to remove the logic from fallbacks

Signed-off-by: Adam Ford <aford173@gmail.com>

# a5a37567 06-Feb-2018 Adam Ford <aford173@gmail.com>

Convert CONFIG LIB_HW_RAND to Kconfig

config_fallbacks.h had some logic to automatically select
LIB_RAND if RANDOM_UUID or CMD_UUID were set if LIB_HW_RAND wasn't
already selected. By migrating LIB_HW_RAND to Kconfig, we can
remove this check from config_fallbacks.h and put it into Kconfig

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
[trini: Turn into a choice, add NET_RANDOM_ETHADDR]
Signed-off-by: Tom Rini <trini@konsulko.com>

# acd4d334 16-Jan-2018 Maxime Ripard <maxime.ripard@free-electrons.com>

net: regex: Disable by default on sunXi

The sunXi arm64 build has overflown, leading to the main U-boot binary
overwriting the environment when flashing the new image, or even worse,
overwriting itself when we're calling saveenv.

Disable this option that is not critical until we can adress the issue
properly.

Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 7e3caa81 03-Dec-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

Move CONFIG_PANIC_HANG to Kconfig

Freescale (NXP) boards have lots of defconfig files per board.
I used "imply PANIC_HANG" for them.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# da5337a6 08-Nov-2017 Nandor Han <nandor.han@ge.com>

rtc: add support for s35392a

Add support for S35392A RTC. The driver supports both U-Boot driver
models.

Signed-off-by: Nandor Han <nandor.han@ge.com>
Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
Cc: Heiko Schocher <hs@denx.de>

# f52bdf4b 14-Sep-2017 Jean-Jacques Hiblot <jjhiblot@ti.com>

lib: allow building lzo for the SPL

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 85d8bf57 03-Sep-2017 Marek Behún <marek.behun@nic.cz>

lib: Add CRC32-C

This is needed for BTRFS.

Signed-off-by: Marek Behun <marek.behun@nic.cz>

create mode 100644 lib/crc32c.c

# 7264f292 15-Aug-2017 York Sun <york.sun@nxp.com>

spl: fit: Eanble GZIP support for image decompression

Add Kconfig option SPL_GZIP and SPL_ZLIB to enable gunzip support for
SPL boot, eg. falcon boot compressed kernel image.

Signed-off-by: York Sun <york.sun@nxp.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6ef2f901 11-Aug-2017 Adam Ford <aford173@gmail.com>

Convert CONFIG_BCH to Kconfig

This converts the following to Kconfig:
CONFIG_BCH

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1a7ba1d 18-Aug-2017 Anatolij Gustschin <agust@denx.de>

Fix 'notes' typos

s/notes/nodes

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 96b9082c 03-Aug-2017 Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

rockchip: rk3188: rock: adjust for SPL/TPL split

With the changes to split SPL/TPL for the RK3368, I apparently missed
some needed adjustments to the RK3188 Kconfig and rock_defconfig.

This fixes build-issues for the rock board after applying the RK3368
enablement (and SPL/TPL) set that resulted from TPL_SERIAL_SUPPORT,
TPL_ROCKCHIP_BACK_TO_BROM and TPL_TINY_MEMSET being separate symbols
now.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d56b4b19 22-Jul-2017 Tom Rini <trini@konsulko.com>

configs: Migrate RBTREE, LZO, CMD_MTDPARTS, CMD_UBI and CMD_UBIFS

The above CONFIG options are in Kconfig, and now have correct depends and
inter-dependencies. Migrate these to configs/ from include/configs/. In the
case of CMD_UBIFS also change it to be a default y if CMD_UBI.

Signed-off-by: Tom Rini <trini@konsulko.com>

# aed998aa 17-May-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_LZMA to Kconfig

This converts the following to Kconfig:
CONFIG_LZMA

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

# b1a873df 26-Apr-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_CMD_AES et al to Kconfig

This converts the following to Kconfig:
CONFIG_CMD_AES
CONFIG_AES

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Add select AES to CMD_AES]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 173aafbf 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

cmd: Expose a Kconfig option to enable UBIFS commands

Create a new Kconfig entry to allow CMD_UBIFS selection from Kconfig and
add an hidden LZO option that can be selected by CMD_UBIFS.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>

# aa049152 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

mtd: ubi: Select RBTREE option from MTD_UBI Kconfig entry

Expose the RBTREE feature through Kconfig and select this option from the
MTD_UBI option.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>
[Rebased on master]
Signed-off-by: Jagan Teki <jagan@openedev.com>

# ab4458bd 02-Apr-2017 Simon Glass <sjg@chromium.org>

string: Provide a slimmed-down memset()

Most of the time the optimised memset() is what we want. For extreme
situations such as TPL it may be too large. For example on the 'rock'
board, using a simple loop saves a useful 48 bytes. With gcc 4.9 and
the rodata bug, this patch is enough to reduce the TPL image below the
limit.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>

# bea79d7d 14-Mar-2017 Andre Przywara <andre.przywara@arm.com>

Kconfig: introduce md5sum command selection

So far CONFIG_MD5SUM would need to be set by a board's include file.
Since the command is really generic, move it over to Kconfig to allow
it to be defined by either a board's defconfig, menuconfig or some
config snippet merged via mergeconfig.sh.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e663b350 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

smbios: Expose in efi_loader as table

We can pass SMBIOS easily as EFI configuration table to an EFI payload. This
patch adds enablement for that case.

While at it, we also enable SMBIOS generation for ARM systems, since they support
EFI_LOADER.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4b6dddc2 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

x86: Move smbios generation into arch independent directory

We will need the SMBIOS generation function on ARM as well going forward,
so let's move it into a non arch specific location.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# ebf7fff2 05-Oct-2016 Heiko Schocher <hs@denx.de>

spl: move FDT_FIXUP_PARTITIONS to Kconfig

Move FDT_FIXUP_PARTITIONS to Kconfig and cleanup existing
uses.

Signed-off-by: Heiko Schocher <hs@denx.de>

# ddf67f71 05-Jul-2016 Maxime Ripard <maxime.ripard@free-electrons.com>

libfdt: Add overlay application function

The device tree overlays are a good way to deal with user-modifyable
boards or boards with some kind of an expansion mechanism where we can
easily plug new board in (like the BBB, the Raspberry Pi or the CHIP).

Add a new function to merge overlays with a base device tree.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>

# 91b86e21 26-May-2016 Marek Vasut <marex@denx.de>

lib: Enable private libgcc by default

This patch decouples U-Boot binary from the toolchain on systems where
private libgcc is available. Instead of pulling in functions provided
by the libgcc from the toolchain, U-Boot will use it's own set of libgcc
functions. These functions are usually imported from Linux kernel, which
also uses it's own libgcc functions instead of the ones provided by the
toolchain.

This patch solves a rather common problem. The toolchain can usually
generate code for many variants of target architecture and often even
different endianness. The libgcc on the other hand is usually compiled
for one particular configuration and the functions provided by it may
or may not be suited for use in U-Boot. This can manifest in two ways,
either the U-Boot fails to compile altogether and linker will complain
or, in the much worse case, the resulting U-Boot will build, but will
misbehave in very subtle and hard to debug ways.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 67976306 30-Mar-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

cosmetic: Fix typos "privide"

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# ed980b8c 03-Mar-2016 Alexander Graf <agraf@csgraf.de>

efi_loader: hook up in build environment

Now that we have all the bits and pieces ready for EFI payload loading
support, hook them up in Makefiles and KConfigs so that we can build.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
[trini: Enable only when we of OF_LIBFDT, disable on kwb and colibri_pxa270]
Signed-off-by: Tom Rini <trini@konsulko.com>

# aa34fbc0 22-Feb-2016 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt to be used in SPL

Add an option to enable libfdt in SPL. This can be useful when decoding
FIT files in SPL.

We need to make sure this option is not enabled in SPL by this change.
Also this option needs to be enabled in host builds. Si add a new
IMAGE_USE_LIBFDT #define which can be used in files that are built on the
host but must also build for U-Boot and SPL.

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

# 69e173eb 22-Feb-2016 Simon Glass <sjg@chromium.org>

Move CONFIG_OF_LIBFDT to Kconfig

Move this option to Kconfig and tidy up existing boards.

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

# a187559e 05-Feb-2016 Bin Meng <bmeng.cn@gmail.com>

Use correct spelling of "U-Boot"

Correct spelling of "U-Boot" shall be used in all written text
(documentation, comments in source files etc.).

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Minkyu Kang <mk7.kang@samsung.com>

# 947c626d 14-Jan-2016 Tom Rini <trini@konsulko.com>

vsprintf.c: Always enable CONFIG_SYS_VSNPRINTF

Enabling this function always removes some class of string saftey issues.
The size change here in general is about 400 bytes and this seems a reasonable
trade-off.

Cc: Peng Fan <peng.fan@nxp.com>
Cc: Peter Robinson <pbrobinson@gmail.com>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Adrian Alonso <aalonso@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 7d9cde10 22-Nov-2015 Stefan Roese <sr@denx.de>

lib/tiny-printf.c: Add tiny printf function for space limited environments

This patch adds a small printf() version that supports all basic formats.
Its intented to be used in U-Boot SPL versions on platforms with very
limited internal RAM sizes.

To enable it, just define CONFIG_USE_TINY_PRINTF in your defconfig. This
will result in the SPL using this tiny function and the main U-Boot
still using the full-blown printf() function.

This code was copied from:
http://www.sparetimelabs.com/printfrevisited
With mostly only coding style related changes so that its checkpatch
clean.

The size reduction is about 2.5KiB. Here a comparison for the db-mv784mp-gp
(Marvell AXP) SPL:

Without this patch:
58963 18536 1928 79427 13643 ./spl/u-boot-spl

With this patch:
56542 18536 1956 77034 12cea ./spl/u-boot-spl

Note:
To make it possible to compile tiny-printf.c instead of vsprintf.c when
CONFIG_USE_TINY_PRINTF is defined, the functions printf() and vprintf() are
moved from common/console.c into vsprintf.c in this patch.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>

# 2419cd16 03-Oct-2015 Simon Glass <sjg@chromium.org>

dm: tpm: Drop CONFIG_DM_TPM

Now that all TPM drivers use driver model, we can drop the special driver
model CONFIG option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>

# 027b728d 06-Oct-2015 Julius Werner <jwerner@chromium.org>

Add support for LZ4 decompression algorithm

This patch adds support for LZ4-compressed FIT image contents. This
algorithm has a slightly worse compression ration than LZO while being
nearly twice as fast to decompress. When loading images from a fast
storage medium this usually results in a boot time win.

Sandbox-tested only since I don't have a U-Boot development system set
up right now. The code was imported unchanged from coreboot where it's
proven to work, though. I'm mostly interested in getting this recognized
by mkImage for use in a downstream project.

Signed-off-by: Julius Werner <jwerner@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# a7d660bc 22-Aug-2015 Simon Glass <sjg@chromium.org>

tpm: Add Kconfig options for TPMs

Add new Kconfig options for TPMs in preparation for moving boards to use
Kconfig for TPM configuration.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 867a6ac8 31-Jul-2015 Simon Glass <sjg@chromium.org>

efi: Add start-up library code

When running as an EFI application, U-Boot must request memory from EFI,
and provide access to the boot services U-Boot needs.

Add library code to perform these tasks. This includes efi_main() which is
the entry point from EFI. U-Boot is built as a shared library.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d1389403 23-Jun-2015 Simon Glass <sjg@chromium.org>

Add a dhrystone benchmark command

Drystone provides a convenient sanity check that the CPU is running at full
speed. Add this as a command which can be enabled as needed.

Note: I investigated using Coremark for this but there was a license
agreement and I could not work out if it was GPL-compatible.

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

# f7848d90 22-Jun-2015 Joe Hershberger <joe.hershberger@ni.com>

Allow CONFIG_REGEX to be disabled when CONFIG_NET

Instead of selecting REGEX when NET is enabled, make it the default, but
allow boards that are tiny to disable it and lose functionality on all
but the first Ethernet adapter.

cm-bf548, bf538f-ezkit, and bf533-stamp need this. None appear to have
more than one Ethernet interface.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# 3850dbe8 11-Jun-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

blackfin: fix undefined reference to srand and rand

Commit 9ba9e85f3f1c (net: Fix NET_RANDOM_ETHADDR dependencies)
accidentally dropped CONFIG_LIB_RAND defines for 14 Blackfin boards.

Prior to that commit, those boards defined CONFIG_LIB_RAND, but not
CONFIG_NET_RANDOM_ETHADDR. So, commit 9ba9e85f3f1c should not have
touched them, but in fact it ripped CONFIG_LIB_RAND off from all the
header files, which caused undefined reference to srand and rand.
CONFIG_LIB_RAND=y must be revived for such boards.

BTW, this commit indeed makes it better, but even with this fix,
three boards (bf533-stamp, bf538f-ezkit, cm-bf548) still can not
build due to region 'ram' overflowed error. This was cause by
commit 6eed3786c68c (net: Move the CMD_NET config to defconfigs)
because CMD_NET selects NET, and NET selects REGEX. Eventually,
some boards were newly enabled with CONFIG_REGEX, increasing the
memory footprint. A patch is expected to fix the build error.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 9ba9e85f 25-May-2015 Michal Simek <michal.simek@xilinx.com>

net: Fix NET_RANDOM_ETHADDR dependencies

NET_RANDOM_ETHADDR depends on lib/rand.c. This patch adds dependency to
Kconfig to ensure that library is also compiled.

Remove the definitions from Blackfin boards' include/configs.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 6501ff62 20-Apr-2015 Przemyslaw Marczak <p.marczak@samsung.com>

lib: Kconfig: add entry for errno_str() function

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1a60650c 21-Apr-2015 Joe Hershberger <joe.hershberger@ni.com>

kconfig: Move REGEX to Kconfig

Having this as a Kconfig allows it to be a dependent feature.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8156345d 06-Mar-2015 Simon Glass <sjg@chromium.org>

sandbox: Move CONFIG_SYS_VSNPRINTF to Kconfig

Move this over to Kconfig and tidy up.

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

# 94e3c8c4 19-Feb-2015 gaurav rana <gaurav.rana@freescale.com>

crypto/fsl - Add progressive hashing support using hardware acceleration.

Currently only normal hashing is supported using hardware acceleration.
Added support for progressive hashing using hardware.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
Signed-off-by: Gaurav Rana <gaurav.rana@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>

# d9f23c7f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

lib/rsa: Add Kconfig for devices supporting RSA Modular Exponentiation

Kconfig option added for devices which support RSA Verification.
1. RSA_SOFTWARE_EXP
Enables driver for supporting RSA Modular Exponentiation in Software
2. RSA_FREESCALE_EXP
Enables driver for supporting RSA Modular Exponentiation using Freescale specific
driver

The above drivers use RSA uclass

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
(Removed duplicate line in Kconfig comment)

Change-Id: I7663c4d5350e2bfc3dfa2696f70ef777d6ccc6f6

# c4beb22f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

FIT: Modify option FIT_SIGNATURE in Kconfig

For FIT signature based approach to work, RSA library needs to be selected.
The FIT_SIGNATURE option in Kconfig is modified to automatically select RSA.
Selecting RSA compiles the RSA library required for image verification.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 45ccec8f 23-Oct-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_USE_PRIVATE_LIBGCC to Kconfig

The private libgcc is supported only on ARM, MIPS, PowerPC, SH, x86.
Those architectures should "select" HAVE_PRIVATE_LIBGCC and
CONFIG_USE_PRIVATE_LIBGCC should depend on it.

Currently, this option is enabled on Tegra boards and x86 architecture.
Move the definition from header files to Kconfig.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Tested-by: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: Tom Warren <twarren@nvidia.com>

# 8c688bc4 23-Oct-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_SYS_HZ to lib/Kconfig

CONFIG_SYS_HZ is always defined as 1000 in config_fallbacks.h
(but some boards still have redundant definitions).

This commit moves the definition and the document in README to
Kconfig. Since lib/Kconfig can assure that CONFIG_SYS_HZ is 1000,
the sanity check in lib/time.c should be removed.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Reviewed-by: Marek Vasut <marex@denx.de>

# b0928da6 16-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED to Kconfig

If this option is enabled, the objects under lib/ directory
are compiled with speed optimization, not size optimization.
(Currently, only used by some Blackfin boards.)

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# ed36323f 16-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: add blank Kconfig files

This would be useful to start moving various config options.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# e87dfb05 05-Aug-2020 Andrii Anisov <andrii_anisov@epam.com>

lib: sscanf: add sscanf implementation

Port sscanf implementation from mini-os and introduce new
Kconfig option to enable it: CONFIG_SSCANF. Disable by default.

Signed-off-by: Andrii Anisov <andrii_anisov@epam.com>
Signed-off-by: Anastasiia Lukianenko <anastasiia_lukianenko@epam.com>
Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>

# 81014f73 30-Jul-2020 Joao Marcos Costa <joaomarcos.costa@bootlin.com>

include/u-boot, lib/zlib: add sources for zlib decompression

Add zlib (v1.2.11) uncompr() function to U-Boot. SquashFS depends on
this function to decompress data from a raw disk image. The actual
support for zlib into SquashFS sources will be added in a follow-up
commit.

Signed-off-by: Joao Marcos Costa <joaomarcos.costa@bootlin.com>

# 69be8fd1 03-Jun-2020 Marek Szyprowski <m.szyprowski@samsung.com>

powerpc: move ADDR_MAP to Kconfig

Move ADDR_MAP related config options from include/configs/*.h to the
proper place in lib/Kconfig. This has been done using
./tools/moveconfig.py and manual inspection of the generated changes.
This is a preparation to use ADDR_MAP helper on ARM 32bit Raspberry Pi4
board for mapping the PCIe XHCI MMIO, which is above the 4GiB identity
mapping limit.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# d16b38f4 15-Apr-2020 Reuben Dowle <reubendowle0@gmail.com>

Add support for SHA384 and SHA512

The current recommendation for best security practice from the US government
is to use SHA384 for TOP SECRET [1].

This patch adds support for SHA384 and SHA512 in the hash command, and also
allows FIT images to be hashed with these algorithms, and signed with
sha384,rsaXXXX and sha512,rsaXXXX

The SHA implementation is adapted from the linux kernel implementation.

[1] Commercial National Security Algorithm Suite
http://www.iad.gov/iad/programs/iad-initiatives/cnsa-suite.cfm

Signed-off-by: Reuben Dowle <reuben.dowle@4rf.com>

# 43e442a5 26-May-2020 Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

kconfig: fix some typos

Signed-off-by: Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

# eff5a547 22-May-2020 Michael Walle <michael@walle.cc>

cmd: zip: automatically pull in gzip()

Move the CONFIG_GZIP_COMPRESSED from a config.h macro to a Kconfig menu
item. It is not selectable by a user because there is no reason to do
so. Instead it will be automatically selected by the stuff which uses
gzip(), like the zip command.

Remove it from the config_whitelist.txt. Also remove
CONFIG_GZIP_COMPRESS_DEF_SZ as this was never used on any board. The
default seems to be sane, otherwise it should be added as a Kconfig
option.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8239be61 06-May-2020 Simon Glass <sjg@chromium.org>

lib: Allow MD5 to be enabled in SPL

At present the MD5 option cannot be enabled by board configs since it has
no Kconfig name. It is generally enabled, so long as FIT support is
present. But not all boards use FIT, particularly in SPL

Fix this and add an option for SPL as well. This allows board code to call
md5() even if FIT support is not enabled.

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

# 04cb3994 21-Apr-2020 Weijie Gao <weijie.gao@mediatek.com>

lib: enable lzma decompression support for SPL build

This patch enables LZMA decompression support for SPL build

Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>

# 2a2119e1 05-Mar-2020 Atish Patra <atish.patra@wdc.com>

lib: kconfig: Add option to set BZIP2 compression method

There is no way to select BZIP2 compression method.
Add it under library/compression config where all other
compression related configs are present.

Signed-off-by: Atish Patra <atish.patra@wdc.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 805b3cac 12-Feb-2020 Keerthy <j-keerthy@ti.com>

lib: elf: Move the generic elf loading/validating functions to lib

Move the generic elf loading/validating functions to lib/
so that they can be re-used and accessed by code existing
outside cmd.

While at it remove the duplicate static version of load_elf_image_phdr
under arch/arm/mach-imx/imx_bootaux.c.

Signed-off-by: Keerthy <j-keerthy@ti.com>
Suggested-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>

# 1611235b 19-Jan-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: Kconfig dependencies for pseudo-random library

drivers/rng/sandbox_rng.c requires rand() to be defined but configuration
option CONFIG_CONFIG_LIB_RAND selected in drivers/rng/Kconfig does not
exist.

test/lib/test_aes.c requires rand() to be defined.

Fix the selection criteria for choice "Pseudo-random library support type".

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 3c10dc95 06-Dec-2019 Simon Glass <sjg@chromium.org>

binman: Add a library to access binman entries

SPL and TPL can access information about binman entries using link-time
symbols but this is not available in U-Boot proper. Of course it could be
made available, but the intention is to just read the device tree.

Add support for this, so that U-Boot can locate entries.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# b4adf627 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: crypto: add x509 parser

Imported from linux kernel v5.3:
x509.asn1 without changes
x509_akid.asn1 without changes
x509_parser.h without changes
x509_cert_parser.c with changes marked as __UBOOT__
x509_public_key.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# a9b45e6e 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add oid registry utility

Imported from linux kernel v5.3:
build_OID_registry without changes
oid_registry.h without changes
oid_registry.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# ab8a0e06 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add asn1 decoder

Imported from linux kernel v5.3:
lib/asn1_decoder.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 2b12196d 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

cmd: add asn1_compiler

Imported from linux kernel v5.3:
asn1.h without changes
asn1_ber_bytecode.h without changes
asn1_decoder.h without changes
asn1_compiler.c without changes

This host command will be used to create a ASN1 parser, for example,
for pkcs7 messages or x509 certificates. More specifically, it will
generate *byte code* which will be interpreted by asn1 decoder library.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 05429b6c 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

rtc: move date.c from drivers/rtc/ to lib/

In the next commit, rtc_mktime(), for compatibility with linux, will be
implemented using rtc_mktime(), which is no longer drivers/rtc specific.
So move this file under lib/.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 37ef1774 10-Nov-2019 Thomas Hebb <tommyhebb@gmail.com>

Kconfig: disambiguate config names for tiny printf

27084c03d36a ("spl: Allow tiny printf() to be controlled in SPL and
TPL") split this option in two for TPL and SPL, but didn't change the
Kconfig names, making them hard to set quickly.

Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>

# 0d76afc0 27-Oct-2019 Simon Glass <sjg@chromium.org>

fdt: Add Kconfig options to control code size

For better or worse libfdt recent grew a lot of code that checks the
validity of the device tree in great detail. When using unsigned or
unverified data this makes things safer, but it does add to code size.

Add some controls to select the trade-off between safety and code size.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 27084c03 25-Sep-2019 Simon Glass <sjg@chromium.org>

spl: Allow tiny printf() to be controlled in SPL and TPL

At present there is only one control for this and it is used for both SPL
and TPL. But SPL might have a lot more space than TPL so the extra cost of
a full printf() might be acceptable.

Split the option into two, providing separate SPL and TPL controls. The
TPL setting defaults to the same as SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2a51e16b 07-Jun-2019 Tom Rini <trini@konsulko.com>

configs: Make USE_TINY_PRINTF depend on SPL||TPL and be default

The USE_TINY_PRINTF symbol only changes things within SPL and TPL
builds, so make it depend on that support. Next, make it default as
within these cases we should rarely have need of more advanced print
formats outside of the debug context.

To do this, in a few cases we need to correct our Kconfig dependencies
as we had cases of non-SPL targets select'ing this symbol. Finally, in
the case of a few boards we really do need the full printf
functionality.

Signed-off-by: Tom Rini <trini@konsulko.com>

# da0fb5fd 02-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: make call depth limit customizable

Up to now we had hard coded values for the call depth up to which trace
records are created: 200 for early tracing, 15 thereafter. UEFI
applications reach a call depth of 80 or above.

Provide customizing settings for the call trace depth limit and the early
call trace depth limit. Use the old values as defaults.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8509f22a 29-Apr-2019 Marek Behún <marek.behun@nic.cz>

lib: add Zstandard decompression support

Add the zstd library from Linux kernel (only decompression support).
There are minimal changes to build with U-Boot, otherwise the files are
identical to Linux commit dc35da16 from March 2018, the files had not
been touched since in kernel. Also SPDX lincese tags were added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 83a486b6 29-Apr-2019 Marek Behún <marek.behun@nic.cz>

lib: Add xxhash support

This adds the xxhash support from Linux. Files are almost identical to
those added to Linux in commit 5d240522 ("lib: Add xxhash module") (they
haven't been touched since in Linux). The only difference is to add some
includes to be compatible with U-Boot. Also SPDX lincese tags were
added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 5132361a 29-Apr-2019 Heiko Schocher <hs@denx.de>

lib: Kconfig: fix help text for GZIP

commit 95f4bbd581cf ("lib: fdt: Allow LZO and GZIP DT compression in U-Boot")

introduced Kconfig option for gzip in U-Boot, but help text
says gzip for SPL, which is wrong. Fix this.

Signed-off-by: Heiko Schocher <hs@denx.de>
Acked-by: Marek Vasut <marex@denx.de>

# 1c6eb075 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE_BUFFER_SIZE et al to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE_BUFFER_SIZE
CONFIG_TRACE_EARLY_SIZE
CONFIG_TRACE_EARLY
CONFIG_TRACE_EARLY_ADDR

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

# a24a78d7 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE

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

# 54969b40 21-Mar-2019 Thierry Reding <treding@nvidia.com>

fdtdec: Add Kconfig symbol for tests

Runtime tests are provided as a test_fdtdec command implementation. Add
a Kconfig symbol that allows this command to be built so that the tests
can be used.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 95f4bbd5 08-Mar-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

lib: fdt: Allow LZO and GZIP DT compression in U-Boot

Add required Kconfig symbols, Makefile bits and macro fixes in a
few places to support LZO and DT compression in U-Boot. This can
save a lot of space with multi-DTB fitImages.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>

# 6e705114 13-Jan-2019 Chris Packham <judge.packham@gmail.com>

lib: Kconfig: spelling fixes

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 048c6e89 06-Nov-2018 Simon Glass <sjg@chromium.org>

spl: lz4: Allow use of lz4 compression in SPL

In some cases U-Boot is compressed and it is useful to be able to
decompress it in SPL. Add a Kconfig and Makefile change to allow this.
Note that this does not actually implement decompression.

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

# 2895c4b7 15-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

kconfig: Introduce HAVE_ARCH_IOMAP

Introduce a new Kconfig option for architecture codes to control
whether it provides io{read,write}{8,16,32} I/O accessor functions.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5592a633 01-Oct-2018 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt in TPL

In some cases (e.g. sandbox with verified boot) it is useful to support
libfdt in TPL. Update the Kconfig to handle this.

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

# 6307896c 01-Oct-2018 Simon Glass <sjg@chromium.org>

tpm: Add support for SPL and TPL

At present the tpm can only be used in U-Boot proper. Updated it to work
in SPL and TPL also.

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

# ab948cd2 19-Jul-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

fdt_support: make FDT_FIXUP_PARTITIONS depend on CMD_MTDPARTS

fdt_fixup_mtdparts() calls mtdparts_init() and device_find(),
which are defined in cmd/mtdparts.c

The combination of FDT_FIXUP_PARTITIONS=y and CMD_MTDPARTS=n
emits the following link error:

common/fdt_support.c:903: undefined reference to `mtdparts_init'
common/fdt_support.c:914: undefined reference to `device_find'

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 3330584d 03-Jun-2018 Igor Opaniuk <igor.opaniuk@gmail.com>

avb2.0: integrate avb 2.0 into the build system

Integrate libavb into the build system. Introduce CONFIG_LIBAVB
build option.

Signed-off-by: Igor Opaniuk <igor.opaniuk@linaro.org>

# f8c987f8 05-Jun-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

lib: Add hexdump

Often during debugging session it's very interesting to see
what data we were dealing with. For example what we write or read
to/from memory or peripherals.

This change introduces functions that allow to dump binary
data with one simple function invocation like:
------------------->8----------------
print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, buf, len);
------------------->8----------------

which gives us the following:
------------------->8----------------
00000000: f2 b7 c9 88 62 61 75 64 72 61 74 65 3d 31 31 35 ....baudrate=115
00000010: 32 30 30 00 62 6f 6f 74 61 72 67 73 3d 63 6f 6e 200.bootargs=con
00000020: 73 6f 6c 65 3d 74 74 79 53 33 2c 31 31 35 32 30 sole=ttyS3,11520
00000030: 30 6e 38 00 62 6f 6f 74 64 65 6c 61 79 3d 33 00 0n8.bootdelay=3.
00000040: 62 6f 6f 74 66 69 6c 65 3d 75 49 6d 61 67 65 00 bootfile=uImage.
00000050: 66 64 74 63 6f 6e 74 72 6f 6c 61 64 64 72 3d 39 fdtcontroladdr=9
00000060: 66 66 62 31 62 61 30 00 6c 6f 61 64 61 64 64 72 ffb1ba0.loadaddr
00000070: 3d 30 78 38 32 30 30 30 30 30 30 00 73 74 64 65 =0x82000000.stde
00000080: 72 72 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 rr=serial0@e0022
00000090: 30 30 30 00 73 74 64 69 6e 3d 73 65 72 69 61 6c 000.stdin=serial
000000a0: 30 40 65 30 30 32 32 30 30 30 00 73 74 64 6f 75 0@e0022000.stdou
000000b0: 74 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 30 t=serial0@e00220
000000c0: 30 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00..............
...
------------------->8----------------

Source of hexdump.c was copied from Linux kernel v4.7-rc2.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Mario Six <mario.six@gdsys.cc>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Stefan Roese <sr@denx.de>

# c232d14d 29-May-2018 Alex Kiernan <alex.kiernan@gmail.com>

mmc: Separate "mmc swrite" from fastboot

Introduce CONFIG_IMAGE_SPARSE and CONFIG_CMD_MMC_SWRITE so the "mmc
swrite" command is separated from the fastboot code.

Move image-sparse from common to lib so it's clear it's library code.

Rename CONFIG_FASTBOOT_FLASH_FILLBUF_SIZE to CONFIG_IMAGE_SPARSE_FILLBUF_SIZE
and migrate it to Kconfig.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Acked-by: Jassi Brar <jaswinder.singh@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6417572e 08-May-2018 Tom Rini <trini@konsulko.com>

lib/Kconfig: Mark OF_LIBFDT_OVERLAY as depending on OF_LIBFDT

The overlay code is only useful when OF_LIBFDT is set, so mark it as
depending on that first.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 58a46f88 25-Apr-2018 Praneeth Bajjuri <praneeth@ti.com>

configs: TI: Enable FIT Library overlay support

Enable the FDT library overlay support for all TI SOC family.

Without this option, when Loading fdt from FIT image, the
following warning is seen.

"config with overlays but CONFIG_OF_LIBFDT_OVERLAY not set".

Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
Suggested-by: Andrew F.Davis <afd@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>

# 14ad44ab 18-Apr-2018 Alex Kiernan <alex.kiernan@gmail.com>

spl: Split sprintf, strto* from SPL serial in Kconfig

When SPL serial is disabled, callers who need sprintf or strtoul fail
because their inclusion is guarded by CONFIG_SPL_SERIAL_SUPPORT/
CONFIG_TPL_SERIAL_SUPPORT.

Split printf, sprintf and strto into their own entries and then select
all of them if SERIAL_SUPPORT is enabled to match the current behaviour.

Include panic.o unconditionally as it can be called from anywhere which
uses BUG_ON().

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>

# e294ba06 04-Apr-2018 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-sunxi

Signed-off-by: Tom Rini <trini@konsulko.com>


# d14db11d 03-Apr-2018 Andre Przywara <andre.przywara@arm.com>

sunxi: revert disabling of features

In January some commits were introduced to mitigate the U-Boot image
size issues we encountered on sunxi builds.
Now with the MMC environment removed we can bring them back, as we
practically don't have a size limit anymore.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 32ce6179 13-Mar-2018 Bryan O'Donoghue <bryan.odonoghue@linaro.org>

optee: Add lib entries for sharing OPTEE code across ports

This patch adds code to lib to enable sharing of useful OPTEE code between
board-ports and architectures. The code on lib/optee/optee.c comes from the
TI omap2 port. Eventually the OMAP2 code will be patched to include the
shared code. The intention here is to add more useful OPTEE specific code
as more functionality gets added.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Cc: Harinarayan Bhatta <harinarayan@ti.com>
Cc: Andrew F. Davis <afd@ti.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Kever Yang <kever.yang@rock-chips.com>
Cc: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Cc: Peng Fan <peng.fan@nxp.com>
Tested-by: Peng Fan <peng.fan@nxp.com>

# 36c1877c 06-Feb-2018 Faiz Abbas <faiz_abbas@ti.com>

lib: Kconfig: Move DYNAMIC_CRC_TABLE to Kconfig

Add CONFIG prefix to DYNAMIC_CRC_TABLE and implement it in
Kconfig.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>

# a451bc27 05-Feb-2018 Adam Ford <aford173@gmail.com>

Convert LIB_UUID to Kconfig

config_fallback.h has some logic that checks a variety of options
and selects LIB_UUID if it hasn't already been selected. This
will all LIB_UUID in Kconfig and select this option for the list
of options to allow us to remove the logic from fallbacks

Signed-off-by: Adam Ford <aford173@gmail.com>

# a5a37567 06-Feb-2018 Adam Ford <aford173@gmail.com>

Convert CONFIG LIB_HW_RAND to Kconfig

config_fallbacks.h had some logic to automatically select
LIB_RAND if RANDOM_UUID or CMD_UUID were set if LIB_HW_RAND wasn't
already selected. By migrating LIB_HW_RAND to Kconfig, we can
remove this check from config_fallbacks.h and put it into Kconfig

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
[trini: Turn into a choice, add NET_RANDOM_ETHADDR]
Signed-off-by: Tom Rini <trini@konsulko.com>

# acd4d334 16-Jan-2018 Maxime Ripard <maxime.ripard@free-electrons.com>

net: regex: Disable by default on sunXi

The sunXi arm64 build has overflown, leading to the main U-boot binary
overwriting the environment when flashing the new image, or even worse,
overwriting itself when we're calling saveenv.

Disable this option that is not critical until we can adress the issue
properly.

Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 7e3caa81 03-Dec-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

Move CONFIG_PANIC_HANG to Kconfig

Freescale (NXP) boards have lots of defconfig files per board.
I used "imply PANIC_HANG" for them.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# da5337a6 08-Nov-2017 Nandor Han <nandor.han@ge.com>

rtc: add support for s35392a

Add support for S35392A RTC. The driver supports both U-Boot driver
models.

Signed-off-by: Nandor Han <nandor.han@ge.com>
Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
Cc: Heiko Schocher <hs@denx.de>

# f52bdf4b 14-Sep-2017 Jean-Jacques Hiblot <jjhiblot@ti.com>

lib: allow building lzo for the SPL

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 85d8bf57 03-Sep-2017 Marek Behún <marek.behun@nic.cz>

lib: Add CRC32-C

This is needed for BTRFS.

Signed-off-by: Marek Behun <marek.behun@nic.cz>

create mode 100644 lib/crc32c.c

# 7264f292 15-Aug-2017 York Sun <york.sun@nxp.com>

spl: fit: Eanble GZIP support for image decompression

Add Kconfig option SPL_GZIP and SPL_ZLIB to enable gunzip support for
SPL boot, eg. falcon boot compressed kernel image.

Signed-off-by: York Sun <york.sun@nxp.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6ef2f901 11-Aug-2017 Adam Ford <aford173@gmail.com>

Convert CONFIG_BCH to Kconfig

This converts the following to Kconfig:
CONFIG_BCH

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1a7ba1d 18-Aug-2017 Anatolij Gustschin <agust@denx.de>

Fix 'notes' typos

s/notes/nodes

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 96b9082c 03-Aug-2017 Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

rockchip: rk3188: rock: adjust for SPL/TPL split

With the changes to split SPL/TPL for the RK3368, I apparently missed
some needed adjustments to the RK3188 Kconfig and rock_defconfig.

This fixes build-issues for the rock board after applying the RK3368
enablement (and SPL/TPL) set that resulted from TPL_SERIAL_SUPPORT,
TPL_ROCKCHIP_BACK_TO_BROM and TPL_TINY_MEMSET being separate symbols
now.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d56b4b19 22-Jul-2017 Tom Rini <trini@konsulko.com>

configs: Migrate RBTREE, LZO, CMD_MTDPARTS, CMD_UBI and CMD_UBIFS

The above CONFIG options are in Kconfig, and now have correct depends and
inter-dependencies. Migrate these to configs/ from include/configs/. In the
case of CMD_UBIFS also change it to be a default y if CMD_UBI.

Signed-off-by: Tom Rini <trini@konsulko.com>

# aed998aa 17-May-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_LZMA to Kconfig

This converts the following to Kconfig:
CONFIG_LZMA

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

# b1a873df 26-Apr-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_CMD_AES et al to Kconfig

This converts the following to Kconfig:
CONFIG_CMD_AES
CONFIG_AES

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Add select AES to CMD_AES]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 173aafbf 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

cmd: Expose a Kconfig option to enable UBIFS commands

Create a new Kconfig entry to allow CMD_UBIFS selection from Kconfig and
add an hidden LZO option that can be selected by CMD_UBIFS.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>

# aa049152 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

mtd: ubi: Select RBTREE option from MTD_UBI Kconfig entry

Expose the RBTREE feature through Kconfig and select this option from the
MTD_UBI option.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>
[Rebased on master]
Signed-off-by: Jagan Teki <jagan@openedev.com>

# ab4458bd 02-Apr-2017 Simon Glass <sjg@chromium.org>

string: Provide a slimmed-down memset()

Most of the time the optimised memset() is what we want. For extreme
situations such as TPL it may be too large. For example on the 'rock'
board, using a simple loop saves a useful 48 bytes. With gcc 4.9 and
the rodata bug, this patch is enough to reduce the TPL image below the
limit.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>

# bea79d7d 14-Mar-2017 Andre Przywara <andre.przywara@arm.com>

Kconfig: introduce md5sum command selection

So far CONFIG_MD5SUM would need to be set by a board's include file.
Since the command is really generic, move it over to Kconfig to allow
it to be defined by either a board's defconfig, menuconfig or some
config snippet merged via mergeconfig.sh.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e663b350 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

smbios: Expose in efi_loader as table

We can pass SMBIOS easily as EFI configuration table to an EFI payload. This
patch adds enablement for that case.

While at it, we also enable SMBIOS generation for ARM systems, since they support
EFI_LOADER.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4b6dddc2 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

x86: Move smbios generation into arch independent directory

We will need the SMBIOS generation function on ARM as well going forward,
so let's move it into a non arch specific location.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# ebf7fff2 05-Oct-2016 Heiko Schocher <hs@denx.de>

spl: move FDT_FIXUP_PARTITIONS to Kconfig

Move FDT_FIXUP_PARTITIONS to Kconfig and cleanup existing
uses.

Signed-off-by: Heiko Schocher <hs@denx.de>

# ddf67f71 05-Jul-2016 Maxime Ripard <maxime.ripard@free-electrons.com>

libfdt: Add overlay application function

The device tree overlays are a good way to deal with user-modifyable
boards or boards with some kind of an expansion mechanism where we can
easily plug new board in (like the BBB, the Raspberry Pi or the CHIP).

Add a new function to merge overlays with a base device tree.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>

# 91b86e21 26-May-2016 Marek Vasut <marex@denx.de>

lib: Enable private libgcc by default

This patch decouples U-Boot binary from the toolchain on systems where
private libgcc is available. Instead of pulling in functions provided
by the libgcc from the toolchain, U-Boot will use it's own set of libgcc
functions. These functions are usually imported from Linux kernel, which
also uses it's own libgcc functions instead of the ones provided by the
toolchain.

This patch solves a rather common problem. The toolchain can usually
generate code for many variants of target architecture and often even
different endianness. The libgcc on the other hand is usually compiled
for one particular configuration and the functions provided by it may
or may not be suited for use in U-Boot. This can manifest in two ways,
either the U-Boot fails to compile altogether and linker will complain
or, in the much worse case, the resulting U-Boot will build, but will
misbehave in very subtle and hard to debug ways.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 67976306 30-Mar-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

cosmetic: Fix typos "privide"

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# ed980b8c 03-Mar-2016 Alexander Graf <agraf@csgraf.de>

efi_loader: hook up in build environment

Now that we have all the bits and pieces ready for EFI payload loading
support, hook them up in Makefiles and KConfigs so that we can build.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
[trini: Enable only when we of OF_LIBFDT, disable on kwb and colibri_pxa270]
Signed-off-by: Tom Rini <trini@konsulko.com>

# aa34fbc0 22-Feb-2016 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt to be used in SPL

Add an option to enable libfdt in SPL. This can be useful when decoding
FIT files in SPL.

We need to make sure this option is not enabled in SPL by this change.
Also this option needs to be enabled in host builds. Si add a new
IMAGE_USE_LIBFDT #define which can be used in files that are built on the
host but must also build for U-Boot and SPL.

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

# 69e173eb 22-Feb-2016 Simon Glass <sjg@chromium.org>

Move CONFIG_OF_LIBFDT to Kconfig

Move this option to Kconfig and tidy up existing boards.

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

# a187559e 05-Feb-2016 Bin Meng <bmeng.cn@gmail.com>

Use correct spelling of "U-Boot"

Correct spelling of "U-Boot" shall be used in all written text
(documentation, comments in source files etc.).

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Minkyu Kang <mk7.kang@samsung.com>

# 947c626d 14-Jan-2016 Tom Rini <trini@konsulko.com>

vsprintf.c: Always enable CONFIG_SYS_VSNPRINTF

Enabling this function always removes some class of string saftey issues.
The size change here in general is about 400 bytes and this seems a reasonable
trade-off.

Cc: Peng Fan <peng.fan@nxp.com>
Cc: Peter Robinson <pbrobinson@gmail.com>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Adrian Alonso <aalonso@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 7d9cde10 22-Nov-2015 Stefan Roese <sr@denx.de>

lib/tiny-printf.c: Add tiny printf function for space limited environments

This patch adds a small printf() version that supports all basic formats.
Its intented to be used in U-Boot SPL versions on platforms with very
limited internal RAM sizes.

To enable it, just define CONFIG_USE_TINY_PRINTF in your defconfig. This
will result in the SPL using this tiny function and the main U-Boot
still using the full-blown printf() function.

This code was copied from:
http://www.sparetimelabs.com/printfrevisited
With mostly only coding style related changes so that its checkpatch
clean.

The size reduction is about 2.5KiB. Here a comparison for the db-mv784mp-gp
(Marvell AXP) SPL:

Without this patch:
58963 18536 1928 79427 13643 ./spl/u-boot-spl

With this patch:
56542 18536 1956 77034 12cea ./spl/u-boot-spl

Note:
To make it possible to compile tiny-printf.c instead of vsprintf.c when
CONFIG_USE_TINY_PRINTF is defined, the functions printf() and vprintf() are
moved from common/console.c into vsprintf.c in this patch.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>

# 2419cd16 03-Oct-2015 Simon Glass <sjg@chromium.org>

dm: tpm: Drop CONFIG_DM_TPM

Now that all TPM drivers use driver model, we can drop the special driver
model CONFIG option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>

# 027b728d 06-Oct-2015 Julius Werner <jwerner@chromium.org>

Add support for LZ4 decompression algorithm

This patch adds support for LZ4-compressed FIT image contents. This
algorithm has a slightly worse compression ration than LZO while being
nearly twice as fast to decompress. When loading images from a fast
storage medium this usually results in a boot time win.

Sandbox-tested only since I don't have a U-Boot development system set
up right now. The code was imported unchanged from coreboot where it's
proven to work, though. I'm mostly interested in getting this recognized
by mkImage for use in a downstream project.

Signed-off-by: Julius Werner <jwerner@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# a7d660bc 22-Aug-2015 Simon Glass <sjg@chromium.org>

tpm: Add Kconfig options for TPMs

Add new Kconfig options for TPMs in preparation for moving boards to use
Kconfig for TPM configuration.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 867a6ac8 31-Jul-2015 Simon Glass <sjg@chromium.org>

efi: Add start-up library code

When running as an EFI application, U-Boot must request memory from EFI,
and provide access to the boot services U-Boot needs.

Add library code to perform these tasks. This includes efi_main() which is
the entry point from EFI. U-Boot is built as a shared library.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d1389403 23-Jun-2015 Simon Glass <sjg@chromium.org>

Add a dhrystone benchmark command

Drystone provides a convenient sanity check that the CPU is running at full
speed. Add this as a command which can be enabled as needed.

Note: I investigated using Coremark for this but there was a license
agreement and I could not work out if it was GPL-compatible.

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

# f7848d90 22-Jun-2015 Joe Hershberger <joe.hershberger@ni.com>

Allow CONFIG_REGEX to be disabled when CONFIG_NET

Instead of selecting REGEX when NET is enabled, make it the default, but
allow boards that are tiny to disable it and lose functionality on all
but the first Ethernet adapter.

cm-bf548, bf538f-ezkit, and bf533-stamp need this. None appear to have
more than one Ethernet interface.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# 3850dbe8 11-Jun-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

blackfin: fix undefined reference to srand and rand

Commit 9ba9e85f3f1c (net: Fix NET_RANDOM_ETHADDR dependencies)
accidentally dropped CONFIG_LIB_RAND defines for 14 Blackfin boards.

Prior to that commit, those boards defined CONFIG_LIB_RAND, but not
CONFIG_NET_RANDOM_ETHADDR. So, commit 9ba9e85f3f1c should not have
touched them, but in fact it ripped CONFIG_LIB_RAND off from all the
header files, which caused undefined reference to srand and rand.
CONFIG_LIB_RAND=y must be revived for such boards.

BTW, this commit indeed makes it better, but even with this fix,
three boards (bf533-stamp, bf538f-ezkit, cm-bf548) still can not
build due to region 'ram' overflowed error. This was cause by
commit 6eed3786c68c (net: Move the CMD_NET config to defconfigs)
because CMD_NET selects NET, and NET selects REGEX. Eventually,
some boards were newly enabled with CONFIG_REGEX, increasing the
memory footprint. A patch is expected to fix the build error.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 9ba9e85f 25-May-2015 Michal Simek <michal.simek@xilinx.com>

net: Fix NET_RANDOM_ETHADDR dependencies

NET_RANDOM_ETHADDR depends on lib/rand.c. This patch adds dependency to
Kconfig to ensure that library is also compiled.

Remove the definitions from Blackfin boards' include/configs.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 6501ff62 20-Apr-2015 Przemyslaw Marczak <p.marczak@samsung.com>

lib: Kconfig: add entry for errno_str() function

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1a60650c 21-Apr-2015 Joe Hershberger <joe.hershberger@ni.com>

kconfig: Move REGEX to Kconfig

Having this as a Kconfig allows it to be a dependent feature.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8156345d 06-Mar-2015 Simon Glass <sjg@chromium.org>

sandbox: Move CONFIG_SYS_VSNPRINTF to Kconfig

Move this over to Kconfig and tidy up.

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

# 94e3c8c4 19-Feb-2015 gaurav rana <gaurav.rana@freescale.com>

crypto/fsl - Add progressive hashing support using hardware acceleration.

Currently only normal hashing is supported using hardware acceleration.
Added support for progressive hashing using hardware.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
Signed-off-by: Gaurav Rana <gaurav.rana@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>

# d9f23c7f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

lib/rsa: Add Kconfig for devices supporting RSA Modular Exponentiation

Kconfig option added for devices which support RSA Verification.
1. RSA_SOFTWARE_EXP
Enables driver for supporting RSA Modular Exponentiation in Software
2. RSA_FREESCALE_EXP
Enables driver for supporting RSA Modular Exponentiation using Freescale specific
driver

The above drivers use RSA uclass

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
(Removed duplicate line in Kconfig comment)

Change-Id: I7663c4d5350e2bfc3dfa2696f70ef777d6ccc6f6

# c4beb22f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

FIT: Modify option FIT_SIGNATURE in Kconfig

For FIT signature based approach to work, RSA library needs to be selected.
The FIT_SIGNATURE option in Kconfig is modified to automatically select RSA.
Selecting RSA compiles the RSA library required for image verification.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 45ccec8f 23-Oct-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_USE_PRIVATE_LIBGCC to Kconfig

The private libgcc is supported only on ARM, MIPS, PowerPC, SH, x86.
Those architectures should "select" HAVE_PRIVATE_LIBGCC and
CONFIG_USE_PRIVATE_LIBGCC should depend on it.

Currently, this option is enabled on Tegra boards and x86 architecture.
Move the definition from header files to Kconfig.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Tested-by: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: Tom Warren <twarren@nvidia.com>

# 8c688bc4 23-Oct-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_SYS_HZ to lib/Kconfig

CONFIG_SYS_HZ is always defined as 1000 in config_fallbacks.h
(but some boards still have redundant definitions).

This commit moves the definition and the document in README to
Kconfig. Since lib/Kconfig can assure that CONFIG_SYS_HZ is 1000,
the sanity check in lib/time.c should be removed.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Reviewed-by: Marek Vasut <marex@denx.de>

# b0928da6 16-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED to Kconfig

If this option is enabled, the objects under lib/ directory
are compiled with speed optimization, not size optimization.
(Currently, only used by some Blackfin boards.)

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# ed36323f 16-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: add blank Kconfig files

This would be useful to start moving various config options.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# 81014f73 30-Jul-2020 Joao Marcos Costa <joaomarcos.costa@bootlin.com>

include/u-boot, lib/zlib: add sources for zlib decompression

Add zlib (v1.2.11) uncompr() function to U-Boot. SquashFS depends on
this function to decompress data from a raw disk image. The actual
support for zlib into SquashFS sources will be added in a follow-up
commit.

Signed-off-by: Joao Marcos Costa <joaomarcos.costa@bootlin.com>

# 69be8fd1 03-Jun-2020 Marek Szyprowski <m.szyprowski@samsung.com>

powerpc: move ADDR_MAP to Kconfig

Move ADDR_MAP related config options from include/configs/*.h to the
proper place in lib/Kconfig. This has been done using
./tools/moveconfig.py and manual inspection of the generated changes.
This is a preparation to use ADDR_MAP helper on ARM 32bit Raspberry Pi4
board for mapping the PCIe XHCI MMIO, which is above the 4GiB identity
mapping limit.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# d16b38f4 15-Apr-2020 Reuben Dowle <reubendowle0@gmail.com>

Add support for SHA384 and SHA512

The current recommendation for best security practice from the US government
is to use SHA384 for TOP SECRET [1].

This patch adds support for SHA384 and SHA512 in the hash command, and also
allows FIT images to be hashed with these algorithms, and signed with
sha384,rsaXXXX and sha512,rsaXXXX

The SHA implementation is adapted from the linux kernel implementation.

[1] Commercial National Security Algorithm Suite
http://www.iad.gov/iad/programs/iad-initiatives/cnsa-suite.cfm

Signed-off-by: Reuben Dowle <reuben.dowle@4rf.com>

# 43e442a5 26-May-2020 Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

kconfig: fix some typos

Signed-off-by: Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

# eff5a547 22-May-2020 Michael Walle <michael@walle.cc>

cmd: zip: automatically pull in gzip()

Move the CONFIG_GZIP_COMPRESSED from a config.h macro to a Kconfig menu
item. It is not selectable by a user because there is no reason to do
so. Instead it will be automatically selected by the stuff which uses
gzip(), like the zip command.

Remove it from the config_whitelist.txt. Also remove
CONFIG_GZIP_COMPRESS_DEF_SZ as this was never used on any board. The
default seems to be sane, otherwise it should be added as a Kconfig
option.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8239be61 06-May-2020 Simon Glass <sjg@chromium.org>

lib: Allow MD5 to be enabled in SPL

At present the MD5 option cannot be enabled by board configs since it has
no Kconfig name. It is generally enabled, so long as FIT support is
present. But not all boards use FIT, particularly in SPL

Fix this and add an option for SPL as well. This allows board code to call
md5() even if FIT support is not enabled.

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

# 04cb3994 21-Apr-2020 Weijie Gao <weijie.gao@mediatek.com>

lib: enable lzma decompression support for SPL build

This patch enables LZMA decompression support for SPL build

Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>

# 2a2119e1 05-Mar-2020 Atish Patra <atish.patra@wdc.com>

lib: kconfig: Add option to set BZIP2 compression method

There is no way to select BZIP2 compression method.
Add it under library/compression config where all other
compression related configs are present.

Signed-off-by: Atish Patra <atish.patra@wdc.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 805b3cac 12-Feb-2020 Keerthy <j-keerthy@ti.com>

lib: elf: Move the generic elf loading/validating functions to lib

Move the generic elf loading/validating functions to lib/
so that they can be re-used and accessed by code existing
outside cmd.

While at it remove the duplicate static version of load_elf_image_phdr
under arch/arm/mach-imx/imx_bootaux.c.

Signed-off-by: Keerthy <j-keerthy@ti.com>
Suggested-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>

# 1611235b 19-Jan-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: Kconfig dependencies for pseudo-random library

drivers/rng/sandbox_rng.c requires rand() to be defined but configuration
option CONFIG_CONFIG_LIB_RAND selected in drivers/rng/Kconfig does not
exist.

test/lib/test_aes.c requires rand() to be defined.

Fix the selection criteria for choice "Pseudo-random library support type".

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 3c10dc95 06-Dec-2019 Simon Glass <sjg@chromium.org>

binman: Add a library to access binman entries

SPL and TPL can access information about binman entries using link-time
symbols but this is not available in U-Boot proper. Of course it could be
made available, but the intention is to just read the device tree.

Add support for this, so that U-Boot can locate entries.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# b4adf627 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: crypto: add x509 parser

Imported from linux kernel v5.3:
x509.asn1 without changes
x509_akid.asn1 without changes
x509_parser.h without changes
x509_cert_parser.c with changes marked as __UBOOT__
x509_public_key.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# a9b45e6e 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add oid registry utility

Imported from linux kernel v5.3:
build_OID_registry without changes
oid_registry.h without changes
oid_registry.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# ab8a0e06 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add asn1 decoder

Imported from linux kernel v5.3:
lib/asn1_decoder.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 2b12196d 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

cmd: add asn1_compiler

Imported from linux kernel v5.3:
asn1.h without changes
asn1_ber_bytecode.h without changes
asn1_decoder.h without changes
asn1_compiler.c without changes

This host command will be used to create a ASN1 parser, for example,
for pkcs7 messages or x509 certificates. More specifically, it will
generate *byte code* which will be interpreted by asn1 decoder library.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 05429b6c 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

rtc: move date.c from drivers/rtc/ to lib/

In the next commit, rtc_mktime(), for compatibility with linux, will be
implemented using rtc_mktime(), which is no longer drivers/rtc specific.
So move this file under lib/.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 37ef1774 10-Nov-2019 Thomas Hebb <tommyhebb@gmail.com>

Kconfig: disambiguate config names for tiny printf

27084c03d36a ("spl: Allow tiny printf() to be controlled in SPL and
TPL") split this option in two for TPL and SPL, but didn't change the
Kconfig names, making them hard to set quickly.

Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>

# 0d76afc0 27-Oct-2019 Simon Glass <sjg@chromium.org>

fdt: Add Kconfig options to control code size

For better or worse libfdt recent grew a lot of code that checks the
validity of the device tree in great detail. When using unsigned or
unverified data this makes things safer, but it does add to code size.

Add some controls to select the trade-off between safety and code size.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 27084c03 25-Sep-2019 Simon Glass <sjg@chromium.org>

spl: Allow tiny printf() to be controlled in SPL and TPL

At present there is only one control for this and it is used for both SPL
and TPL. But SPL might have a lot more space than TPL so the extra cost of
a full printf() might be acceptable.

Split the option into two, providing separate SPL and TPL controls. The
TPL setting defaults to the same as SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2a51e16b 07-Jun-2019 Tom Rini <trini@konsulko.com>

configs: Make USE_TINY_PRINTF depend on SPL||TPL and be default

The USE_TINY_PRINTF symbol only changes things within SPL and TPL
builds, so make it depend on that support. Next, make it default as
within these cases we should rarely have need of more advanced print
formats outside of the debug context.

To do this, in a few cases we need to correct our Kconfig dependencies
as we had cases of non-SPL targets select'ing this symbol. Finally, in
the case of a few boards we really do need the full printf
functionality.

Signed-off-by: Tom Rini <trini@konsulko.com>

# da0fb5fd 02-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: make call depth limit customizable

Up to now we had hard coded values for the call depth up to which trace
records are created: 200 for early tracing, 15 thereafter. UEFI
applications reach a call depth of 80 or above.

Provide customizing settings for the call trace depth limit and the early
call trace depth limit. Use the old values as defaults.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8509f22a 29-Apr-2019 Marek Behún <marek.behun@nic.cz>

lib: add Zstandard decompression support

Add the zstd library from Linux kernel (only decompression support).
There are minimal changes to build with U-Boot, otherwise the files are
identical to Linux commit dc35da16 from March 2018, the files had not
been touched since in kernel. Also SPDX lincese tags were added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 83a486b6 29-Apr-2019 Marek Behún <marek.behun@nic.cz>

lib: Add xxhash support

This adds the xxhash support from Linux. Files are almost identical to
those added to Linux in commit 5d240522 ("lib: Add xxhash module") (they
haven't been touched since in Linux). The only difference is to add some
includes to be compatible with U-Boot. Also SPDX lincese tags were
added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 5132361a 29-Apr-2019 Heiko Schocher <hs@denx.de>

lib: Kconfig: fix help text for GZIP

commit 95f4bbd581cf ("lib: fdt: Allow LZO and GZIP DT compression in U-Boot")

introduced Kconfig option for gzip in U-Boot, but help text
says gzip for SPL, which is wrong. Fix this.

Signed-off-by: Heiko Schocher <hs@denx.de>
Acked-by: Marek Vasut <marex@denx.de>

# 1c6eb075 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE_BUFFER_SIZE et al to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE_BUFFER_SIZE
CONFIG_TRACE_EARLY_SIZE
CONFIG_TRACE_EARLY
CONFIG_TRACE_EARLY_ADDR

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

# a24a78d7 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE

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

# 54969b40 21-Mar-2019 Thierry Reding <treding@nvidia.com>

fdtdec: Add Kconfig symbol for tests

Runtime tests are provided as a test_fdtdec command implementation. Add
a Kconfig symbol that allows this command to be built so that the tests
can be used.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 95f4bbd5 08-Mar-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

lib: fdt: Allow LZO and GZIP DT compression in U-Boot

Add required Kconfig symbols, Makefile bits and macro fixes in a
few places to support LZO and DT compression in U-Boot. This can
save a lot of space with multi-DTB fitImages.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>

# 6e705114 13-Jan-2019 Chris Packham <judge.packham@gmail.com>

lib: Kconfig: spelling fixes

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 048c6e89 06-Nov-2018 Simon Glass <sjg@chromium.org>

spl: lz4: Allow use of lz4 compression in SPL

In some cases U-Boot is compressed and it is useful to be able to
decompress it in SPL. Add a Kconfig and Makefile change to allow this.
Note that this does not actually implement decompression.

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

# 2895c4b7 15-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

kconfig: Introduce HAVE_ARCH_IOMAP

Introduce a new Kconfig option for architecture codes to control
whether it provides io{read,write}{8,16,32} I/O accessor functions.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5592a633 01-Oct-2018 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt in TPL

In some cases (e.g. sandbox with verified boot) it is useful to support
libfdt in TPL. Update the Kconfig to handle this.

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

# 6307896c 01-Oct-2018 Simon Glass <sjg@chromium.org>

tpm: Add support for SPL and TPL

At present the tpm can only be used in U-Boot proper. Updated it to work
in SPL and TPL also.

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

# ab948cd2 19-Jul-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

fdt_support: make FDT_FIXUP_PARTITIONS depend on CMD_MTDPARTS

fdt_fixup_mtdparts() calls mtdparts_init() and device_find(),
which are defined in cmd/mtdparts.c

The combination of FDT_FIXUP_PARTITIONS=y and CMD_MTDPARTS=n
emits the following link error:

common/fdt_support.c:903: undefined reference to `mtdparts_init'
common/fdt_support.c:914: undefined reference to `device_find'

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 3330584d 03-Jun-2018 Igor Opaniuk <igor.opaniuk@gmail.com>

avb2.0: integrate avb 2.0 into the build system

Integrate libavb into the build system. Introduce CONFIG_LIBAVB
build option.

Signed-off-by: Igor Opaniuk <igor.opaniuk@linaro.org>

# f8c987f8 05-Jun-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

lib: Add hexdump

Often during debugging session it's very interesting to see
what data we were dealing with. For example what we write or read
to/from memory or peripherals.

This change introduces functions that allow to dump binary
data with one simple function invocation like:
------------------->8----------------
print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, buf, len);
------------------->8----------------

which gives us the following:
------------------->8----------------
00000000: f2 b7 c9 88 62 61 75 64 72 61 74 65 3d 31 31 35 ....baudrate=115
00000010: 32 30 30 00 62 6f 6f 74 61 72 67 73 3d 63 6f 6e 200.bootargs=con
00000020: 73 6f 6c 65 3d 74 74 79 53 33 2c 31 31 35 32 30 sole=ttyS3,11520
00000030: 30 6e 38 00 62 6f 6f 74 64 65 6c 61 79 3d 33 00 0n8.bootdelay=3.
00000040: 62 6f 6f 74 66 69 6c 65 3d 75 49 6d 61 67 65 00 bootfile=uImage.
00000050: 66 64 74 63 6f 6e 74 72 6f 6c 61 64 64 72 3d 39 fdtcontroladdr=9
00000060: 66 66 62 31 62 61 30 00 6c 6f 61 64 61 64 64 72 ffb1ba0.loadaddr
00000070: 3d 30 78 38 32 30 30 30 30 30 30 00 73 74 64 65 =0x82000000.stde
00000080: 72 72 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 rr=serial0@e0022
00000090: 30 30 30 00 73 74 64 69 6e 3d 73 65 72 69 61 6c 000.stdin=serial
000000a0: 30 40 65 30 30 32 32 30 30 30 00 73 74 64 6f 75 0@e0022000.stdou
000000b0: 74 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 30 t=serial0@e00220
000000c0: 30 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00..............
...
------------------->8----------------

Source of hexdump.c was copied from Linux kernel v4.7-rc2.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Mario Six <mario.six@gdsys.cc>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Stefan Roese <sr@denx.de>

# c232d14d 29-May-2018 Alex Kiernan <alex.kiernan@gmail.com>

mmc: Separate "mmc swrite" from fastboot

Introduce CONFIG_IMAGE_SPARSE and CONFIG_CMD_MMC_SWRITE so the "mmc
swrite" command is separated from the fastboot code.

Move image-sparse from common to lib so it's clear it's library code.

Rename CONFIG_FASTBOOT_FLASH_FILLBUF_SIZE to CONFIG_IMAGE_SPARSE_FILLBUF_SIZE
and migrate it to Kconfig.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Acked-by: Jassi Brar <jaswinder.singh@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6417572e 08-May-2018 Tom Rini <trini@konsulko.com>

lib/Kconfig: Mark OF_LIBFDT_OVERLAY as depending on OF_LIBFDT

The overlay code is only useful when OF_LIBFDT is set, so mark it as
depending on that first.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 58a46f88 25-Apr-2018 Praneeth Bajjuri <praneeth@ti.com>

configs: TI: Enable FIT Library overlay support

Enable the FDT library overlay support for all TI SOC family.

Without this option, when Loading fdt from FIT image, the
following warning is seen.

"config with overlays but CONFIG_OF_LIBFDT_OVERLAY not set".

Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
Suggested-by: Andrew F.Davis <afd@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>

# 14ad44ab 18-Apr-2018 Alex Kiernan <alex.kiernan@gmail.com>

spl: Split sprintf, strto* from SPL serial in Kconfig

When SPL serial is disabled, callers who need sprintf or strtoul fail
because their inclusion is guarded by CONFIG_SPL_SERIAL_SUPPORT/
CONFIG_TPL_SERIAL_SUPPORT.

Split printf, sprintf and strto into their own entries and then select
all of them if SERIAL_SUPPORT is enabled to match the current behaviour.

Include panic.o unconditionally as it can be called from anywhere which
uses BUG_ON().

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>

# e294ba06 04-Apr-2018 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-sunxi

Signed-off-by: Tom Rini <trini@konsulko.com>


# d14db11d 03-Apr-2018 Andre Przywara <andre.przywara@arm.com>

sunxi: revert disabling of features

In January some commits were introduced to mitigate the U-Boot image
size issues we encountered on sunxi builds.
Now with the MMC environment removed we can bring them back, as we
practically don't have a size limit anymore.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 32ce6179 13-Mar-2018 Bryan O'Donoghue <bryan.odonoghue@linaro.org>

optee: Add lib entries for sharing OPTEE code across ports

This patch adds code to lib to enable sharing of useful OPTEE code between
board-ports and architectures. The code on lib/optee/optee.c comes from the
TI omap2 port. Eventually the OMAP2 code will be patched to include the
shared code. The intention here is to add more useful OPTEE specific code
as more functionality gets added.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Cc: Harinarayan Bhatta <harinarayan@ti.com>
Cc: Andrew F. Davis <afd@ti.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Kever Yang <kever.yang@rock-chips.com>
Cc: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Cc: Peng Fan <peng.fan@nxp.com>
Tested-by: Peng Fan <peng.fan@nxp.com>

# 36c1877c 06-Feb-2018 Faiz Abbas <faiz_abbas@ti.com>

lib: Kconfig: Move DYNAMIC_CRC_TABLE to Kconfig

Add CONFIG prefix to DYNAMIC_CRC_TABLE and implement it in
Kconfig.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>

# a451bc27 05-Feb-2018 Adam Ford <aford173@gmail.com>

Convert LIB_UUID to Kconfig

config_fallback.h has some logic that checks a variety of options
and selects LIB_UUID if it hasn't already been selected. This
will all LIB_UUID in Kconfig and select this option for the list
of options to allow us to remove the logic from fallbacks

Signed-off-by: Adam Ford <aford173@gmail.com>

# a5a37567 06-Feb-2018 Adam Ford <aford173@gmail.com>

Convert CONFIG LIB_HW_RAND to Kconfig

config_fallbacks.h had some logic to automatically select
LIB_RAND if RANDOM_UUID or CMD_UUID were set if LIB_HW_RAND wasn't
already selected. By migrating LIB_HW_RAND to Kconfig, we can
remove this check from config_fallbacks.h and put it into Kconfig

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
[trini: Turn into a choice, add NET_RANDOM_ETHADDR]
Signed-off-by: Tom Rini <trini@konsulko.com>

# acd4d334 16-Jan-2018 Maxime Ripard <maxime.ripard@free-electrons.com>

net: regex: Disable by default on sunXi

The sunXi arm64 build has overflown, leading to the main U-boot binary
overwriting the environment when flashing the new image, or even worse,
overwriting itself when we're calling saveenv.

Disable this option that is not critical until we can adress the issue
properly.

Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 7e3caa81 03-Dec-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

Move CONFIG_PANIC_HANG to Kconfig

Freescale (NXP) boards have lots of defconfig files per board.
I used "imply PANIC_HANG" for them.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# da5337a6 08-Nov-2017 Nandor Han <nandor.han@ge.com>

rtc: add support for s35392a

Add support for S35392A RTC. The driver supports both U-Boot driver
models.

Signed-off-by: Nandor Han <nandor.han@ge.com>
Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
Cc: Heiko Schocher <hs@denx.de>

# f52bdf4b 14-Sep-2017 Jean-Jacques Hiblot <jjhiblot@ti.com>

lib: allow building lzo for the SPL

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 85d8bf57 03-Sep-2017 Marek Behún <marek.behun@nic.cz>

lib: Add CRC32-C

This is needed for BTRFS.

Signed-off-by: Marek Behun <marek.behun@nic.cz>

create mode 100644 lib/crc32c.c

# 7264f292 15-Aug-2017 York Sun <york.sun@nxp.com>

spl: fit: Eanble GZIP support for image decompression

Add Kconfig option SPL_GZIP and SPL_ZLIB to enable gunzip support for
SPL boot, eg. falcon boot compressed kernel image.

Signed-off-by: York Sun <york.sun@nxp.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6ef2f901 11-Aug-2017 Adam Ford <aford173@gmail.com>

Convert CONFIG_BCH to Kconfig

This converts the following to Kconfig:
CONFIG_BCH

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1a7ba1d 18-Aug-2017 Anatolij Gustschin <agust@denx.de>

Fix 'notes' typos

s/notes/nodes

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 96b9082c 03-Aug-2017 Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

rockchip: rk3188: rock: adjust for SPL/TPL split

With the changes to split SPL/TPL for the RK3368, I apparently missed
some needed adjustments to the RK3188 Kconfig and rock_defconfig.

This fixes build-issues for the rock board after applying the RK3368
enablement (and SPL/TPL) set that resulted from TPL_SERIAL_SUPPORT,
TPL_ROCKCHIP_BACK_TO_BROM and TPL_TINY_MEMSET being separate symbols
now.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d56b4b19 22-Jul-2017 Tom Rini <trini@konsulko.com>

configs: Migrate RBTREE, LZO, CMD_MTDPARTS, CMD_UBI and CMD_UBIFS

The above CONFIG options are in Kconfig, and now have correct depends and
inter-dependencies. Migrate these to configs/ from include/configs/. In the
case of CMD_UBIFS also change it to be a default y if CMD_UBI.

Signed-off-by: Tom Rini <trini@konsulko.com>

# aed998aa 17-May-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_LZMA to Kconfig

This converts the following to Kconfig:
CONFIG_LZMA

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

# b1a873df 26-Apr-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_CMD_AES et al to Kconfig

This converts the following to Kconfig:
CONFIG_CMD_AES
CONFIG_AES

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Add select AES to CMD_AES]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 173aafbf 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

cmd: Expose a Kconfig option to enable UBIFS commands

Create a new Kconfig entry to allow CMD_UBIFS selection from Kconfig and
add an hidden LZO option that can be selected by CMD_UBIFS.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>

# aa049152 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

mtd: ubi: Select RBTREE option from MTD_UBI Kconfig entry

Expose the RBTREE feature through Kconfig and select this option from the
MTD_UBI option.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>
[Rebased on master]
Signed-off-by: Jagan Teki <jagan@openedev.com>

# ab4458bd 02-Apr-2017 Simon Glass <sjg@chromium.org>

string: Provide a slimmed-down memset()

Most of the time the optimised memset() is what we want. For extreme
situations such as TPL it may be too large. For example on the 'rock'
board, using a simple loop saves a useful 48 bytes. With gcc 4.9 and
the rodata bug, this patch is enough to reduce the TPL image below the
limit.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>

# bea79d7d 14-Mar-2017 Andre Przywara <andre.przywara@arm.com>

Kconfig: introduce md5sum command selection

So far CONFIG_MD5SUM would need to be set by a board's include file.
Since the command is really generic, move it over to Kconfig to allow
it to be defined by either a board's defconfig, menuconfig or some
config snippet merged via mergeconfig.sh.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e663b350 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

smbios: Expose in efi_loader as table

We can pass SMBIOS easily as EFI configuration table to an EFI payload. This
patch adds enablement for that case.

While at it, we also enable SMBIOS generation for ARM systems, since they support
EFI_LOADER.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4b6dddc2 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

x86: Move smbios generation into arch independent directory

We will need the SMBIOS generation function on ARM as well going forward,
so let's move it into a non arch specific location.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# ebf7fff2 05-Oct-2016 Heiko Schocher <hs@denx.de>

spl: move FDT_FIXUP_PARTITIONS to Kconfig

Move FDT_FIXUP_PARTITIONS to Kconfig and cleanup existing
uses.

Signed-off-by: Heiko Schocher <hs@denx.de>

# ddf67f71 05-Jul-2016 Maxime Ripard <maxime.ripard@free-electrons.com>

libfdt: Add overlay application function

The device tree overlays are a good way to deal with user-modifyable
boards or boards with some kind of an expansion mechanism where we can
easily plug new board in (like the BBB, the Raspberry Pi or the CHIP).

Add a new function to merge overlays with a base device tree.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>

# 91b86e21 26-May-2016 Marek Vasut <marex@denx.de>

lib: Enable private libgcc by default

This patch decouples U-Boot binary from the toolchain on systems where
private libgcc is available. Instead of pulling in functions provided
by the libgcc from the toolchain, U-Boot will use it's own set of libgcc
functions. These functions are usually imported from Linux kernel, which
also uses it's own libgcc functions instead of the ones provided by the
toolchain.

This patch solves a rather common problem. The toolchain can usually
generate code for many variants of target architecture and often even
different endianness. The libgcc on the other hand is usually compiled
for one particular configuration and the functions provided by it may
or may not be suited for use in U-Boot. This can manifest in two ways,
either the U-Boot fails to compile altogether and linker will complain
or, in the much worse case, the resulting U-Boot will build, but will
misbehave in very subtle and hard to debug ways.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 67976306 30-Mar-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

cosmetic: Fix typos "privide"

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# ed980b8c 03-Mar-2016 Alexander Graf <agraf@csgraf.de>

efi_loader: hook up in build environment

Now that we have all the bits and pieces ready for EFI payload loading
support, hook them up in Makefiles and KConfigs so that we can build.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
[trini: Enable only when we of OF_LIBFDT, disable on kwb and colibri_pxa270]
Signed-off-by: Tom Rini <trini@konsulko.com>

# aa34fbc0 22-Feb-2016 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt to be used in SPL

Add an option to enable libfdt in SPL. This can be useful when decoding
FIT files in SPL.

We need to make sure this option is not enabled in SPL by this change.
Also this option needs to be enabled in host builds. Si add a new
IMAGE_USE_LIBFDT #define which can be used in files that are built on the
host but must also build for U-Boot and SPL.

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

# 69e173eb 22-Feb-2016 Simon Glass <sjg@chromium.org>

Move CONFIG_OF_LIBFDT to Kconfig

Move this option to Kconfig and tidy up existing boards.

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

# a187559e 05-Feb-2016 Bin Meng <bmeng.cn@gmail.com>

Use correct spelling of "U-Boot"

Correct spelling of "U-Boot" shall be used in all written text
(documentation, comments in source files etc.).

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Minkyu Kang <mk7.kang@samsung.com>

# 947c626d 14-Jan-2016 Tom Rini <trini@konsulko.com>

vsprintf.c: Always enable CONFIG_SYS_VSNPRINTF

Enabling this function always removes some class of string saftey issues.
The size change here in general is about 400 bytes and this seems a reasonable
trade-off.

Cc: Peng Fan <peng.fan@nxp.com>
Cc: Peter Robinson <pbrobinson@gmail.com>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Adrian Alonso <aalonso@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 7d9cde10 22-Nov-2015 Stefan Roese <sr@denx.de>

lib/tiny-printf.c: Add tiny printf function for space limited environments

This patch adds a small printf() version that supports all basic formats.
Its intented to be used in U-Boot SPL versions on platforms with very
limited internal RAM sizes.

To enable it, just define CONFIG_USE_TINY_PRINTF in your defconfig. This
will result in the SPL using this tiny function and the main U-Boot
still using the full-blown printf() function.

This code was copied from:
http://www.sparetimelabs.com/printfrevisited
With mostly only coding style related changes so that its checkpatch
clean.

The size reduction is about 2.5KiB. Here a comparison for the db-mv784mp-gp
(Marvell AXP) SPL:

Without this patch:
58963 18536 1928 79427 13643 ./spl/u-boot-spl

With this patch:
56542 18536 1956 77034 12cea ./spl/u-boot-spl

Note:
To make it possible to compile tiny-printf.c instead of vsprintf.c when
CONFIG_USE_TINY_PRINTF is defined, the functions printf() and vprintf() are
moved from common/console.c into vsprintf.c in this patch.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>

# 2419cd16 03-Oct-2015 Simon Glass <sjg@chromium.org>

dm: tpm: Drop CONFIG_DM_TPM

Now that all TPM drivers use driver model, we can drop the special driver
model CONFIG option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>

# 027b728d 06-Oct-2015 Julius Werner <jwerner@chromium.org>

Add support for LZ4 decompression algorithm

This patch adds support for LZ4-compressed FIT image contents. This
algorithm has a slightly worse compression ration than LZO while being
nearly twice as fast to decompress. When loading images from a fast
storage medium this usually results in a boot time win.

Sandbox-tested only since I don't have a U-Boot development system set
up right now. The code was imported unchanged from coreboot where it's
proven to work, though. I'm mostly interested in getting this recognized
by mkImage for use in a downstream project.

Signed-off-by: Julius Werner <jwerner@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# a7d660bc 22-Aug-2015 Simon Glass <sjg@chromium.org>

tpm: Add Kconfig options for TPMs

Add new Kconfig options for TPMs in preparation for moving boards to use
Kconfig for TPM configuration.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 867a6ac8 31-Jul-2015 Simon Glass <sjg@chromium.org>

efi: Add start-up library code

When running as an EFI application, U-Boot must request memory from EFI,
and provide access to the boot services U-Boot needs.

Add library code to perform these tasks. This includes efi_main() which is
the entry point from EFI. U-Boot is built as a shared library.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d1389403 23-Jun-2015 Simon Glass <sjg@chromium.org>

Add a dhrystone benchmark command

Drystone provides a convenient sanity check that the CPU is running at full
speed. Add this as a command which can be enabled as needed.

Note: I investigated using Coremark for this but there was a license
agreement and I could not work out if it was GPL-compatible.

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

# f7848d90 22-Jun-2015 Joe Hershberger <joe.hershberger@ni.com>

Allow CONFIG_REGEX to be disabled when CONFIG_NET

Instead of selecting REGEX when NET is enabled, make it the default, but
allow boards that are tiny to disable it and lose functionality on all
but the first Ethernet adapter.

cm-bf548, bf538f-ezkit, and bf533-stamp need this. None appear to have
more than one Ethernet interface.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# 3850dbe8 11-Jun-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

blackfin: fix undefined reference to srand and rand

Commit 9ba9e85f3f1c (net: Fix NET_RANDOM_ETHADDR dependencies)
accidentally dropped CONFIG_LIB_RAND defines for 14 Blackfin boards.

Prior to that commit, those boards defined CONFIG_LIB_RAND, but not
CONFIG_NET_RANDOM_ETHADDR. So, commit 9ba9e85f3f1c should not have
touched them, but in fact it ripped CONFIG_LIB_RAND off from all the
header files, which caused undefined reference to srand and rand.
CONFIG_LIB_RAND=y must be revived for such boards.

BTW, this commit indeed makes it better, but even with this fix,
three boards (bf533-stamp, bf538f-ezkit, cm-bf548) still can not
build due to region 'ram' overflowed error. This was cause by
commit 6eed3786c68c (net: Move the CMD_NET config to defconfigs)
because CMD_NET selects NET, and NET selects REGEX. Eventually,
some boards were newly enabled with CONFIG_REGEX, increasing the
memory footprint. A patch is expected to fix the build error.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 9ba9e85f 25-May-2015 Michal Simek <michal.simek@xilinx.com>

net: Fix NET_RANDOM_ETHADDR dependencies

NET_RANDOM_ETHADDR depends on lib/rand.c. This patch adds dependency to
Kconfig to ensure that library is also compiled.

Remove the definitions from Blackfin boards' include/configs.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 6501ff62 20-Apr-2015 Przemyslaw Marczak <p.marczak@samsung.com>

lib: Kconfig: add entry for errno_str() function

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1a60650c 21-Apr-2015 Joe Hershberger <joe.hershberger@ni.com>

kconfig: Move REGEX to Kconfig

Having this as a Kconfig allows it to be a dependent feature.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8156345d 06-Mar-2015 Simon Glass <sjg@chromium.org>

sandbox: Move CONFIG_SYS_VSNPRINTF to Kconfig

Move this over to Kconfig and tidy up.

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

# 94e3c8c4 19-Feb-2015 gaurav rana <gaurav.rana@freescale.com>

crypto/fsl - Add progressive hashing support using hardware acceleration.

Currently only normal hashing is supported using hardware acceleration.
Added support for progressive hashing using hardware.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
Signed-off-by: Gaurav Rana <gaurav.rana@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>

# d9f23c7f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

lib/rsa: Add Kconfig for devices supporting RSA Modular Exponentiation

Kconfig option added for devices which support RSA Verification.
1. RSA_SOFTWARE_EXP
Enables driver for supporting RSA Modular Exponentiation in Software
2. RSA_FREESCALE_EXP
Enables driver for supporting RSA Modular Exponentiation using Freescale specific
driver

The above drivers use RSA uclass

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
(Removed duplicate line in Kconfig comment)

Change-Id: I7663c4d5350e2bfc3dfa2696f70ef777d6ccc6f6

# c4beb22f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

FIT: Modify option FIT_SIGNATURE in Kconfig

For FIT signature based approach to work, RSA library needs to be selected.
The FIT_SIGNATURE option in Kconfig is modified to automatically select RSA.
Selecting RSA compiles the RSA library required for image verification.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 45ccec8f 23-Oct-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_USE_PRIVATE_LIBGCC to Kconfig

The private libgcc is supported only on ARM, MIPS, PowerPC, SH, x86.
Those architectures should "select" HAVE_PRIVATE_LIBGCC and
CONFIG_USE_PRIVATE_LIBGCC should depend on it.

Currently, this option is enabled on Tegra boards and x86 architecture.
Move the definition from header files to Kconfig.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Tested-by: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: Tom Warren <twarren@nvidia.com>

# 8c688bc4 23-Oct-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_SYS_HZ to lib/Kconfig

CONFIG_SYS_HZ is always defined as 1000 in config_fallbacks.h
(but some boards still have redundant definitions).

This commit moves the definition and the document in README to
Kconfig. Since lib/Kconfig can assure that CONFIG_SYS_HZ is 1000,
the sanity check in lib/time.c should be removed.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Reviewed-by: Marek Vasut <marex@denx.de>

# b0928da6 16-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED to Kconfig

If this option is enabled, the objects under lib/ directory
are compiled with speed optimization, not size optimization.
(Currently, only used by some Blackfin boards.)

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# ed36323f 16-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: add blank Kconfig files

This would be useful to start moving various config options.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# 69be8fd1 03-Jun-2020 Marek Szyprowski <m.szyprowski@samsung.com>

powerpc: move ADDR_MAP to Kconfig

Move ADDR_MAP related config options from include/configs/*.h to the
proper place in lib/Kconfig. This has been done using
./tools/moveconfig.py and manual inspection of the generated changes.
This is a preparation to use ADDR_MAP helper on ARM 32bit Raspberry Pi4
board for mapping the PCIe XHCI MMIO, which is above the 4GiB identity
mapping limit.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# d16b38f4 15-Apr-2020 Reuben Dowle <reubendowle0@gmail.com>

Add support for SHA384 and SHA512

The current recommendation for best security practice from the US government
is to use SHA384 for TOP SECRET [1].

This patch adds support for SHA384 and SHA512 in the hash command, and also
allows FIT images to be hashed with these algorithms, and signed with
sha384,rsaXXXX and sha512,rsaXXXX

The SHA implementation is adapted from the linux kernel implementation.

[1] Commercial National Security Algorithm Suite
http://www.iad.gov/iad/programs/iad-initiatives/cnsa-suite.cfm

Signed-off-by: Reuben Dowle <reuben.dowle@4rf.com>

# 43e442a5 26-May-2020 Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

kconfig: fix some typos

Signed-off-by: Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

# eff5a547 22-May-2020 Michael Walle <michael@walle.cc>

cmd: zip: automatically pull in gzip()

Move the CONFIG_GZIP_COMPRESSED from a config.h macro to a Kconfig menu
item. It is not selectable by a user because there is no reason to do
so. Instead it will be automatically selected by the stuff which uses
gzip(), like the zip command.

Remove it from the config_whitelist.txt. Also remove
CONFIG_GZIP_COMPRESS_DEF_SZ as this was never used on any board. The
default seems to be sane, otherwise it should be added as a Kconfig
option.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8239be61 06-May-2020 Simon Glass <sjg@chromium.org>

lib: Allow MD5 to be enabled in SPL

At present the MD5 option cannot be enabled by board configs since it has
no Kconfig name. It is generally enabled, so long as FIT support is
present. But not all boards use FIT, particularly in SPL

Fix this and add an option for SPL as well. This allows board code to call
md5() even if FIT support is not enabled.

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

# 04cb3994 21-Apr-2020 Weijie Gao <weijie.gao@mediatek.com>

lib: enable lzma decompression support for SPL build

This patch enables LZMA decompression support for SPL build

Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>

# 2a2119e1 05-Mar-2020 Atish Patra <atish.patra@wdc.com>

lib: kconfig: Add option to set BZIP2 compression method

There is no way to select BZIP2 compression method.
Add it under library/compression config where all other
compression related configs are present.

Signed-off-by: Atish Patra <atish.patra@wdc.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 805b3cac 12-Feb-2020 Keerthy <j-keerthy@ti.com>

lib: elf: Move the generic elf loading/validating functions to lib

Move the generic elf loading/validating functions to lib/
so that they can be re-used and accessed by code existing
outside cmd.

While at it remove the duplicate static version of load_elf_image_phdr
under arch/arm/mach-imx/imx_bootaux.c.

Signed-off-by: Keerthy <j-keerthy@ti.com>
Suggested-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>

# 1611235b 19-Jan-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: Kconfig dependencies for pseudo-random library

drivers/rng/sandbox_rng.c requires rand() to be defined but configuration
option CONFIG_CONFIG_LIB_RAND selected in drivers/rng/Kconfig does not
exist.

test/lib/test_aes.c requires rand() to be defined.

Fix the selection criteria for choice "Pseudo-random library support type".

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 3c10dc95 06-Dec-2019 Simon Glass <sjg@chromium.org>

binman: Add a library to access binman entries

SPL and TPL can access information about binman entries using link-time
symbols but this is not available in U-Boot proper. Of course it could be
made available, but the intention is to just read the device tree.

Add support for this, so that U-Boot can locate entries.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# b4adf627 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: crypto: add x509 parser

Imported from linux kernel v5.3:
x509.asn1 without changes
x509_akid.asn1 without changes
x509_parser.h without changes
x509_cert_parser.c with changes marked as __UBOOT__
x509_public_key.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# a9b45e6e 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add oid registry utility

Imported from linux kernel v5.3:
build_OID_registry without changes
oid_registry.h without changes
oid_registry.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# ab8a0e06 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add asn1 decoder

Imported from linux kernel v5.3:
lib/asn1_decoder.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 2b12196d 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

cmd: add asn1_compiler

Imported from linux kernel v5.3:
asn1.h without changes
asn1_ber_bytecode.h without changes
asn1_decoder.h without changes
asn1_compiler.c without changes

This host command will be used to create a ASN1 parser, for example,
for pkcs7 messages or x509 certificates. More specifically, it will
generate *byte code* which will be interpreted by asn1 decoder library.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 05429b6c 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

rtc: move date.c from drivers/rtc/ to lib/

In the next commit, rtc_mktime(), for compatibility with linux, will be
implemented using rtc_mktime(), which is no longer drivers/rtc specific.
So move this file under lib/.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 37ef1774 10-Nov-2019 Thomas Hebb <tommyhebb@gmail.com>

Kconfig: disambiguate config names for tiny printf

27084c03d36a ("spl: Allow tiny printf() to be controlled in SPL and
TPL") split this option in two for TPL and SPL, but didn't change the
Kconfig names, making them hard to set quickly.

Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>

# 0d76afc0 27-Oct-2019 Simon Glass <sjg@chromium.org>

fdt: Add Kconfig options to control code size

For better or worse libfdt recent grew a lot of code that checks the
validity of the device tree in great detail. When using unsigned or
unverified data this makes things safer, but it does add to code size.

Add some controls to select the trade-off between safety and code size.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 27084c03 25-Sep-2019 Simon Glass <sjg@chromium.org>

spl: Allow tiny printf() to be controlled in SPL and TPL

At present there is only one control for this and it is used for both SPL
and TPL. But SPL might have a lot more space than TPL so the extra cost of
a full printf() might be acceptable.

Split the option into two, providing separate SPL and TPL controls. The
TPL setting defaults to the same as SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2a51e16b 07-Jun-2019 Tom Rini <trini@konsulko.com>

configs: Make USE_TINY_PRINTF depend on SPL||TPL and be default

The USE_TINY_PRINTF symbol only changes things within SPL and TPL
builds, so make it depend on that support. Next, make it default as
within these cases we should rarely have need of more advanced print
formats outside of the debug context.

To do this, in a few cases we need to correct our Kconfig dependencies
as we had cases of non-SPL targets select'ing this symbol. Finally, in
the case of a few boards we really do need the full printf
functionality.

Signed-off-by: Tom Rini <trini@konsulko.com>

# da0fb5fd 02-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: make call depth limit customizable

Up to now we had hard coded values for the call depth up to which trace
records are created: 200 for early tracing, 15 thereafter. UEFI
applications reach a call depth of 80 or above.

Provide customizing settings for the call trace depth limit and the early
call trace depth limit. Use the old values as defaults.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8509f22a 29-Apr-2019 Marek Behún <marek.behun@nic.cz>

lib: add Zstandard decompression support

Add the zstd library from Linux kernel (only decompression support).
There are minimal changes to build with U-Boot, otherwise the files are
identical to Linux commit dc35da16 from March 2018, the files had not
been touched since in kernel. Also SPDX lincese tags were added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 83a486b6 29-Apr-2019 Marek Behún <marek.behun@nic.cz>

lib: Add xxhash support

This adds the xxhash support from Linux. Files are almost identical to
those added to Linux in commit 5d240522 ("lib: Add xxhash module") (they
haven't been touched since in Linux). The only difference is to add some
includes to be compatible with U-Boot. Also SPDX lincese tags were
added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 5132361a 29-Apr-2019 Heiko Schocher <hs@denx.de>

lib: Kconfig: fix help text for GZIP

commit 95f4bbd581cf ("lib: fdt: Allow LZO and GZIP DT compression in U-Boot")

introduced Kconfig option for gzip in U-Boot, but help text
says gzip for SPL, which is wrong. Fix this.

Signed-off-by: Heiko Schocher <hs@denx.de>
Acked-by: Marek Vasut <marex@denx.de>

# 1c6eb075 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE_BUFFER_SIZE et al to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE_BUFFER_SIZE
CONFIG_TRACE_EARLY_SIZE
CONFIG_TRACE_EARLY
CONFIG_TRACE_EARLY_ADDR

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

# a24a78d7 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE

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

# 54969b40 21-Mar-2019 Thierry Reding <treding@nvidia.com>

fdtdec: Add Kconfig symbol for tests

Runtime tests are provided as a test_fdtdec command implementation. Add
a Kconfig symbol that allows this command to be built so that the tests
can be used.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 95f4bbd5 08-Mar-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

lib: fdt: Allow LZO and GZIP DT compression in U-Boot

Add required Kconfig symbols, Makefile bits and macro fixes in a
few places to support LZO and DT compression in U-Boot. This can
save a lot of space with multi-DTB fitImages.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>

# 6e705114 13-Jan-2019 Chris Packham <judge.packham@gmail.com>

lib: Kconfig: spelling fixes

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 048c6e89 06-Nov-2018 Simon Glass <sjg@chromium.org>

spl: lz4: Allow use of lz4 compression in SPL

In some cases U-Boot is compressed and it is useful to be able to
decompress it in SPL. Add a Kconfig and Makefile change to allow this.
Note that this does not actually implement decompression.

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

# 2895c4b7 15-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

kconfig: Introduce HAVE_ARCH_IOMAP

Introduce a new Kconfig option for architecture codes to control
whether it provides io{read,write}{8,16,32} I/O accessor functions.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5592a633 01-Oct-2018 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt in TPL

In some cases (e.g. sandbox with verified boot) it is useful to support
libfdt in TPL. Update the Kconfig to handle this.

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

# 6307896c 01-Oct-2018 Simon Glass <sjg@chromium.org>

tpm: Add support for SPL and TPL

At present the tpm can only be used in U-Boot proper. Updated it to work
in SPL and TPL also.

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

# ab948cd2 19-Jul-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

fdt_support: make FDT_FIXUP_PARTITIONS depend on CMD_MTDPARTS

fdt_fixup_mtdparts() calls mtdparts_init() and device_find(),
which are defined in cmd/mtdparts.c

The combination of FDT_FIXUP_PARTITIONS=y and CMD_MTDPARTS=n
emits the following link error:

common/fdt_support.c:903: undefined reference to `mtdparts_init'
common/fdt_support.c:914: undefined reference to `device_find'

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 3330584d 03-Jun-2018 Igor Opaniuk <igor.opaniuk@gmail.com>

avb2.0: integrate avb 2.0 into the build system

Integrate libavb into the build system. Introduce CONFIG_LIBAVB
build option.

Signed-off-by: Igor Opaniuk <igor.opaniuk@linaro.org>

# f8c987f8 05-Jun-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

lib: Add hexdump

Often during debugging session it's very interesting to see
what data we were dealing with. For example what we write or read
to/from memory or peripherals.

This change introduces functions that allow to dump binary
data with one simple function invocation like:
------------------->8----------------
print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, buf, len);
------------------->8----------------

which gives us the following:
------------------->8----------------
00000000: f2 b7 c9 88 62 61 75 64 72 61 74 65 3d 31 31 35 ....baudrate=115
00000010: 32 30 30 00 62 6f 6f 74 61 72 67 73 3d 63 6f 6e 200.bootargs=con
00000020: 73 6f 6c 65 3d 74 74 79 53 33 2c 31 31 35 32 30 sole=ttyS3,11520
00000030: 30 6e 38 00 62 6f 6f 74 64 65 6c 61 79 3d 33 00 0n8.bootdelay=3.
00000040: 62 6f 6f 74 66 69 6c 65 3d 75 49 6d 61 67 65 00 bootfile=uImage.
00000050: 66 64 74 63 6f 6e 74 72 6f 6c 61 64 64 72 3d 39 fdtcontroladdr=9
00000060: 66 66 62 31 62 61 30 00 6c 6f 61 64 61 64 64 72 ffb1ba0.loadaddr
00000070: 3d 30 78 38 32 30 30 30 30 30 30 00 73 74 64 65 =0x82000000.stde
00000080: 72 72 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 rr=serial0@e0022
00000090: 30 30 30 00 73 74 64 69 6e 3d 73 65 72 69 61 6c 000.stdin=serial
000000a0: 30 40 65 30 30 32 32 30 30 30 00 73 74 64 6f 75 0@e0022000.stdou
000000b0: 74 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 30 t=serial0@e00220
000000c0: 30 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00..............
...
------------------->8----------------

Source of hexdump.c was copied from Linux kernel v4.7-rc2.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Mario Six <mario.six@gdsys.cc>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Stefan Roese <sr@denx.de>

# c232d14d 29-May-2018 Alex Kiernan <alex.kiernan@gmail.com>

mmc: Separate "mmc swrite" from fastboot

Introduce CONFIG_IMAGE_SPARSE and CONFIG_CMD_MMC_SWRITE so the "mmc
swrite" command is separated from the fastboot code.

Move image-sparse from common to lib so it's clear it's library code.

Rename CONFIG_FASTBOOT_FLASH_FILLBUF_SIZE to CONFIG_IMAGE_SPARSE_FILLBUF_SIZE
and migrate it to Kconfig.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Acked-by: Jassi Brar <jaswinder.singh@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6417572e 08-May-2018 Tom Rini <trini@konsulko.com>

lib/Kconfig: Mark OF_LIBFDT_OVERLAY as depending on OF_LIBFDT

The overlay code is only useful when OF_LIBFDT is set, so mark it as
depending on that first.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 58a46f88 25-Apr-2018 Praneeth Bajjuri <praneeth@ti.com>

configs: TI: Enable FIT Library overlay support

Enable the FDT library overlay support for all TI SOC family.

Without this option, when Loading fdt from FIT image, the
following warning is seen.

"config with overlays but CONFIG_OF_LIBFDT_OVERLAY not set".

Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
Suggested-by: Andrew F.Davis <afd@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>

# 14ad44ab 18-Apr-2018 Alex Kiernan <alex.kiernan@gmail.com>

spl: Split sprintf, strto* from SPL serial in Kconfig

When SPL serial is disabled, callers who need sprintf or strtoul fail
because their inclusion is guarded by CONFIG_SPL_SERIAL_SUPPORT/
CONFIG_TPL_SERIAL_SUPPORT.

Split printf, sprintf and strto into their own entries and then select
all of them if SERIAL_SUPPORT is enabled to match the current behaviour.

Include panic.o unconditionally as it can be called from anywhere which
uses BUG_ON().

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>

# e294ba06 04-Apr-2018 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-sunxi

Signed-off-by: Tom Rini <trini@konsulko.com>


# d14db11d 03-Apr-2018 Andre Przywara <andre.przywara@arm.com>

sunxi: revert disabling of features

In January some commits were introduced to mitigate the U-Boot image
size issues we encountered on sunxi builds.
Now with the MMC environment removed we can bring them back, as we
practically don't have a size limit anymore.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 32ce6179 13-Mar-2018 Bryan O'Donoghue <bryan.odonoghue@linaro.org>

optee: Add lib entries for sharing OPTEE code across ports

This patch adds code to lib to enable sharing of useful OPTEE code between
board-ports and architectures. The code on lib/optee/optee.c comes from the
TI omap2 port. Eventually the OMAP2 code will be patched to include the
shared code. The intention here is to add more useful OPTEE specific code
as more functionality gets added.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Cc: Harinarayan Bhatta <harinarayan@ti.com>
Cc: Andrew F. Davis <afd@ti.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Kever Yang <kever.yang@rock-chips.com>
Cc: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Cc: Peng Fan <peng.fan@nxp.com>
Tested-by: Peng Fan <peng.fan@nxp.com>

# 36c1877c 06-Feb-2018 Faiz Abbas <faiz_abbas@ti.com>

lib: Kconfig: Move DYNAMIC_CRC_TABLE to Kconfig

Add CONFIG prefix to DYNAMIC_CRC_TABLE and implement it in
Kconfig.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>

# a451bc27 05-Feb-2018 Adam Ford <aford173@gmail.com>

Convert LIB_UUID to Kconfig

config_fallback.h has some logic that checks a variety of options
and selects LIB_UUID if it hasn't already been selected. This
will all LIB_UUID in Kconfig and select this option for the list
of options to allow us to remove the logic from fallbacks

Signed-off-by: Adam Ford <aford173@gmail.com>

# a5a37567 06-Feb-2018 Adam Ford <aford173@gmail.com>

Convert CONFIG LIB_HW_RAND to Kconfig

config_fallbacks.h had some logic to automatically select
LIB_RAND if RANDOM_UUID or CMD_UUID were set if LIB_HW_RAND wasn't
already selected. By migrating LIB_HW_RAND to Kconfig, we can
remove this check from config_fallbacks.h and put it into Kconfig

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
[trini: Turn into a choice, add NET_RANDOM_ETHADDR]
Signed-off-by: Tom Rini <trini@konsulko.com>

# acd4d334 16-Jan-2018 Maxime Ripard <maxime.ripard@free-electrons.com>

net: regex: Disable by default on sunXi

The sunXi arm64 build has overflown, leading to the main U-boot binary
overwriting the environment when flashing the new image, or even worse,
overwriting itself when we're calling saveenv.

Disable this option that is not critical until we can adress the issue
properly.

Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 7e3caa81 03-Dec-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

Move CONFIG_PANIC_HANG to Kconfig

Freescale (NXP) boards have lots of defconfig files per board.
I used "imply PANIC_HANG" for them.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# da5337a6 08-Nov-2017 Nandor Han <nandor.han@ge.com>

rtc: add support for s35392a

Add support for S35392A RTC. The driver supports both U-Boot driver
models.

Signed-off-by: Nandor Han <nandor.han@ge.com>
Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
Cc: Heiko Schocher <hs@denx.de>

# f52bdf4b 14-Sep-2017 Jean-Jacques Hiblot <jjhiblot@ti.com>

lib: allow building lzo for the SPL

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 85d8bf57 03-Sep-2017 Marek Behún <marek.behun@nic.cz>

lib: Add CRC32-C

This is needed for BTRFS.

Signed-off-by: Marek Behun <marek.behun@nic.cz>

create mode 100644 lib/crc32c.c

# 7264f292 15-Aug-2017 York Sun <york.sun@nxp.com>

spl: fit: Eanble GZIP support for image decompression

Add Kconfig option SPL_GZIP and SPL_ZLIB to enable gunzip support for
SPL boot, eg. falcon boot compressed kernel image.

Signed-off-by: York Sun <york.sun@nxp.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6ef2f901 11-Aug-2017 Adam Ford <aford173@gmail.com>

Convert CONFIG_BCH to Kconfig

This converts the following to Kconfig:
CONFIG_BCH

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1a7ba1d 18-Aug-2017 Anatolij Gustschin <agust@denx.de>

Fix 'notes' typos

s/notes/nodes

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 96b9082c 03-Aug-2017 Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

rockchip: rk3188: rock: adjust for SPL/TPL split

With the changes to split SPL/TPL for the RK3368, I apparently missed
some needed adjustments to the RK3188 Kconfig and rock_defconfig.

This fixes build-issues for the rock board after applying the RK3368
enablement (and SPL/TPL) set that resulted from TPL_SERIAL_SUPPORT,
TPL_ROCKCHIP_BACK_TO_BROM and TPL_TINY_MEMSET being separate symbols
now.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d56b4b19 22-Jul-2017 Tom Rini <trini@konsulko.com>

configs: Migrate RBTREE, LZO, CMD_MTDPARTS, CMD_UBI and CMD_UBIFS

The above CONFIG options are in Kconfig, and now have correct depends and
inter-dependencies. Migrate these to configs/ from include/configs/. In the
case of CMD_UBIFS also change it to be a default y if CMD_UBI.

Signed-off-by: Tom Rini <trini@konsulko.com>

# aed998aa 17-May-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_LZMA to Kconfig

This converts the following to Kconfig:
CONFIG_LZMA

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

# b1a873df 26-Apr-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_CMD_AES et al to Kconfig

This converts the following to Kconfig:
CONFIG_CMD_AES
CONFIG_AES

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Add select AES to CMD_AES]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 173aafbf 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

cmd: Expose a Kconfig option to enable UBIFS commands

Create a new Kconfig entry to allow CMD_UBIFS selection from Kconfig and
add an hidden LZO option that can be selected by CMD_UBIFS.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>

# aa049152 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

mtd: ubi: Select RBTREE option from MTD_UBI Kconfig entry

Expose the RBTREE feature through Kconfig and select this option from the
MTD_UBI option.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>
[Rebased on master]
Signed-off-by: Jagan Teki <jagan@openedev.com>

# ab4458bd 02-Apr-2017 Simon Glass <sjg@chromium.org>

string: Provide a slimmed-down memset()

Most of the time the optimised memset() is what we want. For extreme
situations such as TPL it may be too large. For example on the 'rock'
board, using a simple loop saves a useful 48 bytes. With gcc 4.9 and
the rodata bug, this patch is enough to reduce the TPL image below the
limit.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>

# bea79d7d 14-Mar-2017 Andre Przywara <andre.przywara@arm.com>

Kconfig: introduce md5sum command selection

So far CONFIG_MD5SUM would need to be set by a board's include file.
Since the command is really generic, move it over to Kconfig to allow
it to be defined by either a board's defconfig, menuconfig or some
config snippet merged via mergeconfig.sh.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e663b350 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

smbios: Expose in efi_loader as table

We can pass SMBIOS easily as EFI configuration table to an EFI payload. This
patch adds enablement for that case.

While at it, we also enable SMBIOS generation for ARM systems, since they support
EFI_LOADER.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4b6dddc2 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

x86: Move smbios generation into arch independent directory

We will need the SMBIOS generation function on ARM as well going forward,
so let's move it into a non arch specific location.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# ebf7fff2 05-Oct-2016 Heiko Schocher <hs@denx.de>

spl: move FDT_FIXUP_PARTITIONS to Kconfig

Move FDT_FIXUP_PARTITIONS to Kconfig and cleanup existing
uses.

Signed-off-by: Heiko Schocher <hs@denx.de>

# ddf67f71 05-Jul-2016 Maxime Ripard <maxime.ripard@free-electrons.com>

libfdt: Add overlay application function

The device tree overlays are a good way to deal with user-modifyable
boards or boards with some kind of an expansion mechanism where we can
easily plug new board in (like the BBB, the Raspberry Pi or the CHIP).

Add a new function to merge overlays with a base device tree.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>

# 91b86e21 26-May-2016 Marek Vasut <marex@denx.de>

lib: Enable private libgcc by default

This patch decouples U-Boot binary from the toolchain on systems where
private libgcc is available. Instead of pulling in functions provided
by the libgcc from the toolchain, U-Boot will use it's own set of libgcc
functions. These functions are usually imported from Linux kernel, which
also uses it's own libgcc functions instead of the ones provided by the
toolchain.

This patch solves a rather common problem. The toolchain can usually
generate code for many variants of target architecture and often even
different endianness. The libgcc on the other hand is usually compiled
for one particular configuration and the functions provided by it may
or may not be suited for use in U-Boot. This can manifest in two ways,
either the U-Boot fails to compile altogether and linker will complain
or, in the much worse case, the resulting U-Boot will build, but will
misbehave in very subtle and hard to debug ways.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 67976306 30-Mar-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

cosmetic: Fix typos "privide"

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# ed980b8c 03-Mar-2016 Alexander Graf <agraf@csgraf.de>

efi_loader: hook up in build environment

Now that we have all the bits and pieces ready for EFI payload loading
support, hook them up in Makefiles and KConfigs so that we can build.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
[trini: Enable only when we of OF_LIBFDT, disable on kwb and colibri_pxa270]
Signed-off-by: Tom Rini <trini@konsulko.com>

# aa34fbc0 22-Feb-2016 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt to be used in SPL

Add an option to enable libfdt in SPL. This can be useful when decoding
FIT files in SPL.

We need to make sure this option is not enabled in SPL by this change.
Also this option needs to be enabled in host builds. Si add a new
IMAGE_USE_LIBFDT #define which can be used in files that are built on the
host but must also build for U-Boot and SPL.

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

# 69e173eb 22-Feb-2016 Simon Glass <sjg@chromium.org>

Move CONFIG_OF_LIBFDT to Kconfig

Move this option to Kconfig and tidy up existing boards.

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

# a187559e 05-Feb-2016 Bin Meng <bmeng.cn@gmail.com>

Use correct spelling of "U-Boot"

Correct spelling of "U-Boot" shall be used in all written text
(documentation, comments in source files etc.).

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Minkyu Kang <mk7.kang@samsung.com>

# 947c626d 14-Jan-2016 Tom Rini <trini@konsulko.com>

vsprintf.c: Always enable CONFIG_SYS_VSNPRINTF

Enabling this function always removes some class of string saftey issues.
The size change here in general is about 400 bytes and this seems a reasonable
trade-off.

Cc: Peng Fan <peng.fan@nxp.com>
Cc: Peter Robinson <pbrobinson@gmail.com>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Adrian Alonso <aalonso@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 7d9cde10 22-Nov-2015 Stefan Roese <sr@denx.de>

lib/tiny-printf.c: Add tiny printf function for space limited environments

This patch adds a small printf() version that supports all basic formats.
Its intented to be used in U-Boot SPL versions on platforms with very
limited internal RAM sizes.

To enable it, just define CONFIG_USE_TINY_PRINTF in your defconfig. This
will result in the SPL using this tiny function and the main U-Boot
still using the full-blown printf() function.

This code was copied from:
http://www.sparetimelabs.com/printfrevisited
With mostly only coding style related changes so that its checkpatch
clean.

The size reduction is about 2.5KiB. Here a comparison for the db-mv784mp-gp
(Marvell AXP) SPL:

Without this patch:
58963 18536 1928 79427 13643 ./spl/u-boot-spl

With this patch:
56542 18536 1956 77034 12cea ./spl/u-boot-spl

Note:
To make it possible to compile tiny-printf.c instead of vsprintf.c when
CONFIG_USE_TINY_PRINTF is defined, the functions printf() and vprintf() are
moved from common/console.c into vsprintf.c in this patch.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>

# 2419cd16 03-Oct-2015 Simon Glass <sjg@chromium.org>

dm: tpm: Drop CONFIG_DM_TPM

Now that all TPM drivers use driver model, we can drop the special driver
model CONFIG option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>

# 027b728d 06-Oct-2015 Julius Werner <jwerner@chromium.org>

Add support for LZ4 decompression algorithm

This patch adds support for LZ4-compressed FIT image contents. This
algorithm has a slightly worse compression ration than LZO while being
nearly twice as fast to decompress. When loading images from a fast
storage medium this usually results in a boot time win.

Sandbox-tested only since I don't have a U-Boot development system set
up right now. The code was imported unchanged from coreboot where it's
proven to work, though. I'm mostly interested in getting this recognized
by mkImage for use in a downstream project.

Signed-off-by: Julius Werner <jwerner@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# a7d660bc 22-Aug-2015 Simon Glass <sjg@chromium.org>

tpm: Add Kconfig options for TPMs

Add new Kconfig options for TPMs in preparation for moving boards to use
Kconfig for TPM configuration.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 867a6ac8 31-Jul-2015 Simon Glass <sjg@chromium.org>

efi: Add start-up library code

When running as an EFI application, U-Boot must request memory from EFI,
and provide access to the boot services U-Boot needs.

Add library code to perform these tasks. This includes efi_main() which is
the entry point from EFI. U-Boot is built as a shared library.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d1389403 23-Jun-2015 Simon Glass <sjg@chromium.org>

Add a dhrystone benchmark command

Drystone provides a convenient sanity check that the CPU is running at full
speed. Add this as a command which can be enabled as needed.

Note: I investigated using Coremark for this but there was a license
agreement and I could not work out if it was GPL-compatible.

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

# f7848d90 22-Jun-2015 Joe Hershberger <joe.hershberger@ni.com>

Allow CONFIG_REGEX to be disabled when CONFIG_NET

Instead of selecting REGEX when NET is enabled, make it the default, but
allow boards that are tiny to disable it and lose functionality on all
but the first Ethernet adapter.

cm-bf548, bf538f-ezkit, and bf533-stamp need this. None appear to have
more than one Ethernet interface.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# 3850dbe8 11-Jun-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

blackfin: fix undefined reference to srand and rand

Commit 9ba9e85f3f1c (net: Fix NET_RANDOM_ETHADDR dependencies)
accidentally dropped CONFIG_LIB_RAND defines for 14 Blackfin boards.

Prior to that commit, those boards defined CONFIG_LIB_RAND, but not
CONFIG_NET_RANDOM_ETHADDR. So, commit 9ba9e85f3f1c should not have
touched them, but in fact it ripped CONFIG_LIB_RAND off from all the
header files, which caused undefined reference to srand and rand.
CONFIG_LIB_RAND=y must be revived for such boards.

BTW, this commit indeed makes it better, but even with this fix,
three boards (bf533-stamp, bf538f-ezkit, cm-bf548) still can not
build due to region 'ram' overflowed error. This was cause by
commit 6eed3786c68c (net: Move the CMD_NET config to defconfigs)
because CMD_NET selects NET, and NET selects REGEX. Eventually,
some boards were newly enabled with CONFIG_REGEX, increasing the
memory footprint. A patch is expected to fix the build error.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 9ba9e85f 25-May-2015 Michal Simek <michal.simek@xilinx.com>

net: Fix NET_RANDOM_ETHADDR dependencies

NET_RANDOM_ETHADDR depends on lib/rand.c. This patch adds dependency to
Kconfig to ensure that library is also compiled.

Remove the definitions from Blackfin boards' include/configs.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 6501ff62 20-Apr-2015 Przemyslaw Marczak <p.marczak@samsung.com>

lib: Kconfig: add entry for errno_str() function

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1a60650c 21-Apr-2015 Joe Hershberger <joe.hershberger@ni.com>

kconfig: Move REGEX to Kconfig

Having this as a Kconfig allows it to be a dependent feature.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8156345d 06-Mar-2015 Simon Glass <sjg@chromium.org>

sandbox: Move CONFIG_SYS_VSNPRINTF to Kconfig

Move this over to Kconfig and tidy up.

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

# 94e3c8c4 19-Feb-2015 gaurav rana <gaurav.rana@freescale.com>

crypto/fsl - Add progressive hashing support using hardware acceleration.

Currently only normal hashing is supported using hardware acceleration.
Added support for progressive hashing using hardware.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
Signed-off-by: Gaurav Rana <gaurav.rana@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>

# d9f23c7f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

lib/rsa: Add Kconfig for devices supporting RSA Modular Exponentiation

Kconfig option added for devices which support RSA Verification.
1. RSA_SOFTWARE_EXP
Enables driver for supporting RSA Modular Exponentiation in Software
2. RSA_FREESCALE_EXP
Enables driver for supporting RSA Modular Exponentiation using Freescale specific
driver

The above drivers use RSA uclass

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
(Removed duplicate line in Kconfig comment)

Change-Id: I7663c4d5350e2bfc3dfa2696f70ef777d6ccc6f6

# c4beb22f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

FIT: Modify option FIT_SIGNATURE in Kconfig

For FIT signature based approach to work, RSA library needs to be selected.
The FIT_SIGNATURE option in Kconfig is modified to automatically select RSA.
Selecting RSA compiles the RSA library required for image verification.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 45ccec8f 23-Oct-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_USE_PRIVATE_LIBGCC to Kconfig

The private libgcc is supported only on ARM, MIPS, PowerPC, SH, x86.
Those architectures should "select" HAVE_PRIVATE_LIBGCC and
CONFIG_USE_PRIVATE_LIBGCC should depend on it.

Currently, this option is enabled on Tegra boards and x86 architecture.
Move the definition from header files to Kconfig.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Tested-by: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: Tom Warren <twarren@nvidia.com>

# 8c688bc4 23-Oct-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_SYS_HZ to lib/Kconfig

CONFIG_SYS_HZ is always defined as 1000 in config_fallbacks.h
(but some boards still have redundant definitions).

This commit moves the definition and the document in README to
Kconfig. Since lib/Kconfig can assure that CONFIG_SYS_HZ is 1000,
the sanity check in lib/time.c should be removed.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Reviewed-by: Marek Vasut <marex@denx.de>

# b0928da6 16-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED to Kconfig

If this option is enabled, the objects under lib/ directory
are compiled with speed optimization, not size optimization.
(Currently, only used by some Blackfin boards.)

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# ed36323f 16-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: add blank Kconfig files

This would be useful to start moving various config options.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# d16b38f4 15-Apr-2020 Reuben Dowle <reubendowle0@gmail.com>

Add support for SHA384 and SHA512

The current recommendation for best security practice from the US government
is to use SHA384 for TOP SECRET [1].

This patch adds support for SHA384 and SHA512 in the hash command, and also
allows FIT images to be hashed with these algorithms, and signed with
sha384,rsaXXXX and sha512,rsaXXXX

The SHA implementation is adapted from the linux kernel implementation.

[1] Commercial National Security Algorithm Suite
http://www.iad.gov/iad/programs/iad-initiatives/cnsa-suite.cfm

Signed-off-by: Reuben Dowle <reuben.dowle@4rf.com>

# 43e442a5 26-May-2020 Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

kconfig: fix some typos

Signed-off-by: Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

# eff5a547 22-May-2020 Michael Walle <michael@walle.cc>

cmd: zip: automatically pull in gzip()

Move the CONFIG_GZIP_COMPRESSED from a config.h macro to a Kconfig menu
item. It is not selectable by a user because there is no reason to do
so. Instead it will be automatically selected by the stuff which uses
gzip(), like the zip command.

Remove it from the config_whitelist.txt. Also remove
CONFIG_GZIP_COMPRESS_DEF_SZ as this was never used on any board. The
default seems to be sane, otherwise it should be added as a Kconfig
option.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8239be61 06-May-2020 Simon Glass <sjg@chromium.org>

lib: Allow MD5 to be enabled in SPL

At present the MD5 option cannot be enabled by board configs since it has
no Kconfig name. It is generally enabled, so long as FIT support is
present. But not all boards use FIT, particularly in SPL

Fix this and add an option for SPL as well. This allows board code to call
md5() even if FIT support is not enabled.

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

# 04cb3994 21-Apr-2020 Weijie Gao <weijie.gao@mediatek.com>

lib: enable lzma decompression support for SPL build

This patch enables LZMA decompression support for SPL build

Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>

# 2a2119e1 05-Mar-2020 Atish Patra <atish.patra@wdc.com>

lib: kconfig: Add option to set BZIP2 compression method

There is no way to select BZIP2 compression method.
Add it under library/compression config where all other
compression related configs are present.

Signed-off-by: Atish Patra <atish.patra@wdc.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 805b3cac 12-Feb-2020 Keerthy <j-keerthy@ti.com>

lib: elf: Move the generic elf loading/validating functions to lib

Move the generic elf loading/validating functions to lib/
so that they can be re-used and accessed by code existing
outside cmd.

While at it remove the duplicate static version of load_elf_image_phdr
under arch/arm/mach-imx/imx_bootaux.c.

Signed-off-by: Keerthy <j-keerthy@ti.com>
Suggested-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>

# 1611235b 19-Jan-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: Kconfig dependencies for pseudo-random library

drivers/rng/sandbox_rng.c requires rand() to be defined but configuration
option CONFIG_CONFIG_LIB_RAND selected in drivers/rng/Kconfig does not
exist.

test/lib/test_aes.c requires rand() to be defined.

Fix the selection criteria for choice "Pseudo-random library support type".

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 3c10dc95 06-Dec-2019 Simon Glass <sjg@chromium.org>

binman: Add a library to access binman entries

SPL and TPL can access information about binman entries using link-time
symbols but this is not available in U-Boot proper. Of course it could be
made available, but the intention is to just read the device tree.

Add support for this, so that U-Boot can locate entries.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# b4adf627 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: crypto: add x509 parser

Imported from linux kernel v5.3:
x509.asn1 without changes
x509_akid.asn1 without changes
x509_parser.h without changes
x509_cert_parser.c with changes marked as __UBOOT__
x509_public_key.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# a9b45e6e 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add oid registry utility

Imported from linux kernel v5.3:
build_OID_registry without changes
oid_registry.h without changes
oid_registry.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# ab8a0e06 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add asn1 decoder

Imported from linux kernel v5.3:
lib/asn1_decoder.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 2b12196d 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

cmd: add asn1_compiler

Imported from linux kernel v5.3:
asn1.h without changes
asn1_ber_bytecode.h without changes
asn1_decoder.h without changes
asn1_compiler.c without changes

This host command will be used to create a ASN1 parser, for example,
for pkcs7 messages or x509 certificates. More specifically, it will
generate *byte code* which will be interpreted by asn1 decoder library.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 05429b6c 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

rtc: move date.c from drivers/rtc/ to lib/

In the next commit, rtc_mktime(), for compatibility with linux, will be
implemented using rtc_mktime(), which is no longer drivers/rtc specific.
So move this file under lib/.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 37ef1774 10-Nov-2019 Thomas Hebb <tommyhebb@gmail.com>

Kconfig: disambiguate config names for tiny printf

27084c03d36a ("spl: Allow tiny printf() to be controlled in SPL and
TPL") split this option in two for TPL and SPL, but didn't change the
Kconfig names, making them hard to set quickly.

Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>

# 0d76afc0 27-Oct-2019 Simon Glass <sjg@chromium.org>

fdt: Add Kconfig options to control code size

For better or worse libfdt recent grew a lot of code that checks the
validity of the device tree in great detail. When using unsigned or
unverified data this makes things safer, but it does add to code size.

Add some controls to select the trade-off between safety and code size.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 27084c03 25-Sep-2019 Simon Glass <sjg@chromium.org>

spl: Allow tiny printf() to be controlled in SPL and TPL

At present there is only one control for this and it is used for both SPL
and TPL. But SPL might have a lot more space than TPL so the extra cost of
a full printf() might be acceptable.

Split the option into two, providing separate SPL and TPL controls. The
TPL setting defaults to the same as SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2a51e16b 07-Jun-2019 Tom Rini <trini@konsulko.com>

configs: Make USE_TINY_PRINTF depend on SPL||TPL and be default

The USE_TINY_PRINTF symbol only changes things within SPL and TPL
builds, so make it depend on that support. Next, make it default as
within these cases we should rarely have need of more advanced print
formats outside of the debug context.

To do this, in a few cases we need to correct our Kconfig dependencies
as we had cases of non-SPL targets select'ing this symbol. Finally, in
the case of a few boards we really do need the full printf
functionality.

Signed-off-by: Tom Rini <trini@konsulko.com>

# da0fb5fd 02-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: make call depth limit customizable

Up to now we had hard coded values for the call depth up to which trace
records are created: 200 for early tracing, 15 thereafter. UEFI
applications reach a call depth of 80 or above.

Provide customizing settings for the call trace depth limit and the early
call trace depth limit. Use the old values as defaults.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8509f22a 29-Apr-2019 Marek Behún <marek.behun@nic.cz>

lib: add Zstandard decompression support

Add the zstd library from Linux kernel (only decompression support).
There are minimal changes to build with U-Boot, otherwise the files are
identical to Linux commit dc35da16 from March 2018, the files had not
been touched since in kernel. Also SPDX lincese tags were added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 83a486b6 29-Apr-2019 Marek Behún <marek.behun@nic.cz>

lib: Add xxhash support

This adds the xxhash support from Linux. Files are almost identical to
those added to Linux in commit 5d240522 ("lib: Add xxhash module") (they
haven't been touched since in Linux). The only difference is to add some
includes to be compatible with U-Boot. Also SPDX lincese tags were
added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 5132361a 29-Apr-2019 Heiko Schocher <hs@denx.de>

lib: Kconfig: fix help text for GZIP

commit 95f4bbd581cf ("lib: fdt: Allow LZO and GZIP DT compression in U-Boot")

introduced Kconfig option for gzip in U-Boot, but help text
says gzip for SPL, which is wrong. Fix this.

Signed-off-by: Heiko Schocher <hs@denx.de>
Acked-by: Marek Vasut <marex@denx.de>

# 1c6eb075 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE_BUFFER_SIZE et al to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE_BUFFER_SIZE
CONFIG_TRACE_EARLY_SIZE
CONFIG_TRACE_EARLY
CONFIG_TRACE_EARLY_ADDR

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

# a24a78d7 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE

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

# 54969b40 21-Mar-2019 Thierry Reding <treding@nvidia.com>

fdtdec: Add Kconfig symbol for tests

Runtime tests are provided as a test_fdtdec command implementation. Add
a Kconfig symbol that allows this command to be built so that the tests
can be used.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 95f4bbd5 08-Mar-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

lib: fdt: Allow LZO and GZIP DT compression in U-Boot

Add required Kconfig symbols, Makefile bits and macro fixes in a
few places to support LZO and DT compression in U-Boot. This can
save a lot of space with multi-DTB fitImages.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>

# 6e705114 13-Jan-2019 Chris Packham <judge.packham@gmail.com>

lib: Kconfig: spelling fixes

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 048c6e89 06-Nov-2018 Simon Glass <sjg@chromium.org>

spl: lz4: Allow use of lz4 compression in SPL

In some cases U-Boot is compressed and it is useful to be able to
decompress it in SPL. Add a Kconfig and Makefile change to allow this.
Note that this does not actually implement decompression.

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

# 2895c4b7 15-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

kconfig: Introduce HAVE_ARCH_IOMAP

Introduce a new Kconfig option for architecture codes to control
whether it provides io{read,write}{8,16,32} I/O accessor functions.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5592a633 01-Oct-2018 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt in TPL

In some cases (e.g. sandbox with verified boot) it is useful to support
libfdt in TPL. Update the Kconfig to handle this.

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

# 6307896c 01-Oct-2018 Simon Glass <sjg@chromium.org>

tpm: Add support for SPL and TPL

At present the tpm can only be used in U-Boot proper. Updated it to work
in SPL and TPL also.

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

# ab948cd2 19-Jul-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

fdt_support: make FDT_FIXUP_PARTITIONS depend on CMD_MTDPARTS

fdt_fixup_mtdparts() calls mtdparts_init() and device_find(),
which are defined in cmd/mtdparts.c

The combination of FDT_FIXUP_PARTITIONS=y and CMD_MTDPARTS=n
emits the following link error:

common/fdt_support.c:903: undefined reference to `mtdparts_init'
common/fdt_support.c:914: undefined reference to `device_find'

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 3330584d 03-Jun-2018 Igor Opaniuk <igor.opaniuk@gmail.com>

avb2.0: integrate avb 2.0 into the build system

Integrate libavb into the build system. Introduce CONFIG_LIBAVB
build option.

Signed-off-by: Igor Opaniuk <igor.opaniuk@linaro.org>

# f8c987f8 05-Jun-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

lib: Add hexdump

Often during debugging session it's very interesting to see
what data we were dealing with. For example what we write or read
to/from memory or peripherals.

This change introduces functions that allow to dump binary
data with one simple function invocation like:
------------------->8----------------
print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, buf, len);
------------------->8----------------

which gives us the following:
------------------->8----------------
00000000: f2 b7 c9 88 62 61 75 64 72 61 74 65 3d 31 31 35 ....baudrate=115
00000010: 32 30 30 00 62 6f 6f 74 61 72 67 73 3d 63 6f 6e 200.bootargs=con
00000020: 73 6f 6c 65 3d 74 74 79 53 33 2c 31 31 35 32 30 sole=ttyS3,11520
00000030: 30 6e 38 00 62 6f 6f 74 64 65 6c 61 79 3d 33 00 0n8.bootdelay=3.
00000040: 62 6f 6f 74 66 69 6c 65 3d 75 49 6d 61 67 65 00 bootfile=uImage.
00000050: 66 64 74 63 6f 6e 74 72 6f 6c 61 64 64 72 3d 39 fdtcontroladdr=9
00000060: 66 66 62 31 62 61 30 00 6c 6f 61 64 61 64 64 72 ffb1ba0.loadaddr
00000070: 3d 30 78 38 32 30 30 30 30 30 30 00 73 74 64 65 =0x82000000.stde
00000080: 72 72 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 rr=serial0@e0022
00000090: 30 30 30 00 73 74 64 69 6e 3d 73 65 72 69 61 6c 000.stdin=serial
000000a0: 30 40 65 30 30 32 32 30 30 30 00 73 74 64 6f 75 0@e0022000.stdou
000000b0: 74 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 30 t=serial0@e00220
000000c0: 30 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00..............
...
------------------->8----------------

Source of hexdump.c was copied from Linux kernel v4.7-rc2.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Mario Six <mario.six@gdsys.cc>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Stefan Roese <sr@denx.de>

# c232d14d 29-May-2018 Alex Kiernan <alex.kiernan@gmail.com>

mmc: Separate "mmc swrite" from fastboot

Introduce CONFIG_IMAGE_SPARSE and CONFIG_CMD_MMC_SWRITE so the "mmc
swrite" command is separated from the fastboot code.

Move image-sparse from common to lib so it's clear it's library code.

Rename CONFIG_FASTBOOT_FLASH_FILLBUF_SIZE to CONFIG_IMAGE_SPARSE_FILLBUF_SIZE
and migrate it to Kconfig.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Acked-by: Jassi Brar <jaswinder.singh@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6417572e 08-May-2018 Tom Rini <trini@konsulko.com>

lib/Kconfig: Mark OF_LIBFDT_OVERLAY as depending on OF_LIBFDT

The overlay code is only useful when OF_LIBFDT is set, so mark it as
depending on that first.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 58a46f88 25-Apr-2018 Praneeth Bajjuri <praneeth@ti.com>

configs: TI: Enable FIT Library overlay support

Enable the FDT library overlay support for all TI SOC family.

Without this option, when Loading fdt from FIT image, the
following warning is seen.

"config with overlays but CONFIG_OF_LIBFDT_OVERLAY not set".

Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
Suggested-by: Andrew F.Davis <afd@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>

# 14ad44ab 18-Apr-2018 Alex Kiernan <alex.kiernan@gmail.com>

spl: Split sprintf, strto* from SPL serial in Kconfig

When SPL serial is disabled, callers who need sprintf or strtoul fail
because their inclusion is guarded by CONFIG_SPL_SERIAL_SUPPORT/
CONFIG_TPL_SERIAL_SUPPORT.

Split printf, sprintf and strto into their own entries and then select
all of them if SERIAL_SUPPORT is enabled to match the current behaviour.

Include panic.o unconditionally as it can be called from anywhere which
uses BUG_ON().

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>

# e294ba06 04-Apr-2018 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-sunxi

Signed-off-by: Tom Rini <trini@konsulko.com>


# d14db11d 03-Apr-2018 Andre Przywara <andre.przywara@arm.com>

sunxi: revert disabling of features

In January some commits were introduced to mitigate the U-Boot image
size issues we encountered on sunxi builds.
Now with the MMC environment removed we can bring them back, as we
practically don't have a size limit anymore.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 32ce6179 13-Mar-2018 Bryan O'Donoghue <bryan.odonoghue@linaro.org>

optee: Add lib entries for sharing OPTEE code across ports

This patch adds code to lib to enable sharing of useful OPTEE code between
board-ports and architectures. The code on lib/optee/optee.c comes from the
TI omap2 port. Eventually the OMAP2 code will be patched to include the
shared code. The intention here is to add more useful OPTEE specific code
as more functionality gets added.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Cc: Harinarayan Bhatta <harinarayan@ti.com>
Cc: Andrew F. Davis <afd@ti.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Kever Yang <kever.yang@rock-chips.com>
Cc: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Cc: Peng Fan <peng.fan@nxp.com>
Tested-by: Peng Fan <peng.fan@nxp.com>

# 36c1877c 06-Feb-2018 Faiz Abbas <faiz_abbas@ti.com>

lib: Kconfig: Move DYNAMIC_CRC_TABLE to Kconfig

Add CONFIG prefix to DYNAMIC_CRC_TABLE and implement it in
Kconfig.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>

# a451bc27 05-Feb-2018 Adam Ford <aford173@gmail.com>

Convert LIB_UUID to Kconfig

config_fallback.h has some logic that checks a variety of options
and selects LIB_UUID if it hasn't already been selected. This
will all LIB_UUID in Kconfig and select this option for the list
of options to allow us to remove the logic from fallbacks

Signed-off-by: Adam Ford <aford173@gmail.com>

# a5a37567 06-Feb-2018 Adam Ford <aford173@gmail.com>

Convert CONFIG LIB_HW_RAND to Kconfig

config_fallbacks.h had some logic to automatically select
LIB_RAND if RANDOM_UUID or CMD_UUID were set if LIB_HW_RAND wasn't
already selected. By migrating LIB_HW_RAND to Kconfig, we can
remove this check from config_fallbacks.h and put it into Kconfig

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
[trini: Turn into a choice, add NET_RANDOM_ETHADDR]
Signed-off-by: Tom Rini <trini@konsulko.com>

# acd4d334 16-Jan-2018 Maxime Ripard <maxime.ripard@free-electrons.com>

net: regex: Disable by default on sunXi

The sunXi arm64 build has overflown, leading to the main U-boot binary
overwriting the environment when flashing the new image, or even worse,
overwriting itself when we're calling saveenv.

Disable this option that is not critical until we can adress the issue
properly.

Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 7e3caa81 03-Dec-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

Move CONFIG_PANIC_HANG to Kconfig

Freescale (NXP) boards have lots of defconfig files per board.
I used "imply PANIC_HANG" for them.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# da5337a6 08-Nov-2017 Nandor Han <nandor.han@ge.com>

rtc: add support for s35392a

Add support for S35392A RTC. The driver supports both U-Boot driver
models.

Signed-off-by: Nandor Han <nandor.han@ge.com>
Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
Cc: Heiko Schocher <hs@denx.de>

# f52bdf4b 14-Sep-2017 Jean-Jacques Hiblot <jjhiblot@ti.com>

lib: allow building lzo for the SPL

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 85d8bf57 03-Sep-2017 Marek Behún <marek.behun@nic.cz>

lib: Add CRC32-C

This is needed for BTRFS.

Signed-off-by: Marek Behun <marek.behun@nic.cz>

create mode 100644 lib/crc32c.c

# 7264f292 15-Aug-2017 York Sun <york.sun@nxp.com>

spl: fit: Eanble GZIP support for image decompression

Add Kconfig option SPL_GZIP and SPL_ZLIB to enable gunzip support for
SPL boot, eg. falcon boot compressed kernel image.

Signed-off-by: York Sun <york.sun@nxp.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6ef2f901 11-Aug-2017 Adam Ford <aford173@gmail.com>

Convert CONFIG_BCH to Kconfig

This converts the following to Kconfig:
CONFIG_BCH

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1a7ba1d 18-Aug-2017 Anatolij Gustschin <agust@denx.de>

Fix 'notes' typos

s/notes/nodes

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 96b9082c 03-Aug-2017 Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

rockchip: rk3188: rock: adjust for SPL/TPL split

With the changes to split SPL/TPL for the RK3368, I apparently missed
some needed adjustments to the RK3188 Kconfig and rock_defconfig.

This fixes build-issues for the rock board after applying the RK3368
enablement (and SPL/TPL) set that resulted from TPL_SERIAL_SUPPORT,
TPL_ROCKCHIP_BACK_TO_BROM and TPL_TINY_MEMSET being separate symbols
now.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d56b4b19 22-Jul-2017 Tom Rini <trini@konsulko.com>

configs: Migrate RBTREE, LZO, CMD_MTDPARTS, CMD_UBI and CMD_UBIFS

The above CONFIG options are in Kconfig, and now have correct depends and
inter-dependencies. Migrate these to configs/ from include/configs/. In the
case of CMD_UBIFS also change it to be a default y if CMD_UBI.

Signed-off-by: Tom Rini <trini@konsulko.com>

# aed998aa 17-May-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_LZMA to Kconfig

This converts the following to Kconfig:
CONFIG_LZMA

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

# b1a873df 26-Apr-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_CMD_AES et al to Kconfig

This converts the following to Kconfig:
CONFIG_CMD_AES
CONFIG_AES

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Add select AES to CMD_AES]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 173aafbf 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

cmd: Expose a Kconfig option to enable UBIFS commands

Create a new Kconfig entry to allow CMD_UBIFS selection from Kconfig and
add an hidden LZO option that can be selected by CMD_UBIFS.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>

# aa049152 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

mtd: ubi: Select RBTREE option from MTD_UBI Kconfig entry

Expose the RBTREE feature through Kconfig and select this option from the
MTD_UBI option.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>
[Rebased on master]
Signed-off-by: Jagan Teki <jagan@openedev.com>

# ab4458bd 02-Apr-2017 Simon Glass <sjg@chromium.org>

string: Provide a slimmed-down memset()

Most of the time the optimised memset() is what we want. For extreme
situations such as TPL it may be too large. For example on the 'rock'
board, using a simple loop saves a useful 48 bytes. With gcc 4.9 and
the rodata bug, this patch is enough to reduce the TPL image below the
limit.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>

# bea79d7d 14-Mar-2017 Andre Przywara <andre.przywara@arm.com>

Kconfig: introduce md5sum command selection

So far CONFIG_MD5SUM would need to be set by a board's include file.
Since the command is really generic, move it over to Kconfig to allow
it to be defined by either a board's defconfig, menuconfig or some
config snippet merged via mergeconfig.sh.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e663b350 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

smbios: Expose in efi_loader as table

We can pass SMBIOS easily as EFI configuration table to an EFI payload. This
patch adds enablement for that case.

While at it, we also enable SMBIOS generation for ARM systems, since they support
EFI_LOADER.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4b6dddc2 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

x86: Move smbios generation into arch independent directory

We will need the SMBIOS generation function on ARM as well going forward,
so let's move it into a non arch specific location.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# ebf7fff2 05-Oct-2016 Heiko Schocher <hs@denx.de>

spl: move FDT_FIXUP_PARTITIONS to Kconfig

Move FDT_FIXUP_PARTITIONS to Kconfig and cleanup existing
uses.

Signed-off-by: Heiko Schocher <hs@denx.de>

# ddf67f71 05-Jul-2016 Maxime Ripard <maxime.ripard@free-electrons.com>

libfdt: Add overlay application function

The device tree overlays are a good way to deal with user-modifyable
boards or boards with some kind of an expansion mechanism where we can
easily plug new board in (like the BBB, the Raspberry Pi or the CHIP).

Add a new function to merge overlays with a base device tree.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>

# 91b86e21 26-May-2016 Marek Vasut <marex@denx.de>

lib: Enable private libgcc by default

This patch decouples U-Boot binary from the toolchain on systems where
private libgcc is available. Instead of pulling in functions provided
by the libgcc from the toolchain, U-Boot will use it's own set of libgcc
functions. These functions are usually imported from Linux kernel, which
also uses it's own libgcc functions instead of the ones provided by the
toolchain.

This patch solves a rather common problem. The toolchain can usually
generate code for many variants of target architecture and often even
different endianness. The libgcc on the other hand is usually compiled
for one particular configuration and the functions provided by it may
or may not be suited for use in U-Boot. This can manifest in two ways,
either the U-Boot fails to compile altogether and linker will complain
or, in the much worse case, the resulting U-Boot will build, but will
misbehave in very subtle and hard to debug ways.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 67976306 30-Mar-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

cosmetic: Fix typos "privide"

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# ed980b8c 03-Mar-2016 Alexander Graf <agraf@csgraf.de>

efi_loader: hook up in build environment

Now that we have all the bits and pieces ready for EFI payload loading
support, hook them up in Makefiles and KConfigs so that we can build.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
[trini: Enable only when we of OF_LIBFDT, disable on kwb and colibri_pxa270]
Signed-off-by: Tom Rini <trini@konsulko.com>

# aa34fbc0 22-Feb-2016 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt to be used in SPL

Add an option to enable libfdt in SPL. This can be useful when decoding
FIT files in SPL.

We need to make sure this option is not enabled in SPL by this change.
Also this option needs to be enabled in host builds. Si add a new
IMAGE_USE_LIBFDT #define which can be used in files that are built on the
host but must also build for U-Boot and SPL.

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

# 69e173eb 22-Feb-2016 Simon Glass <sjg@chromium.org>

Move CONFIG_OF_LIBFDT to Kconfig

Move this option to Kconfig and tidy up existing boards.

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

# a187559e 05-Feb-2016 Bin Meng <bmeng.cn@gmail.com>

Use correct spelling of "U-Boot"

Correct spelling of "U-Boot" shall be used in all written text
(documentation, comments in source files etc.).

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Minkyu Kang <mk7.kang@samsung.com>

# 947c626d 14-Jan-2016 Tom Rini <trini@konsulko.com>

vsprintf.c: Always enable CONFIG_SYS_VSNPRINTF

Enabling this function always removes some class of string saftey issues.
The size change here in general is about 400 bytes and this seems a reasonable
trade-off.

Cc: Peng Fan <peng.fan@nxp.com>
Cc: Peter Robinson <pbrobinson@gmail.com>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Adrian Alonso <aalonso@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 7d9cde10 22-Nov-2015 Stefan Roese <sr@denx.de>

lib/tiny-printf.c: Add tiny printf function for space limited environments

This patch adds a small printf() version that supports all basic formats.
Its intented to be used in U-Boot SPL versions on platforms with very
limited internal RAM sizes.

To enable it, just define CONFIG_USE_TINY_PRINTF in your defconfig. This
will result in the SPL using this tiny function and the main U-Boot
still using the full-blown printf() function.

This code was copied from:
http://www.sparetimelabs.com/printfrevisited
With mostly only coding style related changes so that its checkpatch
clean.

The size reduction is about 2.5KiB. Here a comparison for the db-mv784mp-gp
(Marvell AXP) SPL:

Without this patch:
58963 18536 1928 79427 13643 ./spl/u-boot-spl

With this patch:
56542 18536 1956 77034 12cea ./spl/u-boot-spl

Note:
To make it possible to compile tiny-printf.c instead of vsprintf.c when
CONFIG_USE_TINY_PRINTF is defined, the functions printf() and vprintf() are
moved from common/console.c into vsprintf.c in this patch.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>

# 2419cd16 03-Oct-2015 Simon Glass <sjg@chromium.org>

dm: tpm: Drop CONFIG_DM_TPM

Now that all TPM drivers use driver model, we can drop the special driver
model CONFIG option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>

# 027b728d 06-Oct-2015 Julius Werner <jwerner@chromium.org>

Add support for LZ4 decompression algorithm

This patch adds support for LZ4-compressed FIT image contents. This
algorithm has a slightly worse compression ration than LZO while being
nearly twice as fast to decompress. When loading images from a fast
storage medium this usually results in a boot time win.

Sandbox-tested only since I don't have a U-Boot development system set
up right now. The code was imported unchanged from coreboot where it's
proven to work, though. I'm mostly interested in getting this recognized
by mkImage for use in a downstream project.

Signed-off-by: Julius Werner <jwerner@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# a7d660bc 22-Aug-2015 Simon Glass <sjg@chromium.org>

tpm: Add Kconfig options for TPMs

Add new Kconfig options for TPMs in preparation for moving boards to use
Kconfig for TPM configuration.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 867a6ac8 31-Jul-2015 Simon Glass <sjg@chromium.org>

efi: Add start-up library code

When running as an EFI application, U-Boot must request memory from EFI,
and provide access to the boot services U-Boot needs.

Add library code to perform these tasks. This includes efi_main() which is
the entry point from EFI. U-Boot is built as a shared library.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d1389403 23-Jun-2015 Simon Glass <sjg@chromium.org>

Add a dhrystone benchmark command

Drystone provides a convenient sanity check that the CPU is running at full
speed. Add this as a command which can be enabled as needed.

Note: I investigated using Coremark for this but there was a license
agreement and I could not work out if it was GPL-compatible.

Signed-off-by: Simon Glass <sjg@chromium.org>

# f7848d90 22-Jun-2015 Joe Hershberger <joe.hershberger@ni.com>

Allow CONFIG_REGEX to be disabled when CONFIG_NET

Instead of selecting REGEX when NET is enabled, make it the default, but
allow boards that are tiny to disable it and lose functionality on all
but the first Ethernet adapter.

cm-bf548, bf538f-ezkit, and bf533-stamp need this. None appear to have
more than one Ethernet interface.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# 3850dbe8 11-Jun-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

blackfin: fix undefined reference to srand and rand

Commit 9ba9e85f3f1c (net: Fix NET_RANDOM_ETHADDR dependencies)
accidentally dropped CONFIG_LIB_RAND defines for 14 Blackfin boards.

Prior to that commit, those boards defined CONFIG_LIB_RAND, but not
CONFIG_NET_RANDOM_ETHADDR. So, commit 9ba9e85f3f1c should not have
touched them, but in fact it ripped CONFIG_LIB_RAND off from all the
header files, which caused undefined reference to srand and rand.
CONFIG_LIB_RAND=y must be revived for such boards.

BTW, this commit indeed makes it better, but even with this fix,
three boards (bf533-stamp, bf538f-ezkit, cm-bf548) still can not
build due to region 'ram' overflowed error. This was cause by
commit 6eed3786c68c (net: Move the CMD_NET config to defconfigs)
because CMD_NET selects NET, and NET selects REGEX. Eventually,
some boards were newly enabled with CONFIG_REGEX, increasing the
memory footprint. A patch is expected to fix the build error.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 9ba9e85f 25-May-2015 Michal Simek <michal.simek@xilinx.com>

net: Fix NET_RANDOM_ETHADDR dependencies

NET_RANDOM_ETHADDR depends on lib/rand.c. This patch adds dependency to
Kconfig to ensure that library is also compiled.

Remove the definitions from Blackfin boards' include/configs.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 6501ff62 20-Apr-2015 Przemyslaw Marczak <p.marczak@samsung.com>

lib: Kconfig: add entry for errno_str() function

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1a60650c 21-Apr-2015 Joe Hershberger <joe.hershberger@ni.com>

kconfig: Move REGEX to Kconfig

Having this as a Kconfig allows it to be a dependent feature.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8156345d 06-Mar-2015 Simon Glass <sjg@chromium.org>

sandbox: Move CONFIG_SYS_VSNPRINTF to Kconfig

Move this over to Kconfig and tidy up.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 94e3c8c4 19-Feb-2015 gaurav rana <gaurav.rana@freescale.com>

crypto/fsl - Add progressive hashing support using hardware acceleration.

Currently only normal hashing is supported using hardware acceleration.
Added support for progressive hashing using hardware.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
Signed-off-by: Gaurav Rana <gaurav.rana@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>

# d9f23c7f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

lib/rsa: Add Kconfig for devices supporting RSA Modular Exponentiation

Kconfig option added for devices which support RSA Verification.
1. RSA_SOFTWARE_EXP
Enables driver for supporting RSA Modular Exponentiation in Software
2. RSA_FREESCALE_EXP
Enables driver for supporting RSA Modular Exponentiation using Freescale specific
driver

The above drivers use RSA uclass

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
(Removed duplicate line in Kconfig comment)

Change-Id: I7663c4d5350e2bfc3dfa2696f70ef777d6ccc6f6

# c4beb22f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

FIT: Modify option FIT_SIGNATURE in Kconfig

For FIT signature based approach to work, RSA library needs to be selected.
The FIT_SIGNATURE option in Kconfig is modified to automatically select RSA.
Selecting RSA compiles the RSA library required for image verification.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 45ccec8f 23-Oct-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_USE_PRIVATE_LIBGCC to Kconfig

The private libgcc is supported only on ARM, MIPS, PowerPC, SH, x86.
Those architectures should "select" HAVE_PRIVATE_LIBGCC and
CONFIG_USE_PRIVATE_LIBGCC should depend on it.

Currently, this option is enabled on Tegra boards and x86 architecture.
Move the definition from header files to Kconfig.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Tested-by: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: Tom Warren <twarren@nvidia.com>

# 8c688bc4 23-Oct-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_SYS_HZ to lib/Kconfig

CONFIG_SYS_HZ is always defined as 1000 in config_fallbacks.h
(but some boards still have redundant definitions).

This commit moves the definition and the document in README to
Kconfig. Since lib/Kconfig can assure that CONFIG_SYS_HZ is 1000,
the sanity check in lib/time.c should be removed.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Reviewed-by: Marek Vasut <marex@denx.de>

# b0928da6 16-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED to Kconfig

If this option is enabled, the objects under lib/ directory
are compiled with speed optimization, not size optimization.
(Currently, only used by some Blackfin boards.)

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# ed36323f 16-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: add blank Kconfig files

This would be useful to start moving various config options.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# 43e442a5 26-May-2020 Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

kconfig: fix some typos

Signed-off-by: Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>

# eff5a547 22-May-2020 Michael Walle <michael@walle.cc>

cmd: zip: automatically pull in gzip()

Move the CONFIG_GZIP_COMPRESSED from a config.h macro to a Kconfig menu
item. It is not selectable by a user because there is no reason to do
so. Instead it will be automatically selected by the stuff which uses
gzip(), like the zip command.

Remove it from the config_whitelist.txt. Also remove
CONFIG_GZIP_COMPRESS_DEF_SZ as this was never used on any board. The
default seems to be sane, otherwise it should be added as a Kconfig
option.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8239be61 06-May-2020 Simon Glass <sjg@chromium.org>

lib: Allow MD5 to be enabled in SPL

At present the MD5 option cannot be enabled by board configs since it has
no Kconfig name. It is generally enabled, so long as FIT support is
present. But not all boards use FIT, particularly in SPL

Fix this and add an option for SPL as well. This allows board code to call
md5() even if FIT support is not enabled.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 04cb3994 21-Apr-2020 Weijie Gao <weijie.gao@mediatek.com>

lib: enable lzma decompression support for SPL build

This patch enables LZMA decompression support for SPL build

Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>

# 2a2119e1 05-Mar-2020 Atish Patra <atish.patra@wdc.com>

lib: kconfig: Add option to set BZIP2 compression method

There is no way to select BZIP2 compression method.
Add it under library/compression config where all other
compression related configs are present.

Signed-off-by: Atish Patra <atish.patra@wdc.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 805b3cac 12-Feb-2020 Keerthy <j-keerthy@ti.com>

lib: elf: Move the generic elf loading/validating functions to lib

Move the generic elf loading/validating functions to lib/
so that they can be re-used and accessed by code existing
outside cmd.

While at it remove the duplicate static version of load_elf_image_phdr
under arch/arm/mach-imx/imx_bootaux.c.

Signed-off-by: Keerthy <j-keerthy@ti.com>
Suggested-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>

# 1611235b 19-Jan-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: Kconfig dependencies for pseudo-random library

drivers/rng/sandbox_rng.c requires rand() to be defined but configuration
option CONFIG_CONFIG_LIB_RAND selected in drivers/rng/Kconfig does not
exist.

test/lib/test_aes.c requires rand() to be defined.

Fix the selection criteria for choice "Pseudo-random library support type".

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 3c10dc95 06-Dec-2019 Simon Glass <sjg@chromium.org>

binman: Add a library to access binman entries

SPL and TPL can access information about binman entries using link-time
symbols but this is not available in U-Boot proper. Of course it could be
made available, but the intention is to just read the device tree.

Add support for this, so that U-Boot can locate entries.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# b4adf627 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: crypto: add x509 parser

Imported from linux kernel v5.3:
x509.asn1 without changes
x509_akid.asn1 without changes
x509_parser.h without changes
x509_cert_parser.c with changes marked as __UBOOT__
x509_public_key.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# a9b45e6e 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add oid registry utility

Imported from linux kernel v5.3:
build_OID_registry without changes
oid_registry.h without changes
oid_registry.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# ab8a0e06 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add asn1 decoder

Imported from linux kernel v5.3:
lib/asn1_decoder.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 2b12196d 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

cmd: add asn1_compiler

Imported from linux kernel v5.3:
asn1.h without changes
asn1_ber_bytecode.h without changes
asn1_decoder.h without changes
asn1_compiler.c without changes

This host command will be used to create a ASN1 parser, for example,
for pkcs7 messages or x509 certificates. More specifically, it will
generate *byte code* which will be interpreted by asn1 decoder library.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 05429b6c 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

rtc: move date.c from drivers/rtc/ to lib/

In the next commit, rtc_mktime(), for compatibility with linux, will be
implemented using rtc_mktime(), which is no longer drivers/rtc specific.
So move this file under lib/.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 37ef1774 10-Nov-2019 Thomas Hebb <tommyhebb@gmail.com>

Kconfig: disambiguate config names for tiny printf

27084c03d36a ("spl: Allow tiny printf() to be controlled in SPL and
TPL") split this option in two for TPL and SPL, but didn't change the
Kconfig names, making them hard to set quickly.

Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>

# 0d76afc0 27-Oct-2019 Simon Glass <sjg@chromium.org>

fdt: Add Kconfig options to control code size

For better or worse libfdt recent grew a lot of code that checks the
validity of the device tree in great detail. When using unsigned or
unverified data this makes things safer, but it does add to code size.

Add some controls to select the trade-off between safety and code size.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 27084c03 25-Sep-2019 Simon Glass <sjg@chromium.org>

spl: Allow tiny printf() to be controlled in SPL and TPL

At present there is only one control for this and it is used for both SPL
and TPL. But SPL might have a lot more space than TPL so the extra cost of
a full printf() might be acceptable.

Split the option into two, providing separate SPL and TPL controls. The
TPL setting defaults to the same as SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2a51e16b 07-Jun-2019 Tom Rini <trini@konsulko.com>

configs: Make USE_TINY_PRINTF depend on SPL||TPL and be default

The USE_TINY_PRINTF symbol only changes things within SPL and TPL
builds, so make it depend on that support. Next, make it default as
within these cases we should rarely have need of more advanced print
formats outside of the debug context.

To do this, in a few cases we need to correct our Kconfig dependencies
as we had cases of non-SPL targets select'ing this symbol. Finally, in
the case of a few boards we really do need the full printf
functionality.

Signed-off-by: Tom Rini <trini@konsulko.com>

# da0fb5fd 02-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: make call depth limit customizable

Up to now we had hard coded values for the call depth up to which trace
records are created: 200 for early tracing, 15 thereafter. UEFI
applications reach a call depth of 80 or above.

Provide customizing settings for the call trace depth limit and the early
call trace depth limit. Use the old values as defaults.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8509f22a 29-Apr-2019 Marek Behún <marek.behun@nic.cz>

lib: add Zstandard decompression support

Add the zstd library from Linux kernel (only decompression support).
There are minimal changes to build with U-Boot, otherwise the files are
identical to Linux commit dc35da16 from March 2018, the files had not
been touched since in kernel. Also SPDX lincese tags were added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 83a486b6 29-Apr-2019 Marek Behún <marek.behun@nic.cz>

lib: Add xxhash support

This adds the xxhash support from Linux. Files are almost identical to
those added to Linux in commit 5d240522 ("lib: Add xxhash module") (they
haven't been touched since in Linux). The only difference is to add some
includes to be compatible with U-Boot. Also SPDX lincese tags were
added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 5132361a 29-Apr-2019 Heiko Schocher <hs@denx.de>

lib: Kconfig: fix help text for GZIP

commit 95f4bbd581cf ("lib: fdt: Allow LZO and GZIP DT compression in U-Boot")

introduced Kconfig option for gzip in U-Boot, but help text
says gzip for SPL, which is wrong. Fix this.

Signed-off-by: Heiko Schocher <hs@denx.de>
Acked-by: Marek Vasut <marex@denx.de>

# 1c6eb075 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE_BUFFER_SIZE et al to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE_BUFFER_SIZE
CONFIG_TRACE_EARLY_SIZE
CONFIG_TRACE_EARLY
CONFIG_TRACE_EARLY_ADDR

Signed-off-by: Simon Glass <sjg@chromium.org>

# a24a78d7 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE

Signed-off-by: Simon Glass <sjg@chromium.org>

# 54969b40 21-Mar-2019 Thierry Reding <treding@nvidia.com>

fdtdec: Add Kconfig symbol for tests

Runtime tests are provided as a test_fdtdec command implementation. Add
a Kconfig symbol that allows this command to be built so that the tests
can be used.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 95f4bbd5 08-Mar-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

lib: fdt: Allow LZO and GZIP DT compression in U-Boot

Add required Kconfig symbols, Makefile bits and macro fixes in a
few places to support LZO and DT compression in U-Boot. This can
save a lot of space with multi-DTB fitImages.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>

# 6e705114 13-Jan-2019 Chris Packham <judge.packham@gmail.com>

lib: Kconfig: spelling fixes

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 048c6e89 06-Nov-2018 Simon Glass <sjg@chromium.org>

spl: lz4: Allow use of lz4 compression in SPL

In some cases U-Boot is compressed and it is useful to be able to
decompress it in SPL. Add a Kconfig and Makefile change to allow this.
Note that this does not actually implement decompression.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 2895c4b7 15-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

kconfig: Introduce HAVE_ARCH_IOMAP

Introduce a new Kconfig option for architecture codes to control
whether it provides io{read,write}{8,16,32} I/O accessor functions.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5592a633 01-Oct-2018 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt in TPL

In some cases (e.g. sandbox with verified boot) it is useful to support
libfdt in TPL. Update the Kconfig to handle this.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 6307896c 01-Oct-2018 Simon Glass <sjg@chromium.org>

tpm: Add support for SPL and TPL

At present the tpm can only be used in U-Boot proper. Updated it to work
in SPL and TPL also.

Signed-off-by: Simon Glass <sjg@chromium.org>

# ab948cd2 19-Jul-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

fdt_support: make FDT_FIXUP_PARTITIONS depend on CMD_MTDPARTS

fdt_fixup_mtdparts() calls mtdparts_init() and device_find(),
which are defined in cmd/mtdparts.c

The combination of FDT_FIXUP_PARTITIONS=y and CMD_MTDPARTS=n
emits the following link error:

common/fdt_support.c:903: undefined reference to `mtdparts_init'
common/fdt_support.c:914: undefined reference to `device_find'

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 3330584d 03-Jun-2018 Igor Opaniuk <igor.opaniuk@gmail.com>

avb2.0: integrate avb 2.0 into the build system

Integrate libavb into the build system. Introduce CONFIG_LIBAVB
build option.

Signed-off-by: Igor Opaniuk <igor.opaniuk@linaro.org>

# f8c987f8 05-Jun-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

lib: Add hexdump

Often during debugging session it's very interesting to see
what data we were dealing with. For example what we write or read
to/from memory or peripherals.

This change introduces functions that allow to dump binary
data with one simple function invocation like:
------------------->8----------------
print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, buf, len);
------------------->8----------------

which gives us the following:
------------------->8----------------
00000000: f2 b7 c9 88 62 61 75 64 72 61 74 65 3d 31 31 35 ....baudrate=115
00000010: 32 30 30 00 62 6f 6f 74 61 72 67 73 3d 63 6f 6e 200.bootargs=con
00000020: 73 6f 6c 65 3d 74 74 79 53 33 2c 31 31 35 32 30 sole=ttyS3,11520
00000030: 30 6e 38 00 62 6f 6f 74 64 65 6c 61 79 3d 33 00 0n8.bootdelay=3.
00000040: 62 6f 6f 74 66 69 6c 65 3d 75 49 6d 61 67 65 00 bootfile=uImage.
00000050: 66 64 74 63 6f 6e 74 72 6f 6c 61 64 64 72 3d 39 fdtcontroladdr=9
00000060: 66 66 62 31 62 61 30 00 6c 6f 61 64 61 64 64 72 ffb1ba0.loadaddr
00000070: 3d 30 78 38 32 30 30 30 30 30 30 00 73 74 64 65 =0x82000000.stde
00000080: 72 72 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 rr=serial0@e0022
00000090: 30 30 30 00 73 74 64 69 6e 3d 73 65 72 69 61 6c 000.stdin=serial
000000a0: 30 40 65 30 30 32 32 30 30 30 00 73 74 64 6f 75 0@e0022000.stdou
000000b0: 74 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 30 t=serial0@e00220
000000c0: 30 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00..............
...
------------------->8----------------

Source of hexdump.c was copied from Linux kernel v4.7-rc2.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Mario Six <mario.six@gdsys.cc>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Stefan Roese <sr@denx.de>

# c232d14d 29-May-2018 Alex Kiernan <alex.kiernan@gmail.com>

mmc: Separate "mmc swrite" from fastboot

Introduce CONFIG_IMAGE_SPARSE and CONFIG_CMD_MMC_SWRITE so the "mmc
swrite" command is separated from the fastboot code.

Move image-sparse from common to lib so it's clear it's library code.

Rename CONFIG_FASTBOOT_FLASH_FILLBUF_SIZE to CONFIG_IMAGE_SPARSE_FILLBUF_SIZE
and migrate it to Kconfig.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Acked-by: Jassi Brar <jaswinder.singh@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6417572e 08-May-2018 Tom Rini <trini@konsulko.com>

lib/Kconfig: Mark OF_LIBFDT_OVERLAY as depending on OF_LIBFDT

The overlay code is only useful when OF_LIBFDT is set, so mark it as
depending on that first.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 58a46f88 25-Apr-2018 Praneeth Bajjuri <praneeth@ti.com>

configs: TI: Enable FIT Library overlay support

Enable the FDT library overlay support for all TI SOC family.

Without this option, when Loading fdt from FIT image, the
following warning is seen.

"config with overlays but CONFIG_OF_LIBFDT_OVERLAY not set".

Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
Suggested-by: Andrew F.Davis <afd@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>

# 14ad44ab 18-Apr-2018 Alex Kiernan <alex.kiernan@gmail.com>

spl: Split sprintf, strto* from SPL serial in Kconfig

When SPL serial is disabled, callers who need sprintf or strtoul fail
because their inclusion is guarded by CONFIG_SPL_SERIAL_SUPPORT/
CONFIG_TPL_SERIAL_SUPPORT.

Split printf, sprintf and strto into their own entries and then select
all of them if SERIAL_SUPPORT is enabled to match the current behaviour.

Include panic.o unconditionally as it can be called from anywhere which
uses BUG_ON().

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>

# e294ba06 04-Apr-2018 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-sunxi

Signed-off-by: Tom Rini <trini@konsulko.com>


# d14db11d 03-Apr-2018 Andre Przywara <andre.przywara@arm.com>

sunxi: revert disabling of features

In January some commits were introduced to mitigate the U-Boot image
size issues we encountered on sunxi builds.
Now with the MMC environment removed we can bring them back, as we
practically don't have a size limit anymore.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 32ce6179 13-Mar-2018 Bryan O'Donoghue <bryan.odonoghue@linaro.org>

optee: Add lib entries for sharing OPTEE code across ports

This patch adds code to lib to enable sharing of useful OPTEE code between
board-ports and architectures. The code on lib/optee/optee.c comes from the
TI omap2 port. Eventually the OMAP2 code will be patched to include the
shared code. The intention here is to add more useful OPTEE specific code
as more functionality gets added.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Cc: Harinarayan Bhatta <harinarayan@ti.com>
Cc: Andrew F. Davis <afd@ti.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Kever Yang <kever.yang@rock-chips.com>
Cc: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Cc: Peng Fan <peng.fan@nxp.com>
Tested-by: Peng Fan <peng.fan@nxp.com>

# 36c1877c 06-Feb-2018 Faiz Abbas <faiz_abbas@ti.com>

lib: Kconfig: Move DYNAMIC_CRC_TABLE to Kconfig

Add CONFIG prefix to DYNAMIC_CRC_TABLE and implement it in
Kconfig.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>

# a451bc27 05-Feb-2018 Adam Ford <aford173@gmail.com>

Convert LIB_UUID to Kconfig

config_fallback.h has some logic that checks a variety of options
and selects LIB_UUID if it hasn't already been selected. This
will all LIB_UUID in Kconfig and select this option for the list
of options to allow us to remove the logic from fallbacks

Signed-off-by: Adam Ford <aford173@gmail.com>

# a5a37567 06-Feb-2018 Adam Ford <aford173@gmail.com>

Convert CONFIG LIB_HW_RAND to Kconfig

config_fallbacks.h had some logic to automatically select
LIB_RAND if RANDOM_UUID or CMD_UUID were set if LIB_HW_RAND wasn't
already selected. By migrating LIB_HW_RAND to Kconfig, we can
remove this check from config_fallbacks.h and put it into Kconfig

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
[trini: Turn into a choice, add NET_RANDOM_ETHADDR]
Signed-off-by: Tom Rini <trini@konsulko.com>

# acd4d334 16-Jan-2018 Maxime Ripard <maxime.ripard@free-electrons.com>

net: regex: Disable by default on sunXi

The sunXi arm64 build has overflown, leading to the main U-boot binary
overwriting the environment when flashing the new image, or even worse,
overwriting itself when we're calling saveenv.

Disable this option that is not critical until we can adress the issue
properly.

Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 7e3caa81 03-Dec-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

Move CONFIG_PANIC_HANG to Kconfig

Freescale (NXP) boards have lots of defconfig files per board.
I used "imply PANIC_HANG" for them.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# da5337a6 08-Nov-2017 Nandor Han <nandor.han@ge.com>

rtc: add support for s35392a

Add support for S35392A RTC. The driver supports both U-Boot driver
models.

Signed-off-by: Nandor Han <nandor.han@ge.com>
Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
Cc: Heiko Schocher <hs@denx.de>

# f52bdf4b 14-Sep-2017 Jean-Jacques Hiblot <jjhiblot@ti.com>

lib: allow building lzo for the SPL

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 85d8bf57 03-Sep-2017 Marek Behún <marek.behun@nic.cz>

lib: Add CRC32-C

This is needed for BTRFS.

Signed-off-by: Marek Behun <marek.behun@nic.cz>

create mode 100644 lib/crc32c.c

# 7264f292 15-Aug-2017 York Sun <york.sun@nxp.com>

spl: fit: Eanble GZIP support for image decompression

Add Kconfig option SPL_GZIP and SPL_ZLIB to enable gunzip support for
SPL boot, eg. falcon boot compressed kernel image.

Signed-off-by: York Sun <york.sun@nxp.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6ef2f901 11-Aug-2017 Adam Ford <aford173@gmail.com>

Convert CONFIG_BCH to Kconfig

This converts the following to Kconfig:
CONFIG_BCH

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1a7ba1d 18-Aug-2017 Anatolij Gustschin <agust@denx.de>

Fix 'notes' typos

s/notes/nodes

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 96b9082c 03-Aug-2017 Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

rockchip: rk3188: rock: adjust for SPL/TPL split

With the changes to split SPL/TPL for the RK3368, I apparently missed
some needed adjustments to the RK3188 Kconfig and rock_defconfig.

This fixes build-issues for the rock board after applying the RK3368
enablement (and SPL/TPL) set that resulted from TPL_SERIAL_SUPPORT,
TPL_ROCKCHIP_BACK_TO_BROM and TPL_TINY_MEMSET being separate symbols
now.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d56b4b19 22-Jul-2017 Tom Rini <trini@konsulko.com>

configs: Migrate RBTREE, LZO, CMD_MTDPARTS, CMD_UBI and CMD_UBIFS

The above CONFIG options are in Kconfig, and now have correct depends and
inter-dependencies. Migrate these to configs/ from include/configs/. In the
case of CMD_UBIFS also change it to be a default y if CMD_UBI.

Signed-off-by: Tom Rini <trini@konsulko.com>

# aed998aa 17-May-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_LZMA to Kconfig

This converts the following to Kconfig:
CONFIG_LZMA

Signed-off-by: Simon Glass <sjg@chromium.org>

# b1a873df 26-Apr-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_CMD_AES et al to Kconfig

This converts the following to Kconfig:
CONFIG_CMD_AES
CONFIG_AES

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Add select AES to CMD_AES]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 173aafbf 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

cmd: Expose a Kconfig option to enable UBIFS commands

Create a new Kconfig entry to allow CMD_UBIFS selection from Kconfig and
add an hidden LZO option that can be selected by CMD_UBIFS.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>

# aa049152 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

mtd: ubi: Select RBTREE option from MTD_UBI Kconfig entry

Expose the RBTREE feature through Kconfig and select this option from the
MTD_UBI option.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>
[Rebased on master]
Signed-off-by: Jagan Teki <jagan@openedev.com>

# ab4458bd 02-Apr-2017 Simon Glass <sjg@chromium.org>

string: Provide a slimmed-down memset()

Most of the time the optimised memset() is what we want. For extreme
situations such as TPL it may be too large. For example on the 'rock'
board, using a simple loop saves a useful 48 bytes. With gcc 4.9 and
the rodata bug, this patch is enough to reduce the TPL image below the
limit.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>

# bea79d7d 14-Mar-2017 Andre Przywara <andre.przywara@arm.com>

Kconfig: introduce md5sum command selection

So far CONFIG_MD5SUM would need to be set by a board's include file.
Since the command is really generic, move it over to Kconfig to allow
it to be defined by either a board's defconfig, menuconfig or some
config snippet merged via mergeconfig.sh.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e663b350 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

smbios: Expose in efi_loader as table

We can pass SMBIOS easily as EFI configuration table to an EFI payload. This
patch adds enablement for that case.

While at it, we also enable SMBIOS generation for ARM systems, since they support
EFI_LOADER.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4b6dddc2 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

x86: Move smbios generation into arch independent directory

We will need the SMBIOS generation function on ARM as well going forward,
so let's move it into a non arch specific location.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# ebf7fff2 05-Oct-2016 Heiko Schocher <hs@denx.de>

spl: move FDT_FIXUP_PARTITIONS to Kconfig

Move FDT_FIXUP_PARTITIONS to Kconfig and cleanup existing
uses.

Signed-off-by: Heiko Schocher <hs@denx.de>

# ddf67f71 05-Jul-2016 Maxime Ripard <maxime.ripard@free-electrons.com>

libfdt: Add overlay application function

The device tree overlays are a good way to deal with user-modifyable
boards or boards with some kind of an expansion mechanism where we can
easily plug new board in (like the BBB, the Raspberry Pi or the CHIP).

Add a new function to merge overlays with a base device tree.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>

# 91b86e21 26-May-2016 Marek Vasut <marex@denx.de>

lib: Enable private libgcc by default

This patch decouples U-Boot binary from the toolchain on systems where
private libgcc is available. Instead of pulling in functions provided
by the libgcc from the toolchain, U-Boot will use it's own set of libgcc
functions. These functions are usually imported from Linux kernel, which
also uses it's own libgcc functions instead of the ones provided by the
toolchain.

This patch solves a rather common problem. The toolchain can usually
generate code for many variants of target architecture and often even
different endianness. The libgcc on the other hand is usually compiled
for one particular configuration and the functions provided by it may
or may not be suited for use in U-Boot. This can manifest in two ways,
either the U-Boot fails to compile altogether and linker will complain
or, in the much worse case, the resulting U-Boot will build, but will
misbehave in very subtle and hard to debug ways.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 67976306 30-Mar-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

cosmetic: Fix typos "privide"

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# ed980b8c 03-Mar-2016 Alexander Graf <agraf@csgraf.de>

efi_loader: hook up in build environment

Now that we have all the bits and pieces ready for EFI payload loading
support, hook them up in Makefiles and KConfigs so that we can build.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
[trini: Enable only when we of OF_LIBFDT, disable on kwb and colibri_pxa270]
Signed-off-by: Tom Rini <trini@konsulko.com>

# aa34fbc0 22-Feb-2016 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt to be used in SPL

Add an option to enable libfdt in SPL. This can be useful when decoding
FIT files in SPL.

We need to make sure this option is not enabled in SPL by this change.
Also this option needs to be enabled in host builds. Si add a new
IMAGE_USE_LIBFDT #define which can be used in files that are built on the
host but must also build for U-Boot and SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 69e173eb 22-Feb-2016 Simon Glass <sjg@chromium.org>

Move CONFIG_OF_LIBFDT to Kconfig

Move this option to Kconfig and tidy up existing boards.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a187559e 05-Feb-2016 Bin Meng <bmeng.cn@gmail.com>

Use correct spelling of "U-Boot"

Correct spelling of "U-Boot" shall be used in all written text
(documentation, comments in source files etc.).

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Minkyu Kang <mk7.kang@samsung.com>

# 947c626d 14-Jan-2016 Tom Rini <trini@konsulko.com>

vsprintf.c: Always enable CONFIG_SYS_VSNPRINTF

Enabling this function always removes some class of string saftey issues.
The size change here in general is about 400 bytes and this seems a reasonable
trade-off.

Cc: Peng Fan <peng.fan@nxp.com>
Cc: Peter Robinson <pbrobinson@gmail.com>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Adrian Alonso <aalonso@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 7d9cde10 22-Nov-2015 Stefan Roese <sr@denx.de>

lib/tiny-printf.c: Add tiny printf function for space limited environments

This patch adds a small printf() version that supports all basic formats.
Its intented to be used in U-Boot SPL versions on platforms with very
limited internal RAM sizes.

To enable it, just define CONFIG_USE_TINY_PRINTF in your defconfig. This
will result in the SPL using this tiny function and the main U-Boot
still using the full-blown printf() function.

This code was copied from:
http://www.sparetimelabs.com/printfrevisited
With mostly only coding style related changes so that its checkpatch
clean.

The size reduction is about 2.5KiB. Here a comparison for the db-mv784mp-gp
(Marvell AXP) SPL:

Without this patch:
58963 18536 1928 79427 13643 ./spl/u-boot-spl

With this patch:
56542 18536 1956 77034 12cea ./spl/u-boot-spl

Note:
To make it possible to compile tiny-printf.c instead of vsprintf.c when
CONFIG_USE_TINY_PRINTF is defined, the functions printf() and vprintf() are
moved from common/console.c into vsprintf.c in this patch.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>

# 2419cd16 03-Oct-2015 Simon Glass <sjg@chromium.org>

dm: tpm: Drop CONFIG_DM_TPM

Now that all TPM drivers use driver model, we can drop the special driver
model CONFIG option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>

# 027b728d 06-Oct-2015 Julius Werner <jwerner@chromium.org>

Add support for LZ4 decompression algorithm

This patch adds support for LZ4-compressed FIT image contents. This
algorithm has a slightly worse compression ration than LZO while being
nearly twice as fast to decompress. When loading images from a fast
storage medium this usually results in a boot time win.

Sandbox-tested only since I don't have a U-Boot development system set
up right now. The code was imported unchanged from coreboot where it's
proven to work, though. I'm mostly interested in getting this recognized
by mkImage for use in a downstream project.

Signed-off-by: Julius Werner <jwerner@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# a7d660bc 22-Aug-2015 Simon Glass <sjg@chromium.org>

tpm: Add Kconfig options for TPMs

Add new Kconfig options for TPMs in preparation for moving boards to use
Kconfig for TPM configuration.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 867a6ac8 31-Jul-2015 Simon Glass <sjg@chromium.org>

efi: Add start-up library code

When running as an EFI application, U-Boot must request memory from EFI,
and provide access to the boot services U-Boot needs.

Add library code to perform these tasks. This includes efi_main() which is
the entry point from EFI. U-Boot is built as a shared library.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d1389403 23-Jun-2015 Simon Glass <sjg@chromium.org>

Add a dhrystone benchmark command

Drystone provides a convenient sanity check that the CPU is running at full
speed. Add this as a command which can be enabled as needed.

Note: I investigated using Coremark for this but there was a license
agreement and I could not work out if it was GPL-compatible.

Signed-off-by: Simon Glass <sjg@chromium.org>

# f7848d90 22-Jun-2015 Joe Hershberger <joe.hershberger@ni.com>

Allow CONFIG_REGEX to be disabled when CONFIG_NET

Instead of selecting REGEX when NET is enabled, make it the default, but
allow boards that are tiny to disable it and lose functionality on all
but the first Ethernet adapter.

cm-bf548, bf538f-ezkit, and bf533-stamp need this. None appear to have
more than one Ethernet interface.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# 3850dbe8 11-Jun-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

blackfin: fix undefined reference to srand and rand

Commit 9ba9e85f3f1c (net: Fix NET_RANDOM_ETHADDR dependencies)
accidentally dropped CONFIG_LIB_RAND defines for 14 Blackfin boards.

Prior to that commit, those boards defined CONFIG_LIB_RAND, but not
CONFIG_NET_RANDOM_ETHADDR. So, commit 9ba9e85f3f1c should not have
touched them, but in fact it ripped CONFIG_LIB_RAND off from all the
header files, which caused undefined reference to srand and rand.
CONFIG_LIB_RAND=y must be revived for such boards.

BTW, this commit indeed makes it better, but even with this fix,
three boards (bf533-stamp, bf538f-ezkit, cm-bf548) still can not
build due to region 'ram' overflowed error. This was cause by
commit 6eed3786c68c (net: Move the CMD_NET config to defconfigs)
because CMD_NET selects NET, and NET selects REGEX. Eventually,
some boards were newly enabled with CONFIG_REGEX, increasing the
memory footprint. A patch is expected to fix the build error.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 9ba9e85f 25-May-2015 Michal Simek <michal.simek@xilinx.com>

net: Fix NET_RANDOM_ETHADDR dependencies

NET_RANDOM_ETHADDR depends on lib/rand.c. This patch adds dependency to
Kconfig to ensure that library is also compiled.

Remove the definitions from Blackfin boards' include/configs.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 6501ff62 20-Apr-2015 Przemyslaw Marczak <p.marczak@samsung.com>

lib: Kconfig: add entry for errno_str() function

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1a60650c 21-Apr-2015 Joe Hershberger <joe.hershberger@ni.com>

kconfig: Move REGEX to Kconfig

Having this as a Kconfig allows it to be a dependent feature.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8156345d 06-Mar-2015 Simon Glass <sjg@chromium.org>

sandbox: Move CONFIG_SYS_VSNPRINTF to Kconfig

Move this over to Kconfig and tidy up.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 94e3c8c4 19-Feb-2015 gaurav rana <gaurav.rana@freescale.com>

crypto/fsl - Add progressive hashing support using hardware acceleration.

Currently only normal hashing is supported using hardware acceleration.
Added support for progressive hashing using hardware.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
Signed-off-by: Gaurav Rana <gaurav.rana@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>

# d9f23c7f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

lib/rsa: Add Kconfig for devices supporting RSA Modular Exponentiation

Kconfig option added for devices which support RSA Verification.
1. RSA_SOFTWARE_EXP
Enables driver for supporting RSA Modular Exponentiation in Software
2. RSA_FREESCALE_EXP
Enables driver for supporting RSA Modular Exponentiation using Freescale specific
driver

The above drivers use RSA uclass

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
(Removed duplicate line in Kconfig comment)

Change-Id: I7663c4d5350e2bfc3dfa2696f70ef777d6ccc6f6

# c4beb22f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

FIT: Modify option FIT_SIGNATURE in Kconfig

For FIT signature based approach to work, RSA library needs to be selected.
The FIT_SIGNATURE option in Kconfig is modified to automatically select RSA.
Selecting RSA compiles the RSA library required for image verification.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 45ccec8f 23-Oct-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_USE_PRIVATE_LIBGCC to Kconfig

The private libgcc is supported only on ARM, MIPS, PowerPC, SH, x86.
Those architectures should "select" HAVE_PRIVATE_LIBGCC and
CONFIG_USE_PRIVATE_LIBGCC should depend on it.

Currently, this option is enabled on Tegra boards and x86 architecture.
Move the definition from header files to Kconfig.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Tested-by: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: Tom Warren <twarren@nvidia.com>

# 8c688bc4 23-Oct-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_SYS_HZ to lib/Kconfig

CONFIG_SYS_HZ is always defined as 1000 in config_fallbacks.h
(but some boards still have redundant definitions).

This commit moves the definition and the document in README to
Kconfig. Since lib/Kconfig can assure that CONFIG_SYS_HZ is 1000,
the sanity check in lib/time.c should be removed.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Reviewed-by: Marek Vasut <marex@denx.de>

# b0928da6 16-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED to Kconfig

If this option is enabled, the objects under lib/ directory
are compiled with speed optimization, not size optimization.
(Currently, only used by some Blackfin boards.)

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# ed36323f 16-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: add blank Kconfig files

This would be useful to start moving various config options.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# eff5a547 22-May-2020 Michael Walle <michael@walle.cc>

cmd: zip: automatically pull in gzip()

Move the CONFIG_GZIP_COMPRESSED from a config.h macro to a Kconfig menu
item. It is not selectable by a user because there is no reason to do
so. Instead it will be automatically selected by the stuff which uses
gzip(), like the zip command.

Remove it from the config_whitelist.txt. Also remove
CONFIG_GZIP_COMPRESS_DEF_SZ as this was never used on any board. The
default seems to be sane, otherwise it should be added as a Kconfig
option.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8239be61 06-May-2020 Simon Glass <sjg@chromium.org>

lib: Allow MD5 to be enabled in SPL

At present the MD5 option cannot be enabled by board configs since it has
no Kconfig name. It is generally enabled, so long as FIT support is
present. But not all boards use FIT, particularly in SPL

Fix this and add an option for SPL as well. This allows board code to call
md5() even if FIT support is not enabled.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 04cb3994 21-Apr-2020 Weijie Gao <weijie.gao@mediatek.com>

lib: enable lzma decompression support for SPL build

This patch enables LZMA decompression support for SPL build

Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>

# 2a2119e1 05-Mar-2020 Atish Patra <atish.patra@wdc.com>

lib: kconfig: Add option to set BZIP2 compression method

There is no way to select BZIP2 compression method.
Add it under library/compression config where all other
compression related configs are present.

Signed-off-by: Atish Patra <atish.patra@wdc.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 805b3cac 12-Feb-2020 Keerthy <j-keerthy@ti.com>

lib: elf: Move the generic elf loading/validating functions to lib

Move the generic elf loading/validating functions to lib/
so that they can be re-used and accessed by code existing
outside cmd.

While at it remove the duplicate static version of load_elf_image_phdr
under arch/arm/mach-imx/imx_bootaux.c.

Signed-off-by: Keerthy <j-keerthy@ti.com>
Suggested-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>

# 1611235b 19-Jan-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: Kconfig dependencies for pseudo-random library

drivers/rng/sandbox_rng.c requires rand() to be defined but configuration
option CONFIG_CONFIG_LIB_RAND selected in drivers/rng/Kconfig does not
exist.

test/lib/test_aes.c requires rand() to be defined.

Fix the selection criteria for choice "Pseudo-random library support type".

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 3c10dc95 06-Dec-2019 Simon Glass <sjg@chromium.org>

binman: Add a library to access binman entries

SPL and TPL can access information about binman entries using link-time
symbols but this is not available in U-Boot proper. Of course it could be
made available, but the intention is to just read the device tree.

Add support for this, so that U-Boot can locate entries.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# b4adf627 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: crypto: add x509 parser

Imported from linux kernel v5.3:
x509.asn1 without changes
x509_akid.asn1 without changes
x509_parser.h without changes
x509_cert_parser.c with changes marked as __UBOOT__
x509_public_key.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# a9b45e6e 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add oid registry utility

Imported from linux kernel v5.3:
build_OID_registry without changes
oid_registry.h without changes
oid_registry.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# ab8a0e06 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add asn1 decoder

Imported from linux kernel v5.3:
lib/asn1_decoder.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 2b12196d 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

cmd: add asn1_compiler

Imported from linux kernel v5.3:
asn1.h without changes
asn1_ber_bytecode.h without changes
asn1_decoder.h without changes
asn1_compiler.c without changes

This host command will be used to create a ASN1 parser, for example,
for pkcs7 messages or x509 certificates. More specifically, it will
generate *byte code* which will be interpreted by asn1 decoder library.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 05429b6c 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

rtc: move date.c from drivers/rtc/ to lib/

In the next commit, rtc_mktime(), for compatibility with linux, will be
implemented using rtc_mktime(), which is no longer drivers/rtc specific.
So move this file under lib/.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 37ef1774 10-Nov-2019 Thomas Hebb <tommyhebb@gmail.com>

Kconfig: disambiguate config names for tiny printf

27084c03d36a ("spl: Allow tiny printf() to be controlled in SPL and
TPL") split this option in two for TPL and SPL, but didn't change the
Kconfig names, making them hard to set quickly.

Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>

# 0d76afc0 27-Oct-2019 Simon Glass <sjg@chromium.org>

fdt: Add Kconfig options to control code size

For better or worse libfdt recent grew a lot of code that checks the
validity of the device tree in great detail. When using unsigned or
unverified data this makes things safer, but it does add to code size.

Add some controls to select the trade-off between safety and code size.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 27084c03 25-Sep-2019 Simon Glass <sjg@chromium.org>

spl: Allow tiny printf() to be controlled in SPL and TPL

At present there is only one control for this and it is used for both SPL
and TPL. But SPL might have a lot more space than TPL so the extra cost of
a full printf() might be acceptable.

Split the option into two, providing separate SPL and TPL controls. The
TPL setting defaults to the same as SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2a51e16b 07-Jun-2019 Tom Rini <trini@konsulko.com>

configs: Make USE_TINY_PRINTF depend on SPL||TPL and be default

The USE_TINY_PRINTF symbol only changes things within SPL and TPL
builds, so make it depend on that support. Next, make it default as
within these cases we should rarely have need of more advanced print
formats outside of the debug context.

To do this, in a few cases we need to correct our Kconfig dependencies
as we had cases of non-SPL targets select'ing this symbol. Finally, in
the case of a few boards we really do need the full printf
functionality.

Signed-off-by: Tom Rini <trini@konsulko.com>

# da0fb5fd 02-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: make call depth limit customizable

Up to now we had hard coded values for the call depth up to which trace
records are created: 200 for early tracing, 15 thereafter. UEFI
applications reach a call depth of 80 or above.

Provide customizing settings for the call trace depth limit and the early
call trace depth limit. Use the old values as defaults.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8509f22a 29-Apr-2019 Marek Behún <marek.behun@nic.cz>

lib: add Zstandard decompression support

Add the zstd library from Linux kernel (only decompression support).
There are minimal changes to build with U-Boot, otherwise the files are
identical to Linux commit dc35da16 from March 2018, the files had not
been touched since in kernel. Also SPDX lincese tags were added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 83a486b6 29-Apr-2019 Marek Behún <marek.behun@nic.cz>

lib: Add xxhash support

This adds the xxhash support from Linux. Files are almost identical to
those added to Linux in commit 5d240522 ("lib: Add xxhash module") (they
haven't been touched since in Linux). The only difference is to add some
includes to be compatible with U-Boot. Also SPDX lincese tags were
added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 5132361a 29-Apr-2019 Heiko Schocher <hs@denx.de>

lib: Kconfig: fix help text for GZIP

commit 95f4bbd581cf ("lib: fdt: Allow LZO and GZIP DT compression in U-Boot")

introduced Kconfig option for gzip in U-Boot, but help text
says gzip for SPL, which is wrong. Fix this.

Signed-off-by: Heiko Schocher <hs@denx.de>
Acked-by: Marek Vasut <marex@denx.de>

# 1c6eb075 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE_BUFFER_SIZE et al to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE_BUFFER_SIZE
CONFIG_TRACE_EARLY_SIZE
CONFIG_TRACE_EARLY
CONFIG_TRACE_EARLY_ADDR

Signed-off-by: Simon Glass <sjg@chromium.org>

# a24a78d7 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE

Signed-off-by: Simon Glass <sjg@chromium.org>

# 54969b40 21-Mar-2019 Thierry Reding <treding@nvidia.com>

fdtdec: Add Kconfig symbol for tests

Runtime tests are provided as a test_fdtdec command implementation. Add
a Kconfig symbol that allows this command to be built so that the tests
can be used.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 95f4bbd5 08-Mar-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

lib: fdt: Allow LZO and GZIP DT compression in U-Boot

Add required Kconfig symbols, Makefile bits and macro fixes in a
few places to support LZO and DT compression in U-Boot. This can
save a lot of space with multi-DTB fitImages.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>

# 6e705114 13-Jan-2019 Chris Packham <judge.packham@gmail.com>

lib: Kconfig: spelling fixes

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 048c6e89 06-Nov-2018 Simon Glass <sjg@chromium.org>

spl: lz4: Allow use of lz4 compression in SPL

In some cases U-Boot is compressed and it is useful to be able to
decompress it in SPL. Add a Kconfig and Makefile change to allow this.
Note that this does not actually implement decompression.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 2895c4b7 15-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

kconfig: Introduce HAVE_ARCH_IOMAP

Introduce a new Kconfig option for architecture codes to control
whether it provides io{read,write}{8,16,32} I/O accessor functions.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5592a633 01-Oct-2018 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt in TPL

In some cases (e.g. sandbox with verified boot) it is useful to support
libfdt in TPL. Update the Kconfig to handle this.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 6307896c 01-Oct-2018 Simon Glass <sjg@chromium.org>

tpm: Add support for SPL and TPL

At present the tpm can only be used in U-Boot proper. Updated it to work
in SPL and TPL also.

Signed-off-by: Simon Glass <sjg@chromium.org>

# ab948cd2 19-Jul-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

fdt_support: make FDT_FIXUP_PARTITIONS depend on CMD_MTDPARTS

fdt_fixup_mtdparts() calls mtdparts_init() and device_find(),
which are defined in cmd/mtdparts.c

The combination of FDT_FIXUP_PARTITIONS=y and CMD_MTDPARTS=n
emits the following link error:

common/fdt_support.c:903: undefined reference to `mtdparts_init'
common/fdt_support.c:914: undefined reference to `device_find'

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 3330584d 03-Jun-2018 Igor Opaniuk <igor.opaniuk@gmail.com>

avb2.0: integrate avb 2.0 into the build system

Integrate libavb into the build system. Introduce CONFIG_LIBAVB
build option.

Signed-off-by: Igor Opaniuk <igor.opaniuk@linaro.org>

# f8c987f8 05-Jun-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

lib: Add hexdump

Often during debugging session it's very interesting to see
what data we were dealing with. For example what we write or read
to/from memory or peripherals.

This change introduces functions that allow to dump binary
data with one simple function invocation like:
------------------->8----------------
print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, buf, len);
------------------->8----------------

which gives us the following:
------------------->8----------------
00000000: f2 b7 c9 88 62 61 75 64 72 61 74 65 3d 31 31 35 ....baudrate=115
00000010: 32 30 30 00 62 6f 6f 74 61 72 67 73 3d 63 6f 6e 200.bootargs=con
00000020: 73 6f 6c 65 3d 74 74 79 53 33 2c 31 31 35 32 30 sole=ttyS3,11520
00000030: 30 6e 38 00 62 6f 6f 74 64 65 6c 61 79 3d 33 00 0n8.bootdelay=3.
00000040: 62 6f 6f 74 66 69 6c 65 3d 75 49 6d 61 67 65 00 bootfile=uImage.
00000050: 66 64 74 63 6f 6e 74 72 6f 6c 61 64 64 72 3d 39 fdtcontroladdr=9
00000060: 66 66 62 31 62 61 30 00 6c 6f 61 64 61 64 64 72 ffb1ba0.loadaddr
00000070: 3d 30 78 38 32 30 30 30 30 30 30 00 73 74 64 65 =0x82000000.stde
00000080: 72 72 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 rr=serial0@e0022
00000090: 30 30 30 00 73 74 64 69 6e 3d 73 65 72 69 61 6c 000.stdin=serial
000000a0: 30 40 65 30 30 32 32 30 30 30 00 73 74 64 6f 75 0@e0022000.stdou
000000b0: 74 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 30 t=serial0@e00220
000000c0: 30 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00..............
...
------------------->8----------------

Source of hexdump.c was copied from Linux kernel v4.7-rc2.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Mario Six <mario.six@gdsys.cc>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Stefan Roese <sr@denx.de>

# c232d14d 29-May-2018 Alex Kiernan <alex.kiernan@gmail.com>

mmc: Separate "mmc swrite" from fastboot

Introduce CONFIG_IMAGE_SPARSE and CONFIG_CMD_MMC_SWRITE so the "mmc
swrite" command is separated from the fastboot code.

Move image-sparse from common to lib so it's clear it's library code.

Rename CONFIG_FASTBOOT_FLASH_FILLBUF_SIZE to CONFIG_IMAGE_SPARSE_FILLBUF_SIZE
and migrate it to Kconfig.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Acked-by: Jassi Brar <jaswinder.singh@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6417572e 08-May-2018 Tom Rini <trini@konsulko.com>

lib/Kconfig: Mark OF_LIBFDT_OVERLAY as depending on OF_LIBFDT

The overlay code is only useful when OF_LIBFDT is set, so mark it as
depending on that first.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 58a46f88 25-Apr-2018 Praneeth Bajjuri <praneeth@ti.com>

configs: TI: Enable FIT Library overlay support

Enable the FDT library overlay support for all TI SOC family.

Without this option, when Loading fdt from FIT image, the
following warning is seen.

"config with overlays but CONFIG_OF_LIBFDT_OVERLAY not set".

Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
Suggested-by: Andrew F.Davis <afd@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>

# 14ad44ab 18-Apr-2018 Alex Kiernan <alex.kiernan@gmail.com>

spl: Split sprintf, strto* from SPL serial in Kconfig

When SPL serial is disabled, callers who need sprintf or strtoul fail
because their inclusion is guarded by CONFIG_SPL_SERIAL_SUPPORT/
CONFIG_TPL_SERIAL_SUPPORT.

Split printf, sprintf and strto into their own entries and then select
all of them if SERIAL_SUPPORT is enabled to match the current behaviour.

Include panic.o unconditionally as it can be called from anywhere which
uses BUG_ON().

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>

# e294ba06 04-Apr-2018 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-sunxi

Signed-off-by: Tom Rini <trini@konsulko.com>


# d14db11d 03-Apr-2018 Andre Przywara <andre.przywara@arm.com>

sunxi: revert disabling of features

In January some commits were introduced to mitigate the U-Boot image
size issues we encountered on sunxi builds.
Now with the MMC environment removed we can bring them back, as we
practically don't have a size limit anymore.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 32ce6179 13-Mar-2018 Bryan O'Donoghue <bryan.odonoghue@linaro.org>

optee: Add lib entries for sharing OPTEE code across ports

This patch adds code to lib to enable sharing of useful OPTEE code between
board-ports and architectures. The code on lib/optee/optee.c comes from the
TI omap2 port. Eventually the OMAP2 code will be patched to include the
shared code. The intention here is to add more useful OPTEE specific code
as more functionality gets added.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Cc: Harinarayan Bhatta <harinarayan@ti.com>
Cc: Andrew F. Davis <afd@ti.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Kever Yang <kever.yang@rock-chips.com>
Cc: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Cc: Peng Fan <peng.fan@nxp.com>
Tested-by: Peng Fan <peng.fan@nxp.com>

# 36c1877c 06-Feb-2018 Faiz Abbas <faiz_abbas@ti.com>

lib: Kconfig: Move DYNAMIC_CRC_TABLE to Kconfig

Add CONFIG prefix to DYNAMIC_CRC_TABLE and implement it in
Kconfig.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>

# a451bc27 05-Feb-2018 Adam Ford <aford173@gmail.com>

Convert LIB_UUID to Kconfig

config_fallback.h has some logic that checks a variety of options
and selects LIB_UUID if it hasn't already been selected. This
will all LIB_UUID in Kconfig and select this option for the list
of options to allow us to remove the logic from fallbacks

Signed-off-by: Adam Ford <aford173@gmail.com>

# a5a37567 06-Feb-2018 Adam Ford <aford173@gmail.com>

Convert CONFIG LIB_HW_RAND to Kconfig

config_fallbacks.h had some logic to automatically select
LIB_RAND if RANDOM_UUID or CMD_UUID were set if LIB_HW_RAND wasn't
already selected. By migrating LIB_HW_RAND to Kconfig, we can
remove this check from config_fallbacks.h and put it into Kconfig

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
[trini: Turn into a choice, add NET_RANDOM_ETHADDR]
Signed-off-by: Tom Rini <trini@konsulko.com>

# acd4d334 16-Jan-2018 Maxime Ripard <maxime.ripard@free-electrons.com>

net: regex: Disable by default on sunXi

The sunXi arm64 build has overflown, leading to the main U-boot binary
overwriting the environment when flashing the new image, or even worse,
overwriting itself when we're calling saveenv.

Disable this option that is not critical until we can adress the issue
properly.

Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 7e3caa81 03-Dec-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

Move CONFIG_PANIC_HANG to Kconfig

Freescale (NXP) boards have lots of defconfig files per board.
I used "imply PANIC_HANG" for them.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# da5337a6 08-Nov-2017 Nandor Han <nandor.han@ge.com>

rtc: add support for s35392a

Add support for S35392A RTC. The driver supports both U-Boot driver
models.

Signed-off-by: Nandor Han <nandor.han@ge.com>
Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
Cc: Heiko Schocher <hs@denx.de>

# f52bdf4b 14-Sep-2017 Jean-Jacques Hiblot <jjhiblot@ti.com>

lib: allow building lzo for the SPL

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 85d8bf57 03-Sep-2017 Marek Behún <marek.behun@nic.cz>

lib: Add CRC32-C

This is needed for BTRFS.

Signed-off-by: Marek Behun <marek.behun@nic.cz>

create mode 100644 lib/crc32c.c

# 7264f292 15-Aug-2017 York Sun <york.sun@nxp.com>

spl: fit: Eanble GZIP support for image decompression

Add Kconfig option SPL_GZIP and SPL_ZLIB to enable gunzip support for
SPL boot, eg. falcon boot compressed kernel image.

Signed-off-by: York Sun <york.sun@nxp.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6ef2f901 11-Aug-2017 Adam Ford <aford173@gmail.com>

Convert CONFIG_BCH to Kconfig

This converts the following to Kconfig:
CONFIG_BCH

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1a7ba1d 18-Aug-2017 Anatolij Gustschin <agust@denx.de>

Fix 'notes' typos

s/notes/nodes

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 96b9082c 03-Aug-2017 Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

rockchip: rk3188: rock: adjust for SPL/TPL split

With the changes to split SPL/TPL for the RK3368, I apparently missed
some needed adjustments to the RK3188 Kconfig and rock_defconfig.

This fixes build-issues for the rock board after applying the RK3368
enablement (and SPL/TPL) set that resulted from TPL_SERIAL_SUPPORT,
TPL_ROCKCHIP_BACK_TO_BROM and TPL_TINY_MEMSET being separate symbols
now.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d56b4b19 22-Jul-2017 Tom Rini <trini@konsulko.com>

configs: Migrate RBTREE, LZO, CMD_MTDPARTS, CMD_UBI and CMD_UBIFS

The above CONFIG options are in Kconfig, and now have correct depends and
inter-dependencies. Migrate these to configs/ from include/configs/. In the
case of CMD_UBIFS also change it to be a default y if CMD_UBI.

Signed-off-by: Tom Rini <trini@konsulko.com>

# aed998aa 17-May-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_LZMA to Kconfig

This converts the following to Kconfig:
CONFIG_LZMA

Signed-off-by: Simon Glass <sjg@chromium.org>

# b1a873df 26-Apr-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_CMD_AES et al to Kconfig

This converts the following to Kconfig:
CONFIG_CMD_AES
CONFIG_AES

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Add select AES to CMD_AES]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 173aafbf 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

cmd: Expose a Kconfig option to enable UBIFS commands

Create a new Kconfig entry to allow CMD_UBIFS selection from Kconfig and
add an hidden LZO option that can be selected by CMD_UBIFS.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>

# aa049152 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

mtd: ubi: Select RBTREE option from MTD_UBI Kconfig entry

Expose the RBTREE feature through Kconfig and select this option from the
MTD_UBI option.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>
[Rebased on master]
Signed-off-by: Jagan Teki <jagan@openedev.com>

# ab4458bd 02-Apr-2017 Simon Glass <sjg@chromium.org>

string: Provide a slimmed-down memset()

Most of the time the optimised memset() is what we want. For extreme
situations such as TPL it may be too large. For example on the 'rock'
board, using a simple loop saves a useful 48 bytes. With gcc 4.9 and
the rodata bug, this patch is enough to reduce the TPL image below the
limit.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>

# bea79d7d 14-Mar-2017 Andre Przywara <andre.przywara@arm.com>

Kconfig: introduce md5sum command selection

So far CONFIG_MD5SUM would need to be set by a board's include file.
Since the command is really generic, move it over to Kconfig to allow
it to be defined by either a board's defconfig, menuconfig or some
config snippet merged via mergeconfig.sh.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e663b350 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

smbios: Expose in efi_loader as table

We can pass SMBIOS easily as EFI configuration table to an EFI payload. This
patch adds enablement for that case.

While at it, we also enable SMBIOS generation for ARM systems, since they support
EFI_LOADER.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4b6dddc2 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

x86: Move smbios generation into arch independent directory

We will need the SMBIOS generation function on ARM as well going forward,
so let's move it into a non arch specific location.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# ebf7fff2 05-Oct-2016 Heiko Schocher <hs@denx.de>

spl: move FDT_FIXUP_PARTITIONS to Kconfig

Move FDT_FIXUP_PARTITIONS to Kconfig and cleanup existing
uses.

Signed-off-by: Heiko Schocher <hs@denx.de>

# ddf67f71 05-Jul-2016 Maxime Ripard <maxime.ripard@free-electrons.com>

libfdt: Add overlay application function

The device tree overlays are a good way to deal with user-modifyable
boards or boards with some kind of an expansion mechanism where we can
easily plug new board in (like the BBB, the Raspberry Pi or the CHIP).

Add a new function to merge overlays with a base device tree.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>

# 91b86e21 26-May-2016 Marek Vasut <marex@denx.de>

lib: Enable private libgcc by default

This patch decouples U-Boot binary from the toolchain on systems where
private libgcc is available. Instead of pulling in functions provided
by the libgcc from the toolchain, U-Boot will use it's own set of libgcc
functions. These functions are usually imported from Linux kernel, which
also uses it's own libgcc functions instead of the ones provided by the
toolchain.

This patch solves a rather common problem. The toolchain can usually
generate code for many variants of target architecture and often even
different endianness. The libgcc on the other hand is usually compiled
for one particular configuration and the functions provided by it may
or may not be suited for use in U-Boot. This can manifest in two ways,
either the U-Boot fails to compile altogether and linker will complain
or, in the much worse case, the resulting U-Boot will build, but will
misbehave in very subtle and hard to debug ways.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 67976306 30-Mar-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

cosmetic: Fix typos "privide"

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# ed980b8c 03-Mar-2016 Alexander Graf <agraf@csgraf.de>

efi_loader: hook up in build environment

Now that we have all the bits and pieces ready for EFI payload loading
support, hook them up in Makefiles and KConfigs so that we can build.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
[trini: Enable only when we of OF_LIBFDT, disable on kwb and colibri_pxa270]
Signed-off-by: Tom Rini <trini@konsulko.com>

# aa34fbc0 22-Feb-2016 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt to be used in SPL

Add an option to enable libfdt in SPL. This can be useful when decoding
FIT files in SPL.

We need to make sure this option is not enabled in SPL by this change.
Also this option needs to be enabled in host builds. Si add a new
IMAGE_USE_LIBFDT #define which can be used in files that are built on the
host but must also build for U-Boot and SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 69e173eb 22-Feb-2016 Simon Glass <sjg@chromium.org>

Move CONFIG_OF_LIBFDT to Kconfig

Move this option to Kconfig and tidy up existing boards.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a187559e 05-Feb-2016 Bin Meng <bmeng.cn@gmail.com>

Use correct spelling of "U-Boot"

Correct spelling of "U-Boot" shall be used in all written text
(documentation, comments in source files etc.).

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Minkyu Kang <mk7.kang@samsung.com>

# 947c626d 14-Jan-2016 Tom Rini <trini@konsulko.com>

vsprintf.c: Always enable CONFIG_SYS_VSNPRINTF

Enabling this function always removes some class of string saftey issues.
The size change here in general is about 400 bytes and this seems a reasonable
trade-off.

Cc: Peng Fan <peng.fan@nxp.com>
Cc: Peter Robinson <pbrobinson@gmail.com>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Adrian Alonso <aalonso@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 7d9cde10 22-Nov-2015 Stefan Roese <sr@denx.de>

lib/tiny-printf.c: Add tiny printf function for space limited environments

This patch adds a small printf() version that supports all basic formats.
Its intented to be used in U-Boot SPL versions on platforms with very
limited internal RAM sizes.

To enable it, just define CONFIG_USE_TINY_PRINTF in your defconfig. This
will result in the SPL using this tiny function and the main U-Boot
still using the full-blown printf() function.

This code was copied from:
http://www.sparetimelabs.com/printfrevisited
With mostly only coding style related changes so that its checkpatch
clean.

The size reduction is about 2.5KiB. Here a comparison for the db-mv784mp-gp
(Marvell AXP) SPL:

Without this patch:
58963 18536 1928 79427 13643 ./spl/u-boot-spl

With this patch:
56542 18536 1956 77034 12cea ./spl/u-boot-spl

Note:
To make it possible to compile tiny-printf.c instead of vsprintf.c when
CONFIG_USE_TINY_PRINTF is defined, the functions printf() and vprintf() are
moved from common/console.c into vsprintf.c in this patch.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>

# 2419cd16 03-Oct-2015 Simon Glass <sjg@chromium.org>

dm: tpm: Drop CONFIG_DM_TPM

Now that all TPM drivers use driver model, we can drop the special driver
model CONFIG option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>

# 027b728d 06-Oct-2015 Julius Werner <jwerner@chromium.org>

Add support for LZ4 decompression algorithm

This patch adds support for LZ4-compressed FIT image contents. This
algorithm has a slightly worse compression ration than LZO while being
nearly twice as fast to decompress. When loading images from a fast
storage medium this usually results in a boot time win.

Sandbox-tested only since I don't have a U-Boot development system set
up right now. The code was imported unchanged from coreboot where it's
proven to work, though. I'm mostly interested in getting this recognized
by mkImage for use in a downstream project.

Signed-off-by: Julius Werner <jwerner@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# a7d660bc 22-Aug-2015 Simon Glass <sjg@chromium.org>

tpm: Add Kconfig options for TPMs

Add new Kconfig options for TPMs in preparation for moving boards to use
Kconfig for TPM configuration.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 867a6ac8 31-Jul-2015 Simon Glass <sjg@chromium.org>

efi: Add start-up library code

When running as an EFI application, U-Boot must request memory from EFI,
and provide access to the boot services U-Boot needs.

Add library code to perform these tasks. This includes efi_main() which is
the entry point from EFI. U-Boot is built as a shared library.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d1389403 23-Jun-2015 Simon Glass <sjg@chromium.org>

Add a dhrystone benchmark command

Drystone provides a convenient sanity check that the CPU is running at full
speed. Add this as a command which can be enabled as needed.

Note: I investigated using Coremark for this but there was a license
agreement and I could not work out if it was GPL-compatible.

Signed-off-by: Simon Glass <sjg@chromium.org>

# f7848d90 22-Jun-2015 Joe Hershberger <joe.hershberger@ni.com>

Allow CONFIG_REGEX to be disabled when CONFIG_NET

Instead of selecting REGEX when NET is enabled, make it the default, but
allow boards that are tiny to disable it and lose functionality on all
but the first Ethernet adapter.

cm-bf548, bf538f-ezkit, and bf533-stamp need this. None appear to have
more than one Ethernet interface.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# 3850dbe8 11-Jun-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

blackfin: fix undefined reference to srand and rand

Commit 9ba9e85f3f1c (net: Fix NET_RANDOM_ETHADDR dependencies)
accidentally dropped CONFIG_LIB_RAND defines for 14 Blackfin boards.

Prior to that commit, those boards defined CONFIG_LIB_RAND, but not
CONFIG_NET_RANDOM_ETHADDR. So, commit 9ba9e85f3f1c should not have
touched them, but in fact it ripped CONFIG_LIB_RAND off from all the
header files, which caused undefined reference to srand and rand.
CONFIG_LIB_RAND=y must be revived for such boards.

BTW, this commit indeed makes it better, but even with this fix,
three boards (bf533-stamp, bf538f-ezkit, cm-bf548) still can not
build due to region 'ram' overflowed error. This was cause by
commit 6eed3786c68c (net: Move the CMD_NET config to defconfigs)
because CMD_NET selects NET, and NET selects REGEX. Eventually,
some boards were newly enabled with CONFIG_REGEX, increasing the
memory footprint. A patch is expected to fix the build error.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 9ba9e85f 25-May-2015 Michal Simek <michal.simek@xilinx.com>

net: Fix NET_RANDOM_ETHADDR dependencies

NET_RANDOM_ETHADDR depends on lib/rand.c. This patch adds dependency to
Kconfig to ensure that library is also compiled.

Remove the definitions from Blackfin boards' include/configs.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 6501ff62 20-Apr-2015 Przemyslaw Marczak <p.marczak@samsung.com>

lib: Kconfig: add entry for errno_str() function

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1a60650c 21-Apr-2015 Joe Hershberger <joe.hershberger@ni.com>

kconfig: Move REGEX to Kconfig

Having this as a Kconfig allows it to be a dependent feature.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8156345d 06-Mar-2015 Simon Glass <sjg@chromium.org>

sandbox: Move CONFIG_SYS_VSNPRINTF to Kconfig

Move this over to Kconfig and tidy up.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 94e3c8c4 19-Feb-2015 gaurav rana <gaurav.rana@freescale.com>

crypto/fsl - Add progressive hashing support using hardware acceleration.

Currently only normal hashing is supported using hardware acceleration.
Added support for progressive hashing using hardware.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
Signed-off-by: Gaurav Rana <gaurav.rana@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>

# d9f23c7f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

lib/rsa: Add Kconfig for devices supporting RSA Modular Exponentiation

Kconfig option added for devices which support RSA Verification.
1. RSA_SOFTWARE_EXP
Enables driver for supporting RSA Modular Exponentiation in Software
2. RSA_FREESCALE_EXP
Enables driver for supporting RSA Modular Exponentiation using Freescale specific
driver

The above drivers use RSA uclass

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
(Removed duplicate line in Kconfig comment)

Change-Id: I7663c4d5350e2bfc3dfa2696f70ef777d6ccc6f6

# c4beb22f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

FIT: Modify option FIT_SIGNATURE in Kconfig

For FIT signature based approach to work, RSA library needs to be selected.
The FIT_SIGNATURE option in Kconfig is modified to automatically select RSA.
Selecting RSA compiles the RSA library required for image verification.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 45ccec8f 23-Oct-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_USE_PRIVATE_LIBGCC to Kconfig

The private libgcc is supported only on ARM, MIPS, PowerPC, SH, x86.
Those architectures should "select" HAVE_PRIVATE_LIBGCC and
CONFIG_USE_PRIVATE_LIBGCC should depend on it.

Currently, this option is enabled on Tegra boards and x86 architecture.
Move the definition from header files to Kconfig.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Tested-by: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: Tom Warren <twarren@nvidia.com>

# 8c688bc4 23-Oct-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_SYS_HZ to lib/Kconfig

CONFIG_SYS_HZ is always defined as 1000 in config_fallbacks.h
(but some boards still have redundant definitions).

This commit moves the definition and the document in README to
Kconfig. Since lib/Kconfig can assure that CONFIG_SYS_HZ is 1000,
the sanity check in lib/time.c should be removed.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Reviewed-by: Marek Vasut <marex@denx.de>

# b0928da6 16-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED to Kconfig

If this option is enabled, the objects under lib/ directory
are compiled with speed optimization, not size optimization.
(Currently, only used by some Blackfin boards.)

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# ed36323f 16-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: add blank Kconfig files

This would be useful to start moving various config options.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# 8239be61 06-May-2020 Simon Glass <sjg@chromium.org>

lib: Allow MD5 to be enabled in SPL

At present the MD5 option cannot be enabled by board configs since it has
no Kconfig name. It is generally enabled, so long as FIT support is
present. But not all boards use FIT, particularly in SPL

Fix this and add an option for SPL as well. This allows board code to call
md5() even if FIT support is not enabled.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 04cb3994 21-Apr-2020 Weijie Gao <weijie.gao@mediatek.com>

lib: enable lzma decompression support for SPL build

This patch enables LZMA decompression support for SPL build

Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>

# 2a2119e1 05-Mar-2020 Atish Patra <atish.patra@wdc.com>

lib: kconfig: Add option to set BZIP2 compression method

There is no way to select BZIP2 compression method.
Add it under library/compression config where all other
compression related configs are present.

Signed-off-by: Atish Patra <atish.patra@wdc.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 805b3cac 12-Feb-2020 Keerthy <j-keerthy@ti.com>

lib: elf: Move the generic elf loading/validating functions to lib

Move the generic elf loading/validating functions to lib/
so that they can be re-used and accessed by code existing
outside cmd.

While at it remove the duplicate static version of load_elf_image_phdr
under arch/arm/mach-imx/imx_bootaux.c.

Signed-off-by: Keerthy <j-keerthy@ti.com>
Suggested-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>

# 1611235b 19-Jan-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: Kconfig dependencies for pseudo-random library

drivers/rng/sandbox_rng.c requires rand() to be defined but configuration
option CONFIG_CONFIG_LIB_RAND selected in drivers/rng/Kconfig does not
exist.

test/lib/test_aes.c requires rand() to be defined.

Fix the selection criteria for choice "Pseudo-random library support type".

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 3c10dc95 06-Dec-2019 Simon Glass <sjg@chromium.org>

binman: Add a library to access binman entries

SPL and TPL can access information about binman entries using link-time
symbols but this is not available in U-Boot proper. Of course it could be
made available, but the intention is to just read the device tree.

Add support for this, so that U-Boot can locate entries.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# b4adf627 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: crypto: add x509 parser

Imported from linux kernel v5.3:
x509.asn1 without changes
x509_akid.asn1 without changes
x509_parser.h without changes
x509_cert_parser.c with changes marked as __UBOOT__
x509_public_key.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# a9b45e6e 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add oid registry utility

Imported from linux kernel v5.3:
build_OID_registry without changes
oid_registry.h without changes
oid_registry.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# ab8a0e06 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add asn1 decoder

Imported from linux kernel v5.3:
lib/asn1_decoder.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 2b12196d 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

cmd: add asn1_compiler

Imported from linux kernel v5.3:
asn1.h without changes
asn1_ber_bytecode.h without changes
asn1_decoder.h without changes
asn1_compiler.c without changes

This host command will be used to create a ASN1 parser, for example,
for pkcs7 messages or x509 certificates. More specifically, it will
generate *byte code* which will be interpreted by asn1 decoder library.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 05429b6c 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

rtc: move date.c from drivers/rtc/ to lib/

In the next commit, rtc_mktime(), for compatibility with linux, will be
implemented using rtc_mktime(), which is no longer drivers/rtc specific.
So move this file under lib/.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 37ef1774 10-Nov-2019 Thomas Hebb <tommyhebb@gmail.com>

Kconfig: disambiguate config names for tiny printf

27084c03d36a ("spl: Allow tiny printf() to be controlled in SPL and
TPL") split this option in two for TPL and SPL, but didn't change the
Kconfig names, making them hard to set quickly.

Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>

# 0d76afc0 27-Oct-2019 Simon Glass <sjg@chromium.org>

fdt: Add Kconfig options to control code size

For better or worse libfdt recent grew a lot of code that checks the
validity of the device tree in great detail. When using unsigned or
unverified data this makes things safer, but it does add to code size.

Add some controls to select the trade-off between safety and code size.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 27084c03 25-Sep-2019 Simon Glass <sjg@chromium.org>

spl: Allow tiny printf() to be controlled in SPL and TPL

At present there is only one control for this and it is used for both SPL
and TPL. But SPL might have a lot more space than TPL so the extra cost of
a full printf() might be acceptable.

Split the option into two, providing separate SPL and TPL controls. The
TPL setting defaults to the same as SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2a51e16b 07-Jun-2019 Tom Rini <trini@konsulko.com>

configs: Make USE_TINY_PRINTF depend on SPL||TPL and be default

The USE_TINY_PRINTF symbol only changes things within SPL and TPL
builds, so make it depend on that support. Next, make it default as
within these cases we should rarely have need of more advanced print
formats outside of the debug context.

To do this, in a few cases we need to correct our Kconfig dependencies
as we had cases of non-SPL targets select'ing this symbol. Finally, in
the case of a few boards we really do need the full printf
functionality.

Signed-off-by: Tom Rini <trini@konsulko.com>

# da0fb5fd 02-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: make call depth limit customizable

Up to now we had hard coded values for the call depth up to which trace
records are created: 200 for early tracing, 15 thereafter. UEFI
applications reach a call depth of 80 or above.

Provide customizing settings for the call trace depth limit and the early
call trace depth limit. Use the old values as defaults.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8509f22a 29-Apr-2019 Marek Behún <marek.behun@nic.cz>

lib: add Zstandard decompression support

Add the zstd library from Linux kernel (only decompression support).
There are minimal changes to build with U-Boot, otherwise the files are
identical to Linux commit dc35da16 from March 2018, the files had not
been touched since in kernel. Also SPDX lincese tags were added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 83a486b6 29-Apr-2019 Marek Behún <marek.behun@nic.cz>

lib: Add xxhash support

This adds the xxhash support from Linux. Files are almost identical to
those added to Linux in commit 5d240522 ("lib: Add xxhash module") (they
haven't been touched since in Linux). The only difference is to add some
includes to be compatible with U-Boot. Also SPDX lincese tags were
added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 5132361a 29-Apr-2019 Heiko Schocher <hs@denx.de>

lib: Kconfig: fix help text for GZIP

commit 95f4bbd581cf ("lib: fdt: Allow LZO and GZIP DT compression in U-Boot")

introduced Kconfig option for gzip in U-Boot, but help text
says gzip for SPL, which is wrong. Fix this.

Signed-off-by: Heiko Schocher <hs@denx.de>
Acked-by: Marek Vasut <marex@denx.de>

# 1c6eb075 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE_BUFFER_SIZE et al to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE_BUFFER_SIZE
CONFIG_TRACE_EARLY_SIZE
CONFIG_TRACE_EARLY
CONFIG_TRACE_EARLY_ADDR

Signed-off-by: Simon Glass <sjg@chromium.org>

# a24a78d7 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE

Signed-off-by: Simon Glass <sjg@chromium.org>

# 54969b40 21-Mar-2019 Thierry Reding <treding@nvidia.com>

fdtdec: Add Kconfig symbol for tests

Runtime tests are provided as a test_fdtdec command implementation. Add
a Kconfig symbol that allows this command to be built so that the tests
can be used.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 95f4bbd5 08-Mar-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

lib: fdt: Allow LZO and GZIP DT compression in U-Boot

Add required Kconfig symbols, Makefile bits and macro fixes in a
few places to support LZO and DT compression in U-Boot. This can
save a lot of space with multi-DTB fitImages.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>

# 6e705114 13-Jan-2019 Chris Packham <judge.packham@gmail.com>

lib: Kconfig: spelling fixes

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 048c6e89 06-Nov-2018 Simon Glass <sjg@chromium.org>

spl: lz4: Allow use of lz4 compression in SPL

In some cases U-Boot is compressed and it is useful to be able to
decompress it in SPL. Add a Kconfig and Makefile change to allow this.
Note that this does not actually implement decompression.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 2895c4b7 15-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

kconfig: Introduce HAVE_ARCH_IOMAP

Introduce a new Kconfig option for architecture codes to control
whether it provides io{read,write}{8,16,32} I/O accessor functions.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5592a633 01-Oct-2018 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt in TPL

In some cases (e.g. sandbox with verified boot) it is useful to support
libfdt in TPL. Update the Kconfig to handle this.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 6307896c 01-Oct-2018 Simon Glass <sjg@chromium.org>

tpm: Add support for SPL and TPL

At present the tpm can only be used in U-Boot proper. Updated it to work
in SPL and TPL also.

Signed-off-by: Simon Glass <sjg@chromium.org>

# ab948cd2 19-Jul-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

fdt_support: make FDT_FIXUP_PARTITIONS depend on CMD_MTDPARTS

fdt_fixup_mtdparts() calls mtdparts_init() and device_find(),
which are defined in cmd/mtdparts.c

The combination of FDT_FIXUP_PARTITIONS=y and CMD_MTDPARTS=n
emits the following link error:

common/fdt_support.c:903: undefined reference to `mtdparts_init'
common/fdt_support.c:914: undefined reference to `device_find'

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 3330584d 03-Jun-2018 Igor Opaniuk <igor.opaniuk@gmail.com>

avb2.0: integrate avb 2.0 into the build system

Integrate libavb into the build system. Introduce CONFIG_LIBAVB
build option.

Signed-off-by: Igor Opaniuk <igor.opaniuk@linaro.org>

# f8c987f8 05-Jun-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

lib: Add hexdump

Often during debugging session it's very interesting to see
what data we were dealing with. For example what we write or read
to/from memory or peripherals.

This change introduces functions that allow to dump binary
data with one simple function invocation like:
------------------->8----------------
print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, buf, len);
------------------->8----------------

which gives us the following:
------------------->8----------------
00000000: f2 b7 c9 88 62 61 75 64 72 61 74 65 3d 31 31 35 ....baudrate=115
00000010: 32 30 30 00 62 6f 6f 74 61 72 67 73 3d 63 6f 6e 200.bootargs=con
00000020: 73 6f 6c 65 3d 74 74 79 53 33 2c 31 31 35 32 30 sole=ttyS3,11520
00000030: 30 6e 38 00 62 6f 6f 74 64 65 6c 61 79 3d 33 00 0n8.bootdelay=3.
00000040: 62 6f 6f 74 66 69 6c 65 3d 75 49 6d 61 67 65 00 bootfile=uImage.
00000050: 66 64 74 63 6f 6e 74 72 6f 6c 61 64 64 72 3d 39 fdtcontroladdr=9
00000060: 66 66 62 31 62 61 30 00 6c 6f 61 64 61 64 64 72 ffb1ba0.loadaddr
00000070: 3d 30 78 38 32 30 30 30 30 30 30 00 73 74 64 65 =0x82000000.stde
00000080: 72 72 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 rr=serial0@e0022
00000090: 30 30 30 00 73 74 64 69 6e 3d 73 65 72 69 61 6c 000.stdin=serial
000000a0: 30 40 65 30 30 32 32 30 30 30 00 73 74 64 6f 75 0@e0022000.stdou
000000b0: 74 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 30 t=serial0@e00220
000000c0: 30 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00..............
...
------------------->8----------------

Source of hexdump.c was copied from Linux kernel v4.7-rc2.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Mario Six <mario.six@gdsys.cc>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Stefan Roese <sr@denx.de>

# c232d14d 29-May-2018 Alex Kiernan <alex.kiernan@gmail.com>

mmc: Separate "mmc swrite" from fastboot

Introduce CONFIG_IMAGE_SPARSE and CONFIG_CMD_MMC_SWRITE so the "mmc
swrite" command is separated from the fastboot code.

Move image-sparse from common to lib so it's clear it's library code.

Rename CONFIG_FASTBOOT_FLASH_FILLBUF_SIZE to CONFIG_IMAGE_SPARSE_FILLBUF_SIZE
and migrate it to Kconfig.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Acked-by: Jassi Brar <jaswinder.singh@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6417572e 08-May-2018 Tom Rini <trini@konsulko.com>

lib/Kconfig: Mark OF_LIBFDT_OVERLAY as depending on OF_LIBFDT

The overlay code is only useful when OF_LIBFDT is set, so mark it as
depending on that first.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 58a46f88 25-Apr-2018 Praneeth Bajjuri <praneeth@ti.com>

configs: TI: Enable FIT Library overlay support

Enable the FDT library overlay support for all TI SOC family.

Without this option, when Loading fdt from FIT image, the
following warning is seen.

"config with overlays but CONFIG_OF_LIBFDT_OVERLAY not set".

Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
Suggested-by: Andrew F.Davis <afd@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>

# 14ad44ab 18-Apr-2018 Alex Kiernan <alex.kiernan@gmail.com>

spl: Split sprintf, strto* from SPL serial in Kconfig

When SPL serial is disabled, callers who need sprintf or strtoul fail
because their inclusion is guarded by CONFIG_SPL_SERIAL_SUPPORT/
CONFIG_TPL_SERIAL_SUPPORT.

Split printf, sprintf and strto into their own entries and then select
all of them if SERIAL_SUPPORT is enabled to match the current behaviour.

Include panic.o unconditionally as it can be called from anywhere which
uses BUG_ON().

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>

# e294ba06 04-Apr-2018 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-sunxi

Signed-off-by: Tom Rini <trini@konsulko.com>


# d14db11d 03-Apr-2018 Andre Przywara <andre.przywara@arm.com>

sunxi: revert disabling of features

In January some commits were introduced to mitigate the U-Boot image
size issues we encountered on sunxi builds.
Now with the MMC environment removed we can bring them back, as we
practically don't have a size limit anymore.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 32ce6179 13-Mar-2018 Bryan O'Donoghue <bryan.odonoghue@linaro.org>

optee: Add lib entries for sharing OPTEE code across ports

This patch adds code to lib to enable sharing of useful OPTEE code between
board-ports and architectures. The code on lib/optee/optee.c comes from the
TI omap2 port. Eventually the OMAP2 code will be patched to include the
shared code. The intention here is to add more useful OPTEE specific code
as more functionality gets added.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Cc: Harinarayan Bhatta <harinarayan@ti.com>
Cc: Andrew F. Davis <afd@ti.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Kever Yang <kever.yang@rock-chips.com>
Cc: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Cc: Peng Fan <peng.fan@nxp.com>
Tested-by: Peng Fan <peng.fan@nxp.com>

# 36c1877c 06-Feb-2018 Faiz Abbas <faiz_abbas@ti.com>

lib: Kconfig: Move DYNAMIC_CRC_TABLE to Kconfig

Add CONFIG prefix to DYNAMIC_CRC_TABLE and implement it in
Kconfig.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>

# a451bc27 05-Feb-2018 Adam Ford <aford173@gmail.com>

Convert LIB_UUID to Kconfig

config_fallback.h has some logic that checks a variety of options
and selects LIB_UUID if it hasn't already been selected. This
will all LIB_UUID in Kconfig and select this option for the list
of options to allow us to remove the logic from fallbacks

Signed-off-by: Adam Ford <aford173@gmail.com>

# a5a37567 06-Feb-2018 Adam Ford <aford173@gmail.com>

Convert CONFIG LIB_HW_RAND to Kconfig

config_fallbacks.h had some logic to automatically select
LIB_RAND if RANDOM_UUID or CMD_UUID were set if LIB_HW_RAND wasn't
already selected. By migrating LIB_HW_RAND to Kconfig, we can
remove this check from config_fallbacks.h and put it into Kconfig

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
[trini: Turn into a choice, add NET_RANDOM_ETHADDR]
Signed-off-by: Tom Rini <trini@konsulko.com>

# acd4d334 16-Jan-2018 Maxime Ripard <maxime.ripard@free-electrons.com>

net: regex: Disable by default on sunXi

The sunXi arm64 build has overflown, leading to the main U-boot binary
overwriting the environment when flashing the new image, or even worse,
overwriting itself when we're calling saveenv.

Disable this option that is not critical until we can adress the issue
properly.

Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 7e3caa81 03-Dec-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

Move CONFIG_PANIC_HANG to Kconfig

Freescale (NXP) boards have lots of defconfig files per board.
I used "imply PANIC_HANG" for them.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# da5337a6 08-Nov-2017 Nandor Han <nandor.han@ge.com>

rtc: add support for s35392a

Add support for S35392A RTC. The driver supports both U-Boot driver
models.

Signed-off-by: Nandor Han <nandor.han@ge.com>
Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
Cc: Heiko Schocher <hs@denx.de>

# f52bdf4b 14-Sep-2017 Jean-Jacques Hiblot <jjhiblot@ti.com>

lib: allow building lzo for the SPL

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 85d8bf57 03-Sep-2017 Marek Behún <marek.behun@nic.cz>

lib: Add CRC32-C

This is needed for BTRFS.

Signed-off-by: Marek Behun <marek.behun@nic.cz>

create mode 100644 lib/crc32c.c

# 7264f292 15-Aug-2017 York Sun <york.sun@nxp.com>

spl: fit: Eanble GZIP support for image decompression

Add Kconfig option SPL_GZIP and SPL_ZLIB to enable gunzip support for
SPL boot, eg. falcon boot compressed kernel image.

Signed-off-by: York Sun <york.sun@nxp.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6ef2f901 11-Aug-2017 Adam Ford <aford173@gmail.com>

Convert CONFIG_BCH to Kconfig

This converts the following to Kconfig:
CONFIG_BCH

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1a7ba1d 18-Aug-2017 Anatolij Gustschin <agust@denx.de>

Fix 'notes' typos

s/notes/nodes

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 96b9082c 03-Aug-2017 Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

rockchip: rk3188: rock: adjust for SPL/TPL split

With the changes to split SPL/TPL for the RK3368, I apparently missed
some needed adjustments to the RK3188 Kconfig and rock_defconfig.

This fixes build-issues for the rock board after applying the RK3368
enablement (and SPL/TPL) set that resulted from TPL_SERIAL_SUPPORT,
TPL_ROCKCHIP_BACK_TO_BROM and TPL_TINY_MEMSET being separate symbols
now.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d56b4b19 22-Jul-2017 Tom Rini <trini@konsulko.com>

configs: Migrate RBTREE, LZO, CMD_MTDPARTS, CMD_UBI and CMD_UBIFS

The above CONFIG options are in Kconfig, and now have correct depends and
inter-dependencies. Migrate these to configs/ from include/configs/. In the
case of CMD_UBIFS also change it to be a default y if CMD_UBI.

Signed-off-by: Tom Rini <trini@konsulko.com>

# aed998aa 17-May-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_LZMA to Kconfig

This converts the following to Kconfig:
CONFIG_LZMA

Signed-off-by: Simon Glass <sjg@chromium.org>

# b1a873df 26-Apr-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_CMD_AES et al to Kconfig

This converts the following to Kconfig:
CONFIG_CMD_AES
CONFIG_AES

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Add select AES to CMD_AES]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 173aafbf 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

cmd: Expose a Kconfig option to enable UBIFS commands

Create a new Kconfig entry to allow CMD_UBIFS selection from Kconfig and
add an hidden LZO option that can be selected by CMD_UBIFS.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>

# aa049152 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

mtd: ubi: Select RBTREE option from MTD_UBI Kconfig entry

Expose the RBTREE feature through Kconfig and select this option from the
MTD_UBI option.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>
[Rebased on master]
Signed-off-by: Jagan Teki <jagan@openedev.com>

# ab4458bd 02-Apr-2017 Simon Glass <sjg@chromium.org>

string: Provide a slimmed-down memset()

Most of the time the optimised memset() is what we want. For extreme
situations such as TPL it may be too large. For example on the 'rock'
board, using a simple loop saves a useful 48 bytes. With gcc 4.9 and
the rodata bug, this patch is enough to reduce the TPL image below the
limit.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>

# bea79d7d 14-Mar-2017 Andre Przywara <andre.przywara@arm.com>

Kconfig: introduce md5sum command selection

So far CONFIG_MD5SUM would need to be set by a board's include file.
Since the command is really generic, move it over to Kconfig to allow
it to be defined by either a board's defconfig, menuconfig or some
config snippet merged via mergeconfig.sh.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e663b350 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

smbios: Expose in efi_loader as table

We can pass SMBIOS easily as EFI configuration table to an EFI payload. This
patch adds enablement for that case.

While at it, we also enable SMBIOS generation for ARM systems, since they support
EFI_LOADER.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4b6dddc2 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

x86: Move smbios generation into arch independent directory

We will need the SMBIOS generation function on ARM as well going forward,
so let's move it into a non arch specific location.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# ebf7fff2 05-Oct-2016 Heiko Schocher <hs@denx.de>

spl: move FDT_FIXUP_PARTITIONS to Kconfig

Move FDT_FIXUP_PARTITIONS to Kconfig and cleanup existing
uses.

Signed-off-by: Heiko Schocher <hs@denx.de>

# ddf67f71 05-Jul-2016 Maxime Ripard <maxime.ripard@free-electrons.com>

libfdt: Add overlay application function

The device tree overlays are a good way to deal with user-modifyable
boards or boards with some kind of an expansion mechanism where we can
easily plug new board in (like the BBB, the Raspberry Pi or the CHIP).

Add a new function to merge overlays with a base device tree.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>

# 91b86e21 26-May-2016 Marek Vasut <marex@denx.de>

lib: Enable private libgcc by default

This patch decouples U-Boot binary from the toolchain on systems where
private libgcc is available. Instead of pulling in functions provided
by the libgcc from the toolchain, U-Boot will use it's own set of libgcc
functions. These functions are usually imported from Linux kernel, which
also uses it's own libgcc functions instead of the ones provided by the
toolchain.

This patch solves a rather common problem. The toolchain can usually
generate code for many variants of target architecture and often even
different endianness. The libgcc on the other hand is usually compiled
for one particular configuration and the functions provided by it may
or may not be suited for use in U-Boot. This can manifest in two ways,
either the U-Boot fails to compile altogether and linker will complain
or, in the much worse case, the resulting U-Boot will build, but will
misbehave in very subtle and hard to debug ways.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 67976306 30-Mar-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

cosmetic: Fix typos "privide"

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# ed980b8c 03-Mar-2016 Alexander Graf <agraf@csgraf.de>

efi_loader: hook up in build environment

Now that we have all the bits and pieces ready for EFI payload loading
support, hook them up in Makefiles and KConfigs so that we can build.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
[trini: Enable only when we of OF_LIBFDT, disable on kwb and colibri_pxa270]
Signed-off-by: Tom Rini <trini@konsulko.com>

# aa34fbc0 22-Feb-2016 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt to be used in SPL

Add an option to enable libfdt in SPL. This can be useful when decoding
FIT files in SPL.

We need to make sure this option is not enabled in SPL by this change.
Also this option needs to be enabled in host builds. Si add a new
IMAGE_USE_LIBFDT #define which can be used in files that are built on the
host but must also build for U-Boot and SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 69e173eb 22-Feb-2016 Simon Glass <sjg@chromium.org>

Move CONFIG_OF_LIBFDT to Kconfig

Move this option to Kconfig and tidy up existing boards.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a187559e 05-Feb-2016 Bin Meng <bmeng.cn@gmail.com>

Use correct spelling of "U-Boot"

Correct spelling of "U-Boot" shall be used in all written text
(documentation, comments in source files etc.).

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Minkyu Kang <mk7.kang@samsung.com>

# 947c626d 14-Jan-2016 Tom Rini <trini@konsulko.com>

vsprintf.c: Always enable CONFIG_SYS_VSNPRINTF

Enabling this function always removes some class of string saftey issues.
The size change here in general is about 400 bytes and this seems a reasonable
trade-off.

Cc: Peng Fan <peng.fan@nxp.com>
Cc: Peter Robinson <pbrobinson@gmail.com>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Adrian Alonso <aalonso@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 7d9cde10 22-Nov-2015 Stefan Roese <sr@denx.de>

lib/tiny-printf.c: Add tiny printf function for space limited environments

This patch adds a small printf() version that supports all basic formats.
Its intented to be used in U-Boot SPL versions on platforms with very
limited internal RAM sizes.

To enable it, just define CONFIG_USE_TINY_PRINTF in your defconfig. This
will result in the SPL using this tiny function and the main U-Boot
still using the full-blown printf() function.

This code was copied from:
http://www.sparetimelabs.com/printfrevisited
With mostly only coding style related changes so that its checkpatch
clean.

The size reduction is about 2.5KiB. Here a comparison for the db-mv784mp-gp
(Marvell AXP) SPL:

Without this patch:
58963 18536 1928 79427 13643 ./spl/u-boot-spl

With this patch:
56542 18536 1956 77034 12cea ./spl/u-boot-spl

Note:
To make it possible to compile tiny-printf.c instead of vsprintf.c when
CONFIG_USE_TINY_PRINTF is defined, the functions printf() and vprintf() are
moved from common/console.c into vsprintf.c in this patch.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>

# 2419cd16 03-Oct-2015 Simon Glass <sjg@chromium.org>

dm: tpm: Drop CONFIG_DM_TPM

Now that all TPM drivers use driver model, we can drop the special driver
model CONFIG option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>

# 027b728d 06-Oct-2015 Julius Werner <jwerner@chromium.org>

Add support for LZ4 decompression algorithm

This patch adds support for LZ4-compressed FIT image contents. This
algorithm has a slightly worse compression ration than LZO while being
nearly twice as fast to decompress. When loading images from a fast
storage medium this usually results in a boot time win.

Sandbox-tested only since I don't have a U-Boot development system set
up right now. The code was imported unchanged from coreboot where it's
proven to work, though. I'm mostly interested in getting this recognized
by mkImage for use in a downstream project.

Signed-off-by: Julius Werner <jwerner@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# a7d660bc 22-Aug-2015 Simon Glass <sjg@chromium.org>

tpm: Add Kconfig options for TPMs

Add new Kconfig options for TPMs in preparation for moving boards to use
Kconfig for TPM configuration.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 867a6ac8 31-Jul-2015 Simon Glass <sjg@chromium.org>

efi: Add start-up library code

When running as an EFI application, U-Boot must request memory from EFI,
and provide access to the boot services U-Boot needs.

Add library code to perform these tasks. This includes efi_main() which is
the entry point from EFI. U-Boot is built as a shared library.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d1389403 23-Jun-2015 Simon Glass <sjg@chromium.org>

Add a dhrystone benchmark command

Drystone provides a convenient sanity check that the CPU is running at full
speed. Add this as a command which can be enabled as needed.

Note: I investigated using Coremark for this but there was a license
agreement and I could not work out if it was GPL-compatible.

Signed-off-by: Simon Glass <sjg@chromium.org>

# f7848d90 22-Jun-2015 Joe Hershberger <joe.hershberger@ni.com>

Allow CONFIG_REGEX to be disabled when CONFIG_NET

Instead of selecting REGEX when NET is enabled, make it the default, but
allow boards that are tiny to disable it and lose functionality on all
but the first Ethernet adapter.

cm-bf548, bf538f-ezkit, and bf533-stamp need this. None appear to have
more than one Ethernet interface.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# 3850dbe8 11-Jun-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

blackfin: fix undefined reference to srand and rand

Commit 9ba9e85f3f1c (net: Fix NET_RANDOM_ETHADDR dependencies)
accidentally dropped CONFIG_LIB_RAND defines for 14 Blackfin boards.

Prior to that commit, those boards defined CONFIG_LIB_RAND, but not
CONFIG_NET_RANDOM_ETHADDR. So, commit 9ba9e85f3f1c should not have
touched them, but in fact it ripped CONFIG_LIB_RAND off from all the
header files, which caused undefined reference to srand and rand.
CONFIG_LIB_RAND=y must be revived for such boards.

BTW, this commit indeed makes it better, but even with this fix,
three boards (bf533-stamp, bf538f-ezkit, cm-bf548) still can not
build due to region 'ram' overflowed error. This was cause by
commit 6eed3786c68c (net: Move the CMD_NET config to defconfigs)
because CMD_NET selects NET, and NET selects REGEX. Eventually,
some boards were newly enabled with CONFIG_REGEX, increasing the
memory footprint. A patch is expected to fix the build error.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 9ba9e85f 25-May-2015 Michal Simek <michal.simek@xilinx.com>

net: Fix NET_RANDOM_ETHADDR dependencies

NET_RANDOM_ETHADDR depends on lib/rand.c. This patch adds dependency to
Kconfig to ensure that library is also compiled.

Remove the definitions from Blackfin boards' include/configs.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 6501ff62 20-Apr-2015 Przemyslaw Marczak <p.marczak@samsung.com>

lib: Kconfig: add entry for errno_str() function

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1a60650c 21-Apr-2015 Joe Hershberger <joe.hershberger@ni.com>

kconfig: Move REGEX to Kconfig

Having this as a Kconfig allows it to be a dependent feature.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8156345d 06-Mar-2015 Simon Glass <sjg@chromium.org>

sandbox: Move CONFIG_SYS_VSNPRINTF to Kconfig

Move this over to Kconfig and tidy up.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 94e3c8c4 19-Feb-2015 gaurav rana <gaurav.rana@freescale.com>

crypto/fsl - Add progressive hashing support using hardware acceleration.

Currently only normal hashing is supported using hardware acceleration.
Added support for progressive hashing using hardware.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
Signed-off-by: Gaurav Rana <gaurav.rana@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>

# d9f23c7f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

lib/rsa: Add Kconfig for devices supporting RSA Modular Exponentiation

Kconfig option added for devices which support RSA Verification.
1. RSA_SOFTWARE_EXP
Enables driver for supporting RSA Modular Exponentiation in Software
2. RSA_FREESCALE_EXP
Enables driver for supporting RSA Modular Exponentiation using Freescale specific
driver

The above drivers use RSA uclass

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
(Removed duplicate line in Kconfig comment)

Change-Id: I7663c4d5350e2bfc3dfa2696f70ef777d6ccc6f6

# c4beb22f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

FIT: Modify option FIT_SIGNATURE in Kconfig

For FIT signature based approach to work, RSA library needs to be selected.
The FIT_SIGNATURE option in Kconfig is modified to automatically select RSA.
Selecting RSA compiles the RSA library required for image verification.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 45ccec8f 23-Oct-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_USE_PRIVATE_LIBGCC to Kconfig

The private libgcc is supported only on ARM, MIPS, PowerPC, SH, x86.
Those architectures should "select" HAVE_PRIVATE_LIBGCC and
CONFIG_USE_PRIVATE_LIBGCC should depend on it.

Currently, this option is enabled on Tegra boards and x86 architecture.
Move the definition from header files to Kconfig.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Tested-by: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: Tom Warren <twarren@nvidia.com>

# 8c688bc4 23-Oct-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_SYS_HZ to lib/Kconfig

CONFIG_SYS_HZ is always defined as 1000 in config_fallbacks.h
(but some boards still have redundant definitions).

This commit moves the definition and the document in README to
Kconfig. Since lib/Kconfig can assure that CONFIG_SYS_HZ is 1000,
the sanity check in lib/time.c should be removed.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Reviewed-by: Marek Vasut <marex@denx.de>

# b0928da6 16-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED to Kconfig

If this option is enabled, the objects under lib/ directory
are compiled with speed optimization, not size optimization.
(Currently, only used by some Blackfin boards.)

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# ed36323f 16-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: add blank Kconfig files

This would be useful to start moving various config options.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# 04cb3994 21-Apr-2020 Weijie Gao <weijie.gao@mediatek.com>

lib: enable lzma decompression support for SPL build

This patch enables LZMA decompression support for SPL build

Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>

# 2a2119e1 05-Mar-2020 Atish Patra <atish.patra@wdc.com>

lib: kconfig: Add option to set BZIP2 compression method

There is no way to select BZIP2 compression method.
Add it under library/compression config where all other
compression related configs are present.

Signed-off-by: Atish Patra <atish.patra@wdc.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 805b3cac 12-Feb-2020 Keerthy <j-keerthy@ti.com>

lib: elf: Move the generic elf loading/validating functions to lib

Move the generic elf loading/validating functions to lib/
so that they can be re-used and accessed by code existing
outside cmd.

While at it remove the duplicate static version of load_elf_image_phdr
under arch/arm/mach-imx/imx_bootaux.c.

Signed-off-by: Keerthy <j-keerthy@ti.com>
Suggested-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>

# 1611235b 19-Jan-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: Kconfig dependencies for pseudo-random library

drivers/rng/sandbox_rng.c requires rand() to be defined but configuration
option CONFIG_CONFIG_LIB_RAND selected in drivers/rng/Kconfig does not
exist.

test/lib/test_aes.c requires rand() to be defined.

Fix the selection criteria for choice "Pseudo-random library support type".

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 3c10dc95 06-Dec-2019 Simon Glass <sjg@chromium.org>

binman: Add a library to access binman entries

SPL and TPL can access information about binman entries using link-time
symbols but this is not available in U-Boot proper. Of course it could be
made available, but the intention is to just read the device tree.

Add support for this, so that U-Boot can locate entries.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# b4adf627 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: crypto: add x509 parser

Imported from linux kernel v5.3:
x509.asn1 without changes
x509_akid.asn1 without changes
x509_parser.h without changes
x509_cert_parser.c with changes marked as __UBOOT__
x509_public_key.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# a9b45e6e 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add oid registry utility

Imported from linux kernel v5.3:
build_OID_registry without changes
oid_registry.h without changes
oid_registry.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# ab8a0e06 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add asn1 decoder

Imported from linux kernel v5.3:
lib/asn1_decoder.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 2b12196d 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

cmd: add asn1_compiler

Imported from linux kernel v5.3:
asn1.h without changes
asn1_ber_bytecode.h without changes
asn1_decoder.h without changes
asn1_compiler.c without changes

This host command will be used to create a ASN1 parser, for example,
for pkcs7 messages or x509 certificates. More specifically, it will
generate *byte code* which will be interpreted by asn1 decoder library.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 05429b6c 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

rtc: move date.c from drivers/rtc/ to lib/

In the next commit, rtc_mktime(), for compatibility with linux, will be
implemented using rtc_mktime(), which is no longer drivers/rtc specific.
So move this file under lib/.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 37ef1774 10-Nov-2019 Thomas Hebb <tommyhebb@gmail.com>

Kconfig: disambiguate config names for tiny printf

27084c03d36a ("spl: Allow tiny printf() to be controlled in SPL and
TPL") split this option in two for TPL and SPL, but didn't change the
Kconfig names, making them hard to set quickly.

Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>

# 0d76afc0 27-Oct-2019 Simon Glass <sjg@chromium.org>

fdt: Add Kconfig options to control code size

For better or worse libfdt recent grew a lot of code that checks the
validity of the device tree in great detail. When using unsigned or
unverified data this makes things safer, but it does add to code size.

Add some controls to select the trade-off between safety and code size.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 27084c03 25-Sep-2019 Simon Glass <sjg@chromium.org>

spl: Allow tiny printf() to be controlled in SPL and TPL

At present there is only one control for this and it is used for both SPL
and TPL. But SPL might have a lot more space than TPL so the extra cost of
a full printf() might be acceptable.

Split the option into two, providing separate SPL and TPL controls. The
TPL setting defaults to the same as SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2a51e16b 07-Jun-2019 Tom Rini <trini@konsulko.com>

configs: Make USE_TINY_PRINTF depend on SPL||TPL and be default

The USE_TINY_PRINTF symbol only changes things within SPL and TPL
builds, so make it depend on that support. Next, make it default as
within these cases we should rarely have need of more advanced print
formats outside of the debug context.

To do this, in a few cases we need to correct our Kconfig dependencies
as we had cases of non-SPL targets select'ing this symbol. Finally, in
the case of a few boards we really do need the full printf
functionality.

Signed-off-by: Tom Rini <trini@konsulko.com>

# da0fb5fd 02-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: make call depth limit customizable

Up to now we had hard coded values for the call depth up to which trace
records are created: 200 for early tracing, 15 thereafter. UEFI
applications reach a call depth of 80 or above.

Provide customizing settings for the call trace depth limit and the early
call trace depth limit. Use the old values as defaults.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8509f22a 29-Apr-2019 Marek Behún <marek.behun@nic.cz>

lib: add Zstandard decompression support

Add the zstd library from Linux kernel (only decompression support).
There are minimal changes to build with U-Boot, otherwise the files are
identical to Linux commit dc35da16 from March 2018, the files had not
been touched since in kernel. Also SPDX lincese tags were added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 83a486b6 29-Apr-2019 Marek Behún <marek.behun@nic.cz>

lib: Add xxhash support

This adds the xxhash support from Linux. Files are almost identical to
those added to Linux in commit 5d240522 ("lib: Add xxhash module") (they
haven't been touched since in Linux). The only difference is to add some
includes to be compatible with U-Boot. Also SPDX lincese tags were
added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 5132361a 29-Apr-2019 Heiko Schocher <hs@denx.de>

lib: Kconfig: fix help text for GZIP

commit 95f4bbd581cf ("lib: fdt: Allow LZO and GZIP DT compression in U-Boot")

introduced Kconfig option for gzip in U-Boot, but help text
says gzip for SPL, which is wrong. Fix this.

Signed-off-by: Heiko Schocher <hs@denx.de>
Acked-by: Marek Vasut <marex@denx.de>

# 1c6eb075 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE_BUFFER_SIZE et al to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE_BUFFER_SIZE
CONFIG_TRACE_EARLY_SIZE
CONFIG_TRACE_EARLY
CONFIG_TRACE_EARLY_ADDR

Signed-off-by: Simon Glass <sjg@chromium.org>

# a24a78d7 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE

Signed-off-by: Simon Glass <sjg@chromium.org>

# 54969b40 21-Mar-2019 Thierry Reding <treding@nvidia.com>

fdtdec: Add Kconfig symbol for tests

Runtime tests are provided as a test_fdtdec command implementation. Add
a Kconfig symbol that allows this command to be built so that the tests
can be used.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 95f4bbd5 08-Mar-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

lib: fdt: Allow LZO and GZIP DT compression in U-Boot

Add required Kconfig symbols, Makefile bits and macro fixes in a
few places to support LZO and DT compression in U-Boot. This can
save a lot of space with multi-DTB fitImages.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>

# 6e705114 13-Jan-2019 Chris Packham <judge.packham@gmail.com>

lib: Kconfig: spelling fixes

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 048c6e89 06-Nov-2018 Simon Glass <sjg@chromium.org>

spl: lz4: Allow use of lz4 compression in SPL

In some cases U-Boot is compressed and it is useful to be able to
decompress it in SPL. Add a Kconfig and Makefile change to allow this.
Note that this does not actually implement decompression.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 2895c4b7 15-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

kconfig: Introduce HAVE_ARCH_IOMAP

Introduce a new Kconfig option for architecture codes to control
whether it provides io{read,write}{8,16,32} I/O accessor functions.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5592a633 01-Oct-2018 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt in TPL

In some cases (e.g. sandbox with verified boot) it is useful to support
libfdt in TPL. Update the Kconfig to handle this.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 6307896c 01-Oct-2018 Simon Glass <sjg@chromium.org>

tpm: Add support for SPL and TPL

At present the tpm can only be used in U-Boot proper. Updated it to work
in SPL and TPL also.

Signed-off-by: Simon Glass <sjg@chromium.org>

# ab948cd2 19-Jul-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

fdt_support: make FDT_FIXUP_PARTITIONS depend on CMD_MTDPARTS

fdt_fixup_mtdparts() calls mtdparts_init() and device_find(),
which are defined in cmd/mtdparts.c

The combination of FDT_FIXUP_PARTITIONS=y and CMD_MTDPARTS=n
emits the following link error:

common/fdt_support.c:903: undefined reference to `mtdparts_init'
common/fdt_support.c:914: undefined reference to `device_find'

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 3330584d 03-Jun-2018 Igor Opaniuk <igor.opaniuk@gmail.com>

avb2.0: integrate avb 2.0 into the build system

Integrate libavb into the build system. Introduce CONFIG_LIBAVB
build option.

Signed-off-by: Igor Opaniuk <igor.opaniuk@linaro.org>

# f8c987f8 05-Jun-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

lib: Add hexdump

Often during debugging session it's very interesting to see
what data we were dealing with. For example what we write or read
to/from memory or peripherals.

This change introduces functions that allow to dump binary
data with one simple function invocation like:
------------------->8----------------
print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, buf, len);
------------------->8----------------

which gives us the following:
------------------->8----------------
00000000: f2 b7 c9 88 62 61 75 64 72 61 74 65 3d 31 31 35 ....baudrate=115
00000010: 32 30 30 00 62 6f 6f 74 61 72 67 73 3d 63 6f 6e 200.bootargs=con
00000020: 73 6f 6c 65 3d 74 74 79 53 33 2c 31 31 35 32 30 sole=ttyS3,11520
00000030: 30 6e 38 00 62 6f 6f 74 64 65 6c 61 79 3d 33 00 0n8.bootdelay=3.
00000040: 62 6f 6f 74 66 69 6c 65 3d 75 49 6d 61 67 65 00 bootfile=uImage.
00000050: 66 64 74 63 6f 6e 74 72 6f 6c 61 64 64 72 3d 39 fdtcontroladdr=9
00000060: 66 66 62 31 62 61 30 00 6c 6f 61 64 61 64 64 72 ffb1ba0.loadaddr
00000070: 3d 30 78 38 32 30 30 30 30 30 30 00 73 74 64 65 =0x82000000.stde
00000080: 72 72 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 rr=serial0@e0022
00000090: 30 30 30 00 73 74 64 69 6e 3d 73 65 72 69 61 6c 000.stdin=serial
000000a0: 30 40 65 30 30 32 32 30 30 30 00 73 74 64 6f 75 0@e0022000.stdou
000000b0: 74 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 30 t=serial0@e00220
000000c0: 30 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00..............
...
------------------->8----------------

Source of hexdump.c was copied from Linux kernel v4.7-rc2.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Mario Six <mario.six@gdsys.cc>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Stefan Roese <sr@denx.de>

# c232d14d 29-May-2018 Alex Kiernan <alex.kiernan@gmail.com>

mmc: Separate "mmc swrite" from fastboot

Introduce CONFIG_IMAGE_SPARSE and CONFIG_CMD_MMC_SWRITE so the "mmc
swrite" command is separated from the fastboot code.

Move image-sparse from common to lib so it's clear it's library code.

Rename CONFIG_FASTBOOT_FLASH_FILLBUF_SIZE to CONFIG_IMAGE_SPARSE_FILLBUF_SIZE
and migrate it to Kconfig.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Acked-by: Jassi Brar <jaswinder.singh@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6417572e 08-May-2018 Tom Rini <trini@konsulko.com>

lib/Kconfig: Mark OF_LIBFDT_OVERLAY as depending on OF_LIBFDT

The overlay code is only useful when OF_LIBFDT is set, so mark it as
depending on that first.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 58a46f88 25-Apr-2018 Praneeth Bajjuri <praneeth@ti.com>

configs: TI: Enable FIT Library overlay support

Enable the FDT library overlay support for all TI SOC family.

Without this option, when Loading fdt from FIT image, the
following warning is seen.

"config with overlays but CONFIG_OF_LIBFDT_OVERLAY not set".

Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
Suggested-by: Andrew F.Davis <afd@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>

# 14ad44ab 18-Apr-2018 Alex Kiernan <alex.kiernan@gmail.com>

spl: Split sprintf, strto* from SPL serial in Kconfig

When SPL serial is disabled, callers who need sprintf or strtoul fail
because their inclusion is guarded by CONFIG_SPL_SERIAL_SUPPORT/
CONFIG_TPL_SERIAL_SUPPORT.

Split printf, sprintf and strto into their own entries and then select
all of them if SERIAL_SUPPORT is enabled to match the current behaviour.

Include panic.o unconditionally as it can be called from anywhere which
uses BUG_ON().

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>

# e294ba06 04-Apr-2018 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-sunxi

Signed-off-by: Tom Rini <trini@konsulko.com>


# d14db11d 03-Apr-2018 Andre Przywara <andre.przywara@arm.com>

sunxi: revert disabling of features

In January some commits were introduced to mitigate the U-Boot image
size issues we encountered on sunxi builds.
Now with the MMC environment removed we can bring them back, as we
practically don't have a size limit anymore.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 32ce6179 13-Mar-2018 Bryan O'Donoghue <bryan.odonoghue@linaro.org>

optee: Add lib entries for sharing OPTEE code across ports

This patch adds code to lib to enable sharing of useful OPTEE code between
board-ports and architectures. The code on lib/optee/optee.c comes from the
TI omap2 port. Eventually the OMAP2 code will be patched to include the
shared code. The intention here is to add more useful OPTEE specific code
as more functionality gets added.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Cc: Harinarayan Bhatta <harinarayan@ti.com>
Cc: Andrew F. Davis <afd@ti.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Kever Yang <kever.yang@rock-chips.com>
Cc: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Cc: Peng Fan <peng.fan@nxp.com>
Tested-by: Peng Fan <peng.fan@nxp.com>

# 36c1877c 06-Feb-2018 Faiz Abbas <faiz_abbas@ti.com>

lib: Kconfig: Move DYNAMIC_CRC_TABLE to Kconfig

Add CONFIG prefix to DYNAMIC_CRC_TABLE and implement it in
Kconfig.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>

# a451bc27 05-Feb-2018 Adam Ford <aford173@gmail.com>

Convert LIB_UUID to Kconfig

config_fallback.h has some logic that checks a variety of options
and selects LIB_UUID if it hasn't already been selected. This
will all LIB_UUID in Kconfig and select this option for the list
of options to allow us to remove the logic from fallbacks

Signed-off-by: Adam Ford <aford173@gmail.com>

# a5a37567 06-Feb-2018 Adam Ford <aford173@gmail.com>

Convert CONFIG LIB_HW_RAND to Kconfig

config_fallbacks.h had some logic to automatically select
LIB_RAND if RANDOM_UUID or CMD_UUID were set if LIB_HW_RAND wasn't
already selected. By migrating LIB_HW_RAND to Kconfig, we can
remove this check from config_fallbacks.h and put it into Kconfig

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
[trini: Turn into a choice, add NET_RANDOM_ETHADDR]
Signed-off-by: Tom Rini <trini@konsulko.com>

# acd4d334 16-Jan-2018 Maxime Ripard <maxime.ripard@free-electrons.com>

net: regex: Disable by default on sunXi

The sunXi arm64 build has overflown, leading to the main U-boot binary
overwriting the environment when flashing the new image, or even worse,
overwriting itself when we're calling saveenv.

Disable this option that is not critical until we can adress the issue
properly.

Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 7e3caa81 03-Dec-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

Move CONFIG_PANIC_HANG to Kconfig

Freescale (NXP) boards have lots of defconfig files per board.
I used "imply PANIC_HANG" for them.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# da5337a6 08-Nov-2017 Nandor Han <nandor.han@ge.com>

rtc: add support for s35392a

Add support for S35392A RTC. The driver supports both U-Boot driver
models.

Signed-off-by: Nandor Han <nandor.han@ge.com>
Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
Cc: Heiko Schocher <hs@denx.de>

# f52bdf4b 14-Sep-2017 Jean-Jacques Hiblot <jjhiblot@ti.com>

lib: allow building lzo for the SPL

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 85d8bf57 03-Sep-2017 Marek Behún <marek.behun@nic.cz>

lib: Add CRC32-C

This is needed for BTRFS.

Signed-off-by: Marek Behun <marek.behun@nic.cz>

create mode 100644 lib/crc32c.c

# 7264f292 15-Aug-2017 York Sun <york.sun@nxp.com>

spl: fit: Eanble GZIP support for image decompression

Add Kconfig option SPL_GZIP and SPL_ZLIB to enable gunzip support for
SPL boot, eg. falcon boot compressed kernel image.

Signed-off-by: York Sun <york.sun@nxp.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6ef2f901 11-Aug-2017 Adam Ford <aford173@gmail.com>

Convert CONFIG_BCH to Kconfig

This converts the following to Kconfig:
CONFIG_BCH

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1a7ba1d 18-Aug-2017 Anatolij Gustschin <agust@denx.de>

Fix 'notes' typos

s/notes/nodes

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 96b9082c 03-Aug-2017 Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

rockchip: rk3188: rock: adjust for SPL/TPL split

With the changes to split SPL/TPL for the RK3368, I apparently missed
some needed adjustments to the RK3188 Kconfig and rock_defconfig.

This fixes build-issues for the rock board after applying the RK3368
enablement (and SPL/TPL) set that resulted from TPL_SERIAL_SUPPORT,
TPL_ROCKCHIP_BACK_TO_BROM and TPL_TINY_MEMSET being separate symbols
now.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d56b4b19 22-Jul-2017 Tom Rini <trini@konsulko.com>

configs: Migrate RBTREE, LZO, CMD_MTDPARTS, CMD_UBI and CMD_UBIFS

The above CONFIG options are in Kconfig, and now have correct depends and
inter-dependencies. Migrate these to configs/ from include/configs/. In the
case of CMD_UBIFS also change it to be a default y if CMD_UBI.

Signed-off-by: Tom Rini <trini@konsulko.com>

# aed998aa 17-May-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_LZMA to Kconfig

This converts the following to Kconfig:
CONFIG_LZMA

Signed-off-by: Simon Glass <sjg@chromium.org>

# b1a873df 26-Apr-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_CMD_AES et al to Kconfig

This converts the following to Kconfig:
CONFIG_CMD_AES
CONFIG_AES

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Add select AES to CMD_AES]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 173aafbf 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

cmd: Expose a Kconfig option to enable UBIFS commands

Create a new Kconfig entry to allow CMD_UBIFS selection from Kconfig and
add an hidden LZO option that can be selected by CMD_UBIFS.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>

# aa049152 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

mtd: ubi: Select RBTREE option from MTD_UBI Kconfig entry

Expose the RBTREE feature through Kconfig and select this option from the
MTD_UBI option.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>
[Rebased on master]
Signed-off-by: Jagan Teki <jagan@openedev.com>

# ab4458bd 02-Apr-2017 Simon Glass <sjg@chromium.org>

string: Provide a slimmed-down memset()

Most of the time the optimised memset() is what we want. For extreme
situations such as TPL it may be too large. For example on the 'rock'
board, using a simple loop saves a useful 48 bytes. With gcc 4.9 and
the rodata bug, this patch is enough to reduce the TPL image below the
limit.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>

# bea79d7d 14-Mar-2017 Andre Przywara <andre.przywara@arm.com>

Kconfig: introduce md5sum command selection

So far CONFIG_MD5SUM would need to be set by a board's include file.
Since the command is really generic, move it over to Kconfig to allow
it to be defined by either a board's defconfig, menuconfig or some
config snippet merged via mergeconfig.sh.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e663b350 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

smbios: Expose in efi_loader as table

We can pass SMBIOS easily as EFI configuration table to an EFI payload. This
patch adds enablement for that case.

While at it, we also enable SMBIOS generation for ARM systems, since they support
EFI_LOADER.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4b6dddc2 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

x86: Move smbios generation into arch independent directory

We will need the SMBIOS generation function on ARM as well going forward,
so let's move it into a non arch specific location.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# ebf7fff2 05-Oct-2016 Heiko Schocher <hs@denx.de>

spl: move FDT_FIXUP_PARTITIONS to Kconfig

Move FDT_FIXUP_PARTITIONS to Kconfig and cleanup existing
uses.

Signed-off-by: Heiko Schocher <hs@denx.de>

# ddf67f71 05-Jul-2016 Maxime Ripard <maxime.ripard@free-electrons.com>

libfdt: Add overlay application function

The device tree overlays are a good way to deal with user-modifyable
boards or boards with some kind of an expansion mechanism where we can
easily plug new board in (like the BBB, the Raspberry Pi or the CHIP).

Add a new function to merge overlays with a base device tree.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>

# 91b86e21 26-May-2016 Marek Vasut <marex@denx.de>

lib: Enable private libgcc by default

This patch decouples U-Boot binary from the toolchain on systems where
private libgcc is available. Instead of pulling in functions provided
by the libgcc from the toolchain, U-Boot will use it's own set of libgcc
functions. These functions are usually imported from Linux kernel, which
also uses it's own libgcc functions instead of the ones provided by the
toolchain.

This patch solves a rather common problem. The toolchain can usually
generate code for many variants of target architecture and often even
different endianness. The libgcc on the other hand is usually compiled
for one particular configuration and the functions provided by it may
or may not be suited for use in U-Boot. This can manifest in two ways,
either the U-Boot fails to compile altogether and linker will complain
or, in the much worse case, the resulting U-Boot will build, but will
misbehave in very subtle and hard to debug ways.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 67976306 30-Mar-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

cosmetic: Fix typos "privide"

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# ed980b8c 03-Mar-2016 Alexander Graf <agraf@csgraf.de>

efi_loader: hook up in build environment

Now that we have all the bits and pieces ready for EFI payload loading
support, hook them up in Makefiles and KConfigs so that we can build.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
[trini: Enable only when we of OF_LIBFDT, disable on kwb and colibri_pxa270]
Signed-off-by: Tom Rini <trini@konsulko.com>

# aa34fbc0 22-Feb-2016 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt to be used in SPL

Add an option to enable libfdt in SPL. This can be useful when decoding
FIT files in SPL.

We need to make sure this option is not enabled in SPL by this change.
Also this option needs to be enabled in host builds. Si add a new
IMAGE_USE_LIBFDT #define which can be used in files that are built on the
host but must also build for U-Boot and SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 69e173eb 22-Feb-2016 Simon Glass <sjg@chromium.org>

Move CONFIG_OF_LIBFDT to Kconfig

Move this option to Kconfig and tidy up existing boards.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a187559e 05-Feb-2016 Bin Meng <bmeng.cn@gmail.com>

Use correct spelling of "U-Boot"

Correct spelling of "U-Boot" shall be used in all written text
(documentation, comments in source files etc.).

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Minkyu Kang <mk7.kang@samsung.com>

# 947c626d 14-Jan-2016 Tom Rini <trini@konsulko.com>

vsprintf.c: Always enable CONFIG_SYS_VSNPRINTF

Enabling this function always removes some class of string saftey issues.
The size change here in general is about 400 bytes and this seems a reasonable
trade-off.

Cc: Peng Fan <peng.fan@nxp.com>
Cc: Peter Robinson <pbrobinson@gmail.com>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Adrian Alonso <aalonso@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 7d9cde10 22-Nov-2015 Stefan Roese <sr@denx.de>

lib/tiny-printf.c: Add tiny printf function for space limited environments

This patch adds a small printf() version that supports all basic formats.
Its intented to be used in U-Boot SPL versions on platforms with very
limited internal RAM sizes.

To enable it, just define CONFIG_USE_TINY_PRINTF in your defconfig. This
will result in the SPL using this tiny function and the main U-Boot
still using the full-blown printf() function.

This code was copied from:
http://www.sparetimelabs.com/printfrevisited
With mostly only coding style related changes so that its checkpatch
clean.

The size reduction is about 2.5KiB. Here a comparison for the db-mv784mp-gp
(Marvell AXP) SPL:

Without this patch:
58963 18536 1928 79427 13643 ./spl/u-boot-spl

With this patch:
56542 18536 1956 77034 12cea ./spl/u-boot-spl

Note:
To make it possible to compile tiny-printf.c instead of vsprintf.c when
CONFIG_USE_TINY_PRINTF is defined, the functions printf() and vprintf() are
moved from common/console.c into vsprintf.c in this patch.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>

# 2419cd16 03-Oct-2015 Simon Glass <sjg@chromium.org>

dm: tpm: Drop CONFIG_DM_TPM

Now that all TPM drivers use driver model, we can drop the special driver
model CONFIG option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>

# 027b728d 06-Oct-2015 Julius Werner <jwerner@chromium.org>

Add support for LZ4 decompression algorithm

This patch adds support for LZ4-compressed FIT image contents. This
algorithm has a slightly worse compression ration than LZO while being
nearly twice as fast to decompress. When loading images from a fast
storage medium this usually results in a boot time win.

Sandbox-tested only since I don't have a U-Boot development system set
up right now. The code was imported unchanged from coreboot where it's
proven to work, though. I'm mostly interested in getting this recognized
by mkImage for use in a downstream project.

Signed-off-by: Julius Werner <jwerner@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# a7d660bc 22-Aug-2015 Simon Glass <sjg@chromium.org>

tpm: Add Kconfig options for TPMs

Add new Kconfig options for TPMs in preparation for moving boards to use
Kconfig for TPM configuration.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 867a6ac8 31-Jul-2015 Simon Glass <sjg@chromium.org>

efi: Add start-up library code

When running as an EFI application, U-Boot must request memory from EFI,
and provide access to the boot services U-Boot needs.

Add library code to perform these tasks. This includes efi_main() which is
the entry point from EFI. U-Boot is built as a shared library.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d1389403 23-Jun-2015 Simon Glass <sjg@chromium.org>

Add a dhrystone benchmark command

Drystone provides a convenient sanity check that the CPU is running at full
speed. Add this as a command which can be enabled as needed.

Note: I investigated using Coremark for this but there was a license
agreement and I could not work out if it was GPL-compatible.

Signed-off-by: Simon Glass <sjg@chromium.org>

# f7848d90 22-Jun-2015 Joe Hershberger <joe.hershberger@ni.com>

Allow CONFIG_REGEX to be disabled when CONFIG_NET

Instead of selecting REGEX when NET is enabled, make it the default, but
allow boards that are tiny to disable it and lose functionality on all
but the first Ethernet adapter.

cm-bf548, bf538f-ezkit, and bf533-stamp need this. None appear to have
more than one Ethernet interface.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# 3850dbe8 11-Jun-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

blackfin: fix undefined reference to srand and rand

Commit 9ba9e85f3f1c (net: Fix NET_RANDOM_ETHADDR dependencies)
accidentally dropped CONFIG_LIB_RAND defines for 14 Blackfin boards.

Prior to that commit, those boards defined CONFIG_LIB_RAND, but not
CONFIG_NET_RANDOM_ETHADDR. So, commit 9ba9e85f3f1c should not have
touched them, but in fact it ripped CONFIG_LIB_RAND off from all the
header files, which caused undefined reference to srand and rand.
CONFIG_LIB_RAND=y must be revived for such boards.

BTW, this commit indeed makes it better, but even with this fix,
three boards (bf533-stamp, bf538f-ezkit, cm-bf548) still can not
build due to region 'ram' overflowed error. This was cause by
commit 6eed3786c68c (net: Move the CMD_NET config to defconfigs)
because CMD_NET selects NET, and NET selects REGEX. Eventually,
some boards were newly enabled with CONFIG_REGEX, increasing the
memory footprint. A patch is expected to fix the build error.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 9ba9e85f 25-May-2015 Michal Simek <michal.simek@xilinx.com>

net: Fix NET_RANDOM_ETHADDR dependencies

NET_RANDOM_ETHADDR depends on lib/rand.c. This patch adds dependency to
Kconfig to ensure that library is also compiled.

Remove the definitions from Blackfin boards' include/configs.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 6501ff62 20-Apr-2015 Przemyslaw Marczak <p.marczak@samsung.com>

lib: Kconfig: add entry for errno_str() function

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1a60650c 21-Apr-2015 Joe Hershberger <joe.hershberger@ni.com>

kconfig: Move REGEX to Kconfig

Having this as a Kconfig allows it to be a dependent feature.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8156345d 06-Mar-2015 Simon Glass <sjg@chromium.org>

sandbox: Move CONFIG_SYS_VSNPRINTF to Kconfig

Move this over to Kconfig and tidy up.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 94e3c8c4 19-Feb-2015 gaurav rana <gaurav.rana@freescale.com>

crypto/fsl - Add progressive hashing support using hardware acceleration.

Currently only normal hashing is supported using hardware acceleration.
Added support for progressive hashing using hardware.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
Signed-off-by: Gaurav Rana <gaurav.rana@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>

# d9f23c7f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

lib/rsa: Add Kconfig for devices supporting RSA Modular Exponentiation

Kconfig option added for devices which support RSA Verification.
1. RSA_SOFTWARE_EXP
Enables driver for supporting RSA Modular Exponentiation in Software
2. RSA_FREESCALE_EXP
Enables driver for supporting RSA Modular Exponentiation using Freescale specific
driver

The above drivers use RSA uclass

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
(Removed duplicate line in Kconfig comment)

Change-Id: I7663c4d5350e2bfc3dfa2696f70ef777d6ccc6f6

# c4beb22f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@nxp.com>

FIT: Modify option FIT_SIGNATURE in Kconfig

For FIT signature based approach to work, RSA library needs to be selected.
The FIT_SIGNATURE option in Kconfig is modified to automatically select RSA.
Selecting RSA compiles the RSA library required for image verification.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 45ccec8f 23-Oct-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_USE_PRIVATE_LIBGCC to Kconfig

The private libgcc is supported only on ARM, MIPS, PowerPC, SH, x86.
Those architectures should "select" HAVE_PRIVATE_LIBGCC and
CONFIG_USE_PRIVATE_LIBGCC should depend on it.

Currently, this option is enabled on Tegra boards and x86 architecture.
Move the definition from header files to Kconfig.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Tested-by: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: Tom Warren <twarren@nvidia.com>

# 8c688bc4 23-Oct-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_SYS_HZ to lib/Kconfig

CONFIG_SYS_HZ is always defined as 1000 in config_fallbacks.h
(but some boards still have redundant definitions).

This commit moves the definition and the document in README to
Kconfig. Since lib/Kconfig can assure that CONFIG_SYS_HZ is 1000,
the sanity check in lib/time.c should be removed.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Reviewed-by: Marek Vasut <marex@denx.de>

# b0928da6 16-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED to Kconfig

If this option is enabled, the objects under lib/ directory
are compiled with speed optimization, not size optimization.
(Currently, only used by some Blackfin boards.)

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# ed36323f 16-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: add blank Kconfig files

This would be useful to start moving various config options.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# 2a2119e1 05-Mar-2020 Atish Patra <atish.patra@wdc.com>

lib: kconfig: Add option to set BZIP2 compression method

There is no way to select BZIP2 compression method.
Add it under library/compression config where all other
compression related configs are present.

Signed-off-by: Atish Patra <atish.patra@wdc.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 805b3cac 12-Feb-2020 Keerthy <j-keerthy@ti.com>

lib: elf: Move the generic elf loading/validating functions to lib

Move the generic elf loading/validating functions to lib/
so that they can be re-used and accessed by code existing
outside cmd.

While at it remove the duplicate static version of load_elf_image_phdr
under arch/arm/mach-imx/imx_bootaux.c.

Signed-off-by: Keerthy <j-keerthy@ti.com>
Suggested-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>

# 1611235b 19-Jan-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: Kconfig dependencies for pseudo-random library

drivers/rng/sandbox_rng.c requires rand() to be defined but configuration
option CONFIG_CONFIG_LIB_RAND selected in drivers/rng/Kconfig does not
exist.

test/lib/test_aes.c requires rand() to be defined.

Fix the selection criteria for choice "Pseudo-random library support type".

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 3c10dc95 06-Dec-2019 Simon Glass <sjg@chromium.org>

binman: Add a library to access binman entries

SPL and TPL can access information about binman entries using link-time
symbols but this is not available in U-Boot proper. Of course it could be
made available, but the intention is to just read the device tree.

Add support for this, so that U-Boot can locate entries.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# b4adf627 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: crypto: add x509 parser

Imported from linux kernel v5.3:
x509.asn1 without changes
x509_akid.asn1 without changes
x509_parser.h without changes
x509_cert_parser.c with changes marked as __UBOOT__
x509_public_key.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# a9b45e6e 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add oid registry utility

Imported from linux kernel v5.3:
build_OID_registry without changes
oid_registry.h without changes
oid_registry.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# ab8a0e06 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add asn1 decoder

Imported from linux kernel v5.3:
lib/asn1_decoder.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 2b12196d 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

cmd: add asn1_compiler

Imported from linux kernel v5.3:
asn1.h without changes
asn1_ber_bytecode.h without changes
asn1_decoder.h without changes
asn1_compiler.c without changes

This host command will be used to create a ASN1 parser, for example,
for pkcs7 messages or x509 certificates. More specifically, it will
generate *byte code* which will be interpreted by asn1 decoder library.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 05429b6c 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

rtc: move date.c from drivers/rtc/ to lib/

In the next commit, rtc_mktime(), for compatibility with linux, will be
implemented using rtc_mktime(), which is no longer drivers/rtc specific.
So move this file under lib/.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 37ef1774 10-Nov-2019 Thomas Hebb <tommyhebb@gmail.com>

Kconfig: disambiguate config names for tiny printf

27084c03d36a ("spl: Allow tiny printf() to be controlled in SPL and
TPL") split this option in two for TPL and SPL, but didn't change the
Kconfig names, making them hard to set quickly.

Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>

# 0d76afc0 27-Oct-2019 Simon Glass <sjg@chromium.org>

fdt: Add Kconfig options to control code size

For better or worse libfdt recent grew a lot of code that checks the
validity of the device tree in great detail. When using unsigned or
unverified data this makes things safer, but it does add to code size.

Add some controls to select the trade-off between safety and code size.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 27084c03 25-Sep-2019 Simon Glass <sjg@chromium.org>

spl: Allow tiny printf() to be controlled in SPL and TPL

At present there is only one control for this and it is used for both SPL
and TPL. But SPL might have a lot more space than TPL so the extra cost of
a full printf() might be acceptable.

Split the option into two, providing separate SPL and TPL controls. The
TPL setting defaults to the same as SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2a51e16b 07-Jun-2019 Tom Rini <trini@konsulko.com>

configs: Make USE_TINY_PRINTF depend on SPL||TPL and be default

The USE_TINY_PRINTF symbol only changes things within SPL and TPL
builds, so make it depend on that support. Next, make it default as
within these cases we should rarely have need of more advanced print
formats outside of the debug context.

To do this, in a few cases we need to correct our Kconfig dependencies
as we had cases of non-SPL targets select'ing this symbol. Finally, in
the case of a few boards we really do need the full printf
functionality.

Signed-off-by: Tom Rini <trini@konsulko.com>

# da0fb5fd 02-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: make call depth limit customizable

Up to now we had hard coded values for the call depth up to which trace
records are created: 200 for early tracing, 15 thereafter. UEFI
applications reach a call depth of 80 or above.

Provide customizing settings for the call trace depth limit and the early
call trace depth limit. Use the old values as defaults.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8509f22a 29-Apr-2019 Marek Behún <marek.behun@nic.cz>

lib: add Zstandard decompression support

Add the zstd library from Linux kernel (only decompression support).
There are minimal changes to build with U-Boot, otherwise the files are
identical to Linux commit dc35da16 from March 2018, the files had not
been touched since in kernel. Also SPDX lincese tags were added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 83a486b6 29-Apr-2019 Marek Behún <marek.behun@nic.cz>

lib: Add xxhash support

This adds the xxhash support from Linux. Files are almost identical to
those added to Linux in commit 5d240522 ("lib: Add xxhash module") (they
haven't been touched since in Linux). The only difference is to add some
includes to be compatible with U-Boot. Also SPDX lincese tags were
added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 5132361a 29-Apr-2019 Heiko Schocher <hs@denx.de>

lib: Kconfig: fix help text for GZIP

commit 95f4bbd581cf ("lib: fdt: Allow LZO and GZIP DT compression in U-Boot")

introduced Kconfig option for gzip in U-Boot, but help text
says gzip for SPL, which is wrong. Fix this.

Signed-off-by: Heiko Schocher <hs@denx.de>
Acked-by: Marek Vasut <marex@denx.de>

# 1c6eb075 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE_BUFFER_SIZE et al to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE_BUFFER_SIZE
CONFIG_TRACE_EARLY_SIZE
CONFIG_TRACE_EARLY
CONFIG_TRACE_EARLY_ADDR

Signed-off-by: Simon Glass <sjg@chromium.org>

# a24a78d7 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE

Signed-off-by: Simon Glass <sjg@chromium.org>

# 54969b40 21-Mar-2019 Thierry Reding <treding@nvidia.com>

fdtdec: Add Kconfig symbol for tests

Runtime tests are provided as a test_fdtdec command implementation. Add
a Kconfig symbol that allows this command to be built so that the tests
can be used.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 95f4bbd5 08-Mar-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

lib: fdt: Allow LZO and GZIP DT compression in U-Boot

Add required Kconfig symbols, Makefile bits and macro fixes in a
few places to support LZO and DT compression in U-Boot. This can
save a lot of space with multi-DTB fitImages.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>

# 6e705114 13-Jan-2019 Chris Packham <judge.packham@gmail.com>

lib: Kconfig: spelling fixes

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 048c6e89 06-Nov-2018 Simon Glass <sjg@chromium.org>

spl: lz4: Allow use of lz4 compression in SPL

In some cases U-Boot is compressed and it is useful to be able to
decompress it in SPL. Add a Kconfig and Makefile change to allow this.
Note that this does not actually implement decompression.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 2895c4b7 15-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

kconfig: Introduce HAVE_ARCH_IOMAP

Introduce a new Kconfig option for architecture codes to control
whether it provides io{read,write}{8,16,32} I/O accessor functions.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5592a633 01-Oct-2018 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt in TPL

In some cases (e.g. sandbox with verified boot) it is useful to support
libfdt in TPL. Update the Kconfig to handle this.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 6307896c 01-Oct-2018 Simon Glass <sjg@chromium.org>

tpm: Add support for SPL and TPL

At present the tpm can only be used in U-Boot proper. Updated it to work
in SPL and TPL also.

Signed-off-by: Simon Glass <sjg@chromium.org>

# ab948cd2 19-Jul-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

fdt_support: make FDT_FIXUP_PARTITIONS depend on CMD_MTDPARTS

fdt_fixup_mtdparts() calls mtdparts_init() and device_find(),
which are defined in cmd/mtdparts.c

The combination of FDT_FIXUP_PARTITIONS=y and CMD_MTDPARTS=n
emits the following link error:

common/fdt_support.c:903: undefined reference to `mtdparts_init'
common/fdt_support.c:914: undefined reference to `device_find'

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 3330584d 03-Jun-2018 Igor Opaniuk <igor.opaniuk@gmail.com>

avb2.0: integrate avb 2.0 into the build system

Integrate libavb into the build system. Introduce CONFIG_LIBAVB
build option.

Signed-off-by: Igor Opaniuk <igor.opaniuk@linaro.org>

# f8c987f8 05-Jun-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

lib: Add hexdump

Often during debugging session it's very interesting to see
what data we were dealing with. For example what we write or read
to/from memory or peripherals.

This change introduces functions that allow to dump binary
data with one simple function invocation like:
------------------->8----------------
print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, buf, len);
------------------->8----------------

which gives us the following:
------------------->8----------------
00000000: f2 b7 c9 88 62 61 75 64 72 61 74 65 3d 31 31 35 ....baudrate=115
00000010: 32 30 30 00 62 6f 6f 74 61 72 67 73 3d 63 6f 6e 200.bootargs=con
00000020: 73 6f 6c 65 3d 74 74 79 53 33 2c 31 31 35 32 30 sole=ttyS3,11520
00000030: 30 6e 38 00 62 6f 6f 74 64 65 6c 61 79 3d 33 00 0n8.bootdelay=3.
00000040: 62 6f 6f 74 66 69 6c 65 3d 75 49 6d 61 67 65 00 bootfile=uImage.
00000050: 66 64 74 63 6f 6e 74 72 6f 6c 61 64 64 72 3d 39 fdtcontroladdr=9
00000060: 66 66 62 31 62 61 30 00 6c 6f 61 64 61 64 64 72 ffb1ba0.loadaddr
00000070: 3d 30 78 38 32 30 30 30 30 30 30 00 73 74 64 65 =0x82000000.stde
00000080: 72 72 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 rr=serial0@e0022
00000090: 30 30 30 00 73 74 64 69 6e 3d 73 65 72 69 61 6c 000.stdin=serial
000000a0: 30 40 65 30 30 32 32 30 30 30 00 73 74 64 6f 75 0@e0022000.stdou
000000b0: 74 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 30 t=serial0@e00220
000000c0: 30 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00..............
...
------------------->8----------------

Source of hexdump.c was copied from Linux kernel v4.7-rc2.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Mario Six <mario.six@gdsys.cc>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Stefan Roese <sr@denx.de>

# c232d14d 29-May-2018 Alex Kiernan <alex.kiernan@gmail.com>

mmc: Separate "mmc swrite" from fastboot

Introduce CONFIG_IMAGE_SPARSE and CONFIG_CMD_MMC_SWRITE so the "mmc
swrite" command is separated from the fastboot code.

Move image-sparse from common to lib so it's clear it's library code.

Rename CONFIG_FASTBOOT_FLASH_FILLBUF_SIZE to CONFIG_IMAGE_SPARSE_FILLBUF_SIZE
and migrate it to Kconfig.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Acked-by: Jassi Brar <jaswinder.singh@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6417572e 08-May-2018 Tom Rini <trini@konsulko.com>

lib/Kconfig: Mark OF_LIBFDT_OVERLAY as depending on OF_LIBFDT

The overlay code is only useful when OF_LIBFDT is set, so mark it as
depending on that first.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 58a46f88 25-Apr-2018 Praneeth Bajjuri <praneeth@ti.com>

configs: TI: Enable FIT Library overlay support

Enable the FDT library overlay support for all TI SOC family.

Without this option, when Loading fdt from FIT image, the
following warning is seen.

"config with overlays but CONFIG_OF_LIBFDT_OVERLAY not set".

Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
Suggested-by: Andrew F.Davis <afd@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>

# 14ad44ab 18-Apr-2018 Alex Kiernan <alex.kiernan@gmail.com>

spl: Split sprintf, strto* from SPL serial in Kconfig

When SPL serial is disabled, callers who need sprintf or strtoul fail
because their inclusion is guarded by CONFIG_SPL_SERIAL_SUPPORT/
CONFIG_TPL_SERIAL_SUPPORT.

Split printf, sprintf and strto into their own entries and then select
all of them if SERIAL_SUPPORT is enabled to match the current behaviour.

Include panic.o unconditionally as it can be called from anywhere which
uses BUG_ON().

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>

# e294ba06 04-Apr-2018 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-sunxi

Signed-off-by: Tom Rini <trini@konsulko.com>


# d14db11d 03-Apr-2018 Andre Przywara <andre.przywara@arm.com>

sunxi: revert disabling of features

In January some commits were introduced to mitigate the U-Boot image
size issues we encountered on sunxi builds.
Now with the MMC environment removed we can bring them back, as we
practically don't have a size limit anymore.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 32ce6179 13-Mar-2018 Bryan O'Donoghue <bryan.odonoghue@linaro.org>

optee: Add lib entries for sharing OPTEE code across ports

This patch adds code to lib to enable sharing of useful OPTEE code between
board-ports and architectures. The code on lib/optee/optee.c comes from the
TI omap2 port. Eventually the OMAP2 code will be patched to include the
shared code. The intention here is to add more useful OPTEE specific code
as more functionality gets added.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Cc: Harinarayan Bhatta <harinarayan@ti.com>
Cc: Andrew F. Davis <afd@ti.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Kever Yang <kever.yang@rock-chips.com>
Cc: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Cc: Peng Fan <peng.fan@nxp.com>
Tested-by: Peng Fan <peng.fan@nxp.com>

# 36c1877c 06-Feb-2018 Faiz Abbas <faiz_abbas@ti.com>

lib: Kconfig: Move DYNAMIC_CRC_TABLE to Kconfig

Add CONFIG prefix to DYNAMIC_CRC_TABLE and implement it in
Kconfig.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>

# a451bc27 05-Feb-2018 Adam Ford <aford173@gmail.com>

Convert LIB_UUID to Kconfig

config_fallback.h has some logic that checks a variety of options
and selects LIB_UUID if it hasn't already been selected. This
will all LIB_UUID in Kconfig and select this option for the list
of options to allow us to remove the logic from fallbacks

Signed-off-by: Adam Ford <aford173@gmail.com>

# a5a37567 06-Feb-2018 Adam Ford <aford173@gmail.com>

Convert CONFIG LIB_HW_RAND to Kconfig

config_fallbacks.h had some logic to automatically select
LIB_RAND if RANDOM_UUID or CMD_UUID were set if LIB_HW_RAND wasn't
already selected. By migrating LIB_HW_RAND to Kconfig, we can
remove this check from config_fallbacks.h and put it into Kconfig

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
[trini: Turn into a choice, add NET_RANDOM_ETHADDR]
Signed-off-by: Tom Rini <trini@konsulko.com>

# acd4d334 16-Jan-2018 Maxime Ripard <maxime.ripard@free-electrons.com>

net: regex: Disable by default on sunXi

The sunXi arm64 build has overflown, leading to the main U-boot binary
overwriting the environment when flashing the new image, or even worse,
overwriting itself when we're calling saveenv.

Disable this option that is not critical until we can adress the issue
properly.

Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 7e3caa81 03-Dec-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

Move CONFIG_PANIC_HANG to Kconfig

Freescale (NXP) boards have lots of defconfig files per board.
I used "imply PANIC_HANG" for them.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# da5337a6 08-Nov-2017 Nandor Han <nandor.han@ge.com>

rtc: add support for s35392a

Add support for S35392A RTC. The driver supports both U-Boot driver
models.

Signed-off-by: Nandor Han <nandor.han@ge.com>
Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
Cc: Heiko Schocher <hs@denx.de>

# f52bdf4b 14-Sep-2017 Jean-Jacques Hiblot <jjhiblot@ti.com>

lib: allow building lzo for the SPL

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 85d8bf57 03-Sep-2017 Marek Behún <marek.behun@nic.cz>

lib: Add CRC32-C

This is needed for BTRFS.

Signed-off-by: Marek Behun <marek.behun@nic.cz>

create mode 100644 lib/crc32c.c

# 7264f292 15-Aug-2017 York Sun <york.sun@nxp.com>

spl: fit: Eanble GZIP support for image decompression

Add Kconfig option SPL_GZIP and SPL_ZLIB to enable gunzip support for
SPL boot, eg. falcon boot compressed kernel image.

Signed-off-by: York Sun <york.sun@nxp.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6ef2f901 11-Aug-2017 Adam Ford <aford173@gmail.com>

Convert CONFIG_BCH to Kconfig

This converts the following to Kconfig:
CONFIG_BCH

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1a7ba1d 18-Aug-2017 Anatolij Gustschin <agust@denx.de>

Fix 'notes' typos

s/notes/nodes

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 96b9082c 03-Aug-2017 Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

rockchip: rk3188: rock: adjust for SPL/TPL split

With the changes to split SPL/TPL for the RK3368, I apparently missed
some needed adjustments to the RK3188 Kconfig and rock_defconfig.

This fixes build-issues for the rock board after applying the RK3368
enablement (and SPL/TPL) set that resulted from TPL_SERIAL_SUPPORT,
TPL_ROCKCHIP_BACK_TO_BROM and TPL_TINY_MEMSET being separate symbols
now.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d56b4b19 22-Jul-2017 Tom Rini <trini@konsulko.com>

configs: Migrate RBTREE, LZO, CMD_MTDPARTS, CMD_UBI and CMD_UBIFS

The above CONFIG options are in Kconfig, and now have correct depends and
inter-dependencies. Migrate these to configs/ from include/configs/. In the
case of CMD_UBIFS also change it to be a default y if CMD_UBI.

Signed-off-by: Tom Rini <trini@konsulko.com>

# aed998aa 17-May-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_LZMA to Kconfig

This converts the following to Kconfig:
CONFIG_LZMA

Signed-off-by: Simon Glass <sjg@chromium.org>

# b1a873df 26-Apr-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_CMD_AES et al to Kconfig

This converts the following to Kconfig:
CONFIG_CMD_AES
CONFIG_AES

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Add select AES to CMD_AES]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 173aafbf 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

cmd: Expose a Kconfig option to enable UBIFS commands

Create a new Kconfig entry to allow CMD_UBIFS selection from Kconfig and
add an hidden LZO option that can be selected by CMD_UBIFS.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>

# aa049152 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

mtd: ubi: Select RBTREE option from MTD_UBI Kconfig entry

Expose the RBTREE feature through Kconfig and select this option from the
MTD_UBI option.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>
[Rebased on master]
Signed-off-by: Jagan Teki <jagan@openedev.com>

# ab4458bd 02-Apr-2017 Simon Glass <sjg@chromium.org>

string: Provide a slimmed-down memset()

Most of the time the optimised memset() is what we want. For extreme
situations such as TPL it may be too large. For example on the 'rock'
board, using a simple loop saves a useful 48 bytes. With gcc 4.9 and
the rodata bug, this patch is enough to reduce the TPL image below the
limit.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>

# bea79d7d 14-Mar-2017 Andre Przywara <andre.przywara@arm.com>

Kconfig: introduce md5sum command selection

So far CONFIG_MD5SUM would need to be set by a board's include file.
Since the command is really generic, move it over to Kconfig to allow
it to be defined by either a board's defconfig, menuconfig or some
config snippet merged via mergeconfig.sh.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e663b350 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

smbios: Expose in efi_loader as table

We can pass SMBIOS easily as EFI configuration table to an EFI payload. This
patch adds enablement for that case.

While at it, we also enable SMBIOS generation for ARM systems, since they support
EFI_LOADER.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4b6dddc2 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

x86: Move smbios generation into arch independent directory

We will need the SMBIOS generation function on ARM as well going forward,
so let's move it into a non arch specific location.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# ebf7fff2 05-Oct-2016 Heiko Schocher <hs@denx.de>

spl: move FDT_FIXUP_PARTITIONS to Kconfig

Move FDT_FIXUP_PARTITIONS to Kconfig and cleanup existing
uses.

Signed-off-by: Heiko Schocher <hs@denx.de>

# ddf67f71 05-Jul-2016 Maxime Ripard <maxime.ripard@free-electrons.com>

libfdt: Add overlay application function

The device tree overlays are a good way to deal with user-modifyable
boards or boards with some kind of an expansion mechanism where we can
easily plug new board in (like the BBB, the Raspberry Pi or the CHIP).

Add a new function to merge overlays with a base device tree.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>

# 91b86e21 26-May-2016 Marek Vasut <marex@denx.de>

lib: Enable private libgcc by default

This patch decouples U-Boot binary from the toolchain on systems where
private libgcc is available. Instead of pulling in functions provided
by the libgcc from the toolchain, U-Boot will use it's own set of libgcc
functions. These functions are usually imported from Linux kernel, which
also uses it's own libgcc functions instead of the ones provided by the
toolchain.

This patch solves a rather common problem. The toolchain can usually
generate code for many variants of target architecture and often even
different endianness. The libgcc on the other hand is usually compiled
for one particular configuration and the functions provided by it may
or may not be suited for use in U-Boot. This can manifest in two ways,
either the U-Boot fails to compile altogether and linker will complain
or, in the much worse case, the resulting U-Boot will build, but will
misbehave in very subtle and hard to debug ways.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 67976306 30-Mar-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

cosmetic: Fix typos "privide"

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# ed980b8c 03-Mar-2016 Alexander Graf <agraf@csgraf.de>

efi_loader: hook up in build environment

Now that we have all the bits and pieces ready for EFI payload loading
support, hook them up in Makefiles and KConfigs so that we can build.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
[trini: Enable only when we of OF_LIBFDT, disable on kwb and colibri_pxa270]
Signed-off-by: Tom Rini <trini@konsulko.com>

# aa34fbc0 22-Feb-2016 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt to be used in SPL

Add an option to enable libfdt in SPL. This can be useful when decoding
FIT files in SPL.

We need to make sure this option is not enabled in SPL by this change.
Also this option needs to be enabled in host builds. Si add a new
IMAGE_USE_LIBFDT #define which can be used in files that are built on the
host but must also build for U-Boot and SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 69e173eb 22-Feb-2016 Simon Glass <sjg@chromium.org>

Move CONFIG_OF_LIBFDT to Kconfig

Move this option to Kconfig and tidy up existing boards.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a187559e 05-Feb-2016 Bin Meng <bmeng.cn@gmail.com>

Use correct spelling of "U-Boot"

Correct spelling of "U-Boot" shall be used in all written text
(documentation, comments in source files etc.).

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Minkyu Kang <mk7.kang@samsung.com>

# 947c626d 14-Jan-2016 Tom Rini <trini@konsulko.com>

vsprintf.c: Always enable CONFIG_SYS_VSNPRINTF

Enabling this function always removes some class of string saftey issues.
The size change here in general is about 400 bytes and this seems a reasonable
trade-off.

Cc: Peng Fan <peng.fan@nxp.com>
Cc: Peter Robinson <pbrobinson@gmail.com>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Adrian Alonso <aalonso@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 7d9cde10 22-Nov-2015 Stefan Roese <sr@denx.de>

lib/tiny-printf.c: Add tiny printf function for space limited environments

This patch adds a small printf() version that supports all basic formats.
Its intented to be used in U-Boot SPL versions on platforms with very
limited internal RAM sizes.

To enable it, just define CONFIG_USE_TINY_PRINTF in your defconfig. This
will result in the SPL using this tiny function and the main U-Boot
still using the full-blown printf() function.

This code was copied from:
http://www.sparetimelabs.com/printfrevisited
With mostly only coding style related changes so that its checkpatch
clean.

The size reduction is about 2.5KiB. Here a comparison for the db-mv784mp-gp
(Marvell AXP) SPL:

Without this patch:
58963 18536 1928 79427 13643 ./spl/u-boot-spl

With this patch:
56542 18536 1956 77034 12cea ./spl/u-boot-spl

Note:
To make it possible to compile tiny-printf.c instead of vsprintf.c when
CONFIG_USE_TINY_PRINTF is defined, the functions printf() and vprintf() are
moved from common/console.c into vsprintf.c in this patch.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>

# 2419cd16 03-Oct-2015 Simon Glass <sjg@chromium.org>

dm: tpm: Drop CONFIG_DM_TPM

Now that all TPM drivers use driver model, we can drop the special driver
model CONFIG option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>

# 027b728d 06-Oct-2015 Julius Werner <jwerner@chromium.org>

Add support for LZ4 decompression algorithm

This patch adds support for LZ4-compressed FIT image contents. This
algorithm has a slightly worse compression ration than LZO while being
nearly twice as fast to decompress. When loading images from a fast
storage medium this usually results in a boot time win.

Sandbox-tested only since I don't have a U-Boot development system set
up right now. The code was imported unchanged from coreboot where it's
proven to work, though. I'm mostly interested in getting this recognized
by mkImage for use in a downstream project.

Signed-off-by: Julius Werner <jwerner@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# a7d660bc 22-Aug-2015 Simon Glass <sjg@chromium.org>

tpm: Add Kconfig options for TPMs

Add new Kconfig options for TPMs in preparation for moving boards to use
Kconfig for TPM configuration.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 867a6ac8 31-Jul-2015 Simon Glass <sjg@chromium.org>

efi: Add start-up library code

When running as an EFI application, U-Boot must request memory from EFI,
and provide access to the boot services U-Boot needs.

Add library code to perform these tasks. This includes efi_main() which is
the entry point from EFI. U-Boot is built as a shared library.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d1389403 23-Jun-2015 Simon Glass <sjg@chromium.org>

Add a dhrystone benchmark command

Drystone provides a convenient sanity check that the CPU is running at full
speed. Add this as a command which can be enabled as needed.

Note: I investigated using Coremark for this but there was a license
agreement and I could not work out if it was GPL-compatible.

Signed-off-by: Simon Glass <sjg@chromium.org>

# f7848d90 22-Jun-2015 Joe Hershberger <joe.hershberger@ni.com>

Allow CONFIG_REGEX to be disabled when CONFIG_NET

Instead of selecting REGEX when NET is enabled, make it the default, but
allow boards that are tiny to disable it and lose functionality on all
but the first Ethernet adapter.

cm-bf548, bf538f-ezkit, and bf533-stamp need this. None appear to have
more than one Ethernet interface.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# 3850dbe8 11-Jun-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

blackfin: fix undefined reference to srand and rand

Commit 9ba9e85f3f1c (net: Fix NET_RANDOM_ETHADDR dependencies)
accidentally dropped CONFIG_LIB_RAND defines for 14 Blackfin boards.

Prior to that commit, those boards defined CONFIG_LIB_RAND, but not
CONFIG_NET_RANDOM_ETHADDR. So, commit 9ba9e85f3f1c should not have
touched them, but in fact it ripped CONFIG_LIB_RAND off from all the
header files, which caused undefined reference to srand and rand.
CONFIG_LIB_RAND=y must be revived for such boards.

BTW, this commit indeed makes it better, but even with this fix,
three boards (bf533-stamp, bf538f-ezkit, cm-bf548) still can not
build due to region 'ram' overflowed error. This was cause by
commit 6eed3786c68c (net: Move the CMD_NET config to defconfigs)
because CMD_NET selects NET, and NET selects REGEX. Eventually,
some boards were newly enabled with CONFIG_REGEX, increasing the
memory footprint. A patch is expected to fix the build error.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 9ba9e85f 25-May-2015 Michal Simek <michal.simek@xilinx.com>

net: Fix NET_RANDOM_ETHADDR dependencies

NET_RANDOM_ETHADDR depends on lib/rand.c. This patch adds dependency to
Kconfig to ensure that library is also compiled.

Remove the definitions from Blackfin boards' include/configs.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 6501ff62 20-Apr-2015 Przemyslaw Marczak <p.marczak@samsung.com>

lib: Kconfig: add entry for errno_str() function

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1a60650c 21-Apr-2015 Joe Hershberger <joe.hershberger@ni.com>

kconfig: Move REGEX to Kconfig

Having this as a Kconfig allows it to be a dependent feature.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8156345d 06-Mar-2015 Simon Glass <sjg@chromium.org>

sandbox: Move CONFIG_SYS_VSNPRINTF to Kconfig

Move this over to Kconfig and tidy up.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 94e3c8c4 19-Feb-2015 gaurav rana <gaurav.rana@freescale.com>

crypto/fsl - Add progressive hashing support using hardware acceleration.

Currently only normal hashing is supported using hardware acceleration.
Added support for progressive hashing using hardware.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
Signed-off-by: Gaurav Rana <gaurav.rana@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>

# d9f23c7f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@freescale.com>

lib/rsa: Add Kconfig for devices supporting RSA Modular Exponentiation

Kconfig option added for devices which support RSA Verification.
1. RSA_SOFTWARE_EXP
Enables driver for supporting RSA Modular Exponentiation in Software
2. RSA_FREESCALE_EXP
Enables driver for supporting RSA Modular Exponentiation using Freescale specific
driver

The above drivers use RSA uclass

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
(Removed duplicate line in Kconfig comment)

Change-Id: I7663c4d5350e2bfc3dfa2696f70ef777d6ccc6f6

# c4beb22f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@freescale.com>

FIT: Modify option FIT_SIGNATURE in Kconfig

For FIT signature based approach to work, RSA library needs to be selected.
The FIT_SIGNATURE option in Kconfig is modified to automatically select RSA.
Selecting RSA compiles the RSA library required for image verification.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 45ccec8f 23-Oct-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_USE_PRIVATE_LIBGCC to Kconfig

The private libgcc is supported only on ARM, MIPS, PowerPC, SH, x86.
Those architectures should "select" HAVE_PRIVATE_LIBGCC and
CONFIG_USE_PRIVATE_LIBGCC should depend on it.

Currently, this option is enabled on Tegra boards and x86 architecture.
Move the definition from header files to Kconfig.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Tested-by: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: Tom Warren <twarren@nvidia.com>

# 8c688bc4 23-Oct-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_SYS_HZ to lib/Kconfig

CONFIG_SYS_HZ is always defined as 1000 in config_fallbacks.h
(but some boards still have redundant definitions).

This commit moves the definition and the document in README to
Kconfig. Since lib/Kconfig can assure that CONFIG_SYS_HZ is 1000,
the sanity check in lib/time.c should be removed.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Reviewed-by: Marek Vasut <marex@denx.de>

# b0928da6 16-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED to Kconfig

If this option is enabled, the objects under lib/ directory
are compiled with speed optimization, not size optimization.
(Currently, only used by some Blackfin boards.)

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# ed36323f 16-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: add blank Kconfig files

This would be useful to start moving various config options.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# 805b3cac 12-Feb-2020 Keerthy <j-keerthy@ti.com>

lib: elf: Move the generic elf loading/validating functions to lib

Move the generic elf loading/validating functions to lib/
so that they can be re-used and accessed by code existing
outside cmd.

While at it remove the duplicate static version of load_elf_image_phdr
under arch/arm/mach-imx/imx_bootaux.c.

Signed-off-by: Keerthy <j-keerthy@ti.com>
Suggested-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>

# 1611235b 19-Jan-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: Kconfig dependencies for pseudo-random library

drivers/rng/sandbox_rng.c requires rand() to be defined but configuration
option CONFIG_CONFIG_LIB_RAND selected in drivers/rng/Kconfig does not
exist.

test/lib/test_aes.c requires rand() to be defined.

Fix the selection criteria for choice "Pseudo-random library support type".

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 3c10dc95 06-Dec-2019 Simon Glass <sjg@chromium.org>

binman: Add a library to access binman entries

SPL and TPL can access information about binman entries using link-time
symbols but this is not available in U-Boot proper. Of course it could be
made available, but the intention is to just read the device tree.

Add support for this, so that U-Boot can locate entries.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# b4adf627 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: crypto: add x509 parser

Imported from linux kernel v5.3:
x509.asn1 without changes
x509_akid.asn1 without changes
x509_parser.h without changes
x509_cert_parser.c with changes marked as __UBOOT__
x509_public_key.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# a9b45e6e 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add oid registry utility

Imported from linux kernel v5.3:
build_OID_registry without changes
oid_registry.h without changes
oid_registry.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# ab8a0e06 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add asn1 decoder

Imported from linux kernel v5.3:
lib/asn1_decoder.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 2b12196d 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

cmd: add asn1_compiler

Imported from linux kernel v5.3:
asn1.h without changes
asn1_ber_bytecode.h without changes
asn1_decoder.h without changes
asn1_compiler.c without changes

This host command will be used to create a ASN1 parser, for example,
for pkcs7 messages or x509 certificates. More specifically, it will
generate *byte code* which will be interpreted by asn1 decoder library.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 05429b6c 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

rtc: move date.c from drivers/rtc/ to lib/

In the next commit, rtc_mktime(), for compatibility with linux, will be
implemented using rtc_mktime(), which is no longer drivers/rtc specific.
So move this file under lib/.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 37ef1774 10-Nov-2019 Thomas Hebb <tommyhebb@gmail.com>

Kconfig: disambiguate config names for tiny printf

27084c03d36a ("spl: Allow tiny printf() to be controlled in SPL and
TPL") split this option in two for TPL and SPL, but didn't change the
Kconfig names, making them hard to set quickly.

Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>

# 0d76afc0 27-Oct-2019 Simon Glass <sjg@chromium.org>

fdt: Add Kconfig options to control code size

For better or worse libfdt recent grew a lot of code that checks the
validity of the device tree in great detail. When using unsigned or
unverified data this makes things safer, but it does add to code size.

Add some controls to select the trade-off between safety and code size.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 27084c03 25-Sep-2019 Simon Glass <sjg@chromium.org>

spl: Allow tiny printf() to be controlled in SPL and TPL

At present there is only one control for this and it is used for both SPL
and TPL. But SPL might have a lot more space than TPL so the extra cost of
a full printf() might be acceptable.

Split the option into two, providing separate SPL and TPL controls. The
TPL setting defaults to the same as SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2a51e16b 07-Jun-2019 Tom Rini <trini@konsulko.com>

configs: Make USE_TINY_PRINTF depend on SPL||TPL and be default

The USE_TINY_PRINTF symbol only changes things within SPL and TPL
builds, so make it depend on that support. Next, make it default as
within these cases we should rarely have need of more advanced print
formats outside of the debug context.

To do this, in a few cases we need to correct our Kconfig dependencies
as we had cases of non-SPL targets select'ing this symbol. Finally, in
the case of a few boards we really do need the full printf
functionality.

Signed-off-by: Tom Rini <trini@konsulko.com>

# da0fb5fd 02-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: make call depth limit customizable

Up to now we had hard coded values for the call depth up to which trace
records are created: 200 for early tracing, 15 thereafter. UEFI
applications reach a call depth of 80 or above.

Provide customizing settings for the call trace depth limit and the early
call trace depth limit. Use the old values as defaults.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8509f22a 29-Apr-2019 Marek Behún <marek.behun@nic.cz>

lib: add Zstandard decompression support

Add the zstd library from Linux kernel (only decompression support).
There are minimal changes to build with U-Boot, otherwise the files are
identical to Linux commit dc35da16 from March 2018, the files had not
been touched since in kernel. Also SPDX lincese tags were added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 83a486b6 29-Apr-2019 Marek Behún <marek.behun@nic.cz>

lib: Add xxhash support

This adds the xxhash support from Linux. Files are almost identical to
those added to Linux in commit 5d240522 ("lib: Add xxhash module") (they
haven't been touched since in Linux). The only difference is to add some
includes to be compatible with U-Boot. Also SPDX lincese tags were
added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 5132361a 29-Apr-2019 Heiko Schocher <hs@denx.de>

lib: Kconfig: fix help text for GZIP

commit 95f4bbd581cf ("lib: fdt: Allow LZO and GZIP DT compression in U-Boot")

introduced Kconfig option for gzip in U-Boot, but help text
says gzip for SPL, which is wrong. Fix this.

Signed-off-by: Heiko Schocher <hs@denx.de>
Acked-by: Marek Vasut <marex@denx.de>

# 1c6eb075 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE_BUFFER_SIZE et al to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE_BUFFER_SIZE
CONFIG_TRACE_EARLY_SIZE
CONFIG_TRACE_EARLY
CONFIG_TRACE_EARLY_ADDR

Signed-off-by: Simon Glass <sjg@chromium.org>

# a24a78d7 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE

Signed-off-by: Simon Glass <sjg@chromium.org>

# 54969b40 21-Mar-2019 Thierry Reding <treding@nvidia.com>

fdtdec: Add Kconfig symbol for tests

Runtime tests are provided as a test_fdtdec command implementation. Add
a Kconfig symbol that allows this command to be built so that the tests
can be used.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 95f4bbd5 08-Mar-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

lib: fdt: Allow LZO and GZIP DT compression in U-Boot

Add required Kconfig symbols, Makefile bits and macro fixes in a
few places to support LZO and DT compression in U-Boot. This can
save a lot of space with multi-DTB fitImages.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>

# 6e705114 13-Jan-2019 Chris Packham <judge.packham@gmail.com>

lib: Kconfig: spelling fixes

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 048c6e89 06-Nov-2018 Simon Glass <sjg@chromium.org>

spl: lz4: Allow use of lz4 compression in SPL

In some cases U-Boot is compressed and it is useful to be able to
decompress it in SPL. Add a Kconfig and Makefile change to allow this.
Note that this does not actually implement decompression.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 2895c4b7 15-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

kconfig: Introduce HAVE_ARCH_IOMAP

Introduce a new Kconfig option for architecture codes to control
whether it provides io{read,write}{8,16,32} I/O accessor functions.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5592a633 01-Oct-2018 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt in TPL

In some cases (e.g. sandbox with verified boot) it is useful to support
libfdt in TPL. Update the Kconfig to handle this.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 6307896c 01-Oct-2018 Simon Glass <sjg@chromium.org>

tpm: Add support for SPL and TPL

At present the tpm can only be used in U-Boot proper. Updated it to work
in SPL and TPL also.

Signed-off-by: Simon Glass <sjg@chromium.org>

# ab948cd2 19-Jul-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

fdt_support: make FDT_FIXUP_PARTITIONS depend on CMD_MTDPARTS

fdt_fixup_mtdparts() calls mtdparts_init() and device_find(),
which are defined in cmd/mtdparts.c

The combination of FDT_FIXUP_PARTITIONS=y and CMD_MTDPARTS=n
emits the following link error:

common/fdt_support.c:903: undefined reference to `mtdparts_init'
common/fdt_support.c:914: undefined reference to `device_find'

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 3330584d 03-Jun-2018 Igor Opaniuk <igor.opaniuk@gmail.com>

avb2.0: integrate avb 2.0 into the build system

Integrate libavb into the build system. Introduce CONFIG_LIBAVB
build option.

Signed-off-by: Igor Opaniuk <igor.opaniuk@linaro.org>

# f8c987f8 05-Jun-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

lib: Add hexdump

Often during debugging session it's very interesting to see
what data we were dealing with. For example what we write or read
to/from memory or peripherals.

This change introduces functions that allow to dump binary
data with one simple function invocation like:
------------------->8----------------
print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, buf, len);
------------------->8----------------

which gives us the following:
------------------->8----------------
00000000: f2 b7 c9 88 62 61 75 64 72 61 74 65 3d 31 31 35 ....baudrate=115
00000010: 32 30 30 00 62 6f 6f 74 61 72 67 73 3d 63 6f 6e 200.bootargs=con
00000020: 73 6f 6c 65 3d 74 74 79 53 33 2c 31 31 35 32 30 sole=ttyS3,11520
00000030: 30 6e 38 00 62 6f 6f 74 64 65 6c 61 79 3d 33 00 0n8.bootdelay=3.
00000040: 62 6f 6f 74 66 69 6c 65 3d 75 49 6d 61 67 65 00 bootfile=uImage.
00000050: 66 64 74 63 6f 6e 74 72 6f 6c 61 64 64 72 3d 39 fdtcontroladdr=9
00000060: 66 66 62 31 62 61 30 00 6c 6f 61 64 61 64 64 72 ffb1ba0.loadaddr
00000070: 3d 30 78 38 32 30 30 30 30 30 30 00 73 74 64 65 =0x82000000.stde
00000080: 72 72 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 rr=serial0@e0022
00000090: 30 30 30 00 73 74 64 69 6e 3d 73 65 72 69 61 6c 000.stdin=serial
000000a0: 30 40 65 30 30 32 32 30 30 30 00 73 74 64 6f 75 0@e0022000.stdou
000000b0: 74 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 30 t=serial0@e00220
000000c0: 30 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00..............
...
------------------->8----------------

Source of hexdump.c was copied from Linux kernel v4.7-rc2.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Mario Six <mario.six@gdsys.cc>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Stefan Roese <sr@denx.de>

# c232d14d 29-May-2018 Alex Kiernan <alex.kiernan@gmail.com>

mmc: Separate "mmc swrite" from fastboot

Introduce CONFIG_IMAGE_SPARSE and CONFIG_CMD_MMC_SWRITE so the "mmc
swrite" command is separated from the fastboot code.

Move image-sparse from common to lib so it's clear it's library code.

Rename CONFIG_FASTBOOT_FLASH_FILLBUF_SIZE to CONFIG_IMAGE_SPARSE_FILLBUF_SIZE
and migrate it to Kconfig.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Acked-by: Jassi Brar <jaswinder.singh@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6417572e 08-May-2018 Tom Rini <trini@konsulko.com>

lib/Kconfig: Mark OF_LIBFDT_OVERLAY as depending on OF_LIBFDT

The overlay code is only useful when OF_LIBFDT is set, so mark it as
depending on that first.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 58a46f88 25-Apr-2018 Praneeth Bajjuri <praneeth@ti.com>

configs: TI: Enable FIT Library overlay support

Enable the FDT library overlay support for all TI SOC family.

Without this option, when Loading fdt from FIT image, the
following warning is seen.

"config with overlays but CONFIG_OF_LIBFDT_OVERLAY not set".

Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
Suggested-by: Andrew F.Davis <afd@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>

# 14ad44ab 18-Apr-2018 Alex Kiernan <alex.kiernan@gmail.com>

spl: Split sprintf, strto* from SPL serial in Kconfig

When SPL serial is disabled, callers who need sprintf or strtoul fail
because their inclusion is guarded by CONFIG_SPL_SERIAL_SUPPORT/
CONFIG_TPL_SERIAL_SUPPORT.

Split printf, sprintf and strto into their own entries and then select
all of them if SERIAL_SUPPORT is enabled to match the current behaviour.

Include panic.o unconditionally as it can be called from anywhere which
uses BUG_ON().

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>

# e294ba06 04-Apr-2018 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-sunxi

Signed-off-by: Tom Rini <trini@konsulko.com>


# d14db11d 03-Apr-2018 Andre Przywara <andre.przywara@arm.com>

sunxi: revert disabling of features

In January some commits were introduced to mitigate the U-Boot image
size issues we encountered on sunxi builds.
Now with the MMC environment removed we can bring them back, as we
practically don't have a size limit anymore.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 32ce6179 13-Mar-2018 Bryan O'Donoghue <bryan.odonoghue@linaro.org>

optee: Add lib entries for sharing OPTEE code across ports

This patch adds code to lib to enable sharing of useful OPTEE code between
board-ports and architectures. The code on lib/optee/optee.c comes from the
TI omap2 port. Eventually the OMAP2 code will be patched to include the
shared code. The intention here is to add more useful OPTEE specific code
as more functionality gets added.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Cc: Harinarayan Bhatta <harinarayan@ti.com>
Cc: Andrew F. Davis <afd@ti.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Kever Yang <kever.yang@rock-chips.com>
Cc: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Cc: Peng Fan <peng.fan@nxp.com>
Tested-by: Peng Fan <peng.fan@nxp.com>

# 36c1877c 06-Feb-2018 Faiz Abbas <faiz_abbas@ti.com>

lib: Kconfig: Move DYNAMIC_CRC_TABLE to Kconfig

Add CONFIG prefix to DYNAMIC_CRC_TABLE and implement it in
Kconfig.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>

# a451bc27 05-Feb-2018 Adam Ford <aford173@gmail.com>

Convert LIB_UUID to Kconfig

config_fallback.h has some logic that checks a variety of options
and selects LIB_UUID if it hasn't already been selected. This
will all LIB_UUID in Kconfig and select this option for the list
of options to allow us to remove the logic from fallbacks

Signed-off-by: Adam Ford <aford173@gmail.com>

# a5a37567 06-Feb-2018 Adam Ford <aford173@gmail.com>

Convert CONFIG LIB_HW_RAND to Kconfig

config_fallbacks.h had some logic to automatically select
LIB_RAND if RANDOM_UUID or CMD_UUID were set if LIB_HW_RAND wasn't
already selected. By migrating LIB_HW_RAND to Kconfig, we can
remove this check from config_fallbacks.h and put it into Kconfig

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
[trini: Turn into a choice, add NET_RANDOM_ETHADDR]
Signed-off-by: Tom Rini <trini@konsulko.com>

# acd4d334 16-Jan-2018 Maxime Ripard <maxime.ripard@free-electrons.com>

net: regex: Disable by default on sunXi

The sunXi arm64 build has overflown, leading to the main U-boot binary
overwriting the environment when flashing the new image, or even worse,
overwriting itself when we're calling saveenv.

Disable this option that is not critical until we can adress the issue
properly.

Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 7e3caa81 03-Dec-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

Move CONFIG_PANIC_HANG to Kconfig

Freescale (NXP) boards have lots of defconfig files per board.
I used "imply PANIC_HANG" for them.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# da5337a6 08-Nov-2017 Nandor Han <nandor.han@ge.com>

rtc: add support for s35392a

Add support for S35392A RTC. The driver supports both U-Boot driver
models.

Signed-off-by: Nandor Han <nandor.han@ge.com>
Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
Cc: Heiko Schocher <hs@denx.de>

# f52bdf4b 14-Sep-2017 Jean-Jacques Hiblot <jjhiblot@ti.com>

lib: allow building lzo for the SPL

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 85d8bf57 03-Sep-2017 Marek Behún <marek.behun@nic.cz>

lib: Add CRC32-C

This is needed for BTRFS.

Signed-off-by: Marek Behun <marek.behun@nic.cz>

create mode 100644 lib/crc32c.c

# 7264f292 15-Aug-2017 York Sun <york.sun@nxp.com>

spl: fit: Eanble GZIP support for image decompression

Add Kconfig option SPL_GZIP and SPL_ZLIB to enable gunzip support for
SPL boot, eg. falcon boot compressed kernel image.

Signed-off-by: York Sun <york.sun@nxp.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6ef2f901 11-Aug-2017 Adam Ford <aford173@gmail.com>

Convert CONFIG_BCH to Kconfig

This converts the following to Kconfig:
CONFIG_BCH

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1a7ba1d 18-Aug-2017 Anatolij Gustschin <agust@denx.de>

Fix 'notes' typos

s/notes/nodes

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 96b9082c 03-Aug-2017 Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

rockchip: rk3188: rock: adjust for SPL/TPL split

With the changes to split SPL/TPL for the RK3368, I apparently missed
some needed adjustments to the RK3188 Kconfig and rock_defconfig.

This fixes build-issues for the rock board after applying the RK3368
enablement (and SPL/TPL) set that resulted from TPL_SERIAL_SUPPORT,
TPL_ROCKCHIP_BACK_TO_BROM and TPL_TINY_MEMSET being separate symbols
now.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d56b4b19 22-Jul-2017 Tom Rini <trini@konsulko.com>

configs: Migrate RBTREE, LZO, CMD_MTDPARTS, CMD_UBI and CMD_UBIFS

The above CONFIG options are in Kconfig, and now have correct depends and
inter-dependencies. Migrate these to configs/ from include/configs/. In the
case of CMD_UBIFS also change it to be a default y if CMD_UBI.

Signed-off-by: Tom Rini <trini@konsulko.com>

# aed998aa 17-May-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_LZMA to Kconfig

This converts the following to Kconfig:
CONFIG_LZMA

Signed-off-by: Simon Glass <sjg@chromium.org>

# b1a873df 26-Apr-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_CMD_AES et al to Kconfig

This converts the following to Kconfig:
CONFIG_CMD_AES
CONFIG_AES

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Add select AES to CMD_AES]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 173aafbf 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

cmd: Expose a Kconfig option to enable UBIFS commands

Create a new Kconfig entry to allow CMD_UBIFS selection from Kconfig and
add an hidden LZO option that can be selected by CMD_UBIFS.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>

# aa049152 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

mtd: ubi: Select RBTREE option from MTD_UBI Kconfig entry

Expose the RBTREE feature through Kconfig and select this option from the
MTD_UBI option.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>
[Rebased on master]
Signed-off-by: Jagan Teki <jagan@openedev.com>

# ab4458bd 02-Apr-2017 Simon Glass <sjg@chromium.org>

string: Provide a slimmed-down memset()

Most of the time the optimised memset() is what we want. For extreme
situations such as TPL it may be too large. For example on the 'rock'
board, using a simple loop saves a useful 48 bytes. With gcc 4.9 and
the rodata bug, this patch is enough to reduce the TPL image below the
limit.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>

# bea79d7d 14-Mar-2017 Andre Przywara <andre.przywara@arm.com>

Kconfig: introduce md5sum command selection

So far CONFIG_MD5SUM would need to be set by a board's include file.
Since the command is really generic, move it over to Kconfig to allow
it to be defined by either a board's defconfig, menuconfig or some
config snippet merged via mergeconfig.sh.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e663b350 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

smbios: Expose in efi_loader as table

We can pass SMBIOS easily as EFI configuration table to an EFI payload. This
patch adds enablement for that case.

While at it, we also enable SMBIOS generation for ARM systems, since they support
EFI_LOADER.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4b6dddc2 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

x86: Move smbios generation into arch independent directory

We will need the SMBIOS generation function on ARM as well going forward,
so let's move it into a non arch specific location.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# ebf7fff2 05-Oct-2016 Heiko Schocher <hs@denx.de>

spl: move FDT_FIXUP_PARTITIONS to Kconfig

Move FDT_FIXUP_PARTITIONS to Kconfig and cleanup existing
uses.

Signed-off-by: Heiko Schocher <hs@denx.de>

# ddf67f71 05-Jul-2016 Maxime Ripard <maxime.ripard@free-electrons.com>

libfdt: Add overlay application function

The device tree overlays are a good way to deal with user-modifyable
boards or boards with some kind of an expansion mechanism where we can
easily plug new board in (like the BBB, the Raspberry Pi or the CHIP).

Add a new function to merge overlays with a base device tree.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>

# 91b86e21 26-May-2016 Marek Vasut <marex@denx.de>

lib: Enable private libgcc by default

This patch decouples U-Boot binary from the toolchain on systems where
private libgcc is available. Instead of pulling in functions provided
by the libgcc from the toolchain, U-Boot will use it's own set of libgcc
functions. These functions are usually imported from Linux kernel, which
also uses it's own libgcc functions instead of the ones provided by the
toolchain.

This patch solves a rather common problem. The toolchain can usually
generate code for many variants of target architecture and often even
different endianness. The libgcc on the other hand is usually compiled
for one particular configuration and the functions provided by it may
or may not be suited for use in U-Boot. This can manifest in two ways,
either the U-Boot fails to compile altogether and linker will complain
or, in the much worse case, the resulting U-Boot will build, but will
misbehave in very subtle and hard to debug ways.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 67976306 30-Mar-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

cosmetic: Fix typos "privide"

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# ed980b8c 03-Mar-2016 Alexander Graf <agraf@csgraf.de>

efi_loader: hook up in build environment

Now that we have all the bits and pieces ready for EFI payload loading
support, hook them up in Makefiles and KConfigs so that we can build.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
[trini: Enable only when we of OF_LIBFDT, disable on kwb and colibri_pxa270]
Signed-off-by: Tom Rini <trini@konsulko.com>

# aa34fbc0 22-Feb-2016 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt to be used in SPL

Add an option to enable libfdt in SPL. This can be useful when decoding
FIT files in SPL.

We need to make sure this option is not enabled in SPL by this change.
Also this option needs to be enabled in host builds. Si add a new
IMAGE_USE_LIBFDT #define which can be used in files that are built on the
host but must also build for U-Boot and SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 69e173eb 22-Feb-2016 Simon Glass <sjg@chromium.org>

Move CONFIG_OF_LIBFDT to Kconfig

Move this option to Kconfig and tidy up existing boards.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a187559e 05-Feb-2016 Bin Meng <bmeng.cn@gmail.com>

Use correct spelling of "U-Boot"

Correct spelling of "U-Boot" shall be used in all written text
(documentation, comments in source files etc.).

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Minkyu Kang <mk7.kang@samsung.com>

# 947c626d 14-Jan-2016 Tom Rini <trini@konsulko.com>

vsprintf.c: Always enable CONFIG_SYS_VSNPRINTF

Enabling this function always removes some class of string saftey issues.
The size change here in general is about 400 bytes and this seems a reasonable
trade-off.

Cc: Peng Fan <peng.fan@nxp.com>
Cc: Peter Robinson <pbrobinson@gmail.com>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Adrian Alonso <aalonso@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 7d9cde10 22-Nov-2015 Stefan Roese <sr@denx.de>

lib/tiny-printf.c: Add tiny printf function for space limited environments

This patch adds a small printf() version that supports all basic formats.
Its intented to be used in U-Boot SPL versions on platforms with very
limited internal RAM sizes.

To enable it, just define CONFIG_USE_TINY_PRINTF in your defconfig. This
will result in the SPL using this tiny function and the main U-Boot
still using the full-blown printf() function.

This code was copied from:
http://www.sparetimelabs.com/printfrevisited
With mostly only coding style related changes so that its checkpatch
clean.

The size reduction is about 2.5KiB. Here a comparison for the db-mv784mp-gp
(Marvell AXP) SPL:

Without this patch:
58963 18536 1928 79427 13643 ./spl/u-boot-spl

With this patch:
56542 18536 1956 77034 12cea ./spl/u-boot-spl

Note:
To make it possible to compile tiny-printf.c instead of vsprintf.c when
CONFIG_USE_TINY_PRINTF is defined, the functions printf() and vprintf() are
moved from common/console.c into vsprintf.c in this patch.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>

# 2419cd16 03-Oct-2015 Simon Glass <sjg@chromium.org>

dm: tpm: Drop CONFIG_DM_TPM

Now that all TPM drivers use driver model, we can drop the special driver
model CONFIG option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>

# 027b728d 06-Oct-2015 Julius Werner <jwerner@chromium.org>

Add support for LZ4 decompression algorithm

This patch adds support for LZ4-compressed FIT image contents. This
algorithm has a slightly worse compression ration than LZO while being
nearly twice as fast to decompress. When loading images from a fast
storage medium this usually results in a boot time win.

Sandbox-tested only since I don't have a U-Boot development system set
up right now. The code was imported unchanged from coreboot where it's
proven to work, though. I'm mostly interested in getting this recognized
by mkImage for use in a downstream project.

Signed-off-by: Julius Werner <jwerner@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# a7d660bc 22-Aug-2015 Simon Glass <sjg@chromium.org>

tpm: Add Kconfig options for TPMs

Add new Kconfig options for TPMs in preparation for moving boards to use
Kconfig for TPM configuration.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 867a6ac8 31-Jul-2015 Simon Glass <sjg@chromium.org>

efi: Add start-up library code

When running as an EFI application, U-Boot must request memory from EFI,
and provide access to the boot services U-Boot needs.

Add library code to perform these tasks. This includes efi_main() which is
the entry point from EFI. U-Boot is built as a shared library.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d1389403 23-Jun-2015 Simon Glass <sjg@chromium.org>

Add a dhrystone benchmark command

Drystone provides a convenient sanity check that the CPU is running at full
speed. Add this as a command which can be enabled as needed.

Note: I investigated using Coremark for this but there was a license
agreement and I could not work out if it was GPL-compatible.

Signed-off-by: Simon Glass <sjg@chromium.org>

# f7848d90 22-Jun-2015 Joe Hershberger <joe.hershberger@ni.com>

Allow CONFIG_REGEX to be disabled when CONFIG_NET

Instead of selecting REGEX when NET is enabled, make it the default, but
allow boards that are tiny to disable it and lose functionality on all
but the first Ethernet adapter.

cm-bf548, bf538f-ezkit, and bf533-stamp need this. None appear to have
more than one Ethernet interface.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# 3850dbe8 11-Jun-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

blackfin: fix undefined reference to srand and rand

Commit 9ba9e85f3f1c (net: Fix NET_RANDOM_ETHADDR dependencies)
accidentally dropped CONFIG_LIB_RAND defines for 14 Blackfin boards.

Prior to that commit, those boards defined CONFIG_LIB_RAND, but not
CONFIG_NET_RANDOM_ETHADDR. So, commit 9ba9e85f3f1c should not have
touched them, but in fact it ripped CONFIG_LIB_RAND off from all the
header files, which caused undefined reference to srand and rand.
CONFIG_LIB_RAND=y must be revived for such boards.

BTW, this commit indeed makes it better, but even with this fix,
three boards (bf533-stamp, bf538f-ezkit, cm-bf548) still can not
build due to region 'ram' overflowed error. This was cause by
commit 6eed3786c68c (net: Move the CMD_NET config to defconfigs)
because CMD_NET selects NET, and NET selects REGEX. Eventually,
some boards were newly enabled with CONFIG_REGEX, increasing the
memory footprint. A patch is expected to fix the build error.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 9ba9e85f 25-May-2015 Michal Simek <michal.simek@xilinx.com>

net: Fix NET_RANDOM_ETHADDR dependencies

NET_RANDOM_ETHADDR depends on lib/rand.c. This patch adds dependency to
Kconfig to ensure that library is also compiled.

Remove the definitions from Blackfin boards' include/configs.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 6501ff62 20-Apr-2015 Przemyslaw Marczak <p.marczak@samsung.com>

lib: Kconfig: add entry for errno_str() function

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1a60650c 21-Apr-2015 Joe Hershberger <joe.hershberger@ni.com>

kconfig: Move REGEX to Kconfig

Having this as a Kconfig allows it to be a dependent feature.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8156345d 06-Mar-2015 Simon Glass <sjg@chromium.org>

sandbox: Move CONFIG_SYS_VSNPRINTF to Kconfig

Move this over to Kconfig and tidy up.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 94e3c8c4 19-Feb-2015 gaurav rana <gaurav.rana@freescale.com>

crypto/fsl - Add progressive hashing support using hardware acceleration.

Currently only normal hashing is supported using hardware acceleration.
Added support for progressive hashing using hardware.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
Signed-off-by: Gaurav Rana <gaurav.rana@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>

# d9f23c7f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@freescale.com>

lib/rsa: Add Kconfig for devices supporting RSA Modular Exponentiation

Kconfig option added for devices which support RSA Verification.
1. RSA_SOFTWARE_EXP
Enables driver for supporting RSA Modular Exponentiation in Software
2. RSA_FREESCALE_EXP
Enables driver for supporting RSA Modular Exponentiation using Freescale specific
driver

The above drivers use RSA uclass

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
(Removed duplicate line in Kconfig comment)

Change-Id: I7663c4d5350e2bfc3dfa2696f70ef777d6ccc6f6

# c4beb22f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@freescale.com>

FIT: Modify option FIT_SIGNATURE in Kconfig

For FIT signature based approach to work, RSA library needs to be selected.
The FIT_SIGNATURE option in Kconfig is modified to automatically select RSA.
Selecting RSA compiles the RSA library required for image verification.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 45ccec8f 23-Oct-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_USE_PRIVATE_LIBGCC to Kconfig

The private libgcc is supported only on ARM, MIPS, PowerPC, SH, x86.
Those architectures should "select" HAVE_PRIVATE_LIBGCC and
CONFIG_USE_PRIVATE_LIBGCC should depend on it.

Currently, this option is enabled on Tegra boards and x86 architecture.
Move the definition from header files to Kconfig.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Tested-by: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: Tom Warren <twarren@nvidia.com>

# 8c688bc4 23-Oct-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_SYS_HZ to lib/Kconfig

CONFIG_SYS_HZ is always defined as 1000 in config_fallbacks.h
(but some boards still have redundant definitions).

This commit moves the definition and the document in README to
Kconfig. Since lib/Kconfig can assure that CONFIG_SYS_HZ is 1000,
the sanity check in lib/time.c should be removed.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Reviewed-by: Marek Vasut <marex@denx.de>

# b0928da6 16-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED to Kconfig

If this option is enabled, the objects under lib/ directory
are compiled with speed optimization, not size optimization.
(Currently, only used by some Blackfin boards.)

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# ed36323f 16-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: add blank Kconfig files

This would be useful to start moving various config options.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# 1611235b 19-Jan-2020 Heinrich Schuchardt <xypron.glpk@gmx.de>

lib: Kconfig dependencies for pseudo-random library

drivers/rng/sandbox_rng.c requires rand() to be defined but configuration
option CONFIG_CONFIG_LIB_RAND selected in drivers/rng/Kconfig does not
exist.

test/lib/test_aes.c requires rand() to be defined.

Fix the selection criteria for choice "Pseudo-random library support type".

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 3c10dc95 06-Dec-2019 Simon Glass <sjg@chromium.org>

binman: Add a library to access binman entries

SPL and TPL can access information about binman entries using link-time
symbols but this is not available in U-Boot proper. Of course it could be
made available, but the intention is to just read the device tree.

Add support for this, so that U-Boot can locate entries.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# b4adf627 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: crypto: add x509 parser

Imported from linux kernel v5.3:
x509.asn1 without changes
x509_akid.asn1 without changes
x509_parser.h without changes
x509_cert_parser.c with changes marked as __UBOOT__
x509_public_key.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# a9b45e6e 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add oid registry utility

Imported from linux kernel v5.3:
build_OID_registry without changes
oid_registry.h without changes
oid_registry.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# ab8a0e06 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add asn1 decoder

Imported from linux kernel v5.3:
lib/asn1_decoder.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 2b12196d 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

cmd: add asn1_compiler

Imported from linux kernel v5.3:
asn1.h without changes
asn1_ber_bytecode.h without changes
asn1_decoder.h without changes
asn1_compiler.c without changes

This host command will be used to create a ASN1 parser, for example,
for pkcs7 messages or x509 certificates. More specifically, it will
generate *byte code* which will be interpreted by asn1 decoder library.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 05429b6c 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

rtc: move date.c from drivers/rtc/ to lib/

In the next commit, rtc_mktime(), for compatibility with linux, will be
implemented using rtc_mktime(), which is no longer drivers/rtc specific.
So move this file under lib/.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 37ef1774 10-Nov-2019 Thomas Hebb <tommyhebb@gmail.com>

Kconfig: disambiguate config names for tiny printf

27084c03d36a ("spl: Allow tiny printf() to be controlled in SPL and
TPL") split this option in two for TPL and SPL, but didn't change the
Kconfig names, making them hard to set quickly.

Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>

# 0d76afc0 27-Oct-2019 Simon Glass <sjg@chromium.org>

fdt: Add Kconfig options to control code size

For better or worse libfdt recent grew a lot of code that checks the
validity of the device tree in great detail. When using unsigned or
unverified data this makes things safer, but it does add to code size.

Add some controls to select the trade-off between safety and code size.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 27084c03 25-Sep-2019 Simon Glass <sjg@chromium.org>

spl: Allow tiny printf() to be controlled in SPL and TPL

At present there is only one control for this and it is used for both SPL
and TPL. But SPL might have a lot more space than TPL so the extra cost of
a full printf() might be acceptable.

Split the option into two, providing separate SPL and TPL controls. The
TPL setting defaults to the same as SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2a51e16b 07-Jun-2019 Tom Rini <trini@konsulko.com>

configs: Make USE_TINY_PRINTF depend on SPL||TPL and be default

The USE_TINY_PRINTF symbol only changes things within SPL and TPL
builds, so make it depend on that support. Next, make it default as
within these cases we should rarely have need of more advanced print
formats outside of the debug context.

To do this, in a few cases we need to correct our Kconfig dependencies
as we had cases of non-SPL targets select'ing this symbol. Finally, in
the case of a few boards we really do need the full printf
functionality.

Signed-off-by: Tom Rini <trini@konsulko.com>

# da0fb5fd 02-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: make call depth limit customizable

Up to now we had hard coded values for the call depth up to which trace
records are created: 200 for early tracing, 15 thereafter. UEFI
applications reach a call depth of 80 or above.

Provide customizing settings for the call trace depth limit and the early
call trace depth limit. Use the old values as defaults.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8509f22a 29-Apr-2019 Marek Behún <marek.behun@nic.cz>

lib: add Zstandard decompression support

Add the zstd library from Linux kernel (only decompression support).
There are minimal changes to build with U-Boot, otherwise the files are
identical to Linux commit dc35da16 from March 2018, the files had not
been touched since in kernel. Also SPDX lincese tags were added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 83a486b6 29-Apr-2019 Marek Behún <marek.behun@nic.cz>

lib: Add xxhash support

This adds the xxhash support from Linux. Files are almost identical to
those added to Linux in commit 5d240522 ("lib: Add xxhash module") (they
haven't been touched since in Linux). The only difference is to add some
includes to be compatible with U-Boot. Also SPDX lincese tags were
added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 5132361a 29-Apr-2019 Heiko Schocher <hs@denx.de>

lib: Kconfig: fix help text for GZIP

commit 95f4bbd581cf ("lib: fdt: Allow LZO and GZIP DT compression in U-Boot")

introduced Kconfig option for gzip in U-Boot, but help text
says gzip for SPL, which is wrong. Fix this.

Signed-off-by: Heiko Schocher <hs@denx.de>
Acked-by: Marek Vasut <marex@denx.de>

# 1c6eb075 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE_BUFFER_SIZE et al to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE_BUFFER_SIZE
CONFIG_TRACE_EARLY_SIZE
CONFIG_TRACE_EARLY
CONFIG_TRACE_EARLY_ADDR

Signed-off-by: Simon Glass <sjg@chromium.org>

# a24a78d7 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE

Signed-off-by: Simon Glass <sjg@chromium.org>

# 54969b40 21-Mar-2019 Thierry Reding <treding@nvidia.com>

fdtdec: Add Kconfig symbol for tests

Runtime tests are provided as a test_fdtdec command implementation. Add
a Kconfig symbol that allows this command to be built so that the tests
can be used.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 95f4bbd5 08-Mar-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

lib: fdt: Allow LZO and GZIP DT compression in U-Boot

Add required Kconfig symbols, Makefile bits and macro fixes in a
few places to support LZO and DT compression in U-Boot. This can
save a lot of space with multi-DTB fitImages.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>

# 6e705114 13-Jan-2019 Chris Packham <judge.packham@gmail.com>

lib: Kconfig: spelling fixes

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 048c6e89 06-Nov-2018 Simon Glass <sjg@chromium.org>

spl: lz4: Allow use of lz4 compression in SPL

In some cases U-Boot is compressed and it is useful to be able to
decompress it in SPL. Add a Kconfig and Makefile change to allow this.
Note that this does not actually implement decompression.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 2895c4b7 15-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

kconfig: Introduce HAVE_ARCH_IOMAP

Introduce a new Kconfig option for architecture codes to control
whether it provides io{read,write}{8,16,32} I/O accessor functions.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5592a633 01-Oct-2018 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt in TPL

In some cases (e.g. sandbox with verified boot) it is useful to support
libfdt in TPL. Update the Kconfig to handle this.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 6307896c 01-Oct-2018 Simon Glass <sjg@chromium.org>

tpm: Add support for SPL and TPL

At present the tpm can only be used in U-Boot proper. Updated it to work
in SPL and TPL also.

Signed-off-by: Simon Glass <sjg@chromium.org>

# ab948cd2 19-Jul-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

fdt_support: make FDT_FIXUP_PARTITIONS depend on CMD_MTDPARTS

fdt_fixup_mtdparts() calls mtdparts_init() and device_find(),
which are defined in cmd/mtdparts.c

The combination of FDT_FIXUP_PARTITIONS=y and CMD_MTDPARTS=n
emits the following link error:

common/fdt_support.c:903: undefined reference to `mtdparts_init'
common/fdt_support.c:914: undefined reference to `device_find'

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 3330584d 03-Jun-2018 Igor Opaniuk <igor.opaniuk@gmail.com>

avb2.0: integrate avb 2.0 into the build system

Integrate libavb into the build system. Introduce CONFIG_LIBAVB
build option.

Signed-off-by: Igor Opaniuk <igor.opaniuk@linaro.org>

# f8c987f8 05-Jun-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

lib: Add hexdump

Often during debugging session it's very interesting to see
what data we were dealing with. For example what we write or read
to/from memory or peripherals.

This change introduces functions that allow to dump binary
data with one simple function invocation like:
------------------->8----------------
print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, buf, len);
------------------->8----------------

which gives us the following:
------------------->8----------------
00000000: f2 b7 c9 88 62 61 75 64 72 61 74 65 3d 31 31 35 ....baudrate=115
00000010: 32 30 30 00 62 6f 6f 74 61 72 67 73 3d 63 6f 6e 200.bootargs=con
00000020: 73 6f 6c 65 3d 74 74 79 53 33 2c 31 31 35 32 30 sole=ttyS3,11520
00000030: 30 6e 38 00 62 6f 6f 74 64 65 6c 61 79 3d 33 00 0n8.bootdelay=3.
00000040: 62 6f 6f 74 66 69 6c 65 3d 75 49 6d 61 67 65 00 bootfile=uImage.
00000050: 66 64 74 63 6f 6e 74 72 6f 6c 61 64 64 72 3d 39 fdtcontroladdr=9
00000060: 66 66 62 31 62 61 30 00 6c 6f 61 64 61 64 64 72 ffb1ba0.loadaddr
00000070: 3d 30 78 38 32 30 30 30 30 30 30 00 73 74 64 65 =0x82000000.stde
00000080: 72 72 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 rr=serial0@e0022
00000090: 30 30 30 00 73 74 64 69 6e 3d 73 65 72 69 61 6c 000.stdin=serial
000000a0: 30 40 65 30 30 32 32 30 30 30 00 73 74 64 6f 75 0@e0022000.stdou
000000b0: 74 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 30 t=serial0@e00220
000000c0: 30 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00..............
...
------------------->8----------------

Source of hexdump.c was copied from Linux kernel v4.7-rc2.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Mario Six <mario.six@gdsys.cc>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Stefan Roese <sr@denx.de>

# c232d14d 29-May-2018 Alex Kiernan <alex.kiernan@gmail.com>

mmc: Separate "mmc swrite" from fastboot

Introduce CONFIG_IMAGE_SPARSE and CONFIG_CMD_MMC_SWRITE so the "mmc
swrite" command is separated from the fastboot code.

Move image-sparse from common to lib so it's clear it's library code.

Rename CONFIG_FASTBOOT_FLASH_FILLBUF_SIZE to CONFIG_IMAGE_SPARSE_FILLBUF_SIZE
and migrate it to Kconfig.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Acked-by: Jassi Brar <jaswinder.singh@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6417572e 08-May-2018 Tom Rini <trini@konsulko.com>

lib/Kconfig: Mark OF_LIBFDT_OVERLAY as depending on OF_LIBFDT

The overlay code is only useful when OF_LIBFDT is set, so mark it as
depending on that first.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 58a46f88 25-Apr-2018 Praneeth Bajjuri <praneeth@ti.com>

configs: TI: Enable FIT Library overlay support

Enable the FDT library overlay support for all TI SOC family.

Without this option, when Loading fdt from FIT image, the
following warning is seen.

"config with overlays but CONFIG_OF_LIBFDT_OVERLAY not set".

Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
Suggested-by: Andrew F.Davis <afd@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>

# 14ad44ab 18-Apr-2018 Alex Kiernan <alex.kiernan@gmail.com>

spl: Split sprintf, strto* from SPL serial in Kconfig

When SPL serial is disabled, callers who need sprintf or strtoul fail
because their inclusion is guarded by CONFIG_SPL_SERIAL_SUPPORT/
CONFIG_TPL_SERIAL_SUPPORT.

Split printf, sprintf and strto into their own entries and then select
all of them if SERIAL_SUPPORT is enabled to match the current behaviour.

Include panic.o unconditionally as it can be called from anywhere which
uses BUG_ON().

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>

# e294ba06 04-Apr-2018 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-sunxi

Signed-off-by: Tom Rini <trini@konsulko.com>


# d14db11d 03-Apr-2018 Andre Przywara <andre.przywara@arm.com>

sunxi: revert disabling of features

In January some commits were introduced to mitigate the U-Boot image
size issues we encountered on sunxi builds.
Now with the MMC environment removed we can bring them back, as we
practically don't have a size limit anymore.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 32ce6179 13-Mar-2018 Bryan O'Donoghue <bryan.odonoghue@linaro.org>

optee: Add lib entries for sharing OPTEE code across ports

This patch adds code to lib to enable sharing of useful OPTEE code between
board-ports and architectures. The code on lib/optee/optee.c comes from the
TI omap2 port. Eventually the OMAP2 code will be patched to include the
shared code. The intention here is to add more useful OPTEE specific code
as more functionality gets added.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Cc: Harinarayan Bhatta <harinarayan@ti.com>
Cc: Andrew F. Davis <afd@ti.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Kever Yang <kever.yang@rock-chips.com>
Cc: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Cc: Peng Fan <peng.fan@nxp.com>
Tested-by: Peng Fan <peng.fan@nxp.com>

# 36c1877c 06-Feb-2018 Faiz Abbas <faiz_abbas@ti.com>

lib: Kconfig: Move DYNAMIC_CRC_TABLE to Kconfig

Add CONFIG prefix to DYNAMIC_CRC_TABLE and implement it in
Kconfig.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>

# a451bc27 05-Feb-2018 Adam Ford <aford173@gmail.com>

Convert LIB_UUID to Kconfig

config_fallback.h has some logic that checks a variety of options
and selects LIB_UUID if it hasn't already been selected. This
will all LIB_UUID in Kconfig and select this option for the list
of options to allow us to remove the logic from fallbacks

Signed-off-by: Adam Ford <aford173@gmail.com>

# a5a37567 06-Feb-2018 Adam Ford <aford173@gmail.com>

Convert CONFIG LIB_HW_RAND to Kconfig

config_fallbacks.h had some logic to automatically select
LIB_RAND if RANDOM_UUID or CMD_UUID were set if LIB_HW_RAND wasn't
already selected. By migrating LIB_HW_RAND to Kconfig, we can
remove this check from config_fallbacks.h and put it into Kconfig

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
[trini: Turn into a choice, add NET_RANDOM_ETHADDR]
Signed-off-by: Tom Rini <trini@konsulko.com>

# acd4d334 16-Jan-2018 Maxime Ripard <maxime.ripard@free-electrons.com>

net: regex: Disable by default on sunXi

The sunXi arm64 build has overflown, leading to the main U-boot binary
overwriting the environment when flashing the new image, or even worse,
overwriting itself when we're calling saveenv.

Disable this option that is not critical until we can adress the issue
properly.

Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 7e3caa81 03-Dec-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

Move CONFIG_PANIC_HANG to Kconfig

Freescale (NXP) boards have lots of defconfig files per board.
I used "imply PANIC_HANG" for them.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# da5337a6 08-Nov-2017 Nandor Han <nandor.han@ge.com>

rtc: add support for s35392a

Add support for S35392A RTC. The driver supports both U-Boot driver
models.

Signed-off-by: Nandor Han <nandor.han@ge.com>
Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
Cc: Heiko Schocher <hs@denx.de>

# f52bdf4b 14-Sep-2017 Jean-Jacques Hiblot <jjhiblot@ti.com>

lib: allow building lzo for the SPL

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 85d8bf57 03-Sep-2017 Marek Behún <marek.behun@nic.cz>

lib: Add CRC32-C

This is needed for BTRFS.

Signed-off-by: Marek Behun <marek.behun@nic.cz>

create mode 100644 lib/crc32c.c

# 7264f292 15-Aug-2017 York Sun <york.sun@nxp.com>

spl: fit: Eanble GZIP support for image decompression

Add Kconfig option SPL_GZIP and SPL_ZLIB to enable gunzip support for
SPL boot, eg. falcon boot compressed kernel image.

Signed-off-by: York Sun <york.sun@nxp.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6ef2f901 11-Aug-2017 Adam Ford <aford173@gmail.com>

Convert CONFIG_BCH to Kconfig

This converts the following to Kconfig:
CONFIG_BCH

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1a7ba1d 18-Aug-2017 Anatolij Gustschin <agust@denx.de>

Fix 'notes' typos

s/notes/nodes

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 96b9082c 03-Aug-2017 Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

rockchip: rk3188: rock: adjust for SPL/TPL split

With the changes to split SPL/TPL for the RK3368, I apparently missed
some needed adjustments to the RK3188 Kconfig and rock_defconfig.

This fixes build-issues for the rock board after applying the RK3368
enablement (and SPL/TPL) set that resulted from TPL_SERIAL_SUPPORT,
TPL_ROCKCHIP_BACK_TO_BROM and TPL_TINY_MEMSET being separate symbols
now.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d56b4b19 22-Jul-2017 Tom Rini <trini@konsulko.com>

configs: Migrate RBTREE, LZO, CMD_MTDPARTS, CMD_UBI and CMD_UBIFS

The above CONFIG options are in Kconfig, and now have correct depends and
inter-dependencies. Migrate these to configs/ from include/configs/. In the
case of CMD_UBIFS also change it to be a default y if CMD_UBI.

Signed-off-by: Tom Rini <trini@konsulko.com>

# aed998aa 17-May-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_LZMA to Kconfig

This converts the following to Kconfig:
CONFIG_LZMA

Signed-off-by: Simon Glass <sjg@chromium.org>

# b1a873df 26-Apr-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_CMD_AES et al to Kconfig

This converts the following to Kconfig:
CONFIG_CMD_AES
CONFIG_AES

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Add select AES to CMD_AES]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 173aafbf 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

cmd: Expose a Kconfig option to enable UBIFS commands

Create a new Kconfig entry to allow CMD_UBIFS selection from Kconfig and
add an hidden LZO option that can be selected by CMD_UBIFS.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>

# aa049152 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

mtd: ubi: Select RBTREE option from MTD_UBI Kconfig entry

Expose the RBTREE feature through Kconfig and select this option from the
MTD_UBI option.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>
[Rebased on master]
Signed-off-by: Jagan Teki <jagan@openedev.com>

# ab4458bd 02-Apr-2017 Simon Glass <sjg@chromium.org>

string: Provide a slimmed-down memset()

Most of the time the optimised memset() is what we want. For extreme
situations such as TPL it may be too large. For example on the 'rock'
board, using a simple loop saves a useful 48 bytes. With gcc 4.9 and
the rodata bug, this patch is enough to reduce the TPL image below the
limit.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>

# bea79d7d 14-Mar-2017 Andre Przywara <andre.przywara@arm.com>

Kconfig: introduce md5sum command selection

So far CONFIG_MD5SUM would need to be set by a board's include file.
Since the command is really generic, move it over to Kconfig to allow
it to be defined by either a board's defconfig, menuconfig or some
config snippet merged via mergeconfig.sh.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e663b350 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

smbios: Expose in efi_loader as table

We can pass SMBIOS easily as EFI configuration table to an EFI payload. This
patch adds enablement for that case.

While at it, we also enable SMBIOS generation for ARM systems, since they support
EFI_LOADER.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4b6dddc2 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

x86: Move smbios generation into arch independent directory

We will need the SMBIOS generation function on ARM as well going forward,
so let's move it into a non arch specific location.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# ebf7fff2 05-Oct-2016 Heiko Schocher <hs@denx.de>

spl: move FDT_FIXUP_PARTITIONS to Kconfig

Move FDT_FIXUP_PARTITIONS to Kconfig and cleanup existing
uses.

Signed-off-by: Heiko Schocher <hs@denx.de>

# ddf67f71 05-Jul-2016 Maxime Ripard <maxime.ripard@free-electrons.com>

libfdt: Add overlay application function

The device tree overlays are a good way to deal with user-modifyable
boards or boards with some kind of an expansion mechanism where we can
easily plug new board in (like the BBB, the Raspberry Pi or the CHIP).

Add a new function to merge overlays with a base device tree.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>

# 91b86e21 26-May-2016 Marek Vasut <marex@denx.de>

lib: Enable private libgcc by default

This patch decouples U-Boot binary from the toolchain on systems where
private libgcc is available. Instead of pulling in functions provided
by the libgcc from the toolchain, U-Boot will use it's own set of libgcc
functions. These functions are usually imported from Linux kernel, which
also uses it's own libgcc functions instead of the ones provided by the
toolchain.

This patch solves a rather common problem. The toolchain can usually
generate code for many variants of target architecture and often even
different endianness. The libgcc on the other hand is usually compiled
for one particular configuration and the functions provided by it may
or may not be suited for use in U-Boot. This can manifest in two ways,
either the U-Boot fails to compile altogether and linker will complain
or, in the much worse case, the resulting U-Boot will build, but will
misbehave in very subtle and hard to debug ways.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 67976306 30-Mar-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

cosmetic: Fix typos "privide"

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# ed980b8c 03-Mar-2016 Alexander Graf <agraf@csgraf.de>

efi_loader: hook up in build environment

Now that we have all the bits and pieces ready for EFI payload loading
support, hook them up in Makefiles and KConfigs so that we can build.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
[trini: Enable only when we of OF_LIBFDT, disable on kwb and colibri_pxa270]
Signed-off-by: Tom Rini <trini@konsulko.com>

# aa34fbc0 22-Feb-2016 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt to be used in SPL

Add an option to enable libfdt in SPL. This can be useful when decoding
FIT files in SPL.

We need to make sure this option is not enabled in SPL by this change.
Also this option needs to be enabled in host builds. Si add a new
IMAGE_USE_LIBFDT #define which can be used in files that are built on the
host but must also build for U-Boot and SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 69e173eb 22-Feb-2016 Simon Glass <sjg@chromium.org>

Move CONFIG_OF_LIBFDT to Kconfig

Move this option to Kconfig and tidy up existing boards.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a187559e 05-Feb-2016 Bin Meng <bmeng.cn@gmail.com>

Use correct spelling of "U-Boot"

Correct spelling of "U-Boot" shall be used in all written text
(documentation, comments in source files etc.).

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Minkyu Kang <mk7.kang@samsung.com>

# 947c626d 14-Jan-2016 Tom Rini <trini@konsulko.com>

vsprintf.c: Always enable CONFIG_SYS_VSNPRINTF

Enabling this function always removes some class of string saftey issues.
The size change here in general is about 400 bytes and this seems a reasonable
trade-off.

Cc: Peng Fan <peng.fan@nxp.com>
Cc: Peter Robinson <pbrobinson@gmail.com>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Adrian Alonso <aalonso@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 7d9cde10 22-Nov-2015 Stefan Roese <sr@denx.de>

lib/tiny-printf.c: Add tiny printf function for space limited environments

This patch adds a small printf() version that supports all basic formats.
Its intented to be used in U-Boot SPL versions on platforms with very
limited internal RAM sizes.

To enable it, just define CONFIG_USE_TINY_PRINTF in your defconfig. This
will result in the SPL using this tiny function and the main U-Boot
still using the full-blown printf() function.

This code was copied from:
http://www.sparetimelabs.com/printfrevisited
With mostly only coding style related changes so that its checkpatch
clean.

The size reduction is about 2.5KiB. Here a comparison for the db-mv784mp-gp
(Marvell AXP) SPL:

Without this patch:
58963 18536 1928 79427 13643 ./spl/u-boot-spl

With this patch:
56542 18536 1956 77034 12cea ./spl/u-boot-spl

Note:
To make it possible to compile tiny-printf.c instead of vsprintf.c when
CONFIG_USE_TINY_PRINTF is defined, the functions printf() and vprintf() are
moved from common/console.c into vsprintf.c in this patch.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>

# 2419cd16 03-Oct-2015 Simon Glass <sjg@chromium.org>

dm: tpm: Drop CONFIG_DM_TPM

Now that all TPM drivers use driver model, we can drop the special driver
model CONFIG option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>

# 027b728d 06-Oct-2015 Julius Werner <jwerner@chromium.org>

Add support for LZ4 decompression algorithm

This patch adds support for LZ4-compressed FIT image contents. This
algorithm has a slightly worse compression ration than LZO while being
nearly twice as fast to decompress. When loading images from a fast
storage medium this usually results in a boot time win.

Sandbox-tested only since I don't have a U-Boot development system set
up right now. The code was imported unchanged from coreboot where it's
proven to work, though. I'm mostly interested in getting this recognized
by mkImage for use in a downstream project.

Signed-off-by: Julius Werner <jwerner@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# a7d660bc 22-Aug-2015 Simon Glass <sjg@chromium.org>

tpm: Add Kconfig options for TPMs

Add new Kconfig options for TPMs in preparation for moving boards to use
Kconfig for TPM configuration.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 867a6ac8 31-Jul-2015 Simon Glass <sjg@chromium.org>

efi: Add start-up library code

When running as an EFI application, U-Boot must request memory from EFI,
and provide access to the boot services U-Boot needs.

Add library code to perform these tasks. This includes efi_main() which is
the entry point from EFI. U-Boot is built as a shared library.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d1389403 23-Jun-2015 Simon Glass <sjg@chromium.org>

Add a dhrystone benchmark command

Drystone provides a convenient sanity check that the CPU is running at full
speed. Add this as a command which can be enabled as needed.

Note: I investigated using Coremark for this but there was a license
agreement and I could not work out if it was GPL-compatible.

Signed-off-by: Simon Glass <sjg@chromium.org>

# f7848d90 22-Jun-2015 Joe Hershberger <joe.hershberger@ni.com>

Allow CONFIG_REGEX to be disabled when CONFIG_NET

Instead of selecting REGEX when NET is enabled, make it the default, but
allow boards that are tiny to disable it and lose functionality on all
but the first Ethernet adapter.

cm-bf548, bf538f-ezkit, and bf533-stamp need this. None appear to have
more than one Ethernet interface.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# 3850dbe8 11-Jun-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

blackfin: fix undefined reference to srand and rand

Commit 9ba9e85f3f1c (net: Fix NET_RANDOM_ETHADDR dependencies)
accidentally dropped CONFIG_LIB_RAND defines for 14 Blackfin boards.

Prior to that commit, those boards defined CONFIG_LIB_RAND, but not
CONFIG_NET_RANDOM_ETHADDR. So, commit 9ba9e85f3f1c should not have
touched them, but in fact it ripped CONFIG_LIB_RAND off from all the
header files, which caused undefined reference to srand and rand.
CONFIG_LIB_RAND=y must be revived for such boards.

BTW, this commit indeed makes it better, but even with this fix,
three boards (bf533-stamp, bf538f-ezkit, cm-bf548) still can not
build due to region 'ram' overflowed error. This was cause by
commit 6eed3786c68c (net: Move the CMD_NET config to defconfigs)
because CMD_NET selects NET, and NET selects REGEX. Eventually,
some boards were newly enabled with CONFIG_REGEX, increasing the
memory footprint. A patch is expected to fix the build error.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 9ba9e85f 25-May-2015 Michal Simek <michal.simek@xilinx.com>

net: Fix NET_RANDOM_ETHADDR dependencies

NET_RANDOM_ETHADDR depends on lib/rand.c. This patch adds dependency to
Kconfig to ensure that library is also compiled.

Remove the definitions from Blackfin boards' include/configs.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 6501ff62 20-Apr-2015 Przemyslaw Marczak <p.marczak@samsung.com>

lib: Kconfig: add entry for errno_str() function

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1a60650c 21-Apr-2015 Joe Hershberger <joe.hershberger@ni.com>

kconfig: Move REGEX to Kconfig

Having this as a Kconfig allows it to be a dependent feature.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8156345d 06-Mar-2015 Simon Glass <sjg@chromium.org>

sandbox: Move CONFIG_SYS_VSNPRINTF to Kconfig

Move this over to Kconfig and tidy up.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 94e3c8c4 19-Feb-2015 gaurav rana <gaurav.rana@freescale.com>

crypto/fsl - Add progressive hashing support using hardware acceleration.

Currently only normal hashing is supported using hardware acceleration.
Added support for progressive hashing using hardware.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
Signed-off-by: Gaurav Rana <gaurav.rana@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>

# d9f23c7f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@freescale.com>

lib/rsa: Add Kconfig for devices supporting RSA Modular Exponentiation

Kconfig option added for devices which support RSA Verification.
1. RSA_SOFTWARE_EXP
Enables driver for supporting RSA Modular Exponentiation in Software
2. RSA_FREESCALE_EXP
Enables driver for supporting RSA Modular Exponentiation using Freescale specific
driver

The above drivers use RSA uclass

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
(Removed duplicate line in Kconfig comment)

Change-Id: I7663c4d5350e2bfc3dfa2696f70ef777d6ccc6f6

# c4beb22f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@freescale.com>

FIT: Modify option FIT_SIGNATURE in Kconfig

For FIT signature based approach to work, RSA library needs to be selected.
The FIT_SIGNATURE option in Kconfig is modified to automatically select RSA.
Selecting RSA compiles the RSA library required for image verification.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 45ccec8f 23-Oct-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_USE_PRIVATE_LIBGCC to Kconfig

The private libgcc is supported only on ARM, MIPS, PowerPC, SH, x86.
Those architectures should "select" HAVE_PRIVATE_LIBGCC and
CONFIG_USE_PRIVATE_LIBGCC should depend on it.

Currently, this option is enabled on Tegra boards and x86 architecture.
Move the definition from header files to Kconfig.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Tested-by: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: Tom Warren <twarren@nvidia.com>

# 8c688bc4 23-Oct-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_SYS_HZ to lib/Kconfig

CONFIG_SYS_HZ is always defined as 1000 in config_fallbacks.h
(but some boards still have redundant definitions).

This commit moves the definition and the document in README to
Kconfig. Since lib/Kconfig can assure that CONFIG_SYS_HZ is 1000,
the sanity check in lib/time.c should be removed.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Reviewed-by: Marek Vasut <marex@denx.de>

# b0928da6 16-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED to Kconfig

If this option is enabled, the objects under lib/ directory
are compiled with speed optimization, not size optimization.
(Currently, only used by some Blackfin boards.)

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# ed36323f 16-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: add blank Kconfig files

This would be useful to start moving various config options.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# 3c10dc95 06-Dec-2019 Simon Glass <sjg@chromium.org>

binman: Add a library to access binman entries

SPL and TPL can access information about binman entries using link-time
symbols but this is not available in U-Boot proper. Of course it could be
made available, but the intention is to just read the device tree.

Add support for this, so that U-Boot can locate entries.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# b4adf627 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: crypto: add x509 parser

Imported from linux kernel v5.3:
x509.asn1 without changes
x509_akid.asn1 without changes
x509_parser.h without changes
x509_cert_parser.c with changes marked as __UBOOT__
x509_public_key.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# a9b45e6e 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add oid registry utility

Imported from linux kernel v5.3:
build_OID_registry without changes
oid_registry.h without changes
oid_registry.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# ab8a0e06 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add asn1 decoder

Imported from linux kernel v5.3:
lib/asn1_decoder.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 2b12196d 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

cmd: add asn1_compiler

Imported from linux kernel v5.3:
asn1.h without changes
asn1_ber_bytecode.h without changes
asn1_decoder.h without changes
asn1_compiler.c without changes

This host command will be used to create a ASN1 parser, for example,
for pkcs7 messages or x509 certificates. More specifically, it will
generate *byte code* which will be interpreted by asn1 decoder library.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 05429b6c 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

rtc: move date.c from drivers/rtc/ to lib/

In the next commit, rtc_mktime(), for compatibility with linux, will be
implemented using rtc_mktime(), which is no longer drivers/rtc specific.
So move this file under lib/.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 37ef1774 10-Nov-2019 Thomas Hebb <tommyhebb@gmail.com>

Kconfig: disambiguate config names for tiny printf

27084c03d36a ("spl: Allow tiny printf() to be controlled in SPL and
TPL") split this option in two for TPL and SPL, but didn't change the
Kconfig names, making them hard to set quickly.

Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>

# 0d76afc0 27-Oct-2019 Simon Glass <sjg@chromium.org>

fdt: Add Kconfig options to control code size

For better or worse libfdt recent grew a lot of code that checks the
validity of the device tree in great detail. When using unsigned or
unverified data this makes things safer, but it does add to code size.

Add some controls to select the trade-off between safety and code size.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 27084c03 25-Sep-2019 Simon Glass <sjg@chromium.org>

spl: Allow tiny printf() to be controlled in SPL and TPL

At present there is only one control for this and it is used for both SPL
and TPL. But SPL might have a lot more space than TPL so the extra cost of
a full printf() might be acceptable.

Split the option into two, providing separate SPL and TPL controls. The
TPL setting defaults to the same as SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2a51e16b 07-Jun-2019 Tom Rini <trini@konsulko.com>

configs: Make USE_TINY_PRINTF depend on SPL||TPL and be default

The USE_TINY_PRINTF symbol only changes things within SPL and TPL
builds, so make it depend on that support. Next, make it default as
within these cases we should rarely have need of more advanced print
formats outside of the debug context.

To do this, in a few cases we need to correct our Kconfig dependencies
as we had cases of non-SPL targets select'ing this symbol. Finally, in
the case of a few boards we really do need the full printf
functionality.

Signed-off-by: Tom Rini <trini@konsulko.com>

# da0fb5fd 02-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: make call depth limit customizable

Up to now we had hard coded values for the call depth up to which trace
records are created: 200 for early tracing, 15 thereafter. UEFI
applications reach a call depth of 80 or above.

Provide customizing settings for the call trace depth limit and the early
call trace depth limit. Use the old values as defaults.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8509f22a 29-Apr-2019 Marek Behún <marek.behun@nic.cz>

lib: add Zstandard decompression support

Add the zstd library from Linux kernel (only decompression support).
There are minimal changes to build with U-Boot, otherwise the files are
identical to Linux commit dc35da16 from March 2018, the files had not
been touched since in kernel. Also SPDX lincese tags were added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 83a486b6 29-Apr-2019 Marek Behún <marek.behun@nic.cz>

lib: Add xxhash support

This adds the xxhash support from Linux. Files are almost identical to
those added to Linux in commit 5d240522 ("lib: Add xxhash module") (they
haven't been touched since in Linux). The only difference is to add some
includes to be compatible with U-Boot. Also SPDX lincese tags were
added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 5132361a 29-Apr-2019 Heiko Schocher <hs@denx.de>

lib: Kconfig: fix help text for GZIP

commit 95f4bbd581cf ("lib: fdt: Allow LZO and GZIP DT compression in U-Boot")

introduced Kconfig option for gzip in U-Boot, but help text
says gzip for SPL, which is wrong. Fix this.

Signed-off-by: Heiko Schocher <hs@denx.de>
Acked-by: Marek Vasut <marex@denx.de>

# 1c6eb075 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE_BUFFER_SIZE et al to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE_BUFFER_SIZE
CONFIG_TRACE_EARLY_SIZE
CONFIG_TRACE_EARLY
CONFIG_TRACE_EARLY_ADDR

Signed-off-by: Simon Glass <sjg@chromium.org>

# a24a78d7 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE

Signed-off-by: Simon Glass <sjg@chromium.org>

# 54969b40 21-Mar-2019 Thierry Reding <treding@nvidia.com>

fdtdec: Add Kconfig symbol for tests

Runtime tests are provided as a test_fdtdec command implementation. Add
a Kconfig symbol that allows this command to be built so that the tests
can be used.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 95f4bbd5 08-Mar-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

lib: fdt: Allow LZO and GZIP DT compression in U-Boot

Add required Kconfig symbols, Makefile bits and macro fixes in a
few places to support LZO and DT compression in U-Boot. This can
save a lot of space with multi-DTB fitImages.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>

# 6e705114 13-Jan-2019 Chris Packham <judge.packham@gmail.com>

lib: Kconfig: spelling fixes

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 048c6e89 06-Nov-2018 Simon Glass <sjg@chromium.org>

spl: lz4: Allow use of lz4 compression in SPL

In some cases U-Boot is compressed and it is useful to be able to
decompress it in SPL. Add a Kconfig and Makefile change to allow this.
Note that this does not actually implement decompression.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 2895c4b7 15-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

kconfig: Introduce HAVE_ARCH_IOMAP

Introduce a new Kconfig option for architecture codes to control
whether it provides io{read,write}{8,16,32} I/O accessor functions.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5592a633 01-Oct-2018 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt in TPL

In some cases (e.g. sandbox with verified boot) it is useful to support
libfdt in TPL. Update the Kconfig to handle this.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 6307896c 01-Oct-2018 Simon Glass <sjg@chromium.org>

tpm: Add support for SPL and TPL

At present the tpm can only be used in U-Boot proper. Updated it to work
in SPL and TPL also.

Signed-off-by: Simon Glass <sjg@chromium.org>

# ab948cd2 19-Jul-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

fdt_support: make FDT_FIXUP_PARTITIONS depend on CMD_MTDPARTS

fdt_fixup_mtdparts() calls mtdparts_init() and device_find(),
which are defined in cmd/mtdparts.c

The combination of FDT_FIXUP_PARTITIONS=y and CMD_MTDPARTS=n
emits the following link error:

common/fdt_support.c:903: undefined reference to `mtdparts_init'
common/fdt_support.c:914: undefined reference to `device_find'

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 3330584d 03-Jun-2018 Igor Opaniuk <igor.opaniuk@gmail.com>

avb2.0: integrate avb 2.0 into the build system

Integrate libavb into the build system. Introduce CONFIG_LIBAVB
build option.

Signed-off-by: Igor Opaniuk <igor.opaniuk@linaro.org>

# f8c987f8 05-Jun-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

lib: Add hexdump

Often during debugging session it's very interesting to see
what data we were dealing with. For example what we write or read
to/from memory or peripherals.

This change introduces functions that allow to dump binary
data with one simple function invocation like:
------------------->8----------------
print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, buf, len);
------------------->8----------------

which gives us the following:
------------------->8----------------
00000000: f2 b7 c9 88 62 61 75 64 72 61 74 65 3d 31 31 35 ....baudrate=115
00000010: 32 30 30 00 62 6f 6f 74 61 72 67 73 3d 63 6f 6e 200.bootargs=con
00000020: 73 6f 6c 65 3d 74 74 79 53 33 2c 31 31 35 32 30 sole=ttyS3,11520
00000030: 30 6e 38 00 62 6f 6f 74 64 65 6c 61 79 3d 33 00 0n8.bootdelay=3.
00000040: 62 6f 6f 74 66 69 6c 65 3d 75 49 6d 61 67 65 00 bootfile=uImage.
00000050: 66 64 74 63 6f 6e 74 72 6f 6c 61 64 64 72 3d 39 fdtcontroladdr=9
00000060: 66 66 62 31 62 61 30 00 6c 6f 61 64 61 64 64 72 ffb1ba0.loadaddr
00000070: 3d 30 78 38 32 30 30 30 30 30 30 00 73 74 64 65 =0x82000000.stde
00000080: 72 72 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 rr=serial0@e0022
00000090: 30 30 30 00 73 74 64 69 6e 3d 73 65 72 69 61 6c 000.stdin=serial
000000a0: 30 40 65 30 30 32 32 30 30 30 00 73 74 64 6f 75 0@e0022000.stdou
000000b0: 74 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 30 t=serial0@e00220
000000c0: 30 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00..............
...
------------------->8----------------

Source of hexdump.c was copied from Linux kernel v4.7-rc2.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Mario Six <mario.six@gdsys.cc>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Stefan Roese <sr@denx.de>

# c232d14d 29-May-2018 Alex Kiernan <alex.kiernan@gmail.com>

mmc: Separate "mmc swrite" from fastboot

Introduce CONFIG_IMAGE_SPARSE and CONFIG_CMD_MMC_SWRITE so the "mmc
swrite" command is separated from the fastboot code.

Move image-sparse from common to lib so it's clear it's library code.

Rename CONFIG_FASTBOOT_FLASH_FILLBUF_SIZE to CONFIG_IMAGE_SPARSE_FILLBUF_SIZE
and migrate it to Kconfig.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Acked-by: Jassi Brar <jaswinder.singh@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6417572e 08-May-2018 Tom Rini <trini@konsulko.com>

lib/Kconfig: Mark OF_LIBFDT_OVERLAY as depending on OF_LIBFDT

The overlay code is only useful when OF_LIBFDT is set, so mark it as
depending on that first.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 58a46f88 25-Apr-2018 Praneeth Bajjuri <praneeth@ti.com>

configs: TI: Enable FIT Library overlay support

Enable the FDT library overlay support for all TI SOC family.

Without this option, when Loading fdt from FIT image, the
following warning is seen.

"config with overlays but CONFIG_OF_LIBFDT_OVERLAY not set".

Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
Suggested-by: Andrew F.Davis <afd@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>

# 14ad44ab 18-Apr-2018 Alex Kiernan <alex.kiernan@gmail.com>

spl: Split sprintf, strto* from SPL serial in Kconfig

When SPL serial is disabled, callers who need sprintf or strtoul fail
because their inclusion is guarded by CONFIG_SPL_SERIAL_SUPPORT/
CONFIG_TPL_SERIAL_SUPPORT.

Split printf, sprintf and strto into their own entries and then select
all of them if SERIAL_SUPPORT is enabled to match the current behaviour.

Include panic.o unconditionally as it can be called from anywhere which
uses BUG_ON().

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>

# e294ba06 04-Apr-2018 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-sunxi

Signed-off-by: Tom Rini <trini@konsulko.com>


# d14db11d 03-Apr-2018 Andre Przywara <andre.przywara@arm.com>

sunxi: revert disabling of features

In January some commits were introduced to mitigate the U-Boot image
size issues we encountered on sunxi builds.
Now with the MMC environment removed we can bring them back, as we
practically don't have a size limit anymore.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 32ce6179 13-Mar-2018 Bryan O'Donoghue <bryan.odonoghue@linaro.org>

optee: Add lib entries for sharing OPTEE code across ports

This patch adds code to lib to enable sharing of useful OPTEE code between
board-ports and architectures. The code on lib/optee/optee.c comes from the
TI omap2 port. Eventually the OMAP2 code will be patched to include the
shared code. The intention here is to add more useful OPTEE specific code
as more functionality gets added.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Cc: Harinarayan Bhatta <harinarayan@ti.com>
Cc: Andrew F. Davis <afd@ti.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Kever Yang <kever.yang@rock-chips.com>
Cc: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Cc: Peng Fan <peng.fan@nxp.com>
Tested-by: Peng Fan <peng.fan@nxp.com>

# 36c1877c 06-Feb-2018 Faiz Abbas <faiz_abbas@ti.com>

lib: Kconfig: Move DYNAMIC_CRC_TABLE to Kconfig

Add CONFIG prefix to DYNAMIC_CRC_TABLE and implement it in
Kconfig.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>

# a451bc27 05-Feb-2018 Adam Ford <aford173@gmail.com>

Convert LIB_UUID to Kconfig

config_fallback.h has some logic that checks a variety of options
and selects LIB_UUID if it hasn't already been selected. This
will all LIB_UUID in Kconfig and select this option for the list
of options to allow us to remove the logic from fallbacks

Signed-off-by: Adam Ford <aford173@gmail.com>

# a5a37567 06-Feb-2018 Adam Ford <aford173@gmail.com>

Convert CONFIG LIB_HW_RAND to Kconfig

config_fallbacks.h had some logic to automatically select
LIB_RAND if RANDOM_UUID or CMD_UUID were set if LIB_HW_RAND wasn't
already selected. By migrating LIB_HW_RAND to Kconfig, we can
remove this check from config_fallbacks.h and put it into Kconfig

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
[trini: Turn into a choice, add NET_RANDOM_ETHADDR]
Signed-off-by: Tom Rini <trini@konsulko.com>

# acd4d334 16-Jan-2018 Maxime Ripard <maxime.ripard@free-electrons.com>

net: regex: Disable by default on sunXi

The sunXi arm64 build has overflown, leading to the main U-boot binary
overwriting the environment when flashing the new image, or even worse,
overwriting itself when we're calling saveenv.

Disable this option that is not critical until we can adress the issue
properly.

Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 7e3caa81 03-Dec-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

Move CONFIG_PANIC_HANG to Kconfig

Freescale (NXP) boards have lots of defconfig files per board.
I used "imply PANIC_HANG" for them.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# da5337a6 08-Nov-2017 Nandor Han <nandor.han@ge.com>

rtc: add support for s35392a

Add support for S35392A RTC. The driver supports both U-Boot driver
models.

Signed-off-by: Nandor Han <nandor.han@ge.com>
Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
Cc: Heiko Schocher <hs@denx.de>

# f52bdf4b 14-Sep-2017 Jean-Jacques Hiblot <jjhiblot@ti.com>

lib: allow building lzo for the SPL

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 85d8bf57 03-Sep-2017 Marek Behún <marek.behun@nic.cz>

lib: Add CRC32-C

This is needed for BTRFS.

Signed-off-by: Marek Behun <marek.behun@nic.cz>

create mode 100644 lib/crc32c.c

# 7264f292 15-Aug-2017 York Sun <york.sun@nxp.com>

spl: fit: Eanble GZIP support for image decompression

Add Kconfig option SPL_GZIP and SPL_ZLIB to enable gunzip support for
SPL boot, eg. falcon boot compressed kernel image.

Signed-off-by: York Sun <york.sun@nxp.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6ef2f901 11-Aug-2017 Adam Ford <aford173@gmail.com>

Convert CONFIG_BCH to Kconfig

This converts the following to Kconfig:
CONFIG_BCH

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1a7ba1d 18-Aug-2017 Anatolij Gustschin <agust@denx.de>

Fix 'notes' typos

s/notes/nodes

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 96b9082c 03-Aug-2017 Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

rockchip: rk3188: rock: adjust for SPL/TPL split

With the changes to split SPL/TPL for the RK3368, I apparently missed
some needed adjustments to the RK3188 Kconfig and rock_defconfig.

This fixes build-issues for the rock board after applying the RK3368
enablement (and SPL/TPL) set that resulted from TPL_SERIAL_SUPPORT,
TPL_ROCKCHIP_BACK_TO_BROM and TPL_TINY_MEMSET being separate symbols
now.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d56b4b19 22-Jul-2017 Tom Rini <trini@konsulko.com>

configs: Migrate RBTREE, LZO, CMD_MTDPARTS, CMD_UBI and CMD_UBIFS

The above CONFIG options are in Kconfig, and now have correct depends and
inter-dependencies. Migrate these to configs/ from include/configs/. In the
case of CMD_UBIFS also change it to be a default y if CMD_UBI.

Signed-off-by: Tom Rini <trini@konsulko.com>

# aed998aa 17-May-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_LZMA to Kconfig

This converts the following to Kconfig:
CONFIG_LZMA

Signed-off-by: Simon Glass <sjg@chromium.org>

# b1a873df 26-Apr-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_CMD_AES et al to Kconfig

This converts the following to Kconfig:
CONFIG_CMD_AES
CONFIG_AES

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Add select AES to CMD_AES]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 173aafbf 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

cmd: Expose a Kconfig option to enable UBIFS commands

Create a new Kconfig entry to allow CMD_UBIFS selection from Kconfig and
add an hidden LZO option that can be selected by CMD_UBIFS.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>

# aa049152 27-Feb-2017 Boris Brezillon <bbrezillon@kernel.org>

mtd: ubi: Select RBTREE option from MTD_UBI Kconfig entry

Expose the RBTREE feature through Kconfig and select this option from the
MTD_UBI option.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>
[Rebased on master]
Signed-off-by: Jagan Teki <jagan@openedev.com>

# ab4458bd 02-Apr-2017 Simon Glass <sjg@chromium.org>

string: Provide a slimmed-down memset()

Most of the time the optimised memset() is what we want. For extreme
situations such as TPL it may be too large. For example on the 'rock'
board, using a simple loop saves a useful 48 bytes. With gcc 4.9 and
the rodata bug, this patch is enough to reduce the TPL image below the
limit.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>

# bea79d7d 14-Mar-2017 Andre Przywara <andre.przywara@arm.com>

Kconfig: introduce md5sum command selection

So far CONFIG_MD5SUM would need to be set by a board's include file.
Since the command is really generic, move it over to Kconfig to allow
it to be defined by either a board's defconfig, menuconfig or some
config snippet merged via mergeconfig.sh.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e663b350 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

smbios: Expose in efi_loader as table

We can pass SMBIOS easily as EFI configuration table to an EFI payload. This
patch adds enablement for that case.

While at it, we also enable SMBIOS generation for ARM systems, since they support
EFI_LOADER.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4b6dddc2 18-Aug-2016 Alexander Graf <agraf@csgraf.de>

x86: Move smbios generation into arch independent directory

We will need the SMBIOS generation function on ARM as well going forward,
so let's move it into a non arch specific location.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# ebf7fff2 05-Oct-2016 Heiko Schocher <hs@denx.de>

spl: move FDT_FIXUP_PARTITIONS to Kconfig

Move FDT_FIXUP_PARTITIONS to Kconfig and cleanup existing
uses.

Signed-off-by: Heiko Schocher <hs@denx.de>

# ddf67f71 05-Jul-2016 Maxime Ripard <maxime.ripard@free-electrons.com>

libfdt: Add overlay application function

The device tree overlays are a good way to deal with user-modifyable
boards or boards with some kind of an expansion mechanism where we can
easily plug new board in (like the BBB, the Raspberry Pi or the CHIP).

Add a new function to merge overlays with a base device tree.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>

# 91b86e21 26-May-2016 Marek Vasut <marex@denx.de>

lib: Enable private libgcc by default

This patch decouples U-Boot binary from the toolchain on systems where
private libgcc is available. Instead of pulling in functions provided
by the libgcc from the toolchain, U-Boot will use it's own set of libgcc
functions. These functions are usually imported from Linux kernel, which
also uses it's own libgcc functions instead of the ones provided by the
toolchain.

This patch solves a rather common problem. The toolchain can usually
generate code for many variants of target architecture and often even
different endianness. The libgcc on the other hand is usually compiled
for one particular configuration and the functions provided by it may
or may not be suited for use in U-Boot. This can manifest in two ways,
either the U-Boot fails to compile altogether and linker will complain
or, in the much worse case, the resulting U-Boot will build, but will
misbehave in very subtle and hard to debug ways.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 67976306 30-Mar-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

cosmetic: Fix typos "privide"

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# ed980b8c 03-Mar-2016 Alexander Graf <agraf@csgraf.de>

efi_loader: hook up in build environment

Now that we have all the bits and pieces ready for EFI payload loading
support, hook them up in Makefiles and KConfigs so that we can build.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
[trini: Enable only when we of OF_LIBFDT, disable on kwb and colibri_pxa270]
Signed-off-by: Tom Rini <trini@konsulko.com>

# aa34fbc0 22-Feb-2016 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt to be used in SPL

Add an option to enable libfdt in SPL. This can be useful when decoding
FIT files in SPL.

We need to make sure this option is not enabled in SPL by this change.
Also this option needs to be enabled in host builds. Si add a new
IMAGE_USE_LIBFDT #define which can be used in files that are built on the
host but must also build for U-Boot and SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 69e173eb 22-Feb-2016 Simon Glass <sjg@chromium.org>

Move CONFIG_OF_LIBFDT to Kconfig

Move this option to Kconfig and tidy up existing boards.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a187559e 05-Feb-2016 Bin Meng <bmeng.cn@gmail.com>

Use correct spelling of "U-Boot"

Correct spelling of "U-Boot" shall be used in all written text
(documentation, comments in source files etc.).

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Minkyu Kang <mk7.kang@samsung.com>

# 947c626d 14-Jan-2016 Tom Rini <trini@konsulko.com>

vsprintf.c: Always enable CONFIG_SYS_VSNPRINTF

Enabling this function always removes some class of string saftey issues.
The size change here in general is about 400 bytes and this seems a reasonable
trade-off.

Cc: Peng Fan <peng.fan@nxp.com>
Cc: Peter Robinson <pbrobinson@gmail.com>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Adrian Alonso <aalonso@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 7d9cde10 22-Nov-2015 Stefan Roese <sr@denx.de>

lib/tiny-printf.c: Add tiny printf function for space limited environments

This patch adds a small printf() version that supports all basic formats.
Its intented to be used in U-Boot SPL versions on platforms with very
limited internal RAM sizes.

To enable it, just define CONFIG_USE_TINY_PRINTF in your defconfig. This
will result in the SPL using this tiny function and the main U-Boot
still using the full-blown printf() function.

This code was copied from:
http://www.sparetimelabs.com/printfrevisited
With mostly only coding style related changes so that its checkpatch
clean.

The size reduction is about 2.5KiB. Here a comparison for the db-mv784mp-gp
(Marvell AXP) SPL:

Without this patch:
58963 18536 1928 79427 13643 ./spl/u-boot-spl

With this patch:
56542 18536 1956 77034 12cea ./spl/u-boot-spl

Note:
To make it possible to compile tiny-printf.c instead of vsprintf.c when
CONFIG_USE_TINY_PRINTF is defined, the functions printf() and vprintf() are
moved from common/console.c into vsprintf.c in this patch.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>

# 2419cd16 03-Oct-2015 Simon Glass <sjg@chromium.org>

dm: tpm: Drop CONFIG_DM_TPM

Now that all TPM drivers use driver model, we can drop the special driver
model CONFIG option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>

# 027b728d 06-Oct-2015 Julius Werner <jwerner@chromium.org>

Add support for LZ4 decompression algorithm

This patch adds support for LZ4-compressed FIT image contents. This
algorithm has a slightly worse compression ration than LZO while being
nearly twice as fast to decompress. When loading images from a fast
storage medium this usually results in a boot time win.

Sandbox-tested only since I don't have a U-Boot development system set
up right now. The code was imported unchanged from coreboot where it's
proven to work, though. I'm mostly interested in getting this recognized
by mkImage for use in a downstream project.

Signed-off-by: Julius Werner <jwerner@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# a7d660bc 22-Aug-2015 Simon Glass <sjg@chromium.org>

tpm: Add Kconfig options for TPMs

Add new Kconfig options for TPMs in preparation for moving boards to use
Kconfig for TPM configuration.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 867a6ac8 31-Jul-2015 Simon Glass <sjg@chromium.org>

efi: Add start-up library code

When running as an EFI application, U-Boot must request memory from EFI,
and provide access to the boot services U-Boot needs.

Add library code to perform these tasks. This includes efi_main() which is
the entry point from EFI. U-Boot is built as a shared library.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d1389403 23-Jun-2015 Simon Glass <sjg@chromium.org>

Add a dhrystone benchmark command

Drystone provides a convenient sanity check that the CPU is running at full
speed. Add this as a command which can be enabled as needed.

Note: I investigated using Coremark for this but there was a license
agreement and I could not work out if it was GPL-compatible.

Signed-off-by: Simon Glass <sjg@chromium.org>

# f7848d90 22-Jun-2015 Joe Hershberger <joe.hershberger@ni.com>

Allow CONFIG_REGEX to be disabled when CONFIG_NET

Instead of selecting REGEX when NET is enabled, make it the default, but
allow boards that are tiny to disable it and lose functionality on all
but the first Ethernet adapter.

cm-bf548, bf538f-ezkit, and bf533-stamp need this. None appear to have
more than one Ethernet interface.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# 3850dbe8 11-Jun-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

blackfin: fix undefined reference to srand and rand

Commit 9ba9e85f3f1c (net: Fix NET_RANDOM_ETHADDR dependencies)
accidentally dropped CONFIG_LIB_RAND defines for 14 Blackfin boards.

Prior to that commit, those boards defined CONFIG_LIB_RAND, but not
CONFIG_NET_RANDOM_ETHADDR. So, commit 9ba9e85f3f1c should not have
touched them, but in fact it ripped CONFIG_LIB_RAND off from all the
header files, which caused undefined reference to srand and rand.
CONFIG_LIB_RAND=y must be revived for such boards.

BTW, this commit indeed makes it better, but even with this fix,
three boards (bf533-stamp, bf538f-ezkit, cm-bf548) still can not
build due to region 'ram' overflowed error. This was cause by
commit 6eed3786c68c (net: Move the CMD_NET config to defconfigs)
because CMD_NET selects NET, and NET selects REGEX. Eventually,
some boards were newly enabled with CONFIG_REGEX, increasing the
memory footprint. A patch is expected to fix the build error.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 9ba9e85f 25-May-2015 Michal Simek <michal.simek@xilinx.com>

net: Fix NET_RANDOM_ETHADDR dependencies

NET_RANDOM_ETHADDR depends on lib/rand.c. This patch adds dependency to
Kconfig to ensure that library is also compiled.

Remove the definitions from Blackfin boards' include/configs.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 6501ff62 20-Apr-2015 Przemyslaw Marczak <p.marczak@samsung.com>

lib: Kconfig: add entry for errno_str() function

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1a60650c 21-Apr-2015 Joe Hershberger <joe.hershberger@ni.com>

kconfig: Move REGEX to Kconfig

Having this as a Kconfig allows it to be a dependent feature.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8156345d 06-Mar-2015 Simon Glass <sjg@chromium.org>

sandbox: Move CONFIG_SYS_VSNPRINTF to Kconfig

Move this over to Kconfig and tidy up.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 94e3c8c4 19-Feb-2015 gaurav rana <gaurav.rana@freescale.com>

crypto/fsl - Add progressive hashing support using hardware acceleration.

Currently only normal hashing is supported using hardware acceleration.
Added support for progressive hashing using hardware.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
Signed-off-by: Gaurav Rana <gaurav.rana@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>

# d9f23c7f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@freescale.com>

lib/rsa: Add Kconfig for devices supporting RSA Modular Exponentiation

Kconfig option added for devices which support RSA Verification.
1. RSA_SOFTWARE_EXP
Enables driver for supporting RSA Modular Exponentiation in Software
2. RSA_FREESCALE_EXP
Enables driver for supporting RSA Modular Exponentiation using Freescale specific
driver

The above drivers use RSA uclass

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
(Removed duplicate line in Kconfig comment)

Change-Id: I7663c4d5350e2bfc3dfa2696f70ef777d6ccc6f6

# c4beb22f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@freescale.com>

FIT: Modify option FIT_SIGNATURE in Kconfig

For FIT signature based approach to work, RSA library needs to be selected.
The FIT_SIGNATURE option in Kconfig is modified to automatically select RSA.
Selecting RSA compiles the RSA library required for image verification.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 45ccec8f 23-Oct-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_USE_PRIVATE_LIBGCC to Kconfig

The private libgcc is supported only on ARM, MIPS, PowerPC, SH, x86.
Those architectures should "select" HAVE_PRIVATE_LIBGCC and
CONFIG_USE_PRIVATE_LIBGCC should depend on it.

Currently, this option is enabled on Tegra boards and x86 architecture.
Move the definition from header files to Kconfig.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Tested-by: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: Tom Warren <twarren@nvidia.com>

# 8c688bc4 23-Oct-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_SYS_HZ to lib/Kconfig

CONFIG_SYS_HZ is always defined as 1000 in config_fallbacks.h
(but some boards still have redundant definitions).

This commit moves the definition and the document in README to
Kconfig. Since lib/Kconfig can assure that CONFIG_SYS_HZ is 1000,
the sanity check in lib/time.c should be removed.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Reviewed-by: Marek Vasut <marex@denx.de>

# b0928da6 16-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED to Kconfig

If this option is enabled, the objects under lib/ directory
are compiled with speed optimization, not size optimization.
(Currently, only used by some Blackfin boards.)

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# ed36323f 16-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: add blank Kconfig files

This would be useful to start moving various config options.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# b4adf627 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: crypto: add x509 parser

Imported from linux kernel v5.3:
x509.asn1 without changes
x509_akid.asn1 without changes
x509_parser.h without changes
x509_cert_parser.c with changes marked as __UBOOT__
x509_public_key.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# a9b45e6e 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add oid registry utility

Imported from linux kernel v5.3:
build_OID_registry without changes
oid_registry.h without changes
oid_registry.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# ab8a0e06 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

lib: add asn1 decoder

Imported from linux kernel v5.3:
lib/asn1_decoder.c with changes marked as __UBOOT__

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 2b12196d 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

cmd: add asn1_compiler

Imported from linux kernel v5.3:
asn1.h without changes
asn1_ber_bytecode.h without changes
asn1_decoder.h without changes
asn1_compiler.c without changes

This host command will be used to create a ASN1 parser, for example,
for pkcs7 messages or x509 certificates. More specifically, it will
generate *byte code* which will be interpreted by asn1 decoder library.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

# 05429b6c 12-Nov-2019 AKASHI Takahiro <takahiro.akashi@linaro.org>

rtc: move date.c from drivers/rtc/ to lib/

In the next commit, rtc_mktime(), for compatibility with linux, will be
implemented using rtc_mktime(), which is no longer drivers/rtc specific.
So move this file under lib/.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

# 37ef1774 10-Nov-2019 Thomas Hebb <tommyhebb@gmail.com>

Kconfig: disambiguate config names for tiny printf

27084c03d36a ("spl: Allow tiny printf() to be controlled in SPL and
TPL") split this option in two for TPL and SPL, but didn't change the
Kconfig names, making them hard to set quickly.

Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>

# 0d76afc0 27-Oct-2019 Simon Glass <sjg@chromium.org>

fdt: Add Kconfig options to control code size

For better or worse libfdt recent grew a lot of code that checks the
validity of the device tree in great detail. When using unsigned or
unverified data this makes things safer, but it does add to code size.

Add some controls to select the trade-off between safety and code size.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 27084c03 25-Sep-2019 Simon Glass <sjg@chromium.org>

spl: Allow tiny printf() to be controlled in SPL and TPL

At present there is only one control for this and it is used for both SPL
and TPL. But SPL might have a lot more space than TPL so the extra cost of
a full printf() might be acceptable.

Split the option into two, providing separate SPL and TPL controls. The
TPL setting defaults to the same as SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2a51e16b 07-Jun-2019 Tom Rini <trini@konsulko.com>

configs: Make USE_TINY_PRINTF depend on SPL||TPL and be default

The USE_TINY_PRINTF symbol only changes things within SPL and TPL
builds, so make it depend on that support. Next, make it default as
within these cases we should rarely have need of more advanced print
formats outside of the debug context.

To do this, in a few cases we need to correct our Kconfig dependencies
as we had cases of non-SPL targets select'ing this symbol. Finally, in
the case of a few boards we really do need the full printf
functionality.

Signed-off-by: Tom Rini <trini@konsulko.com>

# da0fb5fd 02-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: make call depth limit customizable

Up to now we had hard coded values for the call depth up to which trace
records are created: 200 for early tracing, 15 thereafter. UEFI
applications reach a call depth of 80 or above.

Provide customizing settings for the call trace depth limit and the early
call trace depth limit. Use the old values as defaults.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8509f22a 29-Apr-2019 Marek Behún <marek.behun@nic.cz>

lib: add Zstandard decompression support

Add the zstd library from Linux kernel (only decompression support).
There are minimal changes to build with U-Boot, otherwise the files are
identical to Linux commit dc35da16 from March 2018, the files had not
been touched since in kernel. Also SPDX lincese tags were added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 83a486b6 29-Apr-2019 Marek Behún <marek.behun@nic.cz>

lib: Add xxhash support

This adds the xxhash support from Linux. Files are almost identical to
those added to Linux in commit 5d240522 ("lib: Add xxhash module") (they
haven't been touched since in Linux). The only difference is to add some
includes to be compatible with U-Boot. Also SPDX lincese tags were
added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 5132361a 29-Apr-2019 Heiko Schocher <hs@denx.de>

lib: Kconfig: fix help text for GZIP

commit 95f4bbd581cf ("lib: fdt: Allow LZO and GZIP DT compression in U-Boot")

introduced Kconfig option for gzip in U-Boot, but help text
says gzip for SPL, which is wrong. Fix this.

Signed-off-by: Heiko Schocher <hs@denx.de>
Acked-by: Marek Vasut <marex@denx.de>

# 1c6eb075 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE_BUFFER_SIZE et al to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE_BUFFER_SIZE
CONFIG_TRACE_EARLY_SIZE
CONFIG_TRACE_EARLY
CONFIG_TRACE_EARLY_ADDR

Signed-off-by: Simon Glass <sjg@chromium.org>

# a24a78d7 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE

Signed-off-by: Simon Glass <sjg@chromium.org>

# 54969b40 21-Mar-2019 Thierry Reding <treding@nvidia.com>

fdtdec: Add Kconfig symbol for tests

Runtime tests are provided as a test_fdtdec command implementation. Add
a Kconfig symbol that allows this command to be built so that the tests
can be used.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 95f4bbd5 08-Mar-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

lib: fdt: Allow LZO and GZIP DT compression in U-Boot

Add required Kconfig symbols, Makefile bits and macro fixes in a
few places to support LZO and DT compression in U-Boot. This can
save a lot of space with multi-DTB fitImages.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>

# 6e705114 13-Jan-2019 Chris Packham <judge.packham@gmail.com>

lib: Kconfig: spelling fixes

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 048c6e89 06-Nov-2018 Simon Glass <sjg@chromium.org>

spl: lz4: Allow use of lz4 compression in SPL

In some cases U-Boot is compressed and it is useful to be able to
decompress it in SPL. Add a Kconfig and Makefile change to allow this.
Note that this does not actually implement decompression.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 2895c4b7 15-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

kconfig: Introduce HAVE_ARCH_IOMAP

Introduce a new Kconfig option for architecture codes to control
whether it provides io{read,write}{8,16,32} I/O accessor functions.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5592a633 01-Oct-2018 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt in TPL

In some cases (e.g. sandbox with verified boot) it is useful to support
libfdt in TPL. Update the Kconfig to handle this.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 6307896c 01-Oct-2018 Simon Glass <sjg@chromium.org>

tpm: Add support for SPL and TPL

At present the tpm can only be used in U-Boot proper. Updated it to work
in SPL and TPL also.

Signed-off-by: Simon Glass <sjg@chromium.org>

# ab948cd2 19-Jul-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

fdt_support: make FDT_FIXUP_PARTITIONS depend on CMD_MTDPARTS

fdt_fixup_mtdparts() calls mtdparts_init() and device_find(),
which are defined in cmd/mtdparts.c

The combination of FDT_FIXUP_PARTITIONS=y and CMD_MTDPARTS=n
emits the following link error:

common/fdt_support.c:903: undefined reference to `mtdparts_init'
common/fdt_support.c:914: undefined reference to `device_find'

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 3330584d 03-Jun-2018 Igor Opaniuk <igor.opaniuk@linaro.org>

avb2.0: integrate avb 2.0 into the build system

Integrate libavb into the build system. Introduce CONFIG_LIBAVB
build option.

Signed-off-by: Igor Opaniuk <igor.opaniuk@linaro.org>

# f8c987f8 05-Jun-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

lib: Add hexdump

Often during debugging session it's very interesting to see
what data we were dealing with. For example what we write or read
to/from memory or peripherals.

This change introduces functions that allow to dump binary
data with one simple function invocation like:
------------------->8----------------
print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, buf, len);
------------------->8----------------

which gives us the following:
------------------->8----------------
00000000: f2 b7 c9 88 62 61 75 64 72 61 74 65 3d 31 31 35 ....baudrate=115
00000010: 32 30 30 00 62 6f 6f 74 61 72 67 73 3d 63 6f 6e 200.bootargs=con
00000020: 73 6f 6c 65 3d 74 74 79 53 33 2c 31 31 35 32 30 sole=ttyS3,11520
00000030: 30 6e 38 00 62 6f 6f 74 64 65 6c 61 79 3d 33 00 0n8.bootdelay=3.
00000040: 62 6f 6f 74 66 69 6c 65 3d 75 49 6d 61 67 65 00 bootfile=uImage.
00000050: 66 64 74 63 6f 6e 74 72 6f 6c 61 64 64 72 3d 39 fdtcontroladdr=9
00000060: 66 66 62 31 62 61 30 00 6c 6f 61 64 61 64 64 72 ffb1ba0.loadaddr
00000070: 3d 30 78 38 32 30 30 30 30 30 30 00 73 74 64 65 =0x82000000.stde
00000080: 72 72 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 rr=serial0@e0022
00000090: 30 30 30 00 73 74 64 69 6e 3d 73 65 72 69 61 6c 000.stdin=serial
000000a0: 30 40 65 30 30 32 32 30 30 30 00 73 74 64 6f 75 0@e0022000.stdou
000000b0: 74 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 30 t=serial0@e00220
000000c0: 30 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00..............
...
------------------->8----------------

Source of hexdump.c was copied from Linux kernel v4.7-rc2.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Mario Six <mario.six@gdsys.cc>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Stefan Roese <sr@denx.de>

# c232d14d 29-May-2018 Alex Kiernan <alex.kiernan@gmail.com>

mmc: Separate "mmc swrite" from fastboot

Introduce CONFIG_IMAGE_SPARSE and CONFIG_CMD_MMC_SWRITE so the "mmc
swrite" command is separated from the fastboot code.

Move image-sparse from common to lib so it's clear it's library code.

Rename CONFIG_FASTBOOT_FLASH_FILLBUF_SIZE to CONFIG_IMAGE_SPARSE_FILLBUF_SIZE
and migrate it to Kconfig.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Acked-by: Jassi Brar <jaswinder.singh@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6417572e 08-May-2018 Tom Rini <trini@konsulko.com>

lib/Kconfig: Mark OF_LIBFDT_OVERLAY as depending on OF_LIBFDT

The overlay code is only useful when OF_LIBFDT is set, so mark it as
depending on that first.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 58a46f88 25-Apr-2018 Praneeth Bajjuri <praneeth@ti.com>

configs: TI: Enable FIT Library overlay support

Enable the FDT library overlay support for all TI SOC family.

Without this option, when Loading fdt from FIT image, the
following warning is seen.

"config with overlays but CONFIG_OF_LIBFDT_OVERLAY not set".

Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
Suggested-by: Andrew F.Davis <afd@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>

# 14ad44ab 18-Apr-2018 Alex Kiernan <alex.kiernan@gmail.com>

spl: Split sprintf, strto* from SPL serial in Kconfig

When SPL serial is disabled, callers who need sprintf or strtoul fail
because their inclusion is guarded by CONFIG_SPL_SERIAL_SUPPORT/
CONFIG_TPL_SERIAL_SUPPORT.

Split printf, sprintf and strto into their own entries and then select
all of them if SERIAL_SUPPORT is enabled to match the current behaviour.

Include panic.o unconditionally as it can be called from anywhere which
uses BUG_ON().

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>

# e294ba06 04-Apr-2018 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-sunxi

Signed-off-by: Tom Rini <trini@konsulko.com>


# d14db11d 03-Apr-2018 Andre Przywara <andre.przywara@arm.com>

sunxi: revert disabling of features

In January some commits were introduced to mitigate the U-Boot image
size issues we encountered on sunxi builds.
Now with the MMC environment removed we can bring them back, as we
practically don't have a size limit anymore.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 32ce6179 13-Mar-2018 Bryan O'Donoghue <bryan.odonoghue@linaro.org>

optee: Add lib entries for sharing OPTEE code across ports

This patch adds code to lib to enable sharing of useful OPTEE code between
board-ports and architectures. The code on lib/optee/optee.c comes from the
TI omap2 port. Eventually the OMAP2 code will be patched to include the
shared code. The intention here is to add more useful OPTEE specific code
as more functionality gets added.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Cc: Harinarayan Bhatta <harinarayan@ti.com>
Cc: Andrew F. Davis <afd@ti.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Kever Yang <kever.yang@rock-chips.com>
Cc: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Cc: Peng Fan <peng.fan@nxp.com>
Tested-by: Peng Fan <peng.fan@nxp.com>

# 36c1877c 06-Feb-2018 Faiz Abbas <faiz_abbas@ti.com>

lib: Kconfig: Move DYNAMIC_CRC_TABLE to Kconfig

Add CONFIG prefix to DYNAMIC_CRC_TABLE and implement it in
Kconfig.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>

# a451bc27 05-Feb-2018 Adam Ford <aford173@gmail.com>

Convert LIB_UUID to Kconfig

config_fallback.h has some logic that checks a variety of options
and selects LIB_UUID if it hasn't already been selected. This
will all LIB_UUID in Kconfig and select this option for the list
of options to allow us to remove the logic from fallbacks

Signed-off-by: Adam Ford <aford173@gmail.com>

# a5a37567 06-Feb-2018 Adam Ford <aford173@gmail.com>

Convert CONFIG LIB_HW_RAND to Kconfig

config_fallbacks.h had some logic to automatically select
LIB_RAND if RANDOM_UUID or CMD_UUID were set if LIB_HW_RAND wasn't
already selected. By migrating LIB_HW_RAND to Kconfig, we can
remove this check from config_fallbacks.h and put it into Kconfig

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
[trini: Turn into a choice, add NET_RANDOM_ETHADDR]
Signed-off-by: Tom Rini <trini@konsulko.com>

# acd4d334 16-Jan-2018 Maxime Ripard <maxime.ripard@free-electrons.com>

net: regex: Disable by default on sunXi

The sunXi arm64 build has overflown, leading to the main U-boot binary
overwriting the environment when flashing the new image, or even worse,
overwriting itself when we're calling saveenv.

Disable this option that is not critical until we can adress the issue
properly.

Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 7e3caa81 03-Dec-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

Move CONFIG_PANIC_HANG to Kconfig

Freescale (NXP) boards have lots of defconfig files per board.
I used "imply PANIC_HANG" for them.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# da5337a6 08-Nov-2017 Nandor Han <nandor.han@ge.com>

rtc: add support for s35392a

Add support for S35392A RTC. The driver supports both U-Boot driver
models.

Signed-off-by: Nandor Han <nandor.han@ge.com>
Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
Cc: Heiko Schocher <hs@denx.de>

# f52bdf4b 14-Sep-2017 Jean-Jacques Hiblot <jjhiblot@ti.com>

lib: allow building lzo for the SPL

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 85d8bf57 03-Sep-2017 Marek Behún <marek.behun@nic.cz>

lib: Add CRC32-C

This is needed for BTRFS.

Signed-off-by: Marek Behun <marek.behun@nic.cz>

create mode 100644 lib/crc32c.c

# 7264f292 15-Aug-2017 York Sun <york.sun@nxp.com>

spl: fit: Eanble GZIP support for image decompression

Add Kconfig option SPL_GZIP and SPL_ZLIB to enable gunzip support for
SPL boot, eg. falcon boot compressed kernel image.

Signed-off-by: York Sun <york.sun@nxp.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6ef2f901 11-Aug-2017 Adam Ford <aford173@gmail.com>

Convert CONFIG_BCH to Kconfig

This converts the following to Kconfig:
CONFIG_BCH

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1a7ba1d 18-Aug-2017 Anatolij Gustschin <agust@denx.de>

Fix 'notes' typos

s/notes/nodes

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 96b9082c 03-Aug-2017 Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

rockchip: rk3188: rock: adjust for SPL/TPL split

With the changes to split SPL/TPL for the RK3368, I apparently missed
some needed adjustments to the RK3188 Kconfig and rock_defconfig.

This fixes build-issues for the rock board after applying the RK3368
enablement (and SPL/TPL) set that resulted from TPL_SERIAL_SUPPORT,
TPL_ROCKCHIP_BACK_TO_BROM and TPL_TINY_MEMSET being separate symbols
now.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d56b4b19 22-Jul-2017 Tom Rini <trini@konsulko.com>

configs: Migrate RBTREE, LZO, CMD_MTDPARTS, CMD_UBI and CMD_UBIFS

The above CONFIG options are in Kconfig, and now have correct depends and
inter-dependencies. Migrate these to configs/ from include/configs/. In the
case of CMD_UBIFS also change it to be a default y if CMD_UBI.

Signed-off-by: Tom Rini <trini@konsulko.com>

# aed998aa 17-May-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_LZMA to Kconfig

This converts the following to Kconfig:
CONFIG_LZMA

Signed-off-by: Simon Glass <sjg@chromium.org>

# b1a873df 26-Apr-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_CMD_AES et al to Kconfig

This converts the following to Kconfig:
CONFIG_CMD_AES
CONFIG_AES

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Add select AES to CMD_AES]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 173aafbf 27-Feb-2017 Boris Brezillon <boris.brezillon@free-electrons.com>

cmd: Expose a Kconfig option to enable UBIFS commands

Create a new Kconfig entry to allow CMD_UBIFS selection from Kconfig and
add an hidden LZO option that can be selected by CMD_UBIFS.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>

# aa049152 27-Feb-2017 Boris Brezillon <boris.brezillon@free-electrons.com>

mtd: ubi: Select RBTREE option from MTD_UBI Kconfig entry

Expose the RBTREE feature through Kconfig and select this option from the
MTD_UBI option.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>
[Rebased on master]
Signed-off-by: Jagan Teki <jagan@openedev.com>

# ab4458bd 02-Apr-2017 Simon Glass <sjg@chromium.org>

string: Provide a slimmed-down memset()

Most of the time the optimised memset() is what we want. For extreme
situations such as TPL it may be too large. For example on the 'rock'
board, using a simple loop saves a useful 48 bytes. With gcc 4.9 and
the rodata bug, this patch is enough to reduce the TPL image below the
limit.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>

# bea79d7d 14-Mar-2017 Andre Przywara <andre.przywara@arm.com>

Kconfig: introduce md5sum command selection

So far CONFIG_MD5SUM would need to be set by a board's include file.
Since the command is really generic, move it over to Kconfig to allow
it to be defined by either a board's defconfig, menuconfig or some
config snippet merged via mergeconfig.sh.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e663b350 18-Aug-2016 Alexander Graf <agraf@suse.de>

smbios: Expose in efi_loader as table

We can pass SMBIOS easily as EFI configuration table to an EFI payload. This
patch adds enablement for that case.

While at it, we also enable SMBIOS generation for ARM systems, since they support
EFI_LOADER.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4b6dddc2 18-Aug-2016 Alexander Graf <agraf@suse.de>

x86: Move smbios generation into arch independent directory

We will need the SMBIOS generation function on ARM as well going forward,
so let's move it into a non arch specific location.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# ebf7fff2 05-Oct-2016 Heiko Schocher <hs@denx.de>

spl: move FDT_FIXUP_PARTITIONS to Kconfig

Move FDT_FIXUP_PARTITIONS to Kconfig and cleanup existing
uses.

Signed-off-by: Heiko Schocher <hs@denx.de>

# ddf67f71 05-Jul-2016 Maxime Ripard <maxime.ripard@free-electrons.com>

libfdt: Add overlay application function

The device tree overlays are a good way to deal with user-modifyable
boards or boards with some kind of an expansion mechanism where we can
easily plug new board in (like the BBB, the Raspberry Pi or the CHIP).

Add a new function to merge overlays with a base device tree.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>

# 91b86e21 26-May-2016 Marek Vasut <marex@denx.de>

lib: Enable private libgcc by default

This patch decouples U-Boot binary from the toolchain on systems where
private libgcc is available. Instead of pulling in functions provided
by the libgcc from the toolchain, U-Boot will use it's own set of libgcc
functions. These functions are usually imported from Linux kernel, which
also uses it's own libgcc functions instead of the ones provided by the
toolchain.

This patch solves a rather common problem. The toolchain can usually
generate code for many variants of target architecture and often even
different endianness. The libgcc on the other hand is usually compiled
for one particular configuration and the functions provided by it may
or may not be suited for use in U-Boot. This can manifest in two ways,
either the U-Boot fails to compile altogether and linker will complain
or, in the much worse case, the resulting U-Boot will build, but will
misbehave in very subtle and hard to debug ways.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 67976306 30-Mar-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

cosmetic: Fix typos "privide"

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# ed980b8c 03-Mar-2016 Alexander Graf <agraf@suse.de>

efi_loader: hook up in build environment

Now that we have all the bits and pieces ready for EFI payload loading
support, hook them up in Makefiles and KConfigs so that we can build.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
[trini: Enable only when we of OF_LIBFDT, disable on kwb and colibri_pxa270]
Signed-off-by: Tom Rini <trini@konsulko.com>

# aa34fbc0 22-Feb-2016 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt to be used in SPL

Add an option to enable libfdt in SPL. This can be useful when decoding
FIT files in SPL.

We need to make sure this option is not enabled in SPL by this change.
Also this option needs to be enabled in host builds. Si add a new
IMAGE_USE_LIBFDT #define which can be used in files that are built on the
host but must also build for U-Boot and SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 69e173eb 22-Feb-2016 Simon Glass <sjg@chromium.org>

Move CONFIG_OF_LIBFDT to Kconfig

Move this option to Kconfig and tidy up existing boards.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a187559e 05-Feb-2016 Bin Meng <bmeng.cn@gmail.com>

Use correct spelling of "U-Boot"

Correct spelling of "U-Boot" shall be used in all written text
(documentation, comments in source files etc.).

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Minkyu Kang <mk7.kang@samsung.com>

# 947c626d 14-Jan-2016 Tom Rini <trini@konsulko.com>

vsprintf.c: Always enable CONFIG_SYS_VSNPRINTF

Enabling this function always removes some class of string saftey issues.
The size change here in general is about 400 bytes and this seems a reasonable
trade-off.

Cc: Peng Fan <peng.fan@nxp.com>
Cc: Peter Robinson <pbrobinson@gmail.com>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Adrian Alonso <aalonso@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 7d9cde10 22-Nov-2015 Stefan Roese <sr@denx.de>

lib/tiny-printf.c: Add tiny printf function for space limited environments

This patch adds a small printf() version that supports all basic formats.
Its intented to be used in U-Boot SPL versions on platforms with very
limited internal RAM sizes.

To enable it, just define CONFIG_USE_TINY_PRINTF in your defconfig. This
will result in the SPL using this tiny function and the main U-Boot
still using the full-blown printf() function.

This code was copied from:
http://www.sparetimelabs.com/printfrevisited
With mostly only coding style related changes so that its checkpatch
clean.

The size reduction is about 2.5KiB. Here a comparison for the db-mv784mp-gp
(Marvell AXP) SPL:

Without this patch:
58963 18536 1928 79427 13643 ./spl/u-boot-spl

With this patch:
56542 18536 1956 77034 12cea ./spl/u-boot-spl

Note:
To make it possible to compile tiny-printf.c instead of vsprintf.c when
CONFIG_USE_TINY_PRINTF is defined, the functions printf() and vprintf() are
moved from common/console.c into vsprintf.c in this patch.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>

# 2419cd16 03-Oct-2015 Simon Glass <sjg@chromium.org>

dm: tpm: Drop CONFIG_DM_TPM

Now that all TPM drivers use driver model, we can drop the special driver
model CONFIG option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>

# 027b728d 06-Oct-2015 Julius Werner <jwerner@chromium.org>

Add support for LZ4 decompression algorithm

This patch adds support for LZ4-compressed FIT image contents. This
algorithm has a slightly worse compression ration than LZO while being
nearly twice as fast to decompress. When loading images from a fast
storage medium this usually results in a boot time win.

Sandbox-tested only since I don't have a U-Boot development system set
up right now. The code was imported unchanged from coreboot where it's
proven to work, though. I'm mostly interested in getting this recognized
by mkImage for use in a downstream project.

Signed-off-by: Julius Werner <jwerner@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# a7d660bc 22-Aug-2015 Simon Glass <sjg@chromium.org>

tpm: Add Kconfig options for TPMs

Add new Kconfig options for TPMs in preparation for moving boards to use
Kconfig for TPM configuration.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 867a6ac8 31-Jul-2015 Simon Glass <sjg@chromium.org>

efi: Add start-up library code

When running as an EFI application, U-Boot must request memory from EFI,
and provide access to the boot services U-Boot needs.

Add library code to perform these tasks. This includes efi_main() which is
the entry point from EFI. U-Boot is built as a shared library.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d1389403 23-Jun-2015 Simon Glass <sjg@chromium.org>

Add a dhrystone benchmark command

Drystone provides a convenient sanity check that the CPU is running at full
speed. Add this as a command which can be enabled as needed.

Note: I investigated using Coremark for this but there was a license
agreement and I could not work out if it was GPL-compatible.

Signed-off-by: Simon Glass <sjg@chromium.org>

# f7848d90 22-Jun-2015 Joe Hershberger <joe.hershberger@ni.com>

Allow CONFIG_REGEX to be disabled when CONFIG_NET

Instead of selecting REGEX when NET is enabled, make it the default, but
allow boards that are tiny to disable it and lose functionality on all
but the first Ethernet adapter.

cm-bf548, bf538f-ezkit, and bf533-stamp need this. None appear to have
more than one Ethernet interface.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# 3850dbe8 11-Jun-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

blackfin: fix undefined reference to srand and rand

Commit 9ba9e85f3f1c (net: Fix NET_RANDOM_ETHADDR dependencies)
accidentally dropped CONFIG_LIB_RAND defines for 14 Blackfin boards.

Prior to that commit, those boards defined CONFIG_LIB_RAND, but not
CONFIG_NET_RANDOM_ETHADDR. So, commit 9ba9e85f3f1c should not have
touched them, but in fact it ripped CONFIG_LIB_RAND off from all the
header files, which caused undefined reference to srand and rand.
CONFIG_LIB_RAND=y must be revived for such boards.

BTW, this commit indeed makes it better, but even with this fix,
three boards (bf533-stamp, bf538f-ezkit, cm-bf548) still can not
build due to region 'ram' overflowed error. This was cause by
commit 6eed3786c68c (net: Move the CMD_NET config to defconfigs)
because CMD_NET selects NET, and NET selects REGEX. Eventually,
some boards were newly enabled with CONFIG_REGEX, increasing the
memory footprint. A patch is expected to fix the build error.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 9ba9e85f 25-May-2015 Michal Simek <michal.simek@xilinx.com>

net: Fix NET_RANDOM_ETHADDR dependencies

NET_RANDOM_ETHADDR depends on lib/rand.c. This patch adds dependency to
Kconfig to ensure that library is also compiled.

Remove the definitions from Blackfin boards' include/configs.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 6501ff62 20-Apr-2015 Przemyslaw Marczak <p.marczak@samsung.com>

lib: Kconfig: add entry for errno_str() function

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1a60650c 21-Apr-2015 Joe Hershberger <joe.hershberger@ni.com>

kconfig: Move REGEX to Kconfig

Having this as a Kconfig allows it to be a dependent feature.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8156345d 06-Mar-2015 Simon Glass <sjg@chromium.org>

sandbox: Move CONFIG_SYS_VSNPRINTF to Kconfig

Move this over to Kconfig and tidy up.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 94e3c8c4 19-Feb-2015 gaurav rana <gaurav.rana@freescale.com>

crypto/fsl - Add progressive hashing support using hardware acceleration.

Currently only normal hashing is supported using hardware acceleration.
Added support for progressive hashing using hardware.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
Signed-off-by: Gaurav Rana <gaurav.rana@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>

# d9f23c7f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@freescale.com>

lib/rsa: Add Kconfig for devices supporting RSA Modular Exponentiation

Kconfig option added for devices which support RSA Verification.
1. RSA_SOFTWARE_EXP
Enables driver for supporting RSA Modular Exponentiation in Software
2. RSA_FREESCALE_EXP
Enables driver for supporting RSA Modular Exponentiation using Freescale specific
driver

The above drivers use RSA uclass

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
(Removed duplicate line in Kconfig comment)

Change-Id: I7663c4d5350e2bfc3dfa2696f70ef777d6ccc6f6

# c4beb22f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@freescale.com>

FIT: Modify option FIT_SIGNATURE in Kconfig

For FIT signature based approach to work, RSA library needs to be selected.
The FIT_SIGNATURE option in Kconfig is modified to automatically select RSA.
Selecting RSA compiles the RSA library required for image verification.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 45ccec8f 23-Oct-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_USE_PRIVATE_LIBGCC to Kconfig

The private libgcc is supported only on ARM, MIPS, PowerPC, SH, x86.
Those architectures should "select" HAVE_PRIVATE_LIBGCC and
CONFIG_USE_PRIVATE_LIBGCC should depend on it.

Currently, this option is enabled on Tegra boards and x86 architecture.
Move the definition from header files to Kconfig.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Tested-by: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: Tom Warren <twarren@nvidia.com>

# 8c688bc4 23-Oct-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_SYS_HZ to lib/Kconfig

CONFIG_SYS_HZ is always defined as 1000 in config_fallbacks.h
(but some boards still have redundant definitions).

This commit moves the definition and the document in README to
Kconfig. Since lib/Kconfig can assure that CONFIG_SYS_HZ is 1000,
the sanity check in lib/time.c should be removed.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Reviewed-by: Marek Vasut <marex@denx.de>

# b0928da6 16-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED to Kconfig

If this option is enabled, the objects under lib/ directory
are compiled with speed optimization, not size optimization.
(Currently, only used by some Blackfin boards.)

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# ed36323f 16-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: add blank Kconfig files

This would be useful to start moving various config options.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# 37ef1774 10-Nov-2019 Thomas Hebb <tommyhebb@gmail.com>

Kconfig: disambiguate config names for tiny printf

27084c03d36a ("spl: Allow tiny printf() to be controlled in SPL and
TPL") split this option in two for TPL and SPL, but didn't change the
Kconfig names, making them hard to set quickly.

Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>

# 0d76afc0 27-Oct-2019 Simon Glass <sjg@chromium.org>

fdt: Add Kconfig options to control code size

For better or worse libfdt recent grew a lot of code that checks the
validity of the device tree in great detail. When using unsigned or
unverified data this makes things safer, but it does add to code size.

Add some controls to select the trade-off between safety and code size.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 27084c03 25-Sep-2019 Simon Glass <sjg@chromium.org>

spl: Allow tiny printf() to be controlled in SPL and TPL

At present there is only one control for this and it is used for both SPL
and TPL. But SPL might have a lot more space than TPL so the extra cost of
a full printf() might be acceptable.

Split the option into two, providing separate SPL and TPL controls. The
TPL setting defaults to the same as SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2a51e16b 07-Jun-2019 Tom Rini <trini@konsulko.com>

configs: Make USE_TINY_PRINTF depend on SPL||TPL and be default

The USE_TINY_PRINTF symbol only changes things within SPL and TPL
builds, so make it depend on that support. Next, make it default as
within these cases we should rarely have need of more advanced print
formats outside of the debug context.

To do this, in a few cases we need to correct our Kconfig dependencies
as we had cases of non-SPL targets select'ing this symbol. Finally, in
the case of a few boards we really do need the full printf
functionality.

Signed-off-by: Tom Rini <trini@konsulko.com>

# da0fb5fd 02-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: make call depth limit customizable

Up to now we had hard coded values for the call depth up to which trace
records are created: 200 for early tracing, 15 thereafter. UEFI
applications reach a call depth of 80 or above.

Provide customizing settings for the call trace depth limit and the early
call trace depth limit. Use the old values as defaults.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8509f22a 29-Apr-2019 Marek Behún <marek.behun@nic.cz>

lib: add Zstandard decompression support

Add the zstd library from Linux kernel (only decompression support).
There are minimal changes to build with U-Boot, otherwise the files are
identical to Linux commit dc35da16 from March 2018, the files had not
been touched since in kernel. Also SPDX lincese tags were added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 83a486b6 29-Apr-2019 Marek Behún <marek.behun@nic.cz>

lib: Add xxhash support

This adds the xxhash support from Linux. Files are almost identical to
those added to Linux in commit 5d240522 ("lib: Add xxhash module") (they
haven't been touched since in Linux). The only difference is to add some
includes to be compatible with U-Boot. Also SPDX lincese tags were
added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 5132361a 29-Apr-2019 Heiko Schocher <hs@denx.de>

lib: Kconfig: fix help text for GZIP

commit 95f4bbd581cf ("lib: fdt: Allow LZO and GZIP DT compression in U-Boot")

introduced Kconfig option for gzip in U-Boot, but help text
says gzip for SPL, which is wrong. Fix this.

Signed-off-by: Heiko Schocher <hs@denx.de>
Acked-by: Marek Vasut <marex@denx.de>

# 1c6eb075 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE_BUFFER_SIZE et al to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE_BUFFER_SIZE
CONFIG_TRACE_EARLY_SIZE
CONFIG_TRACE_EARLY
CONFIG_TRACE_EARLY_ADDR

Signed-off-by: Simon Glass <sjg@chromium.org>

# a24a78d7 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE

Signed-off-by: Simon Glass <sjg@chromium.org>

# 54969b40 21-Mar-2019 Thierry Reding <treding@nvidia.com>

fdtdec: Add Kconfig symbol for tests

Runtime tests are provided as a test_fdtdec command implementation. Add
a Kconfig symbol that allows this command to be built so that the tests
can be used.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 95f4bbd5 08-Mar-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

lib: fdt: Allow LZO and GZIP DT compression in U-Boot

Add required Kconfig symbols, Makefile bits and macro fixes in a
few places to support LZO and DT compression in U-Boot. This can
save a lot of space with multi-DTB fitImages.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>

# 6e705114 13-Jan-2019 Chris Packham <judge.packham@gmail.com>

lib: Kconfig: spelling fixes

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 048c6e89 06-Nov-2018 Simon Glass <sjg@chromium.org>

spl: lz4: Allow use of lz4 compression in SPL

In some cases U-Boot is compressed and it is useful to be able to
decompress it in SPL. Add a Kconfig and Makefile change to allow this.
Note that this does not actually implement decompression.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 2895c4b7 15-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

kconfig: Introduce HAVE_ARCH_IOMAP

Introduce a new Kconfig option for architecture codes to control
whether it provides io{read,write}{8,16,32} I/O accessor functions.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5592a633 01-Oct-2018 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt in TPL

In some cases (e.g. sandbox with verified boot) it is useful to support
libfdt in TPL. Update the Kconfig to handle this.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 6307896c 01-Oct-2018 Simon Glass <sjg@chromium.org>

tpm: Add support for SPL and TPL

At present the tpm can only be used in U-Boot proper. Updated it to work
in SPL and TPL also.

Signed-off-by: Simon Glass <sjg@chromium.org>

# ab948cd2 19-Jul-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

fdt_support: make FDT_FIXUP_PARTITIONS depend on CMD_MTDPARTS

fdt_fixup_mtdparts() calls mtdparts_init() and device_find(),
which are defined in cmd/mtdparts.c

The combination of FDT_FIXUP_PARTITIONS=y and CMD_MTDPARTS=n
emits the following link error:

common/fdt_support.c:903: undefined reference to `mtdparts_init'
common/fdt_support.c:914: undefined reference to `device_find'

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 3330584d 03-Jun-2018 Igor Opaniuk <igor.opaniuk@linaro.org>

avb2.0: integrate avb 2.0 into the build system

Integrate libavb into the build system. Introduce CONFIG_LIBAVB
build option.

Signed-off-by: Igor Opaniuk <igor.opaniuk@linaro.org>

# f8c987f8 05-Jun-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

lib: Add hexdump

Often during debugging session it's very interesting to see
what data we were dealing with. For example what we write or read
to/from memory or peripherals.

This change introduces functions that allow to dump binary
data with one simple function invocation like:
------------------->8----------------
print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, buf, len);
------------------->8----------------

which gives us the following:
------------------->8----------------
00000000: f2 b7 c9 88 62 61 75 64 72 61 74 65 3d 31 31 35 ....baudrate=115
00000010: 32 30 30 00 62 6f 6f 74 61 72 67 73 3d 63 6f 6e 200.bootargs=con
00000020: 73 6f 6c 65 3d 74 74 79 53 33 2c 31 31 35 32 30 sole=ttyS3,11520
00000030: 30 6e 38 00 62 6f 6f 74 64 65 6c 61 79 3d 33 00 0n8.bootdelay=3.
00000040: 62 6f 6f 74 66 69 6c 65 3d 75 49 6d 61 67 65 00 bootfile=uImage.
00000050: 66 64 74 63 6f 6e 74 72 6f 6c 61 64 64 72 3d 39 fdtcontroladdr=9
00000060: 66 66 62 31 62 61 30 00 6c 6f 61 64 61 64 64 72 ffb1ba0.loadaddr
00000070: 3d 30 78 38 32 30 30 30 30 30 30 00 73 74 64 65 =0x82000000.stde
00000080: 72 72 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 rr=serial0@e0022
00000090: 30 30 30 00 73 74 64 69 6e 3d 73 65 72 69 61 6c 000.stdin=serial
000000a0: 30 40 65 30 30 32 32 30 30 30 00 73 74 64 6f 75 0@e0022000.stdou
000000b0: 74 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 30 t=serial0@e00220
000000c0: 30 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00..............
...
------------------->8----------------

Source of hexdump.c was copied from Linux kernel v4.7-rc2.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Mario Six <mario.six@gdsys.cc>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Stefan Roese <sr@denx.de>

# c232d14d 29-May-2018 Alex Kiernan <alex.kiernan@gmail.com>

mmc: Separate "mmc swrite" from fastboot

Introduce CONFIG_IMAGE_SPARSE and CONFIG_CMD_MMC_SWRITE so the "mmc
swrite" command is separated from the fastboot code.

Move image-sparse from common to lib so it's clear it's library code.

Rename CONFIG_FASTBOOT_FLASH_FILLBUF_SIZE to CONFIG_IMAGE_SPARSE_FILLBUF_SIZE
and migrate it to Kconfig.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Acked-by: Jassi Brar <jaswinder.singh@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6417572e 08-May-2018 Tom Rini <trini@konsulko.com>

lib/Kconfig: Mark OF_LIBFDT_OVERLAY as depending on OF_LIBFDT

The overlay code is only useful when OF_LIBFDT is set, so mark it as
depending on that first.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 58a46f88 25-Apr-2018 Praneeth Bajjuri <praneeth@ti.com>

configs: TI: Enable FIT Library overlay support

Enable the FDT library overlay support for all TI SOC family.

Without this option, when Loading fdt from FIT image, the
following warning is seen.

"config with overlays but CONFIG_OF_LIBFDT_OVERLAY not set".

Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
Suggested-by: Andrew F.Davis <afd@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>

# 14ad44ab 18-Apr-2018 Alex Kiernan <alex.kiernan@gmail.com>

spl: Split sprintf, strto* from SPL serial in Kconfig

When SPL serial is disabled, callers who need sprintf or strtoul fail
because their inclusion is guarded by CONFIG_SPL_SERIAL_SUPPORT/
CONFIG_TPL_SERIAL_SUPPORT.

Split printf, sprintf and strto into their own entries and then select
all of them if SERIAL_SUPPORT is enabled to match the current behaviour.

Include panic.o unconditionally as it can be called from anywhere which
uses BUG_ON().

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>

# e294ba06 04-Apr-2018 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-sunxi

Signed-off-by: Tom Rini <trini@konsulko.com>


# d14db11d 03-Apr-2018 Andre Przywara <andre.przywara@arm.com>

sunxi: revert disabling of features

In January some commits were introduced to mitigate the U-Boot image
size issues we encountered on sunxi builds.
Now with the MMC environment removed we can bring them back, as we
practically don't have a size limit anymore.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 32ce6179 13-Mar-2018 Bryan O'Donoghue <bryan.odonoghue@linaro.org>

optee: Add lib entries for sharing OPTEE code across ports

This patch adds code to lib to enable sharing of useful OPTEE code between
board-ports and architectures. The code on lib/optee/optee.c comes from the
TI omap2 port. Eventually the OMAP2 code will be patched to include the
shared code. The intention here is to add more useful OPTEE specific code
as more functionality gets added.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Cc: Harinarayan Bhatta <harinarayan@ti.com>
Cc: Andrew F. Davis <afd@ti.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Kever Yang <kever.yang@rock-chips.com>
Cc: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Cc: Peng Fan <peng.fan@nxp.com>
Tested-by: Peng Fan <peng.fan@nxp.com>

# 36c1877c 06-Feb-2018 Faiz Abbas <faiz_abbas@ti.com>

lib: Kconfig: Move DYNAMIC_CRC_TABLE to Kconfig

Add CONFIG prefix to DYNAMIC_CRC_TABLE and implement it in
Kconfig.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>

# a451bc27 05-Feb-2018 Adam Ford <aford173@gmail.com>

Convert LIB_UUID to Kconfig

config_fallback.h has some logic that checks a variety of options
and selects LIB_UUID if it hasn't already been selected. This
will all LIB_UUID in Kconfig and select this option for the list
of options to allow us to remove the logic from fallbacks

Signed-off-by: Adam Ford <aford173@gmail.com>

# a5a37567 06-Feb-2018 Adam Ford <aford173@gmail.com>

Convert CONFIG LIB_HW_RAND to Kconfig

config_fallbacks.h had some logic to automatically select
LIB_RAND if RANDOM_UUID or CMD_UUID were set if LIB_HW_RAND wasn't
already selected. By migrating LIB_HW_RAND to Kconfig, we can
remove this check from config_fallbacks.h and put it into Kconfig

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
[trini: Turn into a choice, add NET_RANDOM_ETHADDR]
Signed-off-by: Tom Rini <trini@konsulko.com>

# acd4d334 16-Jan-2018 Maxime Ripard <maxime.ripard@free-electrons.com>

net: regex: Disable by default on sunXi

The sunXi arm64 build has overflown, leading to the main U-boot binary
overwriting the environment when flashing the new image, or even worse,
overwriting itself when we're calling saveenv.

Disable this option that is not critical until we can adress the issue
properly.

Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 7e3caa81 03-Dec-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

Move CONFIG_PANIC_HANG to Kconfig

Freescale (NXP) boards have lots of defconfig files per board.
I used "imply PANIC_HANG" for them.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# da5337a6 08-Nov-2017 Nandor Han <nandor.han@ge.com>

rtc: add support for s35392a

Add support for S35392A RTC. The driver supports both U-Boot driver
models.

Signed-off-by: Nandor Han <nandor.han@ge.com>
Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
Cc: Heiko Schocher <hs@denx.de>

# f52bdf4b 14-Sep-2017 Jean-Jacques Hiblot <jjhiblot@ti.com>

lib: allow building lzo for the SPL

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 85d8bf57 03-Sep-2017 Marek Behún <marek.behun@nic.cz>

lib: Add CRC32-C

This is needed for BTRFS.

Signed-off-by: Marek Behun <marek.behun@nic.cz>

create mode 100644 lib/crc32c.c

# 7264f292 15-Aug-2017 York Sun <york.sun@nxp.com>

spl: fit: Eanble GZIP support for image decompression

Add Kconfig option SPL_GZIP and SPL_ZLIB to enable gunzip support for
SPL boot, eg. falcon boot compressed kernel image.

Signed-off-by: York Sun <york.sun@nxp.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6ef2f901 11-Aug-2017 Adam Ford <aford173@gmail.com>

Convert CONFIG_BCH to Kconfig

This converts the following to Kconfig:
CONFIG_BCH

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1a7ba1d 18-Aug-2017 Anatolij Gustschin <agust@denx.de>

Fix 'notes' typos

s/notes/nodes

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 96b9082c 03-Aug-2017 Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

rockchip: rk3188: rock: adjust for SPL/TPL split

With the changes to split SPL/TPL for the RK3368, I apparently missed
some needed adjustments to the RK3188 Kconfig and rock_defconfig.

This fixes build-issues for the rock board after applying the RK3368
enablement (and SPL/TPL) set that resulted from TPL_SERIAL_SUPPORT,
TPL_ROCKCHIP_BACK_TO_BROM and TPL_TINY_MEMSET being separate symbols
now.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d56b4b19 22-Jul-2017 Tom Rini <trini@konsulko.com>

configs: Migrate RBTREE, LZO, CMD_MTDPARTS, CMD_UBI and CMD_UBIFS

The above CONFIG options are in Kconfig, and now have correct depends and
inter-dependencies. Migrate these to configs/ from include/configs/. In the
case of CMD_UBIFS also change it to be a default y if CMD_UBI.

Signed-off-by: Tom Rini <trini@konsulko.com>

# aed998aa 17-May-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_LZMA to Kconfig

This converts the following to Kconfig:
CONFIG_LZMA

Signed-off-by: Simon Glass <sjg@chromium.org>

# b1a873df 26-Apr-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_CMD_AES et al to Kconfig

This converts the following to Kconfig:
CONFIG_CMD_AES
CONFIG_AES

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Add select AES to CMD_AES]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 173aafbf 27-Feb-2017 Boris Brezillon <boris.brezillon@free-electrons.com>

cmd: Expose a Kconfig option to enable UBIFS commands

Create a new Kconfig entry to allow CMD_UBIFS selection from Kconfig and
add an hidden LZO option that can be selected by CMD_UBIFS.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>

# aa049152 27-Feb-2017 Boris Brezillon <boris.brezillon@free-electrons.com>

mtd: ubi: Select RBTREE option from MTD_UBI Kconfig entry

Expose the RBTREE feature through Kconfig and select this option from the
MTD_UBI option.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>
[Rebased on master]
Signed-off-by: Jagan Teki <jagan@openedev.com>

# ab4458bd 02-Apr-2017 Simon Glass <sjg@chromium.org>

string: Provide a slimmed-down memset()

Most of the time the optimised memset() is what we want. For extreme
situations such as TPL it may be too large. For example on the 'rock'
board, using a simple loop saves a useful 48 bytes. With gcc 4.9 and
the rodata bug, this patch is enough to reduce the TPL image below the
limit.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>

# bea79d7d 14-Mar-2017 Andre Przywara <andre.przywara@arm.com>

Kconfig: introduce md5sum command selection

So far CONFIG_MD5SUM would need to be set by a board's include file.
Since the command is really generic, move it over to Kconfig to allow
it to be defined by either a board's defconfig, menuconfig or some
config snippet merged via mergeconfig.sh.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e663b350 18-Aug-2016 Alexander Graf <agraf@suse.de>

smbios: Expose in efi_loader as table

We can pass SMBIOS easily as EFI configuration table to an EFI payload. This
patch adds enablement for that case.

While at it, we also enable SMBIOS generation for ARM systems, since they support
EFI_LOADER.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4b6dddc2 18-Aug-2016 Alexander Graf <agraf@suse.de>

x86: Move smbios generation into arch independent directory

We will need the SMBIOS generation function on ARM as well going forward,
so let's move it into a non arch specific location.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# ebf7fff2 05-Oct-2016 Heiko Schocher <hs@denx.de>

spl: move FDT_FIXUP_PARTITIONS to Kconfig

Move FDT_FIXUP_PARTITIONS to Kconfig and cleanup existing
uses.

Signed-off-by: Heiko Schocher <hs@denx.de>

# ddf67f71 05-Jul-2016 Maxime Ripard <maxime.ripard@free-electrons.com>

libfdt: Add overlay application function

The device tree overlays are a good way to deal with user-modifyable
boards or boards with some kind of an expansion mechanism where we can
easily plug new board in (like the BBB, the Raspberry Pi or the CHIP).

Add a new function to merge overlays with a base device tree.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>

# 91b86e21 26-May-2016 Marek Vasut <marex@denx.de>

lib: Enable private libgcc by default

This patch decouples U-Boot binary from the toolchain on systems where
private libgcc is available. Instead of pulling in functions provided
by the libgcc from the toolchain, U-Boot will use it's own set of libgcc
functions. These functions are usually imported from Linux kernel, which
also uses it's own libgcc functions instead of the ones provided by the
toolchain.

This patch solves a rather common problem. The toolchain can usually
generate code for many variants of target architecture and often even
different endianness. The libgcc on the other hand is usually compiled
for one particular configuration and the functions provided by it may
or may not be suited for use in U-Boot. This can manifest in two ways,
either the U-Boot fails to compile altogether and linker will complain
or, in the much worse case, the resulting U-Boot will build, but will
misbehave in very subtle and hard to debug ways.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 67976306 30-Mar-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

cosmetic: Fix typos "privide"

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# ed980b8c 03-Mar-2016 Alexander Graf <agraf@suse.de>

efi_loader: hook up in build environment

Now that we have all the bits and pieces ready for EFI payload loading
support, hook them up in Makefiles and KConfigs so that we can build.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
[trini: Enable only when we of OF_LIBFDT, disable on kwb and colibri_pxa270]
Signed-off-by: Tom Rini <trini@konsulko.com>

# aa34fbc0 22-Feb-2016 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt to be used in SPL

Add an option to enable libfdt in SPL. This can be useful when decoding
FIT files in SPL.

We need to make sure this option is not enabled in SPL by this change.
Also this option needs to be enabled in host builds. Si add a new
IMAGE_USE_LIBFDT #define which can be used in files that are built on the
host but must also build for U-Boot and SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 69e173eb 22-Feb-2016 Simon Glass <sjg@chromium.org>

Move CONFIG_OF_LIBFDT to Kconfig

Move this option to Kconfig and tidy up existing boards.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a187559e 05-Feb-2016 Bin Meng <bmeng.cn@gmail.com>

Use correct spelling of "U-Boot"

Correct spelling of "U-Boot" shall be used in all written text
(documentation, comments in source files etc.).

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Minkyu Kang <mk7.kang@samsung.com>

# 947c626d 14-Jan-2016 Tom Rini <trini@konsulko.com>

vsprintf.c: Always enable CONFIG_SYS_VSNPRINTF

Enabling this function always removes some class of string saftey issues.
The size change here in general is about 400 bytes and this seems a reasonable
trade-off.

Cc: Peng Fan <peng.fan@nxp.com>
Cc: Peter Robinson <pbrobinson@gmail.com>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Adrian Alonso <aalonso@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 7d9cde10 22-Nov-2015 Stefan Roese <sr@denx.de>

lib/tiny-printf.c: Add tiny printf function for space limited environments

This patch adds a small printf() version that supports all basic formats.
Its intented to be used in U-Boot SPL versions on platforms with very
limited internal RAM sizes.

To enable it, just define CONFIG_USE_TINY_PRINTF in your defconfig. This
will result in the SPL using this tiny function and the main U-Boot
still using the full-blown printf() function.

This code was copied from:
http://www.sparetimelabs.com/printfrevisited
With mostly only coding style related changes so that its checkpatch
clean.

The size reduction is about 2.5KiB. Here a comparison for the db-mv784mp-gp
(Marvell AXP) SPL:

Without this patch:
58963 18536 1928 79427 13643 ./spl/u-boot-spl

With this patch:
56542 18536 1956 77034 12cea ./spl/u-boot-spl

Note:
To make it possible to compile tiny-printf.c instead of vsprintf.c when
CONFIG_USE_TINY_PRINTF is defined, the functions printf() and vprintf() are
moved from common/console.c into vsprintf.c in this patch.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>

# 2419cd16 03-Oct-2015 Simon Glass <sjg@chromium.org>

dm: tpm: Drop CONFIG_DM_TPM

Now that all TPM drivers use driver model, we can drop the special driver
model CONFIG option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>

# 027b728d 06-Oct-2015 Julius Werner <jwerner@chromium.org>

Add support for LZ4 decompression algorithm

This patch adds support for LZ4-compressed FIT image contents. This
algorithm has a slightly worse compression ration than LZO while being
nearly twice as fast to decompress. When loading images from a fast
storage medium this usually results in a boot time win.

Sandbox-tested only since I don't have a U-Boot development system set
up right now. The code was imported unchanged from coreboot where it's
proven to work, though. I'm mostly interested in getting this recognized
by mkImage for use in a downstream project.

Signed-off-by: Julius Werner <jwerner@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# a7d660bc 22-Aug-2015 Simon Glass <sjg@chromium.org>

tpm: Add Kconfig options for TPMs

Add new Kconfig options for TPMs in preparation for moving boards to use
Kconfig for TPM configuration.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 867a6ac8 31-Jul-2015 Simon Glass <sjg@chromium.org>

efi: Add start-up library code

When running as an EFI application, U-Boot must request memory from EFI,
and provide access to the boot services U-Boot needs.

Add library code to perform these tasks. This includes efi_main() which is
the entry point from EFI. U-Boot is built as a shared library.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d1389403 23-Jun-2015 Simon Glass <sjg@chromium.org>

Add a dhrystone benchmark command

Drystone provides a convenient sanity check that the CPU is running at full
speed. Add this as a command which can be enabled as needed.

Note: I investigated using Coremark for this but there was a license
agreement and I could not work out if it was GPL-compatible.

Signed-off-by: Simon Glass <sjg@chromium.org>

# f7848d90 22-Jun-2015 Joe Hershberger <joe.hershberger@ni.com>

Allow CONFIG_REGEX to be disabled when CONFIG_NET

Instead of selecting REGEX when NET is enabled, make it the default, but
allow boards that are tiny to disable it and lose functionality on all
but the first Ethernet adapter.

cm-bf548, bf538f-ezkit, and bf533-stamp need this. None appear to have
more than one Ethernet interface.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# 3850dbe8 11-Jun-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

blackfin: fix undefined reference to srand and rand

Commit 9ba9e85f3f1c (net: Fix NET_RANDOM_ETHADDR dependencies)
accidentally dropped CONFIG_LIB_RAND defines for 14 Blackfin boards.

Prior to that commit, those boards defined CONFIG_LIB_RAND, but not
CONFIG_NET_RANDOM_ETHADDR. So, commit 9ba9e85f3f1c should not have
touched them, but in fact it ripped CONFIG_LIB_RAND off from all the
header files, which caused undefined reference to srand and rand.
CONFIG_LIB_RAND=y must be revived for such boards.

BTW, this commit indeed makes it better, but even with this fix,
three boards (bf533-stamp, bf538f-ezkit, cm-bf548) still can not
build due to region 'ram' overflowed error. This was cause by
commit 6eed3786c68c (net: Move the CMD_NET config to defconfigs)
because CMD_NET selects NET, and NET selects REGEX. Eventually,
some boards were newly enabled with CONFIG_REGEX, increasing the
memory footprint. A patch is expected to fix the build error.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 9ba9e85f 25-May-2015 Michal Simek <michal.simek@xilinx.com>

net: Fix NET_RANDOM_ETHADDR dependencies

NET_RANDOM_ETHADDR depends on lib/rand.c. This patch adds dependency to
Kconfig to ensure that library is also compiled.

Remove the definitions from Blackfin boards' include/configs.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 6501ff62 20-Apr-2015 Przemyslaw Marczak <p.marczak@samsung.com>

lib: Kconfig: add entry for errno_str() function

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1a60650c 21-Apr-2015 Joe Hershberger <joe.hershberger@ni.com>

kconfig: Move REGEX to Kconfig

Having this as a Kconfig allows it to be a dependent feature.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8156345d 06-Mar-2015 Simon Glass <sjg@chromium.org>

sandbox: Move CONFIG_SYS_VSNPRINTF to Kconfig

Move this over to Kconfig and tidy up.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 94e3c8c4 19-Feb-2015 gaurav rana <gaurav.rana@freescale.com>

crypto/fsl - Add progressive hashing support using hardware acceleration.

Currently only normal hashing is supported using hardware acceleration.
Added support for progressive hashing using hardware.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
Signed-off-by: Gaurav Rana <gaurav.rana@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>

# d9f23c7f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@freescale.com>

lib/rsa: Add Kconfig for devices supporting RSA Modular Exponentiation

Kconfig option added for devices which support RSA Verification.
1. RSA_SOFTWARE_EXP
Enables driver for supporting RSA Modular Exponentiation in Software
2. RSA_FREESCALE_EXP
Enables driver for supporting RSA Modular Exponentiation using Freescale specific
driver

The above drivers use RSA uclass

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
(Removed duplicate line in Kconfig comment)

Change-Id: I7663c4d5350e2bfc3dfa2696f70ef777d6ccc6f6

# c4beb22f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@freescale.com>

FIT: Modify option FIT_SIGNATURE in Kconfig

For FIT signature based approach to work, RSA library needs to be selected.
The FIT_SIGNATURE option in Kconfig is modified to automatically select RSA.
Selecting RSA compiles the RSA library required for image verification.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 45ccec8f 23-Oct-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_USE_PRIVATE_LIBGCC to Kconfig

The private libgcc is supported only on ARM, MIPS, PowerPC, SH, x86.
Those architectures should "select" HAVE_PRIVATE_LIBGCC and
CONFIG_USE_PRIVATE_LIBGCC should depend on it.

Currently, this option is enabled on Tegra boards and x86 architecture.
Move the definition from header files to Kconfig.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Tested-by: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: Tom Warren <twarren@nvidia.com>

# 8c688bc4 23-Oct-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_SYS_HZ to lib/Kconfig

CONFIG_SYS_HZ is always defined as 1000 in config_fallbacks.h
(but some boards still have redundant definitions).

This commit moves the definition and the document in README to
Kconfig. Since lib/Kconfig can assure that CONFIG_SYS_HZ is 1000,
the sanity check in lib/time.c should be removed.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Reviewed-by: Marek Vasut <marex@denx.de>

# b0928da6 16-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED to Kconfig

If this option is enabled, the objects under lib/ directory
are compiled with speed optimization, not size optimization.
(Currently, only used by some Blackfin boards.)

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# ed36323f 16-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: add blank Kconfig files

This would be useful to start moving various config options.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# 0d76afc0 27-Oct-2019 Simon Glass <sjg@chromium.org>

fdt: Add Kconfig options to control code size

For better or worse libfdt recent grew a lot of code that checks the
validity of the device tree in great detail. When using unsigned or
unverified data this makes things safer, but it does add to code size.

Add some controls to select the trade-off between safety and code size.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 27084c03 25-Sep-2019 Simon Glass <sjg@chromium.org>

spl: Allow tiny printf() to be controlled in SPL and TPL

At present there is only one control for this and it is used for both SPL
and TPL. But SPL might have a lot more space than TPL so the extra cost of
a full printf() might be acceptable.

Split the option into two, providing separate SPL and TPL controls. The
TPL setting defaults to the same as SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2a51e16b 07-Jun-2019 Tom Rini <trini@konsulko.com>

configs: Make USE_TINY_PRINTF depend on SPL||TPL and be default

The USE_TINY_PRINTF symbol only changes things within SPL and TPL
builds, so make it depend on that support. Next, make it default as
within these cases we should rarely have need of more advanced print
formats outside of the debug context.

To do this, in a few cases we need to correct our Kconfig dependencies
as we had cases of non-SPL targets select'ing this symbol. Finally, in
the case of a few boards we really do need the full printf
functionality.

Signed-off-by: Tom Rini <trini@konsulko.com>

# da0fb5fd 02-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: make call depth limit customizable

Up to now we had hard coded values for the call depth up to which trace
records are created: 200 for early tracing, 15 thereafter. UEFI
applications reach a call depth of 80 or above.

Provide customizing settings for the call trace depth limit and the early
call trace depth limit. Use the old values as defaults.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8509f22a 29-Apr-2019 Marek Behún <marek.behun@nic.cz>

lib: add Zstandard decompression support

Add the zstd library from Linux kernel (only decompression support).
There are minimal changes to build with U-Boot, otherwise the files are
identical to Linux commit dc35da16 from March 2018, the files had not
been touched since in kernel. Also SPDX lincese tags were added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 83a486b6 29-Apr-2019 Marek Behún <marek.behun@nic.cz>

lib: Add xxhash support

This adds the xxhash support from Linux. Files are almost identical to
those added to Linux in commit 5d240522 ("lib: Add xxhash module") (they
haven't been touched since in Linux). The only difference is to add some
includes to be compatible with U-Boot. Also SPDX lincese tags were
added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 5132361a 29-Apr-2019 Heiko Schocher <hs@denx.de>

lib: Kconfig: fix help text for GZIP

commit 95f4bbd581cf ("lib: fdt: Allow LZO and GZIP DT compression in U-Boot")

introduced Kconfig option for gzip in U-Boot, but help text
says gzip for SPL, which is wrong. Fix this.

Signed-off-by: Heiko Schocher <hs@denx.de>
Acked-by: Marek Vasut <marex@denx.de>

# 1c6eb075 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE_BUFFER_SIZE et al to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE_BUFFER_SIZE
CONFIG_TRACE_EARLY_SIZE
CONFIG_TRACE_EARLY
CONFIG_TRACE_EARLY_ADDR

Signed-off-by: Simon Glass <sjg@chromium.org>

# a24a78d7 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE

Signed-off-by: Simon Glass <sjg@chromium.org>

# 54969b40 21-Mar-2019 Thierry Reding <treding@nvidia.com>

fdtdec: Add Kconfig symbol for tests

Runtime tests are provided as a test_fdtdec command implementation. Add
a Kconfig symbol that allows this command to be built so that the tests
can be used.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 95f4bbd5 08-Mar-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

lib: fdt: Allow LZO and GZIP DT compression in U-Boot

Add required Kconfig symbols, Makefile bits and macro fixes in a
few places to support LZO and DT compression in U-Boot. This can
save a lot of space with multi-DTB fitImages.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>

# 6e705114 13-Jan-2019 Chris Packham <judge.packham@gmail.com>

lib: Kconfig: spelling fixes

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 048c6e89 06-Nov-2018 Simon Glass <sjg@chromium.org>

spl: lz4: Allow use of lz4 compression in SPL

In some cases U-Boot is compressed and it is useful to be able to
decompress it in SPL. Add a Kconfig and Makefile change to allow this.
Note that this does not actually implement decompression.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 2895c4b7 15-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

kconfig: Introduce HAVE_ARCH_IOMAP

Introduce a new Kconfig option for architecture codes to control
whether it provides io{read,write}{8,16,32} I/O accessor functions.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5592a633 01-Oct-2018 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt in TPL

In some cases (e.g. sandbox with verified boot) it is useful to support
libfdt in TPL. Update the Kconfig to handle this.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 6307896c 01-Oct-2018 Simon Glass <sjg@chromium.org>

tpm: Add support for SPL and TPL

At present the tpm can only be used in U-Boot proper. Updated it to work
in SPL and TPL also.

Signed-off-by: Simon Glass <sjg@chromium.org>

# ab948cd2 19-Jul-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

fdt_support: make FDT_FIXUP_PARTITIONS depend on CMD_MTDPARTS

fdt_fixup_mtdparts() calls mtdparts_init() and device_find(),
which are defined in cmd/mtdparts.c

The combination of FDT_FIXUP_PARTITIONS=y and CMD_MTDPARTS=n
emits the following link error:

common/fdt_support.c:903: undefined reference to `mtdparts_init'
common/fdt_support.c:914: undefined reference to `device_find'

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 3330584d 03-Jun-2018 Igor Opaniuk <igor.opaniuk@linaro.org>

avb2.0: integrate avb 2.0 into the build system

Integrate libavb into the build system. Introduce CONFIG_LIBAVB
build option.

Signed-off-by: Igor Opaniuk <igor.opaniuk@linaro.org>

# f8c987f8 05-Jun-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

lib: Add hexdump

Often during debugging session it's very interesting to see
what data we were dealing with. For example what we write or read
to/from memory or peripherals.

This change introduces functions that allow to dump binary
data with one simple function invocation like:
------------------->8----------------
print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, buf, len);
------------------->8----------------

which gives us the following:
------------------->8----------------
00000000: f2 b7 c9 88 62 61 75 64 72 61 74 65 3d 31 31 35 ....baudrate=115
00000010: 32 30 30 00 62 6f 6f 74 61 72 67 73 3d 63 6f 6e 200.bootargs=con
00000020: 73 6f 6c 65 3d 74 74 79 53 33 2c 31 31 35 32 30 sole=ttyS3,11520
00000030: 30 6e 38 00 62 6f 6f 74 64 65 6c 61 79 3d 33 00 0n8.bootdelay=3.
00000040: 62 6f 6f 74 66 69 6c 65 3d 75 49 6d 61 67 65 00 bootfile=uImage.
00000050: 66 64 74 63 6f 6e 74 72 6f 6c 61 64 64 72 3d 39 fdtcontroladdr=9
00000060: 66 66 62 31 62 61 30 00 6c 6f 61 64 61 64 64 72 ffb1ba0.loadaddr
00000070: 3d 30 78 38 32 30 30 30 30 30 30 00 73 74 64 65 =0x82000000.stde
00000080: 72 72 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 rr=serial0@e0022
00000090: 30 30 30 00 73 74 64 69 6e 3d 73 65 72 69 61 6c 000.stdin=serial
000000a0: 30 40 65 30 30 32 32 30 30 30 00 73 74 64 6f 75 0@e0022000.stdou
000000b0: 74 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 30 t=serial0@e00220
000000c0: 30 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00..............
...
------------------->8----------------

Source of hexdump.c was copied from Linux kernel v4.7-rc2.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Mario Six <mario.six@gdsys.cc>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Stefan Roese <sr@denx.de>

# c232d14d 29-May-2018 Alex Kiernan <alex.kiernan@gmail.com>

mmc: Separate "mmc swrite" from fastboot

Introduce CONFIG_IMAGE_SPARSE and CONFIG_CMD_MMC_SWRITE so the "mmc
swrite" command is separated from the fastboot code.

Move image-sparse from common to lib so it's clear it's library code.

Rename CONFIG_FASTBOOT_FLASH_FILLBUF_SIZE to CONFIG_IMAGE_SPARSE_FILLBUF_SIZE
and migrate it to Kconfig.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Acked-by: Jassi Brar <jaswinder.singh@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6417572e 08-May-2018 Tom Rini <trini@konsulko.com>

lib/Kconfig: Mark OF_LIBFDT_OVERLAY as depending on OF_LIBFDT

The overlay code is only useful when OF_LIBFDT is set, so mark it as
depending on that first.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 58a46f88 25-Apr-2018 Praneeth Bajjuri <praneeth@ti.com>

configs: TI: Enable FIT Library overlay support

Enable the FDT library overlay support for all TI SOC family.

Without this option, when Loading fdt from FIT image, the
following warning is seen.

"config with overlays but CONFIG_OF_LIBFDT_OVERLAY not set".

Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
Suggested-by: Andrew F.Davis <afd@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>

# 14ad44ab 18-Apr-2018 Alex Kiernan <alex.kiernan@gmail.com>

spl: Split sprintf, strto* from SPL serial in Kconfig

When SPL serial is disabled, callers who need sprintf or strtoul fail
because their inclusion is guarded by CONFIG_SPL_SERIAL_SUPPORT/
CONFIG_TPL_SERIAL_SUPPORT.

Split printf, sprintf and strto into their own entries and then select
all of them if SERIAL_SUPPORT is enabled to match the current behaviour.

Include panic.o unconditionally as it can be called from anywhere which
uses BUG_ON().

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>

# e294ba06 04-Apr-2018 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-sunxi

Signed-off-by: Tom Rini <trini@konsulko.com>


# d14db11d 03-Apr-2018 Andre Przywara <andre.przywara@arm.com>

sunxi: revert disabling of features

In January some commits were introduced to mitigate the U-Boot image
size issues we encountered on sunxi builds.
Now with the MMC environment removed we can bring them back, as we
practically don't have a size limit anymore.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 32ce6179 13-Mar-2018 Bryan O'Donoghue <bryan.odonoghue@linaro.org>

optee: Add lib entries for sharing OPTEE code across ports

This patch adds code to lib to enable sharing of useful OPTEE code between
board-ports and architectures. The code on lib/optee/optee.c comes from the
TI omap2 port. Eventually the OMAP2 code will be patched to include the
shared code. The intention here is to add more useful OPTEE specific code
as more functionality gets added.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Cc: Harinarayan Bhatta <harinarayan@ti.com>
Cc: Andrew F. Davis <afd@ti.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Kever Yang <kever.yang@rock-chips.com>
Cc: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Cc: Peng Fan <peng.fan@nxp.com>
Tested-by: Peng Fan <peng.fan@nxp.com>

# 36c1877c 06-Feb-2018 Faiz Abbas <faiz_abbas@ti.com>

lib: Kconfig: Move DYNAMIC_CRC_TABLE to Kconfig

Add CONFIG prefix to DYNAMIC_CRC_TABLE and implement it in
Kconfig.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>

# a451bc27 05-Feb-2018 Adam Ford <aford173@gmail.com>

Convert LIB_UUID to Kconfig

config_fallback.h has some logic that checks a variety of options
and selects LIB_UUID if it hasn't already been selected. This
will all LIB_UUID in Kconfig and select this option for the list
of options to allow us to remove the logic from fallbacks

Signed-off-by: Adam Ford <aford173@gmail.com>

# a5a37567 06-Feb-2018 Adam Ford <aford173@gmail.com>

Convert CONFIG LIB_HW_RAND to Kconfig

config_fallbacks.h had some logic to automatically select
LIB_RAND if RANDOM_UUID or CMD_UUID were set if LIB_HW_RAND wasn't
already selected. By migrating LIB_HW_RAND to Kconfig, we can
remove this check from config_fallbacks.h and put it into Kconfig

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
[trini: Turn into a choice, add NET_RANDOM_ETHADDR]
Signed-off-by: Tom Rini <trini@konsulko.com>

# acd4d334 16-Jan-2018 Maxime Ripard <maxime.ripard@free-electrons.com>

net: regex: Disable by default on sunXi

The sunXi arm64 build has overflown, leading to the main U-boot binary
overwriting the environment when flashing the new image, or even worse,
overwriting itself when we're calling saveenv.

Disable this option that is not critical until we can adress the issue
properly.

Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 7e3caa81 03-Dec-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

Move CONFIG_PANIC_HANG to Kconfig

Freescale (NXP) boards have lots of defconfig files per board.
I used "imply PANIC_HANG" for them.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# da5337a6 08-Nov-2017 Nandor Han <nandor.han@ge.com>

rtc: add support for s35392a

Add support for S35392A RTC. The driver supports both U-Boot driver
models.

Signed-off-by: Nandor Han <nandor.han@ge.com>
Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
Cc: Heiko Schocher <hs@denx.de>

# f52bdf4b 14-Sep-2017 Jean-Jacques Hiblot <jjhiblot@ti.com>

lib: allow building lzo for the SPL

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 85d8bf57 03-Sep-2017 Marek Behún <marek.behun@nic.cz>

lib: Add CRC32-C

This is needed for BTRFS.

Signed-off-by: Marek Behun <marek.behun@nic.cz>

create mode 100644 lib/crc32c.c

# 7264f292 15-Aug-2017 York Sun <york.sun@nxp.com>

spl: fit: Eanble GZIP support for image decompression

Add Kconfig option SPL_GZIP and SPL_ZLIB to enable gunzip support for
SPL boot, eg. falcon boot compressed kernel image.

Signed-off-by: York Sun <york.sun@nxp.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6ef2f901 11-Aug-2017 Adam Ford <aford173@gmail.com>

Convert CONFIG_BCH to Kconfig

This converts the following to Kconfig:
CONFIG_BCH

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1a7ba1d 18-Aug-2017 Anatolij Gustschin <agust@denx.de>

Fix 'notes' typos

s/notes/nodes

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 96b9082c 03-Aug-2017 Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

rockchip: rk3188: rock: adjust for SPL/TPL split

With the changes to split SPL/TPL for the RK3368, I apparently missed
some needed adjustments to the RK3188 Kconfig and rock_defconfig.

This fixes build-issues for the rock board after applying the RK3368
enablement (and SPL/TPL) set that resulted from TPL_SERIAL_SUPPORT,
TPL_ROCKCHIP_BACK_TO_BROM and TPL_TINY_MEMSET being separate symbols
now.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d56b4b19 22-Jul-2017 Tom Rini <trini@konsulko.com>

configs: Migrate RBTREE, LZO, CMD_MTDPARTS, CMD_UBI and CMD_UBIFS

The above CONFIG options are in Kconfig, and now have correct depends and
inter-dependencies. Migrate these to configs/ from include/configs/. In the
case of CMD_UBIFS also change it to be a default y if CMD_UBI.

Signed-off-by: Tom Rini <trini@konsulko.com>

# aed998aa 17-May-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_LZMA to Kconfig

This converts the following to Kconfig:
CONFIG_LZMA

Signed-off-by: Simon Glass <sjg@chromium.org>

# b1a873df 26-Apr-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_CMD_AES et al to Kconfig

This converts the following to Kconfig:
CONFIG_CMD_AES
CONFIG_AES

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Add select AES to CMD_AES]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 173aafbf 27-Feb-2017 Boris Brezillon <boris.brezillon@free-electrons.com>

cmd: Expose a Kconfig option to enable UBIFS commands

Create a new Kconfig entry to allow CMD_UBIFS selection from Kconfig and
add an hidden LZO option that can be selected by CMD_UBIFS.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>

# aa049152 27-Feb-2017 Boris Brezillon <boris.brezillon@free-electrons.com>

mtd: ubi: Select RBTREE option from MTD_UBI Kconfig entry

Expose the RBTREE feature through Kconfig and select this option from the
MTD_UBI option.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>
[Rebased on master]
Signed-off-by: Jagan Teki <jagan@openedev.com>

# ab4458bd 02-Apr-2017 Simon Glass <sjg@chromium.org>

string: Provide a slimmed-down memset()

Most of the time the optimised memset() is what we want. For extreme
situations such as TPL it may be too large. For example on the 'rock'
board, using a simple loop saves a useful 48 bytes. With gcc 4.9 and
the rodata bug, this patch is enough to reduce the TPL image below the
limit.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>

# bea79d7d 14-Mar-2017 Andre Przywara <andre.przywara@arm.com>

Kconfig: introduce md5sum command selection

So far CONFIG_MD5SUM would need to be set by a board's include file.
Since the command is really generic, move it over to Kconfig to allow
it to be defined by either a board's defconfig, menuconfig or some
config snippet merged via mergeconfig.sh.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e663b350 18-Aug-2016 Alexander Graf <agraf@suse.de>

smbios: Expose in efi_loader as table

We can pass SMBIOS easily as EFI configuration table to an EFI payload. This
patch adds enablement for that case.

While at it, we also enable SMBIOS generation for ARM systems, since they support
EFI_LOADER.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4b6dddc2 18-Aug-2016 Alexander Graf <agraf@suse.de>

x86: Move smbios generation into arch independent directory

We will need the SMBIOS generation function on ARM as well going forward,
so let's move it into a non arch specific location.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# ebf7fff2 05-Oct-2016 Heiko Schocher <hs@denx.de>

spl: move FDT_FIXUP_PARTITIONS to Kconfig

Move FDT_FIXUP_PARTITIONS to Kconfig and cleanup existing
uses.

Signed-off-by: Heiko Schocher <hs@denx.de>

# ddf67f71 05-Jul-2016 Maxime Ripard <maxime.ripard@free-electrons.com>

libfdt: Add overlay application function

The device tree overlays are a good way to deal with user-modifyable
boards or boards with some kind of an expansion mechanism where we can
easily plug new board in (like the BBB, the Raspberry Pi or the CHIP).

Add a new function to merge overlays with a base device tree.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>

# 91b86e21 26-May-2016 Marek Vasut <marex@denx.de>

lib: Enable private libgcc by default

This patch decouples U-Boot binary from the toolchain on systems where
private libgcc is available. Instead of pulling in functions provided
by the libgcc from the toolchain, U-Boot will use it's own set of libgcc
functions. These functions are usually imported from Linux kernel, which
also uses it's own libgcc functions instead of the ones provided by the
toolchain.

This patch solves a rather common problem. The toolchain can usually
generate code for many variants of target architecture and often even
different endianness. The libgcc on the other hand is usually compiled
for one particular configuration and the functions provided by it may
or may not be suited for use in U-Boot. This can manifest in two ways,
either the U-Boot fails to compile altogether and linker will complain
or, in the much worse case, the resulting U-Boot will build, but will
misbehave in very subtle and hard to debug ways.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 67976306 30-Mar-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

cosmetic: Fix typos "privide"

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# ed980b8c 03-Mar-2016 Alexander Graf <agraf@suse.de>

efi_loader: hook up in build environment

Now that we have all the bits and pieces ready for EFI payload loading
support, hook them up in Makefiles and KConfigs so that we can build.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
[trini: Enable only when we of OF_LIBFDT, disable on kwb and colibri_pxa270]
Signed-off-by: Tom Rini <trini@konsulko.com>

# aa34fbc0 22-Feb-2016 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt to be used in SPL

Add an option to enable libfdt in SPL. This can be useful when decoding
FIT files in SPL.

We need to make sure this option is not enabled in SPL by this change.
Also this option needs to be enabled in host builds. Si add a new
IMAGE_USE_LIBFDT #define which can be used in files that are built on the
host but must also build for U-Boot and SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 69e173eb 22-Feb-2016 Simon Glass <sjg@chromium.org>

Move CONFIG_OF_LIBFDT to Kconfig

Move this option to Kconfig and tidy up existing boards.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a187559e 05-Feb-2016 Bin Meng <bmeng.cn@gmail.com>

Use correct spelling of "U-Boot"

Correct spelling of "U-Boot" shall be used in all written text
(documentation, comments in source files etc.).

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Minkyu Kang <mk7.kang@samsung.com>

# 947c626d 14-Jan-2016 Tom Rini <trini@konsulko.com>

vsprintf.c: Always enable CONFIG_SYS_VSNPRINTF

Enabling this function always removes some class of string saftey issues.
The size change here in general is about 400 bytes and this seems a reasonable
trade-off.

Cc: Peng Fan <peng.fan@nxp.com>
Cc: Peter Robinson <pbrobinson@gmail.com>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Adrian Alonso <aalonso@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 7d9cde10 22-Nov-2015 Stefan Roese <sr@denx.de>

lib/tiny-printf.c: Add tiny printf function for space limited environments

This patch adds a small printf() version that supports all basic formats.
Its intented to be used in U-Boot SPL versions on platforms with very
limited internal RAM sizes.

To enable it, just define CONFIG_USE_TINY_PRINTF in your defconfig. This
will result in the SPL using this tiny function and the main U-Boot
still using the full-blown printf() function.

This code was copied from:
http://www.sparetimelabs.com/printfrevisited
With mostly only coding style related changes so that its checkpatch
clean.

The size reduction is about 2.5KiB. Here a comparison for the db-mv784mp-gp
(Marvell AXP) SPL:

Without this patch:
58963 18536 1928 79427 13643 ./spl/u-boot-spl

With this patch:
56542 18536 1956 77034 12cea ./spl/u-boot-spl

Note:
To make it possible to compile tiny-printf.c instead of vsprintf.c when
CONFIG_USE_TINY_PRINTF is defined, the functions printf() and vprintf() are
moved from common/console.c into vsprintf.c in this patch.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>

# 2419cd16 03-Oct-2015 Simon Glass <sjg@chromium.org>

dm: tpm: Drop CONFIG_DM_TPM

Now that all TPM drivers use driver model, we can drop the special driver
model CONFIG option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>

# 027b728d 06-Oct-2015 Julius Werner <jwerner@chromium.org>

Add support for LZ4 decompression algorithm

This patch adds support for LZ4-compressed FIT image contents. This
algorithm has a slightly worse compression ration than LZO while being
nearly twice as fast to decompress. When loading images from a fast
storage medium this usually results in a boot time win.

Sandbox-tested only since I don't have a U-Boot development system set
up right now. The code was imported unchanged from coreboot where it's
proven to work, though. I'm mostly interested in getting this recognized
by mkImage for use in a downstream project.

Signed-off-by: Julius Werner <jwerner@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# a7d660bc 22-Aug-2015 Simon Glass <sjg@chromium.org>

tpm: Add Kconfig options for TPMs

Add new Kconfig options for TPMs in preparation for moving boards to use
Kconfig for TPM configuration.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 867a6ac8 31-Jul-2015 Simon Glass <sjg@chromium.org>

efi: Add start-up library code

When running as an EFI application, U-Boot must request memory from EFI,
and provide access to the boot services U-Boot needs.

Add library code to perform these tasks. This includes efi_main() which is
the entry point from EFI. U-Boot is built as a shared library.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d1389403 23-Jun-2015 Simon Glass <sjg@chromium.org>

Add a dhrystone benchmark command

Drystone provides a convenient sanity check that the CPU is running at full
speed. Add this as a command which can be enabled as needed.

Note: I investigated using Coremark for this but there was a license
agreement and I could not work out if it was GPL-compatible.

Signed-off-by: Simon Glass <sjg@chromium.org>

# f7848d90 22-Jun-2015 Joe Hershberger <joe.hershberger@ni.com>

Allow CONFIG_REGEX to be disabled when CONFIG_NET

Instead of selecting REGEX when NET is enabled, make it the default, but
allow boards that are tiny to disable it and lose functionality on all
but the first Ethernet adapter.

cm-bf548, bf538f-ezkit, and bf533-stamp need this. None appear to have
more than one Ethernet interface.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# 3850dbe8 11-Jun-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

blackfin: fix undefined reference to srand and rand

Commit 9ba9e85f3f1c (net: Fix NET_RANDOM_ETHADDR dependencies)
accidentally dropped CONFIG_LIB_RAND defines for 14 Blackfin boards.

Prior to that commit, those boards defined CONFIG_LIB_RAND, but not
CONFIG_NET_RANDOM_ETHADDR. So, commit 9ba9e85f3f1c should not have
touched them, but in fact it ripped CONFIG_LIB_RAND off from all the
header files, which caused undefined reference to srand and rand.
CONFIG_LIB_RAND=y must be revived for such boards.

BTW, this commit indeed makes it better, but even with this fix,
three boards (bf533-stamp, bf538f-ezkit, cm-bf548) still can not
build due to region 'ram' overflowed error. This was cause by
commit 6eed3786c68c (net: Move the CMD_NET config to defconfigs)
because CMD_NET selects NET, and NET selects REGEX. Eventually,
some boards were newly enabled with CONFIG_REGEX, increasing the
memory footprint. A patch is expected to fix the build error.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 9ba9e85f 25-May-2015 Michal Simek <michal.simek@xilinx.com>

net: Fix NET_RANDOM_ETHADDR dependencies

NET_RANDOM_ETHADDR depends on lib/rand.c. This patch adds dependency to
Kconfig to ensure that library is also compiled.

Remove the definitions from Blackfin boards' include/configs.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 6501ff62 20-Apr-2015 Przemyslaw Marczak <p.marczak@samsung.com>

lib: Kconfig: add entry for errno_str() function

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1a60650c 21-Apr-2015 Joe Hershberger <joe.hershberger@ni.com>

kconfig: Move REGEX to Kconfig

Having this as a Kconfig allows it to be a dependent feature.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8156345d 06-Mar-2015 Simon Glass <sjg@chromium.org>

sandbox: Move CONFIG_SYS_VSNPRINTF to Kconfig

Move this over to Kconfig and tidy up.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 94e3c8c4 19-Feb-2015 gaurav rana <gaurav.rana@freescale.com>

crypto/fsl - Add progressive hashing support using hardware acceleration.

Currently only normal hashing is supported using hardware acceleration.
Added support for progressive hashing using hardware.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
Signed-off-by: Gaurav Rana <gaurav.rana@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>

# d9f23c7f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@freescale.com>

lib/rsa: Add Kconfig for devices supporting RSA Modular Exponentiation

Kconfig option added for devices which support RSA Verification.
1. RSA_SOFTWARE_EXP
Enables driver for supporting RSA Modular Exponentiation in Software
2. RSA_FREESCALE_EXP
Enables driver for supporting RSA Modular Exponentiation using Freescale specific
driver

The above drivers use RSA uclass

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
(Removed duplicate line in Kconfig comment)

Change-Id: I7663c4d5350e2bfc3dfa2696f70ef777d6ccc6f6

# c4beb22f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@freescale.com>

FIT: Modify option FIT_SIGNATURE in Kconfig

For FIT signature based approach to work, RSA library needs to be selected.
The FIT_SIGNATURE option in Kconfig is modified to automatically select RSA.
Selecting RSA compiles the RSA library required for image verification.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 45ccec8f 23-Oct-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_USE_PRIVATE_LIBGCC to Kconfig

The private libgcc is supported only on ARM, MIPS, PowerPC, SH, x86.
Those architectures should "select" HAVE_PRIVATE_LIBGCC and
CONFIG_USE_PRIVATE_LIBGCC should depend on it.

Currently, this option is enabled on Tegra boards and x86 architecture.
Move the definition from header files to Kconfig.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Tested-by: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: Tom Warren <twarren@nvidia.com>

# 8c688bc4 23-Oct-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_SYS_HZ to lib/Kconfig

CONFIG_SYS_HZ is always defined as 1000 in config_fallbacks.h
(but some boards still have redundant definitions).

This commit moves the definition and the document in README to
Kconfig. Since lib/Kconfig can assure that CONFIG_SYS_HZ is 1000,
the sanity check in lib/time.c should be removed.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Reviewed-by: Marek Vasut <marex@denx.de>

# b0928da6 16-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED to Kconfig

If this option is enabled, the objects under lib/ directory
are compiled with speed optimization, not size optimization.
(Currently, only used by some Blackfin boards.)

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# ed36323f 16-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: add blank Kconfig files

This would be useful to start moving various config options.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# 27084c03 25-Sep-2019 Simon Glass <sjg@chromium.org>

spl: Allow tiny printf() to be controlled in SPL and TPL

At present there is only one control for this and it is used for both SPL
and TPL. But SPL might have a lot more space than TPL so the extra cost of
a full printf() might be acceptable.

Split the option into two, providing separate SPL and TPL controls. The
TPL setting defaults to the same as SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# 2a51e16b 07-Jun-2019 Tom Rini <trini@konsulko.com>

configs: Make USE_TINY_PRINTF depend on SPL||TPL and be default

The USE_TINY_PRINTF symbol only changes things within SPL and TPL
builds, so make it depend on that support. Next, make it default as
within these cases we should rarely have need of more advanced print
formats outside of the debug context.

To do this, in a few cases we need to correct our Kconfig dependencies
as we had cases of non-SPL targets select'ing this symbol. Finally, in
the case of a few boards we really do need the full printf
functionality.

Signed-off-by: Tom Rini <trini@konsulko.com>

# da0fb5fd 02-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: make call depth limit customizable

Up to now we had hard coded values for the call depth up to which trace
records are created: 200 for early tracing, 15 thereafter. UEFI
applications reach a call depth of 80 or above.

Provide customizing settings for the call trace depth limit and the early
call trace depth limit. Use the old values as defaults.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8509f22a 29-Apr-2019 Marek Behún <marek.behun@nic.cz>

lib: add Zstandard decompression support

Add the zstd library from Linux kernel (only decompression support).
There are minimal changes to build with U-Boot, otherwise the files are
identical to Linux commit dc35da16 from March 2018, the files had not
been touched since in kernel. Also SPDX lincese tags were added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 83a486b6 29-Apr-2019 Marek Behún <marek.behun@nic.cz>

lib: Add xxhash support

This adds the xxhash support from Linux. Files are almost identical to
those added to Linux in commit 5d240522 ("lib: Add xxhash module") (they
haven't been touched since in Linux). The only difference is to add some
includes to be compatible with U-Boot. Also SPDX lincese tags were
added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 5132361a 29-Apr-2019 Heiko Schocher <hs@denx.de>

lib: Kconfig: fix help text for GZIP

commit 95f4bbd581cf ("lib: fdt: Allow LZO and GZIP DT compression in U-Boot")

introduced Kconfig option for gzip in U-Boot, but help text
says gzip for SPL, which is wrong. Fix this.

Signed-off-by: Heiko Schocher <hs@denx.de>
Acked-by: Marek Vasut <marex@denx.de>

# 1c6eb075 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE_BUFFER_SIZE et al to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE_BUFFER_SIZE
CONFIG_TRACE_EARLY_SIZE
CONFIG_TRACE_EARLY
CONFIG_TRACE_EARLY_ADDR

Signed-off-by: Simon Glass <sjg@chromium.org>

# a24a78d7 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE

Signed-off-by: Simon Glass <sjg@chromium.org>

# 54969b40 21-Mar-2019 Thierry Reding <treding@nvidia.com>

fdtdec: Add Kconfig symbol for tests

Runtime tests are provided as a test_fdtdec command implementation. Add
a Kconfig symbol that allows this command to be built so that the tests
can be used.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 95f4bbd5 08-Mar-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

lib: fdt: Allow LZO and GZIP DT compression in U-Boot

Add required Kconfig symbols, Makefile bits and macro fixes in a
few places to support LZO and DT compression in U-Boot. This can
save a lot of space with multi-DTB fitImages.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>

# 6e705114 13-Jan-2019 Chris Packham <judge.packham@gmail.com>

lib: Kconfig: spelling fixes

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 048c6e89 06-Nov-2018 Simon Glass <sjg@chromium.org>

spl: lz4: Allow use of lz4 compression in SPL

In some cases U-Boot is compressed and it is useful to be able to
decompress it in SPL. Add a Kconfig and Makefile change to allow this.
Note that this does not actually implement decompression.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 2895c4b7 15-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

kconfig: Introduce HAVE_ARCH_IOMAP

Introduce a new Kconfig option for architecture codes to control
whether it provides io{read,write}{8,16,32} I/O accessor functions.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5592a633 01-Oct-2018 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt in TPL

In some cases (e.g. sandbox with verified boot) it is useful to support
libfdt in TPL. Update the Kconfig to handle this.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 6307896c 01-Oct-2018 Simon Glass <sjg@chromium.org>

tpm: Add support for SPL and TPL

At present the tpm can only be used in U-Boot proper. Updated it to work
in SPL and TPL also.

Signed-off-by: Simon Glass <sjg@chromium.org>

# ab948cd2 19-Jul-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

fdt_support: make FDT_FIXUP_PARTITIONS depend on CMD_MTDPARTS

fdt_fixup_mtdparts() calls mtdparts_init() and device_find(),
which are defined in cmd/mtdparts.c

The combination of FDT_FIXUP_PARTITIONS=y and CMD_MTDPARTS=n
emits the following link error:

common/fdt_support.c:903: undefined reference to `mtdparts_init'
common/fdt_support.c:914: undefined reference to `device_find'

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 3330584d 03-Jun-2018 Igor Opaniuk <igor.opaniuk@linaro.org>

avb2.0: integrate avb 2.0 into the build system

Integrate libavb into the build system. Introduce CONFIG_LIBAVB
build option.

Signed-off-by: Igor Opaniuk <igor.opaniuk@linaro.org>

# f8c987f8 05-Jun-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

lib: Add hexdump

Often during debugging session it's very interesting to see
what data we were dealing with. For example what we write or read
to/from memory or peripherals.

This change introduces functions that allow to dump binary
data with one simple function invocation like:
------------------->8----------------
print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, buf, len);
------------------->8----------------

which gives us the following:
------------------->8----------------
00000000: f2 b7 c9 88 62 61 75 64 72 61 74 65 3d 31 31 35 ....baudrate=115
00000010: 32 30 30 00 62 6f 6f 74 61 72 67 73 3d 63 6f 6e 200.bootargs=con
00000020: 73 6f 6c 65 3d 74 74 79 53 33 2c 31 31 35 32 30 sole=ttyS3,11520
00000030: 30 6e 38 00 62 6f 6f 74 64 65 6c 61 79 3d 33 00 0n8.bootdelay=3.
00000040: 62 6f 6f 74 66 69 6c 65 3d 75 49 6d 61 67 65 00 bootfile=uImage.
00000050: 66 64 74 63 6f 6e 74 72 6f 6c 61 64 64 72 3d 39 fdtcontroladdr=9
00000060: 66 66 62 31 62 61 30 00 6c 6f 61 64 61 64 64 72 ffb1ba0.loadaddr
00000070: 3d 30 78 38 32 30 30 30 30 30 30 00 73 74 64 65 =0x82000000.stde
00000080: 72 72 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 rr=serial0@e0022
00000090: 30 30 30 00 73 74 64 69 6e 3d 73 65 72 69 61 6c 000.stdin=serial
000000a0: 30 40 65 30 30 32 32 30 30 30 00 73 74 64 6f 75 0@e0022000.stdou
000000b0: 74 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 30 t=serial0@e00220
000000c0: 30 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00..............
...
------------------->8----------------

Source of hexdump.c was copied from Linux kernel v4.7-rc2.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Mario Six <mario.six@gdsys.cc>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Stefan Roese <sr@denx.de>

# c232d14d 29-May-2018 Alex Kiernan <alex.kiernan@gmail.com>

mmc: Separate "mmc swrite" from fastboot

Introduce CONFIG_IMAGE_SPARSE and CONFIG_CMD_MMC_SWRITE so the "mmc
swrite" command is separated from the fastboot code.

Move image-sparse from common to lib so it's clear it's library code.

Rename CONFIG_FASTBOOT_FLASH_FILLBUF_SIZE to CONFIG_IMAGE_SPARSE_FILLBUF_SIZE
and migrate it to Kconfig.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Acked-by: Jassi Brar <jaswinder.singh@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6417572e 08-May-2018 Tom Rini <trini@konsulko.com>

lib/Kconfig: Mark OF_LIBFDT_OVERLAY as depending on OF_LIBFDT

The overlay code is only useful when OF_LIBFDT is set, so mark it as
depending on that first.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 58a46f88 25-Apr-2018 Praneeth Bajjuri <praneeth@ti.com>

configs: TI: Enable FIT Library overlay support

Enable the FDT library overlay support for all TI SOC family.

Without this option, when Loading fdt from FIT image, the
following warning is seen.

"config with overlays but CONFIG_OF_LIBFDT_OVERLAY not set".

Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
Suggested-by: Andrew F.Davis <afd@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>

# 14ad44ab 18-Apr-2018 Alex Kiernan <alex.kiernan@gmail.com>

spl: Split sprintf, strto* from SPL serial in Kconfig

When SPL serial is disabled, callers who need sprintf or strtoul fail
because their inclusion is guarded by CONFIG_SPL_SERIAL_SUPPORT/
CONFIG_TPL_SERIAL_SUPPORT.

Split printf, sprintf and strto into their own entries and then select
all of them if SERIAL_SUPPORT is enabled to match the current behaviour.

Include panic.o unconditionally as it can be called from anywhere which
uses BUG_ON().

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>

# e294ba06 04-Apr-2018 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-sunxi

Signed-off-by: Tom Rini <trini@konsulko.com>


# d14db11d 03-Apr-2018 Andre Przywara <andre.przywara@arm.com>

sunxi: revert disabling of features

In January some commits were introduced to mitigate the U-Boot image
size issues we encountered on sunxi builds.
Now with the MMC environment removed we can bring them back, as we
practically don't have a size limit anymore.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 32ce6179 13-Mar-2018 Bryan O'Donoghue <bryan.odonoghue@linaro.org>

optee: Add lib entries for sharing OPTEE code across ports

This patch adds code to lib to enable sharing of useful OPTEE code between
board-ports and architectures. The code on lib/optee/optee.c comes from the
TI omap2 port. Eventually the OMAP2 code will be patched to include the
shared code. The intention here is to add more useful OPTEE specific code
as more functionality gets added.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Cc: Harinarayan Bhatta <harinarayan@ti.com>
Cc: Andrew F. Davis <afd@ti.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Kever Yang <kever.yang@rock-chips.com>
Cc: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Cc: Peng Fan <peng.fan@nxp.com>
Tested-by: Peng Fan <peng.fan@nxp.com>

# 36c1877c 06-Feb-2018 Faiz Abbas <faiz_abbas@ti.com>

lib: Kconfig: Move DYNAMIC_CRC_TABLE to Kconfig

Add CONFIG prefix to DYNAMIC_CRC_TABLE and implement it in
Kconfig.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>

# a451bc27 05-Feb-2018 Adam Ford <aford173@gmail.com>

Convert LIB_UUID to Kconfig

config_fallback.h has some logic that checks a variety of options
and selects LIB_UUID if it hasn't already been selected. This
will all LIB_UUID in Kconfig and select this option for the list
of options to allow us to remove the logic from fallbacks

Signed-off-by: Adam Ford <aford173@gmail.com>

# a5a37567 06-Feb-2018 Adam Ford <aford173@gmail.com>

Convert CONFIG LIB_HW_RAND to Kconfig

config_fallbacks.h had some logic to automatically select
LIB_RAND if RANDOM_UUID or CMD_UUID were set if LIB_HW_RAND wasn't
already selected. By migrating LIB_HW_RAND to Kconfig, we can
remove this check from config_fallbacks.h and put it into Kconfig

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
[trini: Turn into a choice, add NET_RANDOM_ETHADDR]
Signed-off-by: Tom Rini <trini@konsulko.com>

# acd4d334 16-Jan-2018 Maxime Ripard <maxime.ripard@free-electrons.com>

net: regex: Disable by default on sunXi

The sunXi arm64 build has overflown, leading to the main U-boot binary
overwriting the environment when flashing the new image, or even worse,
overwriting itself when we're calling saveenv.

Disable this option that is not critical until we can adress the issue
properly.

Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 7e3caa81 03-Dec-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

Move CONFIG_PANIC_HANG to Kconfig

Freescale (NXP) boards have lots of defconfig files per board.
I used "imply PANIC_HANG" for them.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# da5337a6 08-Nov-2017 Nandor Han <nandor.han@ge.com>

rtc: add support for s35392a

Add support for S35392A RTC. The driver supports both U-Boot driver
models.

Signed-off-by: Nandor Han <nandor.han@ge.com>
Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
Cc: Heiko Schocher <hs@denx.de>

# f52bdf4b 14-Sep-2017 Jean-Jacques Hiblot <jjhiblot@ti.com>

lib: allow building lzo for the SPL

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 85d8bf57 03-Sep-2017 Marek Behún <marek.behun@nic.cz>

lib: Add CRC32-C

This is needed for BTRFS.

Signed-off-by: Marek Behun <marek.behun@nic.cz>

create mode 100644 lib/crc32c.c

# 7264f292 15-Aug-2017 York Sun <york.sun@nxp.com>

spl: fit: Eanble GZIP support for image decompression

Add Kconfig option SPL_GZIP and SPL_ZLIB to enable gunzip support for
SPL boot, eg. falcon boot compressed kernel image.

Signed-off-by: York Sun <york.sun@nxp.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6ef2f901 11-Aug-2017 Adam Ford <aford173@gmail.com>

Convert CONFIG_BCH to Kconfig

This converts the following to Kconfig:
CONFIG_BCH

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1a7ba1d 18-Aug-2017 Anatolij Gustschin <agust@denx.de>

Fix 'notes' typos

s/notes/nodes

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 96b9082c 03-Aug-2017 Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

rockchip: rk3188: rock: adjust for SPL/TPL split

With the changes to split SPL/TPL for the RK3368, I apparently missed
some needed adjustments to the RK3188 Kconfig and rock_defconfig.

This fixes build-issues for the rock board after applying the RK3368
enablement (and SPL/TPL) set that resulted from TPL_SERIAL_SUPPORT,
TPL_ROCKCHIP_BACK_TO_BROM and TPL_TINY_MEMSET being separate symbols
now.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d56b4b19 22-Jul-2017 Tom Rini <trini@konsulko.com>

configs: Migrate RBTREE, LZO, CMD_MTDPARTS, CMD_UBI and CMD_UBIFS

The above CONFIG options are in Kconfig, and now have correct depends and
inter-dependencies. Migrate these to configs/ from include/configs/. In the
case of CMD_UBIFS also change it to be a default y if CMD_UBI.

Signed-off-by: Tom Rini <trini@konsulko.com>

# aed998aa 17-May-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_LZMA to Kconfig

This converts the following to Kconfig:
CONFIG_LZMA

Signed-off-by: Simon Glass <sjg@chromium.org>

# b1a873df 26-Apr-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_CMD_AES et al to Kconfig

This converts the following to Kconfig:
CONFIG_CMD_AES
CONFIG_AES

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Add select AES to CMD_AES]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 173aafbf 27-Feb-2017 Boris Brezillon <boris.brezillon@free-electrons.com>

cmd: Expose a Kconfig option to enable UBIFS commands

Create a new Kconfig entry to allow CMD_UBIFS selection from Kconfig and
add an hidden LZO option that can be selected by CMD_UBIFS.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>

# aa049152 27-Feb-2017 Boris Brezillon <boris.brezillon@free-electrons.com>

mtd: ubi: Select RBTREE option from MTD_UBI Kconfig entry

Expose the RBTREE feature through Kconfig and select this option from the
MTD_UBI option.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>
[Rebased on master]
Signed-off-by: Jagan Teki <jagan@openedev.com>

# ab4458bd 02-Apr-2017 Simon Glass <sjg@chromium.org>

string: Provide a slimmed-down memset()

Most of the time the optimised memset() is what we want. For extreme
situations such as TPL it may be too large. For example on the 'rock'
board, using a simple loop saves a useful 48 bytes. With gcc 4.9 and
the rodata bug, this patch is enough to reduce the TPL image below the
limit.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>

# bea79d7d 14-Mar-2017 Andre Przywara <andre.przywara@arm.com>

Kconfig: introduce md5sum command selection

So far CONFIG_MD5SUM would need to be set by a board's include file.
Since the command is really generic, move it over to Kconfig to allow
it to be defined by either a board's defconfig, menuconfig or some
config snippet merged via mergeconfig.sh.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e663b350 18-Aug-2016 Alexander Graf <agraf@suse.de>

smbios: Expose in efi_loader as table

We can pass SMBIOS easily as EFI configuration table to an EFI payload. This
patch adds enablement for that case.

While at it, we also enable SMBIOS generation for ARM systems, since they support
EFI_LOADER.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4b6dddc2 18-Aug-2016 Alexander Graf <agraf@suse.de>

x86: Move smbios generation into arch independent directory

We will need the SMBIOS generation function on ARM as well going forward,
so let's move it into a non arch specific location.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# ebf7fff2 05-Oct-2016 Heiko Schocher <hs@denx.de>

spl: move FDT_FIXUP_PARTITIONS to Kconfig

Move FDT_FIXUP_PARTITIONS to Kconfig and cleanup existing
uses.

Signed-off-by: Heiko Schocher <hs@denx.de>

# ddf67f71 05-Jul-2016 Maxime Ripard <maxime.ripard@free-electrons.com>

libfdt: Add overlay application function

The device tree overlays are a good way to deal with user-modifyable
boards or boards with some kind of an expansion mechanism where we can
easily plug new board in (like the BBB, the Raspberry Pi or the CHIP).

Add a new function to merge overlays with a base device tree.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>

# 91b86e21 26-May-2016 Marek Vasut <marex@denx.de>

lib: Enable private libgcc by default

This patch decouples U-Boot binary from the toolchain on systems where
private libgcc is available. Instead of pulling in functions provided
by the libgcc from the toolchain, U-Boot will use it's own set of libgcc
functions. These functions are usually imported from Linux kernel, which
also uses it's own libgcc functions instead of the ones provided by the
toolchain.

This patch solves a rather common problem. The toolchain can usually
generate code for many variants of target architecture and often even
different endianness. The libgcc on the other hand is usually compiled
for one particular configuration and the functions provided by it may
or may not be suited for use in U-Boot. This can manifest in two ways,
either the U-Boot fails to compile altogether and linker will complain
or, in the much worse case, the resulting U-Boot will build, but will
misbehave in very subtle and hard to debug ways.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 67976306 30-Mar-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

cosmetic: Fix typos "privide"

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# ed980b8c 03-Mar-2016 Alexander Graf <agraf@suse.de>

efi_loader: hook up in build environment

Now that we have all the bits and pieces ready for EFI payload loading
support, hook them up in Makefiles and KConfigs so that we can build.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
[trini: Enable only when we of OF_LIBFDT, disable on kwb and colibri_pxa270]
Signed-off-by: Tom Rini <trini@konsulko.com>

# aa34fbc0 22-Feb-2016 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt to be used in SPL

Add an option to enable libfdt in SPL. This can be useful when decoding
FIT files in SPL.

We need to make sure this option is not enabled in SPL by this change.
Also this option needs to be enabled in host builds. Si add a new
IMAGE_USE_LIBFDT #define which can be used in files that are built on the
host but must also build for U-Boot and SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 69e173eb 22-Feb-2016 Simon Glass <sjg@chromium.org>

Move CONFIG_OF_LIBFDT to Kconfig

Move this option to Kconfig and tidy up existing boards.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a187559e 05-Feb-2016 Bin Meng <bmeng.cn@gmail.com>

Use correct spelling of "U-Boot"

Correct spelling of "U-Boot" shall be used in all written text
(documentation, comments in source files etc.).

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Minkyu Kang <mk7.kang@samsung.com>

# 947c626d 14-Jan-2016 Tom Rini <trini@konsulko.com>

vsprintf.c: Always enable CONFIG_SYS_VSNPRINTF

Enabling this function always removes some class of string saftey issues.
The size change here in general is about 400 bytes and this seems a reasonable
trade-off.

Cc: Peng Fan <peng.fan@nxp.com>
Cc: Peter Robinson <pbrobinson@gmail.com>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Adrian Alonso <aalonso@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 7d9cde10 22-Nov-2015 Stefan Roese <sr@denx.de>

lib/tiny-printf.c: Add tiny printf function for space limited environments

This patch adds a small printf() version that supports all basic formats.
Its intented to be used in U-Boot SPL versions on platforms with very
limited internal RAM sizes.

To enable it, just define CONFIG_USE_TINY_PRINTF in your defconfig. This
will result in the SPL using this tiny function and the main U-Boot
still using the full-blown printf() function.

This code was copied from:
http://www.sparetimelabs.com/printfrevisited
With mostly only coding style related changes so that its checkpatch
clean.

The size reduction is about 2.5KiB. Here a comparison for the db-mv784mp-gp
(Marvell AXP) SPL:

Without this patch:
58963 18536 1928 79427 13643 ./spl/u-boot-spl

With this patch:
56542 18536 1956 77034 12cea ./spl/u-boot-spl

Note:
To make it possible to compile tiny-printf.c instead of vsprintf.c when
CONFIG_USE_TINY_PRINTF is defined, the functions printf() and vprintf() are
moved from common/console.c into vsprintf.c in this patch.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>

# 2419cd16 03-Oct-2015 Simon Glass <sjg@chromium.org>

dm: tpm: Drop CONFIG_DM_TPM

Now that all TPM drivers use driver model, we can drop the special driver
model CONFIG option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>

# 027b728d 06-Oct-2015 Julius Werner <jwerner@chromium.org>

Add support for LZ4 decompression algorithm

This patch adds support for LZ4-compressed FIT image contents. This
algorithm has a slightly worse compression ration than LZO while being
nearly twice as fast to decompress. When loading images from a fast
storage medium this usually results in a boot time win.

Sandbox-tested only since I don't have a U-Boot development system set
up right now. The code was imported unchanged from coreboot where it's
proven to work, though. I'm mostly interested in getting this recognized
by mkImage for use in a downstream project.

Signed-off-by: Julius Werner <jwerner@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# a7d660bc 22-Aug-2015 Simon Glass <sjg@chromium.org>

tpm: Add Kconfig options for TPMs

Add new Kconfig options for TPMs in preparation for moving boards to use
Kconfig for TPM configuration.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 867a6ac8 31-Jul-2015 Simon Glass <sjg@chromium.org>

efi: Add start-up library code

When running as an EFI application, U-Boot must request memory from EFI,
and provide access to the boot services U-Boot needs.

Add library code to perform these tasks. This includes efi_main() which is
the entry point from EFI. U-Boot is built as a shared library.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d1389403 23-Jun-2015 Simon Glass <sjg@chromium.org>

Add a dhrystone benchmark command

Drystone provides a convenient sanity check that the CPU is running at full
speed. Add this as a command which can be enabled as needed.

Note: I investigated using Coremark for this but there was a license
agreement and I could not work out if it was GPL-compatible.

Signed-off-by: Simon Glass <sjg@chromium.org>

# f7848d90 22-Jun-2015 Joe Hershberger <joe.hershberger@ni.com>

Allow CONFIG_REGEX to be disabled when CONFIG_NET

Instead of selecting REGEX when NET is enabled, make it the default, but
allow boards that are tiny to disable it and lose functionality on all
but the first Ethernet adapter.

cm-bf548, bf538f-ezkit, and bf533-stamp need this. None appear to have
more than one Ethernet interface.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# 3850dbe8 11-Jun-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

blackfin: fix undefined reference to srand and rand

Commit 9ba9e85f3f1c (net: Fix NET_RANDOM_ETHADDR dependencies)
accidentally dropped CONFIG_LIB_RAND defines for 14 Blackfin boards.

Prior to that commit, those boards defined CONFIG_LIB_RAND, but not
CONFIG_NET_RANDOM_ETHADDR. So, commit 9ba9e85f3f1c should not have
touched them, but in fact it ripped CONFIG_LIB_RAND off from all the
header files, which caused undefined reference to srand and rand.
CONFIG_LIB_RAND=y must be revived for such boards.

BTW, this commit indeed makes it better, but even with this fix,
three boards (bf533-stamp, bf538f-ezkit, cm-bf548) still can not
build due to region 'ram' overflowed error. This was cause by
commit 6eed3786c68c (net: Move the CMD_NET config to defconfigs)
because CMD_NET selects NET, and NET selects REGEX. Eventually,
some boards were newly enabled with CONFIG_REGEX, increasing the
memory footprint. A patch is expected to fix the build error.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 9ba9e85f 25-May-2015 Michal Simek <michal.simek@xilinx.com>

net: Fix NET_RANDOM_ETHADDR dependencies

NET_RANDOM_ETHADDR depends on lib/rand.c. This patch adds dependency to
Kconfig to ensure that library is also compiled.

Remove the definitions from Blackfin boards' include/configs.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 6501ff62 20-Apr-2015 Przemyslaw Marczak <p.marczak@samsung.com>

lib: Kconfig: add entry for errno_str() function

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1a60650c 21-Apr-2015 Joe Hershberger <joe.hershberger@ni.com>

kconfig: Move REGEX to Kconfig

Having this as a Kconfig allows it to be a dependent feature.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8156345d 06-Mar-2015 Simon Glass <sjg@chromium.org>

sandbox: Move CONFIG_SYS_VSNPRINTF to Kconfig

Move this over to Kconfig and tidy up.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 94e3c8c4 19-Feb-2015 gaurav rana <gaurav.rana@freescale.com>

crypto/fsl - Add progressive hashing support using hardware acceleration.

Currently only normal hashing is supported using hardware acceleration.
Added support for progressive hashing using hardware.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
Signed-off-by: Gaurav Rana <gaurav.rana@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>

# d9f23c7f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@freescale.com>

lib/rsa: Add Kconfig for devices supporting RSA Modular Exponentiation

Kconfig option added for devices which support RSA Verification.
1. RSA_SOFTWARE_EXP
Enables driver for supporting RSA Modular Exponentiation in Software
2. RSA_FREESCALE_EXP
Enables driver for supporting RSA Modular Exponentiation using Freescale specific
driver

The above drivers use RSA uclass

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
(Removed duplicate line in Kconfig comment)

Change-Id: I7663c4d5350e2bfc3dfa2696f70ef777d6ccc6f6

# c4beb22f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@freescale.com>

FIT: Modify option FIT_SIGNATURE in Kconfig

For FIT signature based approach to work, RSA library needs to be selected.
The FIT_SIGNATURE option in Kconfig is modified to automatically select RSA.
Selecting RSA compiles the RSA library required for image verification.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 45ccec8f 23-Oct-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_USE_PRIVATE_LIBGCC to Kconfig

The private libgcc is supported only on ARM, MIPS, PowerPC, SH, x86.
Those architectures should "select" HAVE_PRIVATE_LIBGCC and
CONFIG_USE_PRIVATE_LIBGCC should depend on it.

Currently, this option is enabled on Tegra boards and x86 architecture.
Move the definition from header files to Kconfig.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Tested-by: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: Tom Warren <twarren@nvidia.com>

# 8c688bc4 23-Oct-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_SYS_HZ to lib/Kconfig

CONFIG_SYS_HZ is always defined as 1000 in config_fallbacks.h
(but some boards still have redundant definitions).

This commit moves the definition and the document in README to
Kconfig. Since lib/Kconfig can assure that CONFIG_SYS_HZ is 1000,
the sanity check in lib/time.c should be removed.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Reviewed-by: Marek Vasut <marex@denx.de>

# b0928da6 16-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED to Kconfig

If this option is enabled, the objects under lib/ directory
are compiled with speed optimization, not size optimization.
(Currently, only used by some Blackfin boards.)

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# ed36323f 16-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: add blank Kconfig files

This would be useful to start moving various config options.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# 2a51e16b 07-Jun-2019 Tom Rini <trini@konsulko.com>

configs: Make USE_TINY_PRINTF depend on SPL||TPL and be default

The USE_TINY_PRINTF symbol only changes things within SPL and TPL
builds, so make it depend on that support. Next, make it default as
within these cases we should rarely have need of more advanced print
formats outside of the debug context.

To do this, in a few cases we need to correct our Kconfig dependencies
as we had cases of non-SPL targets select'ing this symbol. Finally, in
the case of a few boards we really do need the full printf
functionality.

Signed-off-by: Tom Rini <trini@konsulko.com>

# da0fb5fd 02-Jun-2019 Heinrich Schuchardt <xypron.glpk@gmx.de>

trace: make call depth limit customizable

Up to now we had hard coded values for the call depth up to which trace
records are created: 200 for early tracing, 15 thereafter. UEFI
applications reach a call depth of 80 or above.

Provide customizing settings for the call trace depth limit and the early
call trace depth limit. Use the old values as defaults.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8509f22a 29-Apr-2019 Marek Behún <marek.behun@nic.cz>

lib: add Zstandard decompression support

Add the zstd library from Linux kernel (only decompression support).
There are minimal changes to build with U-Boot, otherwise the files are
identical to Linux commit dc35da16 from March 2018, the files had not
been touched since in kernel. Also SPDX lincese tags were added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 83a486b6 29-Apr-2019 Marek Behún <marek.behun@nic.cz>

lib: Add xxhash support

This adds the xxhash support from Linux. Files are almost identical to
those added to Linux in commit 5d240522 ("lib: Add xxhash module") (they
haven't been touched since in Linux). The only difference is to add some
includes to be compatible with U-Boot. Also SPDX lincese tags were
added.

Signed-off-by: Marek Behún <marek.behun@nic.cz>

# 5132361a 29-Apr-2019 Heiko Schocher <hs@denx.de>

lib: Kconfig: fix help text for GZIP

commit 95f4bbd581cf ("lib: fdt: Allow LZO and GZIP DT compression in U-Boot")

introduced Kconfig option for gzip in U-Boot, but help text
says gzip for SPL, which is wrong. Fix this.

Signed-off-by: Heiko Schocher <hs@denx.de>
Acked-by: Marek Vasut <marex@denx.de>

# 1c6eb075 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE_BUFFER_SIZE et al to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE_BUFFER_SIZE
CONFIG_TRACE_EARLY_SIZE
CONFIG_TRACE_EARLY
CONFIG_TRACE_EARLY_ADDR

Signed-off-by: Simon Glass <sjg@chromium.org>

# a24a78d7 08-Apr-2019 Simon Glass <sjg@chromium.org>

Convert CONFIG_TRACE to Kconfig

This converts the following to Kconfig:
CONFIG_TRACE

Signed-off-by: Simon Glass <sjg@chromium.org>

# 54969b40 21-Mar-2019 Thierry Reding <treding@nvidia.com>

fdtdec: Add Kconfig symbol for tests

Runtime tests are provided as a test_fdtdec command implementation. Add
a Kconfig symbol that allows this command to be built so that the tests
can be used.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 95f4bbd5 08-Mar-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

lib: fdt: Allow LZO and GZIP DT compression in U-Boot

Add required Kconfig symbols, Makefile bits and macro fixes in a
few places to support LZO and DT compression in U-Boot. This can
save a lot of space with multi-DTB fitImages.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>

# 6e705114 13-Jan-2019 Chris Packham <judge.packham@gmail.com>

lib: Kconfig: spelling fixes

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 048c6e89 06-Nov-2018 Simon Glass <sjg@chromium.org>

spl: lz4: Allow use of lz4 compression in SPL

In some cases U-Boot is compressed and it is useful to be able to
decompress it in SPL. Add a Kconfig and Makefile change to allow this.
Note that this does not actually implement decompression.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 2895c4b7 15-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

kconfig: Introduce HAVE_ARCH_IOMAP

Introduce a new Kconfig option for architecture codes to control
whether it provides io{read,write}{8,16,32} I/O accessor functions.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 5592a633 01-Oct-2018 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt in TPL

In some cases (e.g. sandbox with verified boot) it is useful to support
libfdt in TPL. Update the Kconfig to handle this.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 6307896c 01-Oct-2018 Simon Glass <sjg@chromium.org>

tpm: Add support for SPL and TPL

At present the tpm can only be used in U-Boot proper. Updated it to work
in SPL and TPL also.

Signed-off-by: Simon Glass <sjg@chromium.org>

# ab948cd2 19-Jul-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

fdt_support: make FDT_FIXUP_PARTITIONS depend on CMD_MTDPARTS

fdt_fixup_mtdparts() calls mtdparts_init() and device_find(),
which are defined in cmd/mtdparts.c

The combination of FDT_FIXUP_PARTITIONS=y and CMD_MTDPARTS=n
emits the following link error:

common/fdt_support.c:903: undefined reference to `mtdparts_init'
common/fdt_support.c:914: undefined reference to `device_find'

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 3330584d 03-Jun-2018 Igor Opaniuk <igor.opaniuk@linaro.org>

avb2.0: integrate avb 2.0 into the build system

Integrate libavb into the build system. Introduce CONFIG_LIBAVB
build option.

Signed-off-by: Igor Opaniuk <igor.opaniuk@linaro.org>

# f8c987f8 05-Jun-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

lib: Add hexdump

Often during debugging session it's very interesting to see
what data we were dealing with. For example what we write or read
to/from memory or peripherals.

This change introduces functions that allow to dump binary
data with one simple function invocation like:
------------------->8----------------
print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, buf, len);
------------------->8----------------

which gives us the following:
------------------->8----------------
00000000: f2 b7 c9 88 62 61 75 64 72 61 74 65 3d 31 31 35 ....baudrate=115
00000010: 32 30 30 00 62 6f 6f 74 61 72 67 73 3d 63 6f 6e 200.bootargs=con
00000020: 73 6f 6c 65 3d 74 74 79 53 33 2c 31 31 35 32 30 sole=ttyS3,11520
00000030: 30 6e 38 00 62 6f 6f 74 64 65 6c 61 79 3d 33 00 0n8.bootdelay=3.
00000040: 62 6f 6f 74 66 69 6c 65 3d 75 49 6d 61 67 65 00 bootfile=uImage.
00000050: 66 64 74 63 6f 6e 74 72 6f 6c 61 64 64 72 3d 39 fdtcontroladdr=9
00000060: 66 66 62 31 62 61 30 00 6c 6f 61 64 61 64 64 72 ffb1ba0.loadaddr
00000070: 3d 30 78 38 32 30 30 30 30 30 30 00 73 74 64 65 =0x82000000.stde
00000080: 72 72 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 rr=serial0@e0022
00000090: 30 30 30 00 73 74 64 69 6e 3d 73 65 72 69 61 6c 000.stdin=serial
000000a0: 30 40 65 30 30 32 32 30 30 30 00 73 74 64 6f 75 0@e0022000.stdou
000000b0: 74 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 30 t=serial0@e00220
000000c0: 30 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00..............
...
------------------->8----------------

Source of hexdump.c was copied from Linux kernel v4.7-rc2.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Mario Six <mario.six@gdsys.cc>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Stefan Roese <sr@denx.de>

# c232d14d 29-May-2018 Alex Kiernan <alex.kiernan@gmail.com>

mmc: Separate "mmc swrite" from fastboot

Introduce CONFIG_IMAGE_SPARSE and CONFIG_CMD_MMC_SWRITE so the "mmc
swrite" command is separated from the fastboot code.

Move image-sparse from common to lib so it's clear it's library code.

Rename CONFIG_FASTBOOT_FLASH_FILLBUF_SIZE to CONFIG_IMAGE_SPARSE_FILLBUF_SIZE
and migrate it to Kconfig.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Acked-by: Jassi Brar <jaswinder.singh@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6417572e 08-May-2018 Tom Rini <trini@konsulko.com>

lib/Kconfig: Mark OF_LIBFDT_OVERLAY as depending on OF_LIBFDT

The overlay code is only useful when OF_LIBFDT is set, so mark it as
depending on that first.

Signed-off-by: Tom Rini <trini@konsulko.com>

# 58a46f88 25-Apr-2018 Praneeth Bajjuri <praneeth@ti.com>

configs: TI: Enable FIT Library overlay support

Enable the FDT library overlay support for all TI SOC family.

Without this option, when Loading fdt from FIT image, the
following warning is seen.

"config with overlays but CONFIG_OF_LIBFDT_OVERLAY not set".

Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
Suggested-by: Andrew F.Davis <afd@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>

# 14ad44ab 18-Apr-2018 Alex Kiernan <alex.kiernan@gmail.com>

spl: Split sprintf, strto* from SPL serial in Kconfig

When SPL serial is disabled, callers who need sprintf or strtoul fail
because their inclusion is guarded by CONFIG_SPL_SERIAL_SUPPORT/
CONFIG_TPL_SERIAL_SUPPORT.

Split printf, sprintf and strto into their own entries and then select
all of them if SERIAL_SUPPORT is enabled to match the current behaviour.

Include panic.o unconditionally as it can be called from anywhere which
uses BUG_ON().

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>

# e294ba06 04-Apr-2018 Tom Rini <trini@konsulko.com>

Merge git://git.denx.de/u-boot-sunxi

Signed-off-by: Tom Rini <trini@konsulko.com>


# d14db11d 03-Apr-2018 Andre Przywara <andre.przywara@arm.com>

sunxi: revert disabling of features

In January some commits were introduced to mitigate the U-Boot image
size issues we encountered on sunxi builds.
Now with the MMC environment removed we can bring them back, as we
practically don't have a size limit anymore.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 32ce6179 13-Mar-2018 Bryan O'Donoghue <bryan.odonoghue@linaro.org>

optee: Add lib entries for sharing OPTEE code across ports

This patch adds code to lib to enable sharing of useful OPTEE code between
board-ports and architectures. The code on lib/optee/optee.c comes from the
TI omap2 port. Eventually the OMAP2 code will be patched to include the
shared code. The intention here is to add more useful OPTEE specific code
as more functionality gets added.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Cc: Harinarayan Bhatta <harinarayan@ti.com>
Cc: Andrew F. Davis <afd@ti.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Kever Yang <kever.yang@rock-chips.com>
Cc: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Cc: Peng Fan <peng.fan@nxp.com>
Tested-by: Peng Fan <peng.fan@nxp.com>

# 36c1877c 06-Feb-2018 Faiz Abbas <faiz_abbas@ti.com>

lib: Kconfig: Move DYNAMIC_CRC_TABLE to Kconfig

Add CONFIG prefix to DYNAMIC_CRC_TABLE and implement it in
Kconfig.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>

# a451bc27 05-Feb-2018 Adam Ford <aford173@gmail.com>

Convert LIB_UUID to Kconfig

config_fallback.h has some logic that checks a variety of options
and selects LIB_UUID if it hasn't already been selected. This
will all LIB_UUID in Kconfig and select this option for the list
of options to allow us to remove the logic from fallbacks

Signed-off-by: Adam Ford <aford173@gmail.com>

# a5a37567 06-Feb-2018 Adam Ford <aford173@gmail.com>

Convert CONFIG LIB_HW_RAND to Kconfig

config_fallbacks.h had some logic to automatically select
LIB_RAND if RANDOM_UUID or CMD_UUID were set if LIB_HW_RAND wasn't
already selected. By migrating LIB_HW_RAND to Kconfig, we can
remove this check from config_fallbacks.h and put it into Kconfig

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
[trini: Turn into a choice, add NET_RANDOM_ETHADDR]
Signed-off-by: Tom Rini <trini@konsulko.com>

# acd4d334 16-Jan-2018 Maxime Ripard <maxime.ripard@free-electrons.com>

net: regex: Disable by default on sunXi

The sunXi arm64 build has overflown, leading to the main U-boot binary
overwriting the environment when flashing the new image, or even worse,
overwriting itself when we're calling saveenv.

Disable this option that is not critical until we can adress the issue
properly.

Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>

# 7e3caa81 03-Dec-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

Move CONFIG_PANIC_HANG to Kconfig

Freescale (NXP) boards have lots of defconfig files per board.
I used "imply PANIC_HANG" for them.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: York Sun <york.sun@nxp.com>

# da5337a6 08-Nov-2017 Nandor Han <nandor.han@ge.com>

rtc: add support for s35392a

Add support for S35392A RTC. The driver supports both U-Boot driver
models.

Signed-off-by: Nandor Han <nandor.han@ge.com>
Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
Cc: Heiko Schocher <hs@denx.de>

# f52bdf4b 14-Sep-2017 Jean-Jacques Hiblot <jjhiblot@ti.com>

lib: allow building lzo for the SPL

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 85d8bf57 03-Sep-2017 Marek Behún <marek.behun@nic.cz>

lib: Add CRC32-C

This is needed for BTRFS.

Signed-off-by: Marek Behun <marek.behun@nic.cz>

create mode 100644 lib/crc32c.c

# 7264f292 15-Aug-2017 York Sun <york.sun@nxp.com>

spl: fit: Eanble GZIP support for image decompression

Add Kconfig option SPL_GZIP and SPL_ZLIB to enable gunzip support for
SPL boot, eg. falcon boot compressed kernel image.

Signed-off-by: York Sun <york.sun@nxp.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 6ef2f901 11-Aug-2017 Adam Ford <aford173@gmail.com>

Convert CONFIG_BCH to Kconfig

This converts the following to Kconfig:
CONFIG_BCH

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# f1a7ba1d 18-Aug-2017 Anatolij Gustschin <agust@denx.de>

Fix 'notes' typos

s/notes/nodes

Signed-off-by: Anatolij Gustschin <agust@denx.de>

# 96b9082c 03-Aug-2017 Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

rockchip: rk3188: rock: adjust for SPL/TPL split

With the changes to split SPL/TPL for the RK3368, I apparently missed
some needed adjustments to the RK3188 Kconfig and rock_defconfig.

This fixes build-issues for the rock board after applying the RK3368
enablement (and SPL/TPL) set that resulted from TPL_SERIAL_SUPPORT,
TPL_ROCKCHIP_BACK_TO_BROM and TPL_TINY_MEMSET being separate symbols
now.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# d56b4b19 22-Jul-2017 Tom Rini <trini@konsulko.com>

configs: Migrate RBTREE, LZO, CMD_MTDPARTS, CMD_UBI and CMD_UBIFS

The above CONFIG options are in Kconfig, and now have correct depends and
inter-dependencies. Migrate these to configs/ from include/configs/. In the
case of CMD_UBIFS also change it to be a default y if CMD_UBI.

Signed-off-by: Tom Rini <trini@konsulko.com>

# aed998aa 17-May-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_LZMA to Kconfig

This converts the following to Kconfig:
CONFIG_LZMA

Signed-off-by: Simon Glass <sjg@chromium.org>

# b1a873df 26-Apr-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_CMD_AES et al to Kconfig

This converts the following to Kconfig:
CONFIG_CMD_AES
CONFIG_AES

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Add select AES to CMD_AES]
Signed-off-by: Tom Rini <trini@konsulko.com>

# 173aafbf 27-Feb-2017 Boris Brezillon <boris.brezillon@free-electrons.com>

cmd: Expose a Kconfig option to enable UBIFS commands

Create a new Kconfig entry to allow CMD_UBIFS selection from Kconfig and
add an hidden LZO option that can be selected by CMD_UBIFS.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>

# aa049152 27-Feb-2017 Boris Brezillon <boris.brezillon@free-electrons.com>

mtd: ubi: Select RBTREE option from MTD_UBI Kconfig entry

Expose the RBTREE feature through Kconfig and select this option from the
MTD_UBI option.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>
[Rebased on master]
Signed-off-by: Jagan Teki <jagan@openedev.com>

# ab4458bd 02-Apr-2017 Simon Glass <sjg@chromium.org>

string: Provide a slimmed-down memset()

Most of the time the optimised memset() is what we want. For extreme
situations such as TPL it may be too large. For example on the 'rock'
board, using a simple loop saves a useful 48 bytes. With gcc 4.9 and
the rodata bug, this patch is enough to reduce the TPL image below the
limit.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>

# bea79d7d 14-Mar-2017 Andre Przywara <andre.przywara@arm.com>

Kconfig: introduce md5sum command selection

So far CONFIG_MD5SUM would need to be set by a board's include file.
Since the command is really generic, move it over to Kconfig to allow
it to be defined by either a board's defconfig, menuconfig or some
config snippet merged via mergeconfig.sh.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# e663b350 18-Aug-2016 Alexander Graf <agraf@suse.de>

smbios: Expose in efi_loader as table

We can pass SMBIOS easily as EFI configuration table to an EFI payload. This
patch adds enablement for that case.

While at it, we also enable SMBIOS generation for ARM systems, since they support
EFI_LOADER.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 4b6dddc2 18-Aug-2016 Alexander Graf <agraf@suse.de>

x86: Move smbios generation into arch independent directory

We will need the SMBIOS generation function on ARM as well going forward,
so let's move it into a non arch specific location.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# ebf7fff2 05-Oct-2016 Heiko Schocher <hs@denx.de>

spl: move FDT_FIXUP_PARTITIONS to Kconfig

Move FDT_FIXUP_PARTITIONS to Kconfig and cleanup existing
uses.

Signed-off-by: Heiko Schocher <hs@denx.de>

# ddf67f71 05-Jul-2016 Maxime Ripard <maxime.ripard@free-electrons.com>

libfdt: Add overlay application function

The device tree overlays are a good way to deal with user-modifyable
boards or boards with some kind of an expansion mechanism where we can
easily plug new board in (like the BBB, the Raspberry Pi or the CHIP).

Add a new function to merge overlays with a base device tree.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>

# 91b86e21 26-May-2016 Marek Vasut <marex@denx.de>

lib: Enable private libgcc by default

This patch decouples U-Boot binary from the toolchain on systems where
private libgcc is available. Instead of pulling in functions provided
by the libgcc from the toolchain, U-Boot will use it's own set of libgcc
functions. These functions are usually imported from Linux kernel, which
also uses it's own libgcc functions instead of the ones provided by the
toolchain.

This patch solves a rather common problem. The toolchain can usually
generate code for many variants of target architecture and often even
different endianness. The libgcc on the other hand is usually compiled
for one particular configuration and the functions provided by it may
or may not be suited for use in U-Boot. This can manifest in two ways,
either the U-Boot fails to compile altogether and linker will complain
or, in the much worse case, the resulting U-Boot will build, but will
misbehave in very subtle and hard to debug ways.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Tom Rini <trini@konsulko.com>

# 67976306 30-Mar-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

cosmetic: Fix typos "privide"

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# ed980b8c 03-Mar-2016 Alexander Graf <agraf@suse.de>

efi_loader: hook up in build environment

Now that we have all the bits and pieces ready for EFI payload loading
support, hook them up in Makefiles and KConfigs so that we can build.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
[trini: Enable only when we of OF_LIBFDT, disable on kwb and colibri_pxa270]
Signed-off-by: Tom Rini <trini@konsulko.com>

# aa34fbc0 22-Feb-2016 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt to be used in SPL

Add an option to enable libfdt in SPL. This can be useful when decoding
FIT files in SPL.

We need to make sure this option is not enabled in SPL by this change.
Also this option needs to be enabled in host builds. Si add a new
IMAGE_USE_LIBFDT #define which can be used in files that are built on the
host but must also build for U-Boot and SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 69e173eb 22-Feb-2016 Simon Glass <sjg@chromium.org>

Move CONFIG_OF_LIBFDT to Kconfig

Move this option to Kconfig and tidy up existing boards.

Signed-off-by: Simon Glass <sjg@chromium.org>

# a187559e 05-Feb-2016 Bin Meng <bmeng.cn@gmail.com>

Use correct spelling of "U-Boot"

Correct spelling of "U-Boot" shall be used in all written text
(documentation, comments in source files etc.).

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Minkyu Kang <mk7.kang@samsung.com>

# 947c626d 14-Jan-2016 Tom Rini <trini@konsulko.com>

vsprintf.c: Always enable CONFIG_SYS_VSNPRINTF

Enabling this function always removes some class of string saftey issues.
The size change here in general is about 400 bytes and this seems a reasonable
trade-off.

Cc: Peng Fan <peng.fan@nxp.com>
Cc: Peter Robinson <pbrobinson@gmail.com>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Adrian Alonso <aalonso@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 7d9cde10 22-Nov-2015 Stefan Roese <sr@denx.de>

lib/tiny-printf.c: Add tiny printf function for space limited environments

This patch adds a small printf() version that supports all basic formats.
Its intented to be used in U-Boot SPL versions on platforms with very
limited internal RAM sizes.

To enable it, just define CONFIG_USE_TINY_PRINTF in your defconfig. This
will result in the SPL using this tiny function and the main U-Boot
still using the full-blown printf() function.

This code was copied from:
http://www.sparetimelabs.com/printfrevisited
With mostly only coding style related changes so that its checkpatch
clean.

The size reduction is about 2.5KiB. Here a comparison for the db-mv784mp-gp
(Marvell AXP) SPL:

Without this patch:
58963 18536 1928 79427 13643 ./spl/u-boot-spl

With this patch:
56542 18536 1956 77034 12cea ./spl/u-boot-spl

Note:
To make it possible to compile tiny-printf.c instead of vsprintf.c when
CONFIG_USE_TINY_PRINTF is defined, the functions printf() and vprintf() are
moved from common/console.c into vsprintf.c in this patch.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>

# 2419cd16 03-Oct-2015 Simon Glass <sjg@chromium.org>

dm: tpm: Drop CONFIG_DM_TPM

Now that all TPM drivers use driver model, we can drop the special driver
model CONFIG option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>

# 027b728d 06-Oct-2015 Julius Werner <jwerner@chromium.org>

Add support for LZ4 decompression algorithm

This patch adds support for LZ4-compressed FIT image contents. This
algorithm has a slightly worse compression ration than LZO while being
nearly twice as fast to decompress. When loading images from a fast
storage medium this usually results in a boot time win.

Sandbox-tested only since I don't have a U-Boot development system set
up right now. The code was imported unchanged from coreboot where it's
proven to work, though. I'm mostly interested in getting this recognized
by mkImage for use in a downstream project.

Signed-off-by: Julius Werner <jwerner@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# a7d660bc 22-Aug-2015 Simon Glass <sjg@chromium.org>

tpm: Add Kconfig options for TPMs

Add new Kconfig options for TPMs in preparation for moving boards to use
Kconfig for TPM configuration.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>
Reviewed-by: Heiko Schocher <hs@denx.de>

# 867a6ac8 31-Jul-2015 Simon Glass <sjg@chromium.org>

efi: Add start-up library code

When running as an EFI application, U-Boot must request memory from EFI,
and provide access to the boot services U-Boot needs.

Add library code to perform these tasks. This includes efi_main() which is
the entry point from EFI. U-Boot is built as a shared library.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d1389403 23-Jun-2015 Simon Glass <sjg@chromium.org>

Add a dhrystone benchmark command

Drystone provides a convenient sanity check that the CPU is running at full
speed. Add this as a command which can be enabled as needed.

Note: I investigated using Coremark for this but there was a license
agreement and I could not work out if it was GPL-compatible.

Signed-off-by: Simon Glass <sjg@chromium.org>

# f7848d90 22-Jun-2015 Joe Hershberger <joe.hershberger@ni.com>

Allow CONFIG_REGEX to be disabled when CONFIG_NET

Instead of selecting REGEX when NET is enabled, make it the default, but
allow boards that are tiny to disable it and lose functionality on all
but the first Ethernet adapter.

cm-bf548, bf538f-ezkit, and bf533-stamp need this. None appear to have
more than one Ethernet interface.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

# 3850dbe8 11-Jun-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

blackfin: fix undefined reference to srand and rand

Commit 9ba9e85f3f1c (net: Fix NET_RANDOM_ETHADDR dependencies)
accidentally dropped CONFIG_LIB_RAND defines for 14 Blackfin boards.

Prior to that commit, those boards defined CONFIG_LIB_RAND, but not
CONFIG_NET_RANDOM_ETHADDR. So, commit 9ba9e85f3f1c should not have
touched them, but in fact it ripped CONFIG_LIB_RAND off from all the
header files, which caused undefined reference to srand and rand.
CONFIG_LIB_RAND=y must be revived for such boards.

BTW, this commit indeed makes it better, but even with this fix,
three boards (bf533-stamp, bf538f-ezkit, cm-bf548) still can not
build due to region 'ram' overflowed error. This was cause by
commit 6eed3786c68c (net: Move the CMD_NET config to defconfigs)
because CMD_NET selects NET, and NET selects REGEX. Eventually,
some boards were newly enabled with CONFIG_REGEX, increasing the
memory footprint. A patch is expected to fix the build error.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 9ba9e85f 25-May-2015 Michal Simek <michal.simek@xilinx.com>

net: Fix NET_RANDOM_ETHADDR dependencies

NET_RANDOM_ETHADDR depends on lib/rand.c. This patch adds dependency to
Kconfig to ensure that library is also compiled.

Remove the definitions from Blackfin boards' include/configs.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

# 6501ff62 20-Apr-2015 Przemyslaw Marczak <p.marczak@samsung.com>

lib: Kconfig: add entry for errno_str() function

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 1a60650c 21-Apr-2015 Joe Hershberger <joe.hershberger@ni.com>

kconfig: Move REGEX to Kconfig

Having this as a Kconfig allows it to be a dependent feature.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 8156345d 06-Mar-2015 Simon Glass <sjg@chromium.org>

sandbox: Move CONFIG_SYS_VSNPRINTF to Kconfig

Move this over to Kconfig and tidy up.

Signed-off-by: Simon Glass <sjg@chromium.org>

# 94e3c8c4 19-Feb-2015 gaurav rana <gaurav.rana@freescale.com>

crypto/fsl - Add progressive hashing support using hardware acceleration.

Currently only normal hashing is supported using hardware acceleration.
Added support for progressive hashing using hardware.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
Signed-off-by: Gaurav Rana <gaurav.rana@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>

# d9f23c7f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@freescale.com>

lib/rsa: Add Kconfig for devices supporting RSA Modular Exponentiation

Kconfig option added for devices which support RSA Verification.
1. RSA_SOFTWARE_EXP
Enables driver for supporting RSA Modular Exponentiation in Software
2. RSA_FREESCALE_EXP
Enables driver for supporting RSA Modular Exponentiation using Freescale specific
driver

The above drivers use RSA uclass

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
(Removed duplicate line in Kconfig comment)

Change-Id: I7663c4d5350e2bfc3dfa2696f70ef777d6ccc6f6

# c4beb22f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@freescale.com>

FIT: Modify option FIT_SIGNATURE in Kconfig

For FIT signature based approach to work, RSA library needs to be selected.
The FIT_SIGNATURE option in Kconfig is modified to automatically select RSA.
Selecting RSA compiles the RSA library required for image verification.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>

# 45ccec8f 23-Oct-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_USE_PRIVATE_LIBGCC to Kconfig

The private libgcc is supported only on ARM, MIPS, PowerPC, SH, x86.
Those architectures should "select" HAVE_PRIVATE_LIBGCC and
CONFIG_USE_PRIVATE_LIBGCC should depend on it.

Currently, this option is enabled on Tegra boards and x86 architecture.
Move the definition from header files to Kconfig.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Tested-by: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: Tom Warren <twarren@nvidia.com>

# 8c688bc4 23-Oct-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_SYS_HZ to lib/Kconfig

CONFIG_SYS_HZ is always defined as 1000 in config_fallbacks.h
(but some boards still have redundant definitions).

This commit moves the definition and the document in README to
Kconfig. Since lib/Kconfig can assure that CONFIG_SYS_HZ is 1000,
the sanity check in lib/time.c should be removed.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Reviewed-by: Marek Vasut <marex@denx.de>

# b0928da6 16-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED to Kconfig

If this option is enabled, the objects under lib/ directory
are compiled with speed optimization, not size optimization.
(Currently, only used by some Blackfin boards.)

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# ed36323f 16-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: add blank Kconfig files

This would be useful to start moving various config options.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

# 048c6e89 06-Nov-2018 Simon Glass <sjg@chromium.org>

spl: lz4: Allow use of lz4 compression in SPL

In some cases U-Boot is compressed and it is useful to be able to
decompress it in SPL. Add a Kconfig and Makefile change to allow this.
Note that this does not actually implement decompression.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 2895c4b7 15-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

kconfig: Introduce HAVE_ARCH_IOMAP

Introduce a new Kconfig option for architecture codes to control
whether it provides io{read,write}{8,16,32} I/O accessor functions.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>


# 5592a633 01-Oct-2018 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt in TPL

In some cases (e.g. sandbox with verified boot) it is useful to support
libfdt in TPL. Update the Kconfig to handle this.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 6307896c 01-Oct-2018 Simon Glass <sjg@chromium.org>

tpm: Add support for SPL and TPL

At present the tpm can only be used in U-Boot proper. Updated it to work
in SPL and TPL also.

Signed-off-by: Simon Glass <sjg@chromium.org>


# ab948cd2 19-Jul-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

fdt_support: make FDT_FIXUP_PARTITIONS depend on CMD_MTDPARTS

fdt_fixup_mtdparts() calls mtdparts_init() and device_find(),
which are defined in cmd/mtdparts.c

The combination of FDT_FIXUP_PARTITIONS=y and CMD_MTDPARTS=n
emits the following link error:

common/fdt_support.c:903: undefined reference to `mtdparts_init'
common/fdt_support.c:914: undefined reference to `device_find'

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>


# 3330584d 03-Jun-2018 Igor Opaniuk <igor.opaniuk@linaro.org>

avb2.0: integrate avb 2.0 into the build system

Integrate libavb into the build system. Introduce CONFIG_LIBAVB
build option.

Signed-off-by: Igor Opaniuk <igor.opaniuk@linaro.org>


# f8c987f8 05-Jun-2018 Alexey Brodkin <Alexey.Brodkin@synopsys.com>

lib: Add hexdump

Often during debugging session it's very interesting to see
what data we were dealing with. For example what we write or read
to/from memory or peripherals.

This change introduces functions that allow to dump binary
data with one simple function invocation like:
------------------->8----------------
print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, buf, len);
------------------->8----------------

which gives us the following:
------------------->8----------------
00000000: f2 b7 c9 88 62 61 75 64 72 61 74 65 3d 31 31 35 ....baudrate=115
00000010: 32 30 30 00 62 6f 6f 74 61 72 67 73 3d 63 6f 6e 200.bootargs=con
00000020: 73 6f 6c 65 3d 74 74 79 53 33 2c 31 31 35 32 30 sole=ttyS3,11520
00000030: 30 6e 38 00 62 6f 6f 74 64 65 6c 61 79 3d 33 00 0n8.bootdelay=3.
00000040: 62 6f 6f 74 66 69 6c 65 3d 75 49 6d 61 67 65 00 bootfile=uImage.
00000050: 66 64 74 63 6f 6e 74 72 6f 6c 61 64 64 72 3d 39 fdtcontroladdr=9
00000060: 66 66 62 31 62 61 30 00 6c 6f 61 64 61 64 64 72 ffb1ba0.loadaddr
00000070: 3d 30 78 38 32 30 30 30 30 30 30 00 73 74 64 65 =0x82000000.stde
00000080: 72 72 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 rr=serial0@e0022
00000090: 30 30 30 00 73 74 64 69 6e 3d 73 65 72 69 61 6c 000.stdin=serial
000000a0: 30 40 65 30 30 32 32 30 30 30 00 73 74 64 6f 75 0@e0022000.stdou
000000b0: 74 3d 73 65 72 69 61 6c 30 40 65 30 30 32 32 30 t=serial0@e00220
000000c0: 30 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00..............
...
------------------->8----------------

Source of hexdump.c was copied from Linux kernel v4.7-rc2.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Mario Six <mario.six@gdsys.cc>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Stefan Roese <sr@denx.de>


# c232d14d 29-May-2018 Alex Kiernan <alex.kiernan@gmail.com>

mmc: Separate "mmc swrite" from fastboot

Introduce CONFIG_IMAGE_SPARSE and CONFIG_CMD_MMC_SWRITE so the "mmc
swrite" command is separated from the fastboot code.

Move image-sparse from common to lib so it's clear it's library code.

Rename CONFIG_FASTBOOT_FLASH_FILLBUF_SIZE to CONFIG_IMAGE_SPARSE_FILLBUF_SIZE
and migrate it to Kconfig.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Acked-by: Jassi Brar <jaswinder.singh@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>


# 6417572e 08-May-2018 Tom Rini <trini@konsulko.com>

lib/Kconfig: Mark OF_LIBFDT_OVERLAY as depending on OF_LIBFDT

The overlay code is only useful when OF_LIBFDT is set, so mark it as
depending on that first.

Signed-off-by: Tom Rini <trini@konsulko.com>


# 58a46f88 25-Apr-2018 Praneeth Bajjuri <praneeth@ti.com>

configs: TI: Enable FIT Library overlay support

Enable the FDT library overlay support for all TI SOC family.

Without this option, when Loading fdt from FIT image, the
following warning is seen.

"config with overlays but CONFIG_OF_LIBFDT_OVERLAY not set".

Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
Suggested-by: Andrew F.Davis <afd@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>


# 14ad44ab 18-Apr-2018 Alex Kiernan <alex.kiernan@gmail.com>

spl: Split sprintf, strto* from SPL serial in Kconfig

When SPL serial is disabled, callers who need sprintf or strtoul fail
because their inclusion is guarded by CONFIG_SPL_SERIAL_SUPPORT/
CONFIG_TPL_SERIAL_SUPPORT.

Split printf, sprintf and strto into their own entries and then select
all of them if SERIAL_SUPPORT is enabled to match the current behaviour.

Include panic.o unconditionally as it can be called from anywhere which
uses BUG_ON().

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>


# d14db11d 03-Apr-2018 Andre Przywara <andre.przywara@arm.com>

sunxi: revert disabling of features

In January some commits were introduced to mitigate the U-Boot image
size issues we encountered on sunxi builds.
Now with the MMC environment removed we can bring them back, as we
practically don't have a size limit anymore.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>


# 32ce6179 13-Mar-2018 Bryan O'Donoghue <bryan.odonoghue@linaro.org>

optee: Add lib entries for sharing OPTEE code across ports

This patch adds code to lib to enable sharing of useful OPTEE code between
board-ports and architectures. The code on lib/optee/optee.c comes from the
TI omap2 port. Eventually the OMAP2 code will be patched to include the
shared code. The intention here is to add more useful OPTEE specific code
as more functionality gets added.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Cc: Harinarayan Bhatta <harinarayan@ti.com>
Cc: Andrew F. Davis <afd@ti.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Kever Yang <kever.yang@rock-chips.com>
Cc: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Cc: Peng Fan <peng.fan@nxp.com>
Tested-by: Peng Fan <peng.fan@nxp.com>


# 36c1877c 06-Feb-2018 Faiz Abbas <faiz_abbas@ti.com>

lib: Kconfig: Move DYNAMIC_CRC_TABLE to Kconfig

Add CONFIG prefix to DYNAMIC_CRC_TABLE and implement it in
Kconfig.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>


# a451bc27 05-Feb-2018 Adam Ford <aford173@gmail.com>

Convert LIB_UUID to Kconfig

config_fallback.h has some logic that checks a variety of options
and selects LIB_UUID if it hasn't already been selected. This
will all LIB_UUID in Kconfig and select this option for the list
of options to allow us to remove the logic from fallbacks

Signed-off-by: Adam Ford <aford173@gmail.com>


# a5a37567 06-Feb-2018 Adam Ford <aford173@gmail.com>

Convert CONFIG LIB_HW_RAND to Kconfig

config_fallbacks.h had some logic to automatically select
LIB_RAND if RANDOM_UUID or CMD_UUID were set if LIB_HW_RAND wasn't
already selected. By migrating LIB_HW_RAND to Kconfig, we can
remove this check from config_fallbacks.h and put it into Kconfig

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
[trini: Turn into a choice, add NET_RANDOM_ETHADDR]
Signed-off-by: Tom Rini <trini@konsulko.com>


# acd4d334 16-Jan-2018 Maxime Ripard <maxime.ripard@free-electrons.com>

net: regex: Disable by default on sunXi

The sunXi arm64 build has overflown, leading to the main U-boot binary
overwriting the environment when flashing the new image, or even worse,
overwriting itself when we're calling saveenv.

Disable this option that is not critical until we can adress the issue
properly.

Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>


# 7e3caa81 03-Dec-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

Move CONFIG_PANIC_HANG to Kconfig

Freescale (NXP) boards have lots of defconfig files per board.
I used "imply PANIC_HANG" for them.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: York Sun <york.sun@nxp.com>


# da5337a6 08-Nov-2017 Nandor Han <nandor.han@ge.com>

rtc: add support for s35392a

Add support for S35392A RTC. The driver supports both U-Boot driver
models.

Signed-off-by: Nandor Han <nandor.han@ge.com>
Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
Cc: Heiko Schocher <hs@denx.de>


# f52bdf4b 14-Sep-2017 Jean-Jacques Hiblot <jjhiblot@ti.com>

lib: allow building lzo for the SPL

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>


# 85d8bf57 03-Sep-2017 Marek Behún <marek.behun@nic.cz>

lib: Add CRC32-C

This is needed for BTRFS.

Signed-off-by: Marek Behun <marek.behun@nic.cz>

create mode 100644 lib/crc32c.c


# 7264f292 15-Aug-2017 York Sun <york.sun@nxp.com>

spl: fit: Eanble GZIP support for image decompression

Add Kconfig option SPL_GZIP and SPL_ZLIB to enable gunzip support for
SPL boot, eg. falcon boot compressed kernel image.

Signed-off-by: York Sun <york.sun@nxp.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>


# 6ef2f901 11-Aug-2017 Adam Ford <aford173@gmail.com>

Convert CONFIG_BCH to Kconfig

This converts the following to Kconfig:
CONFIG_BCH

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>


# f1a7ba1d 18-Aug-2017 Anatolij Gustschin <agust@denx.de>

Fix 'notes' typos

s/notes/nodes

Signed-off-by: Anatolij Gustschin <agust@denx.de>


# 96b9082c 03-Aug-2017 Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

rockchip: rk3188: rock: adjust for SPL/TPL split

With the changes to split SPL/TPL for the RK3368, I apparently missed
some needed adjustments to the RK3188 Kconfig and rock_defconfig.

This fixes build-issues for the rock board after applying the RK3368
enablement (and SPL/TPL) set that resulted from TPL_SERIAL_SUPPORT,
TPL_ROCKCHIP_BACK_TO_BROM and TPL_TINY_MEMSET being separate symbols
now.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>


# d56b4b19 22-Jul-2017 Tom Rini <trini@konsulko.com>

configs: Migrate RBTREE, LZO, CMD_MTDPARTS, CMD_UBI and CMD_UBIFS

The above CONFIG options are in Kconfig, and now have correct depends and
inter-dependencies. Migrate these to configs/ from include/configs/. In the
case of CMD_UBIFS also change it to be a default y if CMD_UBI.

Signed-off-by: Tom Rini <trini@konsulko.com>


# aed998aa 17-May-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_LZMA to Kconfig

This converts the following to Kconfig:
CONFIG_LZMA

Signed-off-by: Simon Glass <sjg@chromium.org>


# b1a873df 26-Apr-2017 Simon Glass <sjg@chromium.org>

Convert CONFIG_CMD_AES et al to Kconfig

This converts the following to Kconfig:
CONFIG_CMD_AES
CONFIG_AES

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Add select AES to CMD_AES]
Signed-off-by: Tom Rini <trini@konsulko.com>


# 173aafbf 27-Feb-2017 Boris Brezillon <boris.brezillon@free-electrons.com>

cmd: Expose a Kconfig option to enable UBIFS commands

Create a new Kconfig entry to allow CMD_UBIFS selection from Kconfig and
add an hidden LZO option that can be selected by CMD_UBIFS.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>


# aa049152 27-Feb-2017 Boris Brezillon <boris.brezillon@free-electrons.com>

mtd: ubi: Select RBTREE option from MTD_UBI Kconfig entry

Expose the RBTREE feature through Kconfig and select this option from the
MTD_UBI option.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Jagan Teki <jagan@openedev.com>
[Rebased on master]
Signed-off-by: Jagan Teki <jagan@openedev.com>


# ab4458bd 02-Apr-2017 Simon Glass <sjg@chromium.org>

string: Provide a slimmed-down memset()

Most of the time the optimised memset() is what we want. For extreme
situations such as TPL it may be too large. For example on the 'rock'
board, using a simple loop saves a useful 48 bytes. With gcc 4.9 and
the rodata bug, this patch is enough to reduce the TPL image below the
limit.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>


# bea79d7d 14-Mar-2017 Andre Przywara <andre.przywara@arm.com>

Kconfig: introduce md5sum command selection

So far CONFIG_MD5SUM would need to be set by a board's include file.
Since the command is really generic, move it over to Kconfig to allow
it to be defined by either a board's defconfig, menuconfig or some
config snippet merged via mergeconfig.sh.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>


# e663b350 18-Aug-2016 Alexander Graf <agraf@suse.de>

smbios: Expose in efi_loader as table

We can pass SMBIOS easily as EFI configuration table to an EFI payload. This
patch adds enablement for that case.

While at it, we also enable SMBIOS generation for ARM systems, since they support
EFI_LOADER.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>


# 4b6dddc2 18-Aug-2016 Alexander Graf <agraf@suse.de>

x86: Move smbios generation into arch independent directory

We will need the SMBIOS generation function on ARM as well going forward,
so let's move it into a non arch specific location.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>


# ebf7fff2 05-Oct-2016 Heiko Schocher <hs@denx.de>

spl: move FDT_FIXUP_PARTITIONS to Kconfig

Move FDT_FIXUP_PARTITIONS to Kconfig and cleanup existing
uses.

Signed-off-by: Heiko Schocher <hs@denx.de>


# ddf67f71 05-Jul-2016 Maxime Ripard <maxime.ripard@free-electrons.com>

libfdt: Add overlay application function

The device tree overlays are a good way to deal with user-modifyable
boards or boards with some kind of an expansion mechanism where we can
easily plug new board in (like the BBB, the Raspberry Pi or the CHIP).

Add a new function to merge overlays with a base device tree.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>


# 91b86e21 26-May-2016 Marek Vasut <marex@denx.de>

lib: Enable private libgcc by default

This patch decouples U-Boot binary from the toolchain on systems where
private libgcc is available. Instead of pulling in functions provided
by the libgcc from the toolchain, U-Boot will use it's own set of libgcc
functions. These functions are usually imported from Linux kernel, which
also uses it's own libgcc functions instead of the ones provided by the
toolchain.

This patch solves a rather common problem. The toolchain can usually
generate code for many variants of target architecture and often even
different endianness. The libgcc on the other hand is usually compiled
for one particular configuration and the functions provided by it may
or may not be suited for use in U-Boot. This can manifest in two ways,
either the U-Boot fails to compile altogether and linker will complain
or, in the much worse case, the resulting U-Boot will build, but will
misbehave in very subtle and hard to debug ways.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Tom Rini <trini@konsulko.com>


# 67976306 30-Mar-2016 Masahiro Yamada <yamada.masahiro@socionext.com>

cosmetic: Fix typos "privide"

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>


# ed980b8c 03-Mar-2016 Alexander Graf <agraf@suse.de>

efi_loader: hook up in build environment

Now that we have all the bits and pieces ready for EFI payload loading
support, hook them up in Makefiles and KConfigs so that we can build.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
[trini: Enable only when we of OF_LIBFDT, disable on kwb and colibri_pxa270]
Signed-off-by: Tom Rini <trini@konsulko.com>


# aa34fbc0 22-Feb-2016 Simon Glass <sjg@chromium.org>

fdt: Allow libfdt to be used in SPL

Add an option to enable libfdt in SPL. This can be useful when decoding
FIT files in SPL.

We need to make sure this option is not enabled in SPL by this change.
Also this option needs to be enabled in host builds. Si add a new
IMAGE_USE_LIBFDT #define which can be used in files that are built on the
host but must also build for U-Boot and SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 69e173eb 22-Feb-2016 Simon Glass <sjg@chromium.org>

Move CONFIG_OF_LIBFDT to Kconfig

Move this option to Kconfig and tidy up existing boards.

Signed-off-by: Simon Glass <sjg@chromium.org>


# a187559e 05-Feb-2016 Bin Meng <bmeng.cn@gmail.com>

Use correct spelling of "U-Boot"

Correct spelling of "U-Boot" shall be used in all written text
(documentation, comments in source files etc.).

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Minkyu Kang <mk7.kang@samsung.com>


# 947c626d 14-Jan-2016 Tom Rini <trini@konsulko.com>

vsprintf.c: Always enable CONFIG_SYS_VSNPRINTF

Enabling this function always removes some class of string saftey issues.
The size change here in general is about 400 bytes and this seems a reasonable
trade-off.

Cc: Peng Fan <peng.fan@nxp.com>
Cc: Peter Robinson <pbrobinson@gmail.com>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Adrian Alonso <aalonso@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tom Rini <trini@konsulko.com>


# 7d9cde10 22-Nov-2015 Stefan Roese <sr@denx.de>

lib/tiny-printf.c: Add tiny printf function for space limited environments

This patch adds a small printf() version that supports all basic formats.
Its intented to be used in U-Boot SPL versions on platforms with very
limited internal RAM sizes.

To enable it, just define CONFIG_USE_TINY_PRINTF in your defconfig. This
will result in the SPL using this tiny function and the main U-Boot
still using the full-blown printf() function.

This code was copied from:
http://www.sparetimelabs.com/printfrevisited
With mostly only coding style related changes so that its checkpatch
clean.

The size reduction is about 2.5KiB. Here a comparison for the db-mv784mp-gp
(Marvell AXP) SPL:

Without this patch:
58963 18536 1928 79427 13643 ./spl/u-boot-spl

With this patch:
56542 18536 1956 77034 12cea ./spl/u-boot-spl

Note:
To make it possible to compile tiny-printf.c instead of vsprintf.c when
CONFIG_USE_TINY_PRINTF is defined, the functions printf() and vprintf() are
moved from common/console.c into vsprintf.c in this patch.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>


# 2419cd16 03-Oct-2015 Simon Glass <sjg@chromium.org>

dm: tpm: Drop CONFIG_DM_TPM

Now that all TPM drivers use driver model, we can drop the special driver
model CONFIG option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>


# 027b728d 06-Oct-2015 Julius Werner <jwerner@chromium.org>

Add support for LZ4 decompression algorithm

This patch adds support for LZ4-compressed FIT image contents. This
algorithm has a slightly worse compression ration than LZO while being
nearly twice as fast to decompress. When loading images from a fast
storage medium this usually results in a boot time win.

Sandbox-tested only since I don't have a U-Boot development system set
up right now. The code was imported unchanged from coreboot where it's
proven to work, though. I'm mostly interested in getting this recognized
by mkImage for use in a downstream project.

Signed-off-by: Julius Werner <jwerner@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>


# a7d660bc 22-Aug-2015 Simon Glass <sjg@chromium.org>

tpm: Add Kconfig options for TPMs

Add new Kconfig options for TPMs in preparation for moving boards to use
Kconfig for TPM configuration.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Christophe Ricard<christophe-h.ricard@st.com>
Reviewed-by: Heiko Schocher <hs@denx.de>


# 867a6ac8 31-Jul-2015 Simon Glass <sjg@chromium.org>

efi: Add start-up library code

When running as an EFI application, U-Boot must request memory from EFI,
and provide access to the boot services U-Boot needs.

Add library code to perform these tasks. This includes efi_main() which is
the entry point from EFI. U-Boot is built as a shared library.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>


# d1389403 23-Jun-2015 Simon Glass <sjg@chromium.org>

Add a dhrystone benchmark command

Drystone provides a convenient sanity check that the CPU is running at full
speed. Add this as a command which can be enabled as needed.

Note: I investigated using Coremark for this but there was a license
agreement and I could not work out if it was GPL-compatible.

Signed-off-by: Simon Glass <sjg@chromium.org>


# f7848d90 22-Jun-2015 Joe Hershberger <joe.hershberger@ni.com>

Allow CONFIG_REGEX to be disabled when CONFIG_NET

Instead of selecting REGEX when NET is enabled, make it the default, but
allow boards that are tiny to disable it and lose functionality on all
but the first Ethernet adapter.

cm-bf548, bf538f-ezkit, and bf533-stamp need this. None appear to have
more than one Ethernet interface.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>


# 3850dbe8 11-Jun-2015 Masahiro Yamada <yamada.masahiro@socionext.com>

blackfin: fix undefined reference to srand and rand

Commit 9ba9e85f3f1c (net: Fix NET_RANDOM_ETHADDR dependencies)
accidentally dropped CONFIG_LIB_RAND defines for 14 Blackfin boards.

Prior to that commit, those boards defined CONFIG_LIB_RAND, but not
CONFIG_NET_RANDOM_ETHADDR. So, commit 9ba9e85f3f1c should not have
touched them, but in fact it ripped CONFIG_LIB_RAND off from all the
header files, which caused undefined reference to srand and rand.
CONFIG_LIB_RAND=y must be revived for such boards.

BTW, this commit indeed makes it better, but even with this fix,
three boards (bf533-stamp, bf538f-ezkit, cm-bf548) still can not
build due to region 'ram' overflowed error. This was cause by
commit 6eed3786c68c (net: Move the CMD_NET config to defconfigs)
because CMD_NET selects NET, and NET selects REGEX. Eventually,
some boards were newly enabled with CONFIG_REGEX, increasing the
memory footprint. A patch is expected to fix the build error.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>


# 9ba9e85f 25-May-2015 Michal Simek <michal.simek@xilinx.com>

net: Fix NET_RANDOM_ETHADDR dependencies

NET_RANDOM_ETHADDR depends on lib/rand.c. This patch adds dependency to
Kconfig to ensure that library is also compiled.

Remove the definitions from Blackfin boards' include/configs.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>


# 6501ff62 20-Apr-2015 Przemyslaw Marczak <p.marczak@samsung.com>

lib: Kconfig: add entry for errno_str() function

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>


# 1a60650c 21-Apr-2015 Joe Hershberger <joe.hershberger@ni.com>

kconfig: Move REGEX to Kconfig

Having this as a Kconfig allows it to be a dependent feature.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>


# 8156345d 06-Mar-2015 Simon Glass <sjg@chromium.org>

sandbox: Move CONFIG_SYS_VSNPRINTF to Kconfig

Move this over to Kconfig and tidy up.

Signed-off-by: Simon Glass <sjg@chromium.org>


# 94e3c8c4 19-Feb-2015 gaurav rana <gaurav.rana@freescale.com>

crypto/fsl - Add progressive hashing support using hardware acceleration.

Currently only normal hashing is supported using hardware acceleration.
Added support for progressive hashing using hardware.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
Signed-off-by: Gaurav Rana <gaurav.rana@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <yorksun@freescale.com>


# d9f23c7f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@freescale.com>

lib/rsa: Add Kconfig for devices supporting RSA Modular Exponentiation

Kconfig option added for devices which support RSA Verification.
1. RSA_SOFTWARE_EXP
Enables driver for supporting RSA Modular Exponentiation in Software
2. RSA_FREESCALE_EXP
Enables driver for supporting RSA Modular Exponentiation using Freescale specific
driver

The above drivers use RSA uclass

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
(Removed duplicate line in Kconfig comment)

Change-Id: I7663c4d5350e2bfc3dfa2696f70ef777d6ccc6f6


# c4beb22f 23-Jan-2015 Ruchika Gupta <ruchika.gupta@freescale.com>

FIT: Modify option FIT_SIGNATURE in Kconfig

For FIT signature based approach to work, RSA library needs to be selected.
The FIT_SIGNATURE option in Kconfig is modified to automatically select RSA.
Selecting RSA compiles the RSA library required for image verification.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
CC: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>


# 45ccec8f 23-Oct-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_USE_PRIVATE_LIBGCC to Kconfig

The private libgcc is supported only on ARM, MIPS, PowerPC, SH, x86.
Those architectures should "select" HAVE_PRIVATE_LIBGCC and
CONFIG_USE_PRIVATE_LIBGCC should depend on it.

Currently, this option is enabled on Tegra boards and x86 architecture.
Move the definition from header files to Kconfig.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Tested-by: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: Tom Warren <twarren@nvidia.com>


# 8c688bc4 23-Oct-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_SYS_HZ to lib/Kconfig

CONFIG_SYS_HZ is always defined as 1000 in config_fallbacks.h
(but some boards still have redundant definitions).

This commit moves the definition and the document in README to
Kconfig. Since lib/Kconfig can assure that CONFIG_SYS_HZ is 1000,
the sanity check in lib/time.c should be removed.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Reviewed-by: Marek Vasut <marex@denx.de>


# b0928da6 16-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: move CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED to Kconfig

If this option is enabled, the objects under lib/ directory
are compiled with speed optimization, not size optimization.
(Currently, only used by some Blackfin boards.)

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>


# ed36323f 16-Sep-2014 Masahiro Yamada <yamada.m@jp.panasonic.com>

kconfig: add blank Kconfig files

This would be useful to start moving various config options.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>