History log of /u-boot/boot/image-board.c
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# d678a59d 18-May-2024 Tom Rini <trini@konsulko.com>

Revert "Merge patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet""

When bringing in the series 'arm: dts: am62-beagleplay: Fix Beagleplay
Ethernet"' I failed to notice that b4 noticed it was based on next and
so took that as the base commit and merged that part of next to master.

This reverts commit c8ffd1356d42223cbb8c86280a083cc3c93e6426, reversing
changes made to 2ee6f3a5f7550de3599faef9704e166e5dcace35.

Reported-by: Jonas Karlman <jonas@kwiboo.se>
Signed-off-by: Tom Rini <trini@konsulko.com>

# c4b646d4 27-Apr-2024 Tom Rini <trini@konsulko.com>

boot: Remove <common.h> and add needed includes

Remove <common.h> from all "boot/" files and when needed add
missing include files directly.

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

# ca8d4dfd 26-Mar-2024 Marek Vasut <marek.vasut+renesas@mailbox.org>

boot: fdt: Clean up env_get_bootm_mapsize()

Reduce tmp variable use and remove unnecessary type cast in
env_get_bootm_mapsize(). This aligns the env variable parsing
with env_get_bootm_low(). No functional change.

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

# 5fb569b3 26-Mar-2024 Marek Vasut <marek.vasut+renesas@mailbox.org>

boot: fdt: Fix tmp type in env_get_bootm_size() and rename to low

Change type of 'tmp' variable from phys_size_t to phys_addr_t and
rename it to 'low' to better describe what the variable represents,
which is either the bootm_low address from environment or start of
DRAM address.

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

# 98e68ec1 26-Mar-2024 Marek Vasut <marek.vasut+renesas@mailbox.org>

boot: fdt: Clean up env_get_bootm_size()

Reduce tmp variable use and remove unnecessary type cast in
env_get_bootm_size(). This aligns the env variable parsing
with env_get_bootm_low(). No functional change.

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

# a4df06e4 26-Mar-2024 Marek Vasut <marek.vasut+renesas@mailbox.org>

boot: fdt: Change type of env_get_bootm_low() to phys_addr_t

Change type of ulong env_get_bootm_low() to phys_addr_t env_get_bootm_low().
The PPC/LS systems already treat env_get_bootm_low() result as phys_addr_t,
while the function itself still returns ulong. This is potentially dangerous
on 64bit systems, where ulong might not be large enough to hold the content
of "bootm_low" environment variable. Fix it by using phys_addr_t, similar to
what env_get_bootm_size() does, which returns phys_size_t .

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reported-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>

# 1de1a034 12-Nov-2023 Simon Glass <sjg@chromium.org>

boot: Drop size parameter from image_setup_libfdt()

The of_size parameter is not used, so remove it.

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

# 96456285 18-Nov-2023 Simon Glass <sjg@chromium.org>

bootm: Reduce arguments to boot_get_loadables()

This function only uses two arguments. The 'arch' always has a constant
value, so drop it. This simplifies the function call.

Tidy up the function comment while we are here.

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

# 745367b2 18-Nov-2023 Simon Glass <sjg@chromium.org>

bootm: Reduce arguments to boot_get_fpga()

This function only uses two arguments. The 'arch' always has a constant
value, so drop it. This simplifies the function call.

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

# 8eda15bc 18-Nov-2023 Simon Glass <sjg@chromium.org>

bootm: Reduce arguments to boot_get_ramdisk()

This function normally only uses one argument so pass it in directly.
Move comments to the header file so could one day include these
functions in API docs. Fix up the u8 argument while here, since it
avoids the compiler having to mask the value on some machines.

The Android case here is bit strange, since it can use argv[0], so deal
with that in the caller.

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

# 530cc479 18-Nov-2023 Simon Glass <sjg@chromium.org>

image: Tidy up genimg_get_kernel_addr_fit()

This function does not modify its first argument, so mark it const. Also
move the comments to the header file and expand them to provide more
useful information.

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

# 51a765b3 05-Apr-2023 Tom Rini <trini@konsulko.com>

boot/image-board.c: Silence warning in select_ramdisk

When building with clang we get a warning that rdaddr could be
uninitialized in one case. While this cannot functionally happen, we can
easily silence the warning.

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

# e45bba56 16-Feb-2023 Tobias Waldekranz <tobias@waldekranz.com>

image: Fix script execution from FIT images with external data

Update the script loading code to recognize when script data is stored
externally from the FIT metadata (i.e., built with `mkimage -E`).

Signed-off-by: Tobias Waldekranz <tobias@waldekranz.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 636da203 05-Feb-2023 Safae Ouajih <souajih@baylibre.com>

android: boot: support boot image header version 3 and 4

Enable the support for boot image header version 3 and 4
using abootimg command.

In order to use version 3 or 4:

1- Vendor boot image address should be given to abootimg cmd.

abootimg addr $1 $vendor_boot_load_addr

2- "ramdisk_addr_r" env variable (ramdisk address) should be set to host
the ramdisk : generic ramdisk + vendor ramdisk

Replace "struct andr_boot_img_hdr_v0*" by "void *" in
some functions since v3 and v4 are now supported as well.

Signed-off-by: Safae Ouajih <souajih@baylibre.com>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Tested-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>

# e058176b 05-Feb-2023 Safae Ouajih <souajih@baylibre.com>

android: boot: add vendor boot image to prepare for v3, v4 support

Introduce vendor boot image for version 3 and 4 of boot image header.
The vendor boot image will hold extra information about kernel, dtb
and ramdisk.

This is done to prepare for boot image version 3 and 4 support.

Signed-off-by: Safae Ouajih <souajih@baylibre.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Tested-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>

# 734cb47d 05-Feb-2023 Safae Ouajih <souajih@baylibre.com>

android: boot: replace android_image_check_header

With the new vendor boot image introduced in versions 3 and 4
of boot image header, the header check must be done for both boot
image and vendor boot image. Thus, replace android_image_check_header()
by is_android_boot_image_header() to only refer to boot image header check.

Signed-off-by: Safae Ouajih <souajih@baylibre.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Tested-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>

# 771cb4d5 27-Feb-2023 Marek Vasut <marek.vasut+renesas@mailbox.org>

image: Fix potentially uninitialized data variable

In case fitImage support is disabled, and image_locate_script() is
passed a fitImage, then the 'data' variable is used uninitialized.
Drop into the default: branch of the switch-case statement and do
not return the uninitialized data, and do not modify the return
pointer either, just print an error message.

Reported by clang build:
"
$ make HOSTCC=clang CC=clang KCFLAGS=-Werror sandbox64_defconfig && make HOSTCC=clang CC=clang KCFLAGS=-Werror
...
boot/image-board.c:1006:7: error: variable 'data' is used uninitialized whenever switch case is taken [-Werror,-Wsometimes-uninitialized]
case IMAGE_FORMAT_LEGACY:
^~~~~~~~~~~~~~~~~~~
include/image.h:608:29: note: expanded from macro 'IMAGE_FORMAT_LEGACY'
^~~~
boot/image-board.c:1128:19: note: uninitialized use occurs here
*datap = (char *)data;
^~~~
boot/image-board.c:1001:11: note: initialize the variable 'data' to silence this warning
u32 *data;
^
= NULL
"

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 210af549 05-Feb-2023 Simon Glass <sjg@chromium.org>

Correct SPL uses of LMB

This converts 9 usages of this option to the non-SPL form, since there is
no SPL_LMB defined in Kconfig

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

# 30f3333d 06-Jan-2023 Simon Glass <sjg@chromium.org>

image: Move common image code to image_board and command

We should use the cmd/ directory for commands rather than for common code
used elsewhere in U-Boot. Move the common 'source' code into
image-board.c to achieve this.

The image_source_script() function needs to call run_command_list() so
seems to belong better in the command library. Move and rename it.

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

# 65cc0e2a 16-Nov-2022 Tom Rini <trini@konsulko.com>

global: Move remaining CONFIG_SYS_* to CFG_SYS_*

The rest of the unmigrated CONFIG symbols in the CONFIG_SYS namespace do
not easily transition to Kconfig. In many cases they likely should come
from the device tree instead. Move these out of CONFIG namespace and in
to CFG namespace.

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

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

global: Move remaining CONFIG_SYS_SDRAM_* to CFG_SYS_SDRAM_*

The rest of the unmigrated CONFIG symbols in the CONFIG_SYS_SDRAM
namespace do not easily transition to Kconfig. In many cases they likely
should come from the device tree instead. Move these out of CONFIG
namespace and in to CFG namespace.

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

# f3543e69 06-Sep-2022 Simon Glass <sjg@chromium.org>

treewide: Drop image_header_t typedef

This is not needed and we should avoid typedefs. Use the struct instead
and rename it to indicate that it really is a legacy struct.

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

# d9d7c20b 06-Sep-2022 Simon Glass <sjg@chromium.org>

treewide: Drop bootm_headers_t typedef

This is not needed and we should avoid typedefs. Use the struct instead.

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

# 29caf930 02-Sep-2022 Stefan Roese <sr@denx.de>

cyclic: Use schedule() instead of WATCHDOG_RESET()

Globally replace all occurances of WATCHDOG_RESET() with schedule(),
which handles the HW_WATCHDOG functionality and the cyclic
infrastructure.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Tom Rini <trini@konsulko.com> [am335x_evm, mx6cuboxi, rpi_3,dra7xx_evm, pine64_plus, am65x_evm, j721e_evm]

# 9c2e9128 28-Aug-2022 Simon Glass <sjg@chromium.org>

image: Drop some other #ifdefs in image-board.c

Remove all but a few that are difficult, relying on legacy CONFIG options
or optional global_data fields.

Drop the duplicate function name in the comment for boot_get_cmdline().

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

# 20f5d83f 28-Aug-2022 Simon Glass <sjg@chromium.org>

image: Correct indentation in select_ramdisk()

Finish off the refactoring by correcting the indent levels. Note that this
does not include any functional changes.

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

# ca78883f 28-Aug-2022 Simon Glass <sjg@chromium.org>

image: Drop remaining FIT #ifdef

Drop the last one of these, by using a done_select variable to control
whether to fall back to using 'select' as a hex value.

Note that the indentation is not adjusted, to make this easier to review.

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

# 1a68c039 28-Aug-2022 Simon Glass <sjg@chromium.org>

image: Drop another #ifdef for FIT

Drop the prenultimate one of these from select_ramdisk().

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

# f7659f69 28-Aug-2022 Simon Glass <sjg@chromium.org>

image: Drop one #ifdef for FIT

Drop the #ifdef from near the end of select_ramdisk(). Move some variables
to the top of the function to make this work.

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

# 0f81af48 28-Aug-2022 Simon Glass <sjg@chromium.org>

image: Drop #ifdefs for LEGACY_IMAGE_FORMAT

Use if() instead of the #ifdef in select_ramdisk().

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

# 4f2d9412 28-Aug-2022 Simon Glass <sjg@chromium.org>

image: Track when ramdisk processing is completed

The current switch default is tricky since it relies on #ifdefs to work.
Use a bool instead.

Also fix the comment on @select, since it has a dual purpose.

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

# 1ce8e10f 28-Aug-2022 Simon Glass <sjg@chromium.org>

image: Fix up ANDROID_BOOT_IMAGE ramdisk code

Convert this to an if(), fix the cast from an address to a pointer and
make sure that any error is returned correctly.

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

# 4e4bf944 31-Jul-2022 Simon Glass <sjg@chromium.org>

common: Drop display_options.h from common header

Move this out of the common header and include it only where needed.

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

# 282eed50 22-Jul-2022 Oleksandr Suvorov <oleksandr.suvorov@foundries.io>

fpga: pass compatible flags to fpga_load()

These flags may be used to check whether an FPGA driver is able to
load a particular FPGA bitstream image.

Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
Tested-by: Ricardo Salveti <ricardo@foundries.io>
Tested-by: Adrian Fiergolski <adrian.fiergolski@fastree3d.com>
Link: https://lore.kernel.org/r/20220722141614.297383-7-oleksandr.suvorov@foundries.io
Signed-off-by: Michal Simek <michal.simek@amd.com>

# 65168910 07-Jul-2022 Ashok Reddy Soma <ashok.reddy.soma@amd.com>

zynqmp: Run board_get_usable_ram_top() only on main U-Boot

With commit ce39ee28ec31 ("zynqmp: Do not place u-boot to reserved memory
location"), the function board_get_usable_ram_top() is allocating
MMU_SECTION_SIZE of about 2MB using lmb_alloc(). But we dont have this
much memory in case of mini U-Boot.

Keep these functions which use lmb under CONFIG_LMB so that they are
compiled and used only when LMB is enabled.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/75e52def75f573e554a6b177a78504c128cb0c4a.1657183534.git.michal.simek@amd.com

# 6889412a 12-May-2022 Tom Rini <trini@konsulko.com>

Convert CONFIG_SYS_BARGSIZE to Kconfig

This converts the following to Kconfig:
CONFIG_SYS_BARGSIZE

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

# 185f812c 19-Jan-2022 Heinrich Schuchardt <xypron.glpk@gmx.de>

doc: replace @return by Return:

Sphinx expects Return: and not @return to indicate a return value.

find . -name '*.c' -exec \
sed -i 's/^\(\s\)\*\(\s*\)@return\(\s\)/\1*\2Return:\3/' {} \;

find . -name '*.h' -exec \
sed -i 's/^\(\s\)\*\(\s*\)@return\(\s\)/\1*\2Return:\3/' {} \;

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>

# 621158d1 20-Dec-2021 Tom Rini <trini@konsulko.com>

Revert "image: Remove #ifdefs from select_ramdisk()"

This reverts commit f33a2c1bd0fb371511a485cac1f182ba50db51be.

This causes a crash on some platforms as seen here:
https://lore.kernel.org/r/f153017b-c41a-0d32-67b9-f288e695f900@baylibre.com/

Reported-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 4b32531b 08-Nov-2021 Andy Shevchenko <andriy.shevchenko@linux.intel.com>

image: Explicitly declare do_bdinfo()

Compiler is not happy:

common/image-board.c: In function ‘boot_get_kbd’:
common/image-board.c:902:17: warning: implicit declaration of function ‘do_bdinfo’ [-Wimplicit-function-declaration]
902 | do_bdinfo(NULL, 0, 0, NULL);
| ^~~~~~~~~

Move the forward declaration to a header.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 19a91f24 14-Oct-2021 Simon Glass <sjg@chromium.org>

Create a new boot/ directory

Quite a lot of the code in common/relates to booting and images. Before
adding more it seems like a good time to move the code into its own
directory.

Most files with 'boot' or 'image' in them are moved, except:

- autoboot.c which relates to U-Boot automatically running a script
- bootstage.c which relates to U-Boot timing

Drop the removal of boot* files from the output directory, since this
interfers with the symlinks created by tools and there does not appear
to be any such file from my brief testing.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Artem Lapkin <email2tema@gmail.com>
Tested-by: Artem Lapkin <email2tema@gmail.com>

# c4b646d4 27-Apr-2024 Tom Rini <trini@konsulko.com>

boot: Remove <common.h> and add needed includes

Remove <common.h> from all "boot/" files and when needed add
missing include files directly.

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

# ca8d4dfd 26-Mar-2024 Marek Vasut <marek.vasut+renesas@mailbox.org>

boot: fdt: Clean up env_get_bootm_mapsize()

Reduce tmp variable use and remove unnecessary type cast in
env_get_bootm_mapsize(). This aligns the env variable parsing
with env_get_bootm_low(). No functional change.

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

# 5fb569b3 26-Mar-2024 Marek Vasut <marek.vasut+renesas@mailbox.org>

boot: fdt: Fix tmp type in env_get_bootm_size() and rename to low

Change type of 'tmp' variable from phys_size_t to phys_addr_t and
rename it to 'low' to better describe what the variable represents,
which is either the bootm_low address from environment or start of
DRAM address.

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

# 98e68ec1 26-Mar-2024 Marek Vasut <marek.vasut+renesas@mailbox.org>

boot: fdt: Clean up env_get_bootm_size()

Reduce tmp variable use and remove unnecessary type cast in
env_get_bootm_size(). This aligns the env variable parsing
with env_get_bootm_low(). No functional change.

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

# a4df06e4 26-Mar-2024 Marek Vasut <marek.vasut+renesas@mailbox.org>

boot: fdt: Change type of env_get_bootm_low() to phys_addr_t

Change type of ulong env_get_bootm_low() to phys_addr_t env_get_bootm_low().
The PPC/LS systems already treat env_get_bootm_low() result as phys_addr_t,
while the function itself still returns ulong. This is potentially dangerous
on 64bit systems, where ulong might not be large enough to hold the content
of "bootm_low" environment variable. Fix it by using phys_addr_t, similar to
what env_get_bootm_size() does, which returns phys_size_t .

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reported-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>

# 1de1a034 12-Nov-2023 Simon Glass <sjg@chromium.org>

boot: Drop size parameter from image_setup_libfdt()

The of_size parameter is not used, so remove it.

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

# 96456285 18-Nov-2023 Simon Glass <sjg@chromium.org>

bootm: Reduce arguments to boot_get_loadables()

This function only uses two arguments. The 'arch' always has a constant
value, so drop it. This simplifies the function call.

Tidy up the function comment while we are here.

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

# 745367b2 18-Nov-2023 Simon Glass <sjg@chromium.org>

bootm: Reduce arguments to boot_get_fpga()

This function only uses two arguments. The 'arch' always has a constant
value, so drop it. This simplifies the function call.

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

# 8eda15bc 18-Nov-2023 Simon Glass <sjg@chromium.org>

bootm: Reduce arguments to boot_get_ramdisk()

This function normally only uses one argument so pass it in directly.
Move comments to the header file so could one day include these
functions in API docs. Fix up the u8 argument while here, since it
avoids the compiler having to mask the value on some machines.

The Android case here is bit strange, since it can use argv[0], so deal
with that in the caller.

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

# 530cc479 18-Nov-2023 Simon Glass <sjg@chromium.org>

image: Tidy up genimg_get_kernel_addr_fit()

This function does not modify its first argument, so mark it const. Also
move the comments to the header file and expand them to provide more
useful information.

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

# 51a765b3 05-Apr-2023 Tom Rini <trini@konsulko.com>

boot/image-board.c: Silence warning in select_ramdisk

When building with clang we get a warning that rdaddr could be
uninitialized in one case. While this cannot functionally happen, we can
easily silence the warning.

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

# e45bba56 16-Feb-2023 Tobias Waldekranz <tobias@waldekranz.com>

image: Fix script execution from FIT images with external data

Update the script loading code to recognize when script data is stored
externally from the FIT metadata (i.e., built with `mkimage -E`).

Signed-off-by: Tobias Waldekranz <tobias@waldekranz.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 636da203 05-Feb-2023 Safae Ouajih <souajih@baylibre.com>

android: boot: support boot image header version 3 and 4

Enable the support for boot image header version 3 and 4
using abootimg command.

In order to use version 3 or 4:

1- Vendor boot image address should be given to abootimg cmd.

abootimg addr $1 $vendor_boot_load_addr

2- "ramdisk_addr_r" env variable (ramdisk address) should be set to host
the ramdisk : generic ramdisk + vendor ramdisk

Replace "struct andr_boot_img_hdr_v0*" by "void *" in
some functions since v3 and v4 are now supported as well.

Signed-off-by: Safae Ouajih <souajih@baylibre.com>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Tested-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>

# e058176b 05-Feb-2023 Safae Ouajih <souajih@baylibre.com>

android: boot: add vendor boot image to prepare for v3, v4 support

Introduce vendor boot image for version 3 and 4 of boot image header.
The vendor boot image will hold extra information about kernel, dtb
and ramdisk.

This is done to prepare for boot image version 3 and 4 support.

Signed-off-by: Safae Ouajih <souajih@baylibre.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Tested-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>

# 734cb47d 05-Feb-2023 Safae Ouajih <souajih@baylibre.com>

android: boot: replace android_image_check_header

With the new vendor boot image introduced in versions 3 and 4
of boot image header, the header check must be done for both boot
image and vendor boot image. Thus, replace android_image_check_header()
by is_android_boot_image_header() to only refer to boot image header check.

Signed-off-by: Safae Ouajih <souajih@baylibre.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Tested-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>

# 771cb4d5 27-Feb-2023 Marek Vasut <marek.vasut+renesas@mailbox.org>

image: Fix potentially uninitialized data variable

In case fitImage support is disabled, and image_locate_script() is
passed a fitImage, then the 'data' variable is used uninitialized.
Drop into the default: branch of the switch-case statement and do
not return the uninitialized data, and do not modify the return
pointer either, just print an error message.

Reported by clang build:
"
$ make HOSTCC=clang CC=clang KCFLAGS=-Werror sandbox64_defconfig && make HOSTCC=clang CC=clang KCFLAGS=-Werror
...
boot/image-board.c:1006:7: error: variable 'data' is used uninitialized whenever switch case is taken [-Werror,-Wsometimes-uninitialized]
case IMAGE_FORMAT_LEGACY:
^~~~~~~~~~~~~~~~~~~
include/image.h:608:29: note: expanded from macro 'IMAGE_FORMAT_LEGACY'
^~~~
boot/image-board.c:1128:19: note: uninitialized use occurs here
*datap = (char *)data;
^~~~
boot/image-board.c:1001:11: note: initialize the variable 'data' to silence this warning
u32 *data;
^
= NULL
"

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 210af549 05-Feb-2023 Simon Glass <sjg@chromium.org>

Correct SPL uses of LMB

This converts 9 usages of this option to the non-SPL form, since there is
no SPL_LMB defined in Kconfig

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

# 30f3333d 06-Jan-2023 Simon Glass <sjg@chromium.org>

image: Move common image code to image_board and command

We should use the cmd/ directory for commands rather than for common code
used elsewhere in U-Boot. Move the common 'source' code into
image-board.c to achieve this.

The image_source_script() function needs to call run_command_list() so
seems to belong better in the command library. Move and rename it.

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

# 65cc0e2a 16-Nov-2022 Tom Rini <trini@konsulko.com>

global: Move remaining CONFIG_SYS_* to CFG_SYS_*

The rest of the unmigrated CONFIG symbols in the CONFIG_SYS namespace do
not easily transition to Kconfig. In many cases they likely should come
from the device tree instead. Move these out of CONFIG namespace and in
to CFG namespace.

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

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

global: Move remaining CONFIG_SYS_SDRAM_* to CFG_SYS_SDRAM_*

The rest of the unmigrated CONFIG symbols in the CONFIG_SYS_SDRAM
namespace do not easily transition to Kconfig. In many cases they likely
should come from the device tree instead. Move these out of CONFIG
namespace and in to CFG namespace.

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

# f3543e69 06-Sep-2022 Simon Glass <sjg@chromium.org>

treewide: Drop image_header_t typedef

This is not needed and we should avoid typedefs. Use the struct instead
and rename it to indicate that it really is a legacy struct.

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

# d9d7c20b 06-Sep-2022 Simon Glass <sjg@chromium.org>

treewide: Drop bootm_headers_t typedef

This is not needed and we should avoid typedefs. Use the struct instead.

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

# 29caf930 02-Sep-2022 Stefan Roese <sr@denx.de>

cyclic: Use schedule() instead of WATCHDOG_RESET()

Globally replace all occurances of WATCHDOG_RESET() with schedule(),
which handles the HW_WATCHDOG functionality and the cyclic
infrastructure.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Tom Rini <trini@konsulko.com> [am335x_evm, mx6cuboxi, rpi_3,dra7xx_evm, pine64_plus, am65x_evm, j721e_evm]

# 9c2e9128 28-Aug-2022 Simon Glass <sjg@chromium.org>

image: Drop some other #ifdefs in image-board.c

Remove all but a few that are difficult, relying on legacy CONFIG options
or optional global_data fields.

Drop the duplicate function name in the comment for boot_get_cmdline().

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

# 20f5d83f 28-Aug-2022 Simon Glass <sjg@chromium.org>

image: Correct indentation in select_ramdisk()

Finish off the refactoring by correcting the indent levels. Note that this
does not include any functional changes.

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

# ca78883f 28-Aug-2022 Simon Glass <sjg@chromium.org>

image: Drop remaining FIT #ifdef

Drop the last one of these, by using a done_select variable to control
whether to fall back to using 'select' as a hex value.

Note that the indentation is not adjusted, to make this easier to review.

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

# 1a68c039 28-Aug-2022 Simon Glass <sjg@chromium.org>

image: Drop another #ifdef for FIT

Drop the prenultimate one of these from select_ramdisk().

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

# f7659f69 28-Aug-2022 Simon Glass <sjg@chromium.org>

image: Drop one #ifdef for FIT

Drop the #ifdef from near the end of select_ramdisk(). Move some variables
to the top of the function to make this work.

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

# 0f81af48 28-Aug-2022 Simon Glass <sjg@chromium.org>

image: Drop #ifdefs for LEGACY_IMAGE_FORMAT

Use if() instead of the #ifdef in select_ramdisk().

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

# 4f2d9412 28-Aug-2022 Simon Glass <sjg@chromium.org>

image: Track when ramdisk processing is completed

The current switch default is tricky since it relies on #ifdefs to work.
Use a bool instead.

Also fix the comment on @select, since it has a dual purpose.

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

# 1ce8e10f 28-Aug-2022 Simon Glass <sjg@chromium.org>

image: Fix up ANDROID_BOOT_IMAGE ramdisk code

Convert this to an if(), fix the cast from an address to a pointer and
make sure that any error is returned correctly.

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

# 4e4bf944 31-Jul-2022 Simon Glass <sjg@chromium.org>

common: Drop display_options.h from common header

Move this out of the common header and include it only where needed.

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

# 282eed50 22-Jul-2022 Oleksandr Suvorov <oleksandr.suvorov@foundries.io>

fpga: pass compatible flags to fpga_load()

These flags may be used to check whether an FPGA driver is able to
load a particular FPGA bitstream image.

Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
Tested-by: Ricardo Salveti <ricardo@foundries.io>
Tested-by: Adrian Fiergolski <adrian.fiergolski@fastree3d.com>
Link: https://lore.kernel.org/r/20220722141614.297383-7-oleksandr.suvorov@foundries.io
Signed-off-by: Michal Simek <michal.simek@amd.com>

# 65168910 07-Jul-2022 Ashok Reddy Soma <ashok.reddy.soma@amd.com>

zynqmp: Run board_get_usable_ram_top() only on main U-Boot

With commit ce39ee28ec31 ("zynqmp: Do not place u-boot to reserved memory
location"), the function board_get_usable_ram_top() is allocating
MMU_SECTION_SIZE of about 2MB using lmb_alloc(). But we dont have this
much memory in case of mini U-Boot.

Keep these functions which use lmb under CONFIG_LMB so that they are
compiled and used only when LMB is enabled.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/75e52def75f573e554a6b177a78504c128cb0c4a.1657183534.git.michal.simek@amd.com

# 6889412a 12-May-2022 Tom Rini <trini@konsulko.com>

Convert CONFIG_SYS_BARGSIZE to Kconfig

This converts the following to Kconfig:
CONFIG_SYS_BARGSIZE

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

# 185f812c 19-Jan-2022 Heinrich Schuchardt <xypron.glpk@gmx.de>

doc: replace @return by Return:

Sphinx expects Return: and not @return to indicate a return value.

find . -name '*.c' -exec \
sed -i 's/^\(\s\)\*\(\s*\)@return\(\s\)/\1*\2Return:\3/' {} \;

find . -name '*.h' -exec \
sed -i 's/^\(\s\)\*\(\s*\)@return\(\s\)/\1*\2Return:\3/' {} \;

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>

# 621158d1 20-Dec-2021 Tom Rini <trini@konsulko.com>

Revert "image: Remove #ifdefs from select_ramdisk()"

This reverts commit f33a2c1bd0fb371511a485cac1f182ba50db51be.

This causes a crash on some platforms as seen here:
https://lore.kernel.org/r/f153017b-c41a-0d32-67b9-f288e695f900@baylibre.com/

Reported-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 4b32531b 08-Nov-2021 Andy Shevchenko <andriy.shevchenko@linux.intel.com>

image: Explicitly declare do_bdinfo()

Compiler is not happy:

common/image-board.c: In function ‘boot_get_kbd’:
common/image-board.c:902:17: warning: implicit declaration of function ‘do_bdinfo’ [-Wimplicit-function-declaration]
902 | do_bdinfo(NULL, 0, 0, NULL);
| ^~~~~~~~~

Move the forward declaration to a header.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 19a91f24 14-Oct-2021 Simon Glass <sjg@chromium.org>

Create a new boot/ directory

Quite a lot of the code in common/relates to booting and images. Before
adding more it seems like a good time to move the code into its own
directory.

Most files with 'boot' or 'image' in them are moved, except:

- autoboot.c which relates to U-Boot automatically running a script
- bootstage.c which relates to U-Boot timing

Drop the removal of boot* files from the output directory, since this
interfers with the symlinks created by tools and there does not appear
to be any such file from my brief testing.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Artem Lapkin <email2tema@gmail.com>
Tested-by: Artem Lapkin <email2tema@gmail.com>

# ca8d4dfd 26-Mar-2024 Marek Vasut <marek.vasut+renesas@mailbox.org>

boot: fdt: Clean up env_get_bootm_mapsize()

Reduce tmp variable use and remove unnecessary type cast in
env_get_bootm_mapsize(). This aligns the env variable parsing
with env_get_bootm_low(). No functional change.

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

# 5fb569b3 26-Mar-2024 Marek Vasut <marek.vasut+renesas@mailbox.org>

boot: fdt: Fix tmp type in env_get_bootm_size() and rename to low

Change type of 'tmp' variable from phys_size_t to phys_addr_t and
rename it to 'low' to better describe what the variable represents,
which is either the bootm_low address from environment or start of
DRAM address.

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

# 98e68ec1 26-Mar-2024 Marek Vasut <marek.vasut+renesas@mailbox.org>

boot: fdt: Clean up env_get_bootm_size()

Reduce tmp variable use and remove unnecessary type cast in
env_get_bootm_size(). This aligns the env variable parsing
with env_get_bootm_low(). No functional change.

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

# a4df06e4 26-Mar-2024 Marek Vasut <marek.vasut+renesas@mailbox.org>

boot: fdt: Change type of env_get_bootm_low() to phys_addr_t

Change type of ulong env_get_bootm_low() to phys_addr_t env_get_bootm_low().
The PPC/LS systems already treat env_get_bootm_low() result as phys_addr_t,
while the function itself still returns ulong. This is potentially dangerous
on 64bit systems, where ulong might not be large enough to hold the content
of "bootm_low" environment variable. Fix it by using phys_addr_t, similar to
what env_get_bootm_size() does, which returns phys_size_t .

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reported-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>

# 1de1a034 12-Nov-2023 Simon Glass <sjg@chromium.org>

boot: Drop size parameter from image_setup_libfdt()

The of_size parameter is not used, so remove it.

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

# 96456285 18-Nov-2023 Simon Glass <sjg@chromium.org>

bootm: Reduce arguments to boot_get_loadables()

This function only uses two arguments. The 'arch' always has a constant
value, so drop it. This simplifies the function call.

Tidy up the function comment while we are here.

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

# 745367b2 18-Nov-2023 Simon Glass <sjg@chromium.org>

bootm: Reduce arguments to boot_get_fpga()

This function only uses two arguments. The 'arch' always has a constant
value, so drop it. This simplifies the function call.

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

# 8eda15bc 18-Nov-2023 Simon Glass <sjg@chromium.org>

bootm: Reduce arguments to boot_get_ramdisk()

This function normally only uses one argument so pass it in directly.
Move comments to the header file so could one day include these
functions in API docs. Fix up the u8 argument while here, since it
avoids the compiler having to mask the value on some machines.

The Android case here is bit strange, since it can use argv[0], so deal
with that in the caller.

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

# 530cc479 18-Nov-2023 Simon Glass <sjg@chromium.org>

image: Tidy up genimg_get_kernel_addr_fit()

This function does not modify its first argument, so mark it const. Also
move the comments to the header file and expand them to provide more
useful information.

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

# 51a765b3 05-Apr-2023 Tom Rini <trini@konsulko.com>

boot/image-board.c: Silence warning in select_ramdisk

When building with clang we get a warning that rdaddr could be
uninitialized in one case. While this cannot functionally happen, we can
easily silence the warning.

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

# e45bba56 16-Feb-2023 Tobias Waldekranz <tobias@waldekranz.com>

image: Fix script execution from FIT images with external data

Update the script loading code to recognize when script data is stored
externally from the FIT metadata (i.e., built with `mkimage -E`).

Signed-off-by: Tobias Waldekranz <tobias@waldekranz.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 636da203 05-Feb-2023 Safae Ouajih <souajih@baylibre.com>

android: boot: support boot image header version 3 and 4

Enable the support for boot image header version 3 and 4
using abootimg command.

In order to use version 3 or 4:

1- Vendor boot image address should be given to abootimg cmd.

abootimg addr $1 $vendor_boot_load_addr

2- "ramdisk_addr_r" env variable (ramdisk address) should be set to host
the ramdisk : generic ramdisk + vendor ramdisk

Replace "struct andr_boot_img_hdr_v0*" by "void *" in
some functions since v3 and v4 are now supported as well.

Signed-off-by: Safae Ouajih <souajih@baylibre.com>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Tested-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>

# e058176b 05-Feb-2023 Safae Ouajih <souajih@baylibre.com>

android: boot: add vendor boot image to prepare for v3, v4 support

Introduce vendor boot image for version 3 and 4 of boot image header.
The vendor boot image will hold extra information about kernel, dtb
and ramdisk.

This is done to prepare for boot image version 3 and 4 support.

Signed-off-by: Safae Ouajih <souajih@baylibre.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Tested-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>

# 734cb47d 05-Feb-2023 Safae Ouajih <souajih@baylibre.com>

android: boot: replace android_image_check_header

With the new vendor boot image introduced in versions 3 and 4
of boot image header, the header check must be done for both boot
image and vendor boot image. Thus, replace android_image_check_header()
by is_android_boot_image_header() to only refer to boot image header check.

Signed-off-by: Safae Ouajih <souajih@baylibre.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Tested-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>

# 771cb4d5 27-Feb-2023 Marek Vasut <marek.vasut+renesas@mailbox.org>

image: Fix potentially uninitialized data variable

In case fitImage support is disabled, and image_locate_script() is
passed a fitImage, then the 'data' variable is used uninitialized.
Drop into the default: branch of the switch-case statement and do
not return the uninitialized data, and do not modify the return
pointer either, just print an error message.

Reported by clang build:
"
$ make HOSTCC=clang CC=clang KCFLAGS=-Werror sandbox64_defconfig && make HOSTCC=clang CC=clang KCFLAGS=-Werror
...
boot/image-board.c:1006:7: error: variable 'data' is used uninitialized whenever switch case is taken [-Werror,-Wsometimes-uninitialized]
case IMAGE_FORMAT_LEGACY:
^~~~~~~~~~~~~~~~~~~
include/image.h:608:29: note: expanded from macro 'IMAGE_FORMAT_LEGACY'
^~~~
boot/image-board.c:1128:19: note: uninitialized use occurs here
*datap = (char *)data;
^~~~
boot/image-board.c:1001:11: note: initialize the variable 'data' to silence this warning
u32 *data;
^
= NULL
"

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 210af549 05-Feb-2023 Simon Glass <sjg@chromium.org>

Correct SPL uses of LMB

This converts 9 usages of this option to the non-SPL form, since there is
no SPL_LMB defined in Kconfig

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

# 30f3333d 06-Jan-2023 Simon Glass <sjg@chromium.org>

image: Move common image code to image_board and command

We should use the cmd/ directory for commands rather than for common code
used elsewhere in U-Boot. Move the common 'source' code into
image-board.c to achieve this.

The image_source_script() function needs to call run_command_list() so
seems to belong better in the command library. Move and rename it.

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

# 65cc0e2a 16-Nov-2022 Tom Rini <trini@konsulko.com>

global: Move remaining CONFIG_SYS_* to CFG_SYS_*

The rest of the unmigrated CONFIG symbols in the CONFIG_SYS namespace do
not easily transition to Kconfig. In many cases they likely should come
from the device tree instead. Move these out of CONFIG namespace and in
to CFG namespace.

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

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

global: Move remaining CONFIG_SYS_SDRAM_* to CFG_SYS_SDRAM_*

The rest of the unmigrated CONFIG symbols in the CONFIG_SYS_SDRAM
namespace do not easily transition to Kconfig. In many cases they likely
should come from the device tree instead. Move these out of CONFIG
namespace and in to CFG namespace.

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

# f3543e69 06-Sep-2022 Simon Glass <sjg@chromium.org>

treewide: Drop image_header_t typedef

This is not needed and we should avoid typedefs. Use the struct instead
and rename it to indicate that it really is a legacy struct.

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

# d9d7c20b 06-Sep-2022 Simon Glass <sjg@chromium.org>

treewide: Drop bootm_headers_t typedef

This is not needed and we should avoid typedefs. Use the struct instead.

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

# 29caf930 02-Sep-2022 Stefan Roese <sr@denx.de>

cyclic: Use schedule() instead of WATCHDOG_RESET()

Globally replace all occurances of WATCHDOG_RESET() with schedule(),
which handles the HW_WATCHDOG functionality and the cyclic
infrastructure.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Tom Rini <trini@konsulko.com> [am335x_evm, mx6cuboxi, rpi_3,dra7xx_evm, pine64_plus, am65x_evm, j721e_evm]

# 9c2e9128 28-Aug-2022 Simon Glass <sjg@chromium.org>

image: Drop some other #ifdefs in image-board.c

Remove all but a few that are difficult, relying on legacy CONFIG options
or optional global_data fields.

Drop the duplicate function name in the comment for boot_get_cmdline().

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

# 20f5d83f 28-Aug-2022 Simon Glass <sjg@chromium.org>

image: Correct indentation in select_ramdisk()

Finish off the refactoring by correcting the indent levels. Note that this
does not include any functional changes.

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

# ca78883f 28-Aug-2022 Simon Glass <sjg@chromium.org>

image: Drop remaining FIT #ifdef

Drop the last one of these, by using a done_select variable to control
whether to fall back to using 'select' as a hex value.

Note that the indentation is not adjusted, to make this easier to review.

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

# 1a68c039 28-Aug-2022 Simon Glass <sjg@chromium.org>

image: Drop another #ifdef for FIT

Drop the prenultimate one of these from select_ramdisk().

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

# f7659f69 28-Aug-2022 Simon Glass <sjg@chromium.org>

image: Drop one #ifdef for FIT

Drop the #ifdef from near the end of select_ramdisk(). Move some variables
to the top of the function to make this work.

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

# 0f81af48 28-Aug-2022 Simon Glass <sjg@chromium.org>

image: Drop #ifdefs for LEGACY_IMAGE_FORMAT

Use if() instead of the #ifdef in select_ramdisk().

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

# 4f2d9412 28-Aug-2022 Simon Glass <sjg@chromium.org>

image: Track when ramdisk processing is completed

The current switch default is tricky since it relies on #ifdefs to work.
Use a bool instead.

Also fix the comment on @select, since it has a dual purpose.

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

# 1ce8e10f 28-Aug-2022 Simon Glass <sjg@chromium.org>

image: Fix up ANDROID_BOOT_IMAGE ramdisk code

Convert this to an if(), fix the cast from an address to a pointer and
make sure that any error is returned correctly.

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

# 4e4bf944 31-Jul-2022 Simon Glass <sjg@chromium.org>

common: Drop display_options.h from common header

Move this out of the common header and include it only where needed.

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

# 282eed50 22-Jul-2022 Oleksandr Suvorov <oleksandr.suvorov@foundries.io>

fpga: pass compatible flags to fpga_load()

These flags may be used to check whether an FPGA driver is able to
load a particular FPGA bitstream image.

Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
Tested-by: Ricardo Salveti <ricardo@foundries.io>
Tested-by: Adrian Fiergolski <adrian.fiergolski@fastree3d.com>
Link: https://lore.kernel.org/r/20220722141614.297383-7-oleksandr.suvorov@foundries.io
Signed-off-by: Michal Simek <michal.simek@amd.com>

# 65168910 07-Jul-2022 Ashok Reddy Soma <ashok.reddy.soma@amd.com>

zynqmp: Run board_get_usable_ram_top() only on main U-Boot

With commit ce39ee28ec31 ("zynqmp: Do not place u-boot to reserved memory
location"), the function board_get_usable_ram_top() is allocating
MMU_SECTION_SIZE of about 2MB using lmb_alloc(). But we dont have this
much memory in case of mini U-Boot.

Keep these functions which use lmb under CONFIG_LMB so that they are
compiled and used only when LMB is enabled.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/75e52def75f573e554a6b177a78504c128cb0c4a.1657183534.git.michal.simek@amd.com

# 6889412a 12-May-2022 Tom Rini <trini@konsulko.com>

Convert CONFIG_SYS_BARGSIZE to Kconfig

This converts the following to Kconfig:
CONFIG_SYS_BARGSIZE

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

# 185f812c 19-Jan-2022 Heinrich Schuchardt <xypron.glpk@gmx.de>

doc: replace @return by Return:

Sphinx expects Return: and not @return to indicate a return value.

find . -name '*.c' -exec \
sed -i 's/^\(\s\)\*\(\s*\)@return\(\s\)/\1*\2Return:\3/' {} \;

find . -name '*.h' -exec \
sed -i 's/^\(\s\)\*\(\s*\)@return\(\s\)/\1*\2Return:\3/' {} \;

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>

# 621158d1 20-Dec-2021 Tom Rini <trini@konsulko.com>

Revert "image: Remove #ifdefs from select_ramdisk()"

This reverts commit f33a2c1bd0fb371511a485cac1f182ba50db51be.

This causes a crash on some platforms as seen here:
https://lore.kernel.org/r/f153017b-c41a-0d32-67b9-f288e695f900@baylibre.com/

Reported-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 4b32531b 08-Nov-2021 Andy Shevchenko <andriy.shevchenko@linux.intel.com>

image: Explicitly declare do_bdinfo()

Compiler is not happy:

common/image-board.c: In function ‘boot_get_kbd’:
common/image-board.c:902:17: warning: implicit declaration of function ‘do_bdinfo’ [-Wimplicit-function-declaration]
902 | do_bdinfo(NULL, 0, 0, NULL);
| ^~~~~~~~~

Move the forward declaration to a header.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 19a91f24 14-Oct-2021 Simon Glass <sjg@chromium.org>

Create a new boot/ directory

Quite a lot of the code in common/relates to booting and images. Before
adding more it seems like a good time to move the code into its own
directory.

Most files with 'boot' or 'image' in them are moved, except:

- autoboot.c which relates to U-Boot automatically running a script
- bootstage.c which relates to U-Boot timing

Drop the removal of boot* files from the output directory, since this
interfers with the symlinks created by tools and there does not appear
to be any such file from my brief testing.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Artem Lapkin <email2tema@gmail.com>
Tested-by: Artem Lapkin <email2tema@gmail.com>

# 1de1a034 12-Nov-2023 Simon Glass <sjg@chromium.org>

boot: Drop size parameter from image_setup_libfdt()

The of_size parameter is not used, so remove it.

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

# 96456285 18-Nov-2023 Simon Glass <sjg@chromium.org>

bootm: Reduce arguments to boot_get_loadables()

This function only uses two arguments. The 'arch' always has a constant
value, so drop it. This simplifies the function call.

Tidy up the function comment while we are here.

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

# 745367b2 18-Nov-2023 Simon Glass <sjg@chromium.org>

bootm: Reduce arguments to boot_get_fpga()

This function only uses two arguments. The 'arch' always has a constant
value, so drop it. This simplifies the function call.

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

# 8eda15bc 18-Nov-2023 Simon Glass <sjg@chromium.org>

bootm: Reduce arguments to boot_get_ramdisk()

This function normally only uses one argument so pass it in directly.
Move comments to the header file so could one day include these
functions in API docs. Fix up the u8 argument while here, since it
avoids the compiler having to mask the value on some machines.

The Android case here is bit strange, since it can use argv[0], so deal
with that in the caller.

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

# 530cc479 18-Nov-2023 Simon Glass <sjg@chromium.org>

image: Tidy up genimg_get_kernel_addr_fit()

This function does not modify its first argument, so mark it const. Also
move the comments to the header file and expand them to provide more
useful information.

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

# 51a765b3 05-Apr-2023 Tom Rini <trini@konsulko.com>

boot/image-board.c: Silence warning in select_ramdisk

When building with clang we get a warning that rdaddr could be
uninitialized in one case. While this cannot functionally happen, we can
easily silence the warning.

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

# e45bba56 16-Feb-2023 Tobias Waldekranz <tobias@waldekranz.com>

image: Fix script execution from FIT images with external data

Update the script loading code to recognize when script data is stored
externally from the FIT metadata (i.e., built with `mkimage -E`).

Signed-off-by: Tobias Waldekranz <tobias@waldekranz.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 636da203 05-Feb-2023 Safae Ouajih <souajih@baylibre.com>

android: boot: support boot image header version 3 and 4

Enable the support for boot image header version 3 and 4
using abootimg command.

In order to use version 3 or 4:

1- Vendor boot image address should be given to abootimg cmd.

abootimg addr $1 $vendor_boot_load_addr

2- "ramdisk_addr_r" env variable (ramdisk address) should be set to host
the ramdisk : generic ramdisk + vendor ramdisk

Replace "struct andr_boot_img_hdr_v0*" by "void *" in
some functions since v3 and v4 are now supported as well.

Signed-off-by: Safae Ouajih <souajih@baylibre.com>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Tested-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>

# e058176b 05-Feb-2023 Safae Ouajih <souajih@baylibre.com>

android: boot: add vendor boot image to prepare for v3, v4 support

Introduce vendor boot image for version 3 and 4 of boot image header.
The vendor boot image will hold extra information about kernel, dtb
and ramdisk.

This is done to prepare for boot image version 3 and 4 support.

Signed-off-by: Safae Ouajih <souajih@baylibre.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Tested-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>

# 734cb47d 05-Feb-2023 Safae Ouajih <souajih@baylibre.com>

android: boot: replace android_image_check_header

With the new vendor boot image introduced in versions 3 and 4
of boot image header, the header check must be done for both boot
image and vendor boot image. Thus, replace android_image_check_header()
by is_android_boot_image_header() to only refer to boot image header check.

Signed-off-by: Safae Ouajih <souajih@baylibre.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Tested-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>

# 771cb4d5 27-Feb-2023 Marek Vasut <marek.vasut+renesas@mailbox.org>

image: Fix potentially uninitialized data variable

In case fitImage support is disabled, and image_locate_script() is
passed a fitImage, then the 'data' variable is used uninitialized.
Drop into the default: branch of the switch-case statement and do
not return the uninitialized data, and do not modify the return
pointer either, just print an error message.

Reported by clang build:
"
$ make HOSTCC=clang CC=clang KCFLAGS=-Werror sandbox64_defconfig && make HOSTCC=clang CC=clang KCFLAGS=-Werror
...
boot/image-board.c:1006:7: error: variable 'data' is used uninitialized whenever switch case is taken [-Werror,-Wsometimes-uninitialized]
case IMAGE_FORMAT_LEGACY:
^~~~~~~~~~~~~~~~~~~
include/image.h:608:29: note: expanded from macro 'IMAGE_FORMAT_LEGACY'
^~~~
boot/image-board.c:1128:19: note: uninitialized use occurs here
*datap = (char *)data;
^~~~
boot/image-board.c:1001:11: note: initialize the variable 'data' to silence this warning
u32 *data;
^
= NULL
"

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 210af549 05-Feb-2023 Simon Glass <sjg@chromium.org>

Correct SPL uses of LMB

This converts 9 usages of this option to the non-SPL form, since there is
no SPL_LMB defined in Kconfig

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

# 30f3333d 06-Jan-2023 Simon Glass <sjg@chromium.org>

image: Move common image code to image_board and command

We should use the cmd/ directory for commands rather than for common code
used elsewhere in U-Boot. Move the common 'source' code into
image-board.c to achieve this.

The image_source_script() function needs to call run_command_list() so
seems to belong better in the command library. Move and rename it.

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

# 65cc0e2a 16-Nov-2022 Tom Rini <trini@konsulko.com>

global: Move remaining CONFIG_SYS_* to CFG_SYS_*

The rest of the unmigrated CONFIG symbols in the CONFIG_SYS namespace do
not easily transition to Kconfig. In many cases they likely should come
from the device tree instead. Move these out of CONFIG namespace and in
to CFG namespace.

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

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

global: Move remaining CONFIG_SYS_SDRAM_* to CFG_SYS_SDRAM_*

The rest of the unmigrated CONFIG symbols in the CONFIG_SYS_SDRAM
namespace do not easily transition to Kconfig. In many cases they likely
should come from the device tree instead. Move these out of CONFIG
namespace and in to CFG namespace.

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

# f3543e69 06-Sep-2022 Simon Glass <sjg@chromium.org>

treewide: Drop image_header_t typedef

This is not needed and we should avoid typedefs. Use the struct instead
and rename it to indicate that it really is a legacy struct.

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

# d9d7c20b 06-Sep-2022 Simon Glass <sjg@chromium.org>

treewide: Drop bootm_headers_t typedef

This is not needed and we should avoid typedefs. Use the struct instead.

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

# 29caf930 02-Sep-2022 Stefan Roese <sr@denx.de>

cyclic: Use schedule() instead of WATCHDOG_RESET()

Globally replace all occurances of WATCHDOG_RESET() with schedule(),
which handles the HW_WATCHDOG functionality and the cyclic
infrastructure.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Tom Rini <trini@konsulko.com> [am335x_evm, mx6cuboxi, rpi_3,dra7xx_evm, pine64_plus, am65x_evm, j721e_evm]

# 9c2e9128 28-Aug-2022 Simon Glass <sjg@chromium.org>

image: Drop some other #ifdefs in image-board.c

Remove all but a few that are difficult, relying on legacy CONFIG options
or optional global_data fields.

Drop the duplicate function name in the comment for boot_get_cmdline().

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

# 20f5d83f 28-Aug-2022 Simon Glass <sjg@chromium.org>

image: Correct indentation in select_ramdisk()

Finish off the refactoring by correcting the indent levels. Note that this
does not include any functional changes.

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

# ca78883f 28-Aug-2022 Simon Glass <sjg@chromium.org>

image: Drop remaining FIT #ifdef

Drop the last one of these, by using a done_select variable to control
whether to fall back to using 'select' as a hex value.

Note that the indentation is not adjusted, to make this easier to review.

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

# 1a68c039 28-Aug-2022 Simon Glass <sjg@chromium.org>

image: Drop another #ifdef for FIT

Drop the prenultimate one of these from select_ramdisk().

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

# f7659f69 28-Aug-2022 Simon Glass <sjg@chromium.org>

image: Drop one #ifdef for FIT

Drop the #ifdef from near the end of select_ramdisk(). Move some variables
to the top of the function to make this work.

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

# 0f81af48 28-Aug-2022 Simon Glass <sjg@chromium.org>

image: Drop #ifdefs for LEGACY_IMAGE_FORMAT

Use if() instead of the #ifdef in select_ramdisk().

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

# 4f2d9412 28-Aug-2022 Simon Glass <sjg@chromium.org>

image: Track when ramdisk processing is completed

The current switch default is tricky since it relies on #ifdefs to work.
Use a bool instead.

Also fix the comment on @select, since it has a dual purpose.

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

# 1ce8e10f 28-Aug-2022 Simon Glass <sjg@chromium.org>

image: Fix up ANDROID_BOOT_IMAGE ramdisk code

Convert this to an if(), fix the cast from an address to a pointer and
make sure that any error is returned correctly.

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

# 4e4bf944 31-Jul-2022 Simon Glass <sjg@chromium.org>

common: Drop display_options.h from common header

Move this out of the common header and include it only where needed.

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

# 282eed50 22-Jul-2022 Oleksandr Suvorov <oleksandr.suvorov@foundries.io>

fpga: pass compatible flags to fpga_load()

These flags may be used to check whether an FPGA driver is able to
load a particular FPGA bitstream image.

Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
Tested-by: Ricardo Salveti <ricardo@foundries.io>
Tested-by: Adrian Fiergolski <adrian.fiergolski@fastree3d.com>
Link: https://lore.kernel.org/r/20220722141614.297383-7-oleksandr.suvorov@foundries.io
Signed-off-by: Michal Simek <michal.simek@amd.com>

# 65168910 07-Jul-2022 Ashok Reddy Soma <ashok.reddy.soma@amd.com>

zynqmp: Run board_get_usable_ram_top() only on main U-Boot

With commit ce39ee28ec31 ("zynqmp: Do not place u-boot to reserved memory
location"), the function board_get_usable_ram_top() is allocating
MMU_SECTION_SIZE of about 2MB using lmb_alloc(). But we dont have this
much memory in case of mini U-Boot.

Keep these functions which use lmb under CONFIG_LMB so that they are
compiled and used only when LMB is enabled.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/75e52def75f573e554a6b177a78504c128cb0c4a.1657183534.git.michal.simek@amd.com

# 6889412a 12-May-2022 Tom Rini <trini@konsulko.com>

Convert CONFIG_SYS_BARGSIZE to Kconfig

This converts the following to Kconfig:
CONFIG_SYS_BARGSIZE

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

# 185f812c 19-Jan-2022 Heinrich Schuchardt <xypron.glpk@gmx.de>

doc: replace @return by Return:

Sphinx expects Return: and not @return to indicate a return value.

find . -name '*.c' -exec \
sed -i 's/^\(\s\)\*\(\s*\)@return\(\s\)/\1*\2Return:\3/' {} \;

find . -name '*.h' -exec \
sed -i 's/^\(\s\)\*\(\s*\)@return\(\s\)/\1*\2Return:\3/' {} \;

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>

# 621158d1 20-Dec-2021 Tom Rini <trini@konsulko.com>

Revert "image: Remove #ifdefs from select_ramdisk()"

This reverts commit f33a2c1bd0fb371511a485cac1f182ba50db51be.

This causes a crash on some platforms as seen here:
https://lore.kernel.org/r/f153017b-c41a-0d32-67b9-f288e695f900@baylibre.com/

Reported-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 4b32531b 08-Nov-2021 Andy Shevchenko <andriy.shevchenko@linux.intel.com>

image: Explicitly declare do_bdinfo()

Compiler is not happy:

common/image-board.c: In function ‘boot_get_kbd’:
common/image-board.c:902:17: warning: implicit declaration of function ‘do_bdinfo’ [-Wimplicit-function-declaration]
902 | do_bdinfo(NULL, 0, 0, NULL);
| ^~~~~~~~~

Move the forward declaration to a header.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 19a91f24 14-Oct-2021 Simon Glass <sjg@chromium.org>

Create a new boot/ directory

Quite a lot of the code in common/relates to booting and images. Before
adding more it seems like a good time to move the code into its own
directory.

Most files with 'boot' or 'image' in them are moved, except:

- autoboot.c which relates to U-Boot automatically running a script
- bootstage.c which relates to U-Boot timing

Drop the removal of boot* files from the output directory, since this
interfers with the symlinks created by tools and there does not appear
to be any such file from my brief testing.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Artem Lapkin <email2tema@gmail.com>
Tested-by: Artem Lapkin <email2tema@gmail.com>

# 51a765b3 05-Apr-2023 Tom Rini <trini@konsulko.com>

boot/image-board.c: Silence warning in select_ramdisk

When building with clang we get a warning that rdaddr could be
uninitialized in one case. While this cannot functionally happen, we can
easily silence the warning.

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

# e45bba56 16-Feb-2023 Tobias Waldekranz <tobias@waldekranz.com>

image: Fix script execution from FIT images with external data

Update the script loading code to recognize when script data is stored
externally from the FIT metadata (i.e., built with `mkimage -E`).

Signed-off-by: Tobias Waldekranz <tobias@waldekranz.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 636da203 05-Feb-2023 Safae Ouajih <souajih@baylibre.com>

android: boot: support boot image header version 3 and 4

Enable the support for boot image header version 3 and 4
using abootimg command.

In order to use version 3 or 4:

1- Vendor boot image address should be given to abootimg cmd.

abootimg addr $1 $vendor_boot_load_addr

2- "ramdisk_addr_r" env variable (ramdisk address) should be set to host
the ramdisk : generic ramdisk + vendor ramdisk

Replace "struct andr_boot_img_hdr_v0*" by "void *" in
some functions since v3 and v4 are now supported as well.

Signed-off-by: Safae Ouajih <souajih@baylibre.com>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Tested-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>

# e058176b 05-Feb-2023 Safae Ouajih <souajih@baylibre.com>

android: boot: add vendor boot image to prepare for v3, v4 support

Introduce vendor boot image for version 3 and 4 of boot image header.
The vendor boot image will hold extra information about kernel, dtb
and ramdisk.

This is done to prepare for boot image version 3 and 4 support.

Signed-off-by: Safae Ouajih <souajih@baylibre.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Tested-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>

# 734cb47d 05-Feb-2023 Safae Ouajih <souajih@baylibre.com>

android: boot: replace android_image_check_header

With the new vendor boot image introduced in versions 3 and 4
of boot image header, the header check must be done for both boot
image and vendor boot image. Thus, replace android_image_check_header()
by is_android_boot_image_header() to only refer to boot image header check.

Signed-off-by: Safae Ouajih <souajih@baylibre.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Tested-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>

# 771cb4d5 27-Feb-2023 Marek Vasut <marek.vasut+renesas@mailbox.org>

image: Fix potentially uninitialized data variable

In case fitImage support is disabled, and image_locate_script() is
passed a fitImage, then the 'data' variable is used uninitialized.
Drop into the default: branch of the switch-case statement and do
not return the uninitialized data, and do not modify the return
pointer either, just print an error message.

Reported by clang build:
"
$ make HOSTCC=clang CC=clang KCFLAGS=-Werror sandbox64_defconfig && make HOSTCC=clang CC=clang KCFLAGS=-Werror
...
boot/image-board.c:1006:7: error: variable 'data' is used uninitialized whenever switch case is taken [-Werror,-Wsometimes-uninitialized]
case IMAGE_FORMAT_LEGACY:
^~~~~~~~~~~~~~~~~~~
include/image.h:608:29: note: expanded from macro 'IMAGE_FORMAT_LEGACY'
^~~~
boot/image-board.c:1128:19: note: uninitialized use occurs here
*datap = (char *)data;
^~~~
boot/image-board.c:1001:11: note: initialize the variable 'data' to silence this warning
u32 *data;
^
= NULL
"

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 210af549 05-Feb-2023 Simon Glass <sjg@chromium.org>

Correct SPL uses of LMB

This converts 9 usages of this option to the non-SPL form, since there is
no SPL_LMB defined in Kconfig

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

# 30f3333d 06-Jan-2023 Simon Glass <sjg@chromium.org>

image: Move common image code to image_board and command

We should use the cmd/ directory for commands rather than for common code
used elsewhere in U-Boot. Move the common 'source' code into
image-board.c to achieve this.

The image_source_script() function needs to call run_command_list() so
seems to belong better in the command library. Move and rename it.

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

# 65cc0e2a 16-Nov-2022 Tom Rini <trini@konsulko.com>

global: Move remaining CONFIG_SYS_* to CFG_SYS_*

The rest of the unmigrated CONFIG symbols in the CONFIG_SYS namespace do
not easily transition to Kconfig. In many cases they likely should come
from the device tree instead. Move these out of CONFIG namespace and in
to CFG namespace.

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

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

global: Move remaining CONFIG_SYS_SDRAM_* to CFG_SYS_SDRAM_*

The rest of the unmigrated CONFIG symbols in the CONFIG_SYS_SDRAM
namespace do not easily transition to Kconfig. In many cases they likely
should come from the device tree instead. Move these out of CONFIG
namespace and in to CFG namespace.

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

# f3543e69 06-Sep-2022 Simon Glass <sjg@chromium.org>

treewide: Drop image_header_t typedef

This is not needed and we should avoid typedefs. Use the struct instead
and rename it to indicate that it really is a legacy struct.

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

# d9d7c20b 06-Sep-2022 Simon Glass <sjg@chromium.org>

treewide: Drop bootm_headers_t typedef

This is not needed and we should avoid typedefs. Use the struct instead.

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

# 29caf930 02-Sep-2022 Stefan Roese <sr@denx.de>

cyclic: Use schedule() instead of WATCHDOG_RESET()

Globally replace all occurances of WATCHDOG_RESET() with schedule(),
which handles the HW_WATCHDOG functionality and the cyclic
infrastructure.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Tom Rini <trini@konsulko.com> [am335x_evm, mx6cuboxi, rpi_3,dra7xx_evm, pine64_plus, am65x_evm, j721e_evm]

# 9c2e9128 28-Aug-2022 Simon Glass <sjg@chromium.org>

image: Drop some other #ifdefs in image-board.c

Remove all but a few that are difficult, relying on legacy CONFIG options
or optional global_data fields.

Drop the duplicate function name in the comment for boot_get_cmdline().

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

# 20f5d83f 28-Aug-2022 Simon Glass <sjg@chromium.org>

image: Correct indentation in select_ramdisk()

Finish off the refactoring by correcting the indent levels. Note that this
does not include any functional changes.

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

# ca78883f 28-Aug-2022 Simon Glass <sjg@chromium.org>

image: Drop remaining FIT #ifdef

Drop the last one of these, by using a done_select variable to control
whether to fall back to using 'select' as a hex value.

Note that the indentation is not adjusted, to make this easier to review.

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

# 1a68c039 28-Aug-2022 Simon Glass <sjg@chromium.org>

image: Drop another #ifdef for FIT

Drop the prenultimate one of these from select_ramdisk().

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

# f7659f69 28-Aug-2022 Simon Glass <sjg@chromium.org>

image: Drop one #ifdef for FIT

Drop the #ifdef from near the end of select_ramdisk(). Move some variables
to the top of the function to make this work.

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

# 0f81af48 28-Aug-2022 Simon Glass <sjg@chromium.org>

image: Drop #ifdefs for LEGACY_IMAGE_FORMAT

Use if() instead of the #ifdef in select_ramdisk().

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

# 4f2d9412 28-Aug-2022 Simon Glass <sjg@chromium.org>

image: Track when ramdisk processing is completed

The current switch default is tricky since it relies on #ifdefs to work.
Use a bool instead.

Also fix the comment on @select, since it has a dual purpose.

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

# 1ce8e10f 28-Aug-2022 Simon Glass <sjg@chromium.org>

image: Fix up ANDROID_BOOT_IMAGE ramdisk code

Convert this to an if(), fix the cast from an address to a pointer and
make sure that any error is returned correctly.

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

# 4e4bf944 31-Jul-2022 Simon Glass <sjg@chromium.org>

common: Drop display_options.h from common header

Move this out of the common header and include it only where needed.

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

# 282eed50 22-Jul-2022 Oleksandr Suvorov <oleksandr.suvorov@foundries.io>

fpga: pass compatible flags to fpga_load()

These flags may be used to check whether an FPGA driver is able to
load a particular FPGA bitstream image.

Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
Tested-by: Ricardo Salveti <ricardo@foundries.io>
Tested-by: Adrian Fiergolski <adrian.fiergolski@fastree3d.com>
Link: https://lore.kernel.org/r/20220722141614.297383-7-oleksandr.suvorov@foundries.io
Signed-off-by: Michal Simek <michal.simek@amd.com>

# 65168910 07-Jul-2022 Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>

zynqmp: Run board_get_usable_ram_top() only on main U-Boot

With commit ce39ee28ec31 ("zynqmp: Do not place u-boot to reserved memory
location"), the function board_get_usable_ram_top() is allocating
MMU_SECTION_SIZE of about 2MB using lmb_alloc(). But we dont have this
much memory in case of mini U-Boot.

Keep these functions which use lmb under CONFIG_LMB so that they are
compiled and used only when LMB is enabled.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/75e52def75f573e554a6b177a78504c128cb0c4a.1657183534.git.michal.simek@amd.com

# 6889412a 12-May-2022 Tom Rini <trini@konsulko.com>

Convert CONFIG_SYS_BARGSIZE to Kconfig

This converts the following to Kconfig:
CONFIG_SYS_BARGSIZE

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

# 185f812c 19-Jan-2022 Heinrich Schuchardt <xypron.glpk@gmx.de>

doc: replace @return by Return:

Sphinx expects Return: and not @return to indicate a return value.

find . -name '*.c' -exec \
sed -i 's/^\(\s\)\*\(\s*\)@return\(\s\)/\1*\2Return:\3/' {} \;

find . -name '*.h' -exec \
sed -i 's/^\(\s\)\*\(\s*\)@return\(\s\)/\1*\2Return:\3/' {} \;

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>

# 621158d1 20-Dec-2021 Tom Rini <trini@konsulko.com>

Revert "image: Remove #ifdefs from select_ramdisk()"

This reverts commit f33a2c1bd0fb371511a485cac1f182ba50db51be.

This causes a crash on some platforms as seen here:
https://lore.kernel.org/r/f153017b-c41a-0d32-67b9-f288e695f900@baylibre.com/

Reported-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 4b32531b 08-Nov-2021 Andy Shevchenko <andriy.shevchenko@linux.intel.com>

image: Explicitly declare do_bdinfo()

Compiler is not happy:

common/image-board.c: In function ‘boot_get_kbd’:
common/image-board.c:902:17: warning: implicit declaration of function ‘do_bdinfo’ [-Wimplicit-function-declaration]
902 | do_bdinfo(NULL, 0, 0, NULL);
| ^~~~~~~~~

Move the forward declaration to a header.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 19a91f24 14-Oct-2021 Simon Glass <sjg@chromium.org>

Create a new boot/ directory

Quite a lot of the code in common/relates to booting and images. Before
adding more it seems like a good time to move the code into its own
directory.

Most files with 'boot' or 'image' in them are moved, except:

- autoboot.c which relates to U-Boot automatically running a script
- bootstage.c which relates to U-Boot timing

Drop the removal of boot* files from the output directory, since this
interfers with the symlinks created by tools and there does not appear
to be any such file from my brief testing.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Artem Lapkin <email2tema@gmail.com>
Tested-by: Artem Lapkin <email2tema@gmail.com>

# e45bba56 16-Feb-2023 Tobias Waldekranz <tobias@waldekranz.com>

image: Fix script execution from FIT images with external data

Update the script loading code to recognize when script data is stored
externally from the FIT metadata (i.e., built with `mkimage -E`).

Signed-off-by: Tobias Waldekranz <tobias@waldekranz.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 636da203 05-Feb-2023 Safae Ouajih <souajih@baylibre.com>

android: boot: support boot image header version 3 and 4

Enable the support for boot image header version 3 and 4
using abootimg command.

In order to use version 3 or 4:

1- Vendor boot image address should be given to abootimg cmd.

abootimg addr $1 $vendor_boot_load_addr

2- "ramdisk_addr_r" env variable (ramdisk address) should be set to host
the ramdisk : generic ramdisk + vendor ramdisk

Replace "struct andr_boot_img_hdr_v0*" by "void *" in
some functions since v3 and v4 are now supported as well.

Signed-off-by: Safae Ouajih <souajih@baylibre.com>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Tested-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>

# e058176b 05-Feb-2023 Safae Ouajih <souajih@baylibre.com>

android: boot: add vendor boot image to prepare for v3, v4 support

Introduce vendor boot image for version 3 and 4 of boot image header.
The vendor boot image will hold extra information about kernel, dtb
and ramdisk.

This is done to prepare for boot image version 3 and 4 support.

Signed-off-by: Safae Ouajih <souajih@baylibre.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Tested-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>

# 734cb47d 05-Feb-2023 Safae Ouajih <souajih@baylibre.com>

android: boot: replace android_image_check_header

With the new vendor boot image introduced in versions 3 and 4
of boot image header, the header check must be done for both boot
image and vendor boot image. Thus, replace android_image_check_header()
by is_android_boot_image_header() to only refer to boot image header check.

Signed-off-by: Safae Ouajih <souajih@baylibre.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Tested-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>

# 771cb4d5 27-Feb-2023 Marek Vasut <marek.vasut+renesas@mailbox.org>

image: Fix potentially uninitialized data variable

In case fitImage support is disabled, and image_locate_script() is
passed a fitImage, then the 'data' variable is used uninitialized.
Drop into the default: branch of the switch-case statement and do
not return the uninitialized data, and do not modify the return
pointer either, just print an error message.

Reported by clang build:
"
$ make HOSTCC=clang CC=clang KCFLAGS=-Werror sandbox64_defconfig && make HOSTCC=clang CC=clang KCFLAGS=-Werror
...
boot/image-board.c:1006:7: error: variable 'data' is used uninitialized whenever switch case is taken [-Werror,-Wsometimes-uninitialized]
case IMAGE_FORMAT_LEGACY:
^~~~~~~~~~~~~~~~~~~
include/image.h:608:29: note: expanded from macro 'IMAGE_FORMAT_LEGACY'
^~~~
boot/image-board.c:1128:19: note: uninitialized use occurs here
*datap = (char *)data;
^~~~
boot/image-board.c:1001:11: note: initialize the variable 'data' to silence this warning
u32 *data;
^
= NULL
"

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 210af549 05-Feb-2023 Simon Glass <sjg@chromium.org>

Correct SPL uses of LMB

This converts 9 usages of this option to the non-SPL form, since there is
no SPL_LMB defined in Kconfig

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

# 30f3333d 06-Jan-2023 Simon Glass <sjg@chromium.org>

image: Move common image code to image_board and command

We should use the cmd/ directory for commands rather than for common code
used elsewhere in U-Boot. Move the common 'source' code into
image-board.c to achieve this.

The image_source_script() function needs to call run_command_list() so
seems to belong better in the command library. Move and rename it.

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

# 65cc0e2a 16-Nov-2022 Tom Rini <trini@konsulko.com>

global: Move remaining CONFIG_SYS_* to CFG_SYS_*

The rest of the unmigrated CONFIG symbols in the CONFIG_SYS namespace do
not easily transition to Kconfig. In many cases they likely should come
from the device tree instead. Move these out of CONFIG namespace and in
to CFG namespace.

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

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

global: Move remaining CONFIG_SYS_SDRAM_* to CFG_SYS_SDRAM_*

The rest of the unmigrated CONFIG symbols in the CONFIG_SYS_SDRAM
namespace do not easily transition to Kconfig. In many cases they likely
should come from the device tree instead. Move these out of CONFIG
namespace and in to CFG namespace.

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

# f3543e69 06-Sep-2022 Simon Glass <sjg@chromium.org>

treewide: Drop image_header_t typedef

This is not needed and we should avoid typedefs. Use the struct instead
and rename it to indicate that it really is a legacy struct.

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

# d9d7c20b 06-Sep-2022 Simon Glass <sjg@chromium.org>

treewide: Drop bootm_headers_t typedef

This is not needed and we should avoid typedefs. Use the struct instead.

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

# 29caf930 02-Sep-2022 Stefan Roese <sr@denx.de>

cyclic: Use schedule() instead of WATCHDOG_RESET()

Globally replace all occurances of WATCHDOG_RESET() with schedule(),
which handles the HW_WATCHDOG functionality and the cyclic
infrastructure.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Tom Rini <trini@konsulko.com> [am335x_evm, mx6cuboxi, rpi_3,dra7xx_evm, pine64_plus, am65x_evm, j721e_evm]

# 9c2e9128 28-Aug-2022 Simon Glass <sjg@chromium.org>

image: Drop some other #ifdefs in image-board.c

Remove all but a few that are difficult, relying on legacy CONFIG options
or optional global_data fields.

Drop the duplicate function name in the comment for boot_get_cmdline().

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

# 20f5d83f 28-Aug-2022 Simon Glass <sjg@chromium.org>

image: Correct indentation in select_ramdisk()

Finish off the refactoring by correcting the indent levels. Note that this
does not include any functional changes.

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

# ca78883f 28-Aug-2022 Simon Glass <sjg@chromium.org>

image: Drop remaining FIT #ifdef

Drop the last one of these, by using a done_select variable to control
whether to fall back to using 'select' as a hex value.

Note that the indentation is not adjusted, to make this easier to review.

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

# 1a68c039 28-Aug-2022 Simon Glass <sjg@chromium.org>

image: Drop another #ifdef for FIT

Drop the prenultimate one of these from select_ramdisk().

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

# f7659f69 28-Aug-2022 Simon Glass <sjg@chromium.org>

image: Drop one #ifdef for FIT

Drop the #ifdef from near the end of select_ramdisk(). Move some variables
to the top of the function to make this work.

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

# 0f81af48 28-Aug-2022 Simon Glass <sjg@chromium.org>

image: Drop #ifdefs for LEGACY_IMAGE_FORMAT

Use if() instead of the #ifdef in select_ramdisk().

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

# 4f2d9412 28-Aug-2022 Simon Glass <sjg@chromium.org>

image: Track when ramdisk processing is completed

The current switch default is tricky since it relies on #ifdefs to work.
Use a bool instead.

Also fix the comment on @select, since it has a dual purpose.

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

# 1ce8e10f 28-Aug-2022 Simon Glass <sjg@chromium.org>

image: Fix up ANDROID_BOOT_IMAGE ramdisk code

Convert this to an if(), fix the cast from an address to a pointer and
make sure that any error is returned correctly.

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

# 4e4bf944 31-Jul-2022 Simon Glass <sjg@chromium.org>

common: Drop display_options.h from common header

Move this out of the common header and include it only where needed.

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

# 282eed50 22-Jul-2022 Oleksandr Suvorov <oleksandr.suvorov@foundries.io>

fpga: pass compatible flags to fpga_load()

These flags may be used to check whether an FPGA driver is able to
load a particular FPGA bitstream image.

Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
Tested-by: Ricardo Salveti <ricardo@foundries.io>
Tested-by: Adrian Fiergolski <adrian.fiergolski@fastree3d.com>
Link: https://lore.kernel.org/r/20220722141614.297383-7-oleksandr.suvorov@foundries.io
Signed-off-by: Michal Simek <michal.simek@amd.com>

# 65168910 07-Jul-2022 Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>

zynqmp: Run board_get_usable_ram_top() only on main U-Boot

With commit ce39ee28ec31 ("zynqmp: Do not place u-boot to reserved memory
location"), the function board_get_usable_ram_top() is allocating
MMU_SECTION_SIZE of about 2MB using lmb_alloc(). But we dont have this
much memory in case of mini U-Boot.

Keep these functions which use lmb under CONFIG_LMB so that they are
compiled and used only when LMB is enabled.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/75e52def75f573e554a6b177a78504c128cb0c4a.1657183534.git.michal.simek@amd.com

# 6889412a 12-May-2022 Tom Rini <trini@konsulko.com>

Convert CONFIG_SYS_BARGSIZE to Kconfig

This converts the following to Kconfig:
CONFIG_SYS_BARGSIZE

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

# 185f812c 19-Jan-2022 Heinrich Schuchardt <xypron.glpk@gmx.de>

doc: replace @return by Return:

Sphinx expects Return: and not @return to indicate a return value.

find . -name '*.c' -exec \
sed -i 's/^\(\s\)\*\(\s*\)@return\(\s\)/\1*\2Return:\3/' {} \;

find . -name '*.h' -exec \
sed -i 's/^\(\s\)\*\(\s*\)@return\(\s\)/\1*\2Return:\3/' {} \;

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>

# 621158d1 20-Dec-2021 Tom Rini <trini@konsulko.com>

Revert "image: Remove #ifdefs from select_ramdisk()"

This reverts commit f33a2c1bd0fb371511a485cac1f182ba50db51be.

This causes a crash on some platforms as seen here:
https://lore.kernel.org/r/f153017b-c41a-0d32-67b9-f288e695f900@baylibre.com/

Reported-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 4b32531b 08-Nov-2021 Andy Shevchenko <andriy.shevchenko@linux.intel.com>

image: Explicitly declare do_bdinfo()

Compiler is not happy:

common/image-board.c: In function ‘boot_get_kbd’:
common/image-board.c:902:17: warning: implicit declaration of function ‘do_bdinfo’ [-Wimplicit-function-declaration]
902 | do_bdinfo(NULL, 0, 0, NULL);
| ^~~~~~~~~

Move the forward declaration to a header.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 19a91f24 14-Oct-2021 Simon Glass <sjg@chromium.org>

Create a new boot/ directory

Quite a lot of the code in common/relates to booting and images. Before
adding more it seems like a good time to move the code into its own
directory.

Most files with 'boot' or 'image' in them are moved, except:

- autoboot.c which relates to U-Boot automatically running a script
- bootstage.c which relates to U-Boot timing

Drop the removal of boot* files from the output directory, since this
interfers with the symlinks created by tools and there does not appear
to be any such file from my brief testing.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Artem Lapkin <email2tema@gmail.com>
Tested-by: Artem Lapkin <email2tema@gmail.com>

# 210af549 05-Feb-2023 Simon Glass <sjg@chromium.org>

Correct SPL uses of LMB

This converts 9 usages of this option to the non-SPL form, since there is
no SPL_LMB defined in Kconfig

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

# 30f3333d 06-Jan-2023 Simon Glass <sjg@chromium.org>

image: Move common image code to image_board and command

We should use the cmd/ directory for commands rather than for common code
used elsewhere in U-Boot. Move the common 'source' code into
image-board.c to achieve this.

The image_source_script() function needs to call run_command_list() so
seems to belong better in the command library. Move and rename it.

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

# 65cc0e2a 16-Nov-2022 Tom Rini <trini@konsulko.com>

global: Move remaining CONFIG_SYS_* to CFG_SYS_*

The rest of the unmigrated CONFIG symbols in the CONFIG_SYS namespace do
not easily transition to Kconfig. In many cases they likely should come
from the device tree instead. Move these out of CONFIG namespace and in
to CFG namespace.

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

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

global: Move remaining CONFIG_SYS_SDRAM_* to CFG_SYS_SDRAM_*

The rest of the unmigrated CONFIG symbols in the CONFIG_SYS_SDRAM
namespace do not easily transition to Kconfig. In many cases they likely
should come from the device tree instead. Move these out of CONFIG
namespace and in to CFG namespace.

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

# f3543e69 06-Sep-2022 Simon Glass <sjg@chromium.org>

treewide: Drop image_header_t typedef

This is not needed and we should avoid typedefs. Use the struct instead
and rename it to indicate that it really is a legacy struct.

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

# d9d7c20b 06-Sep-2022 Simon Glass <sjg@chromium.org>

treewide: Drop bootm_headers_t typedef

This is not needed and we should avoid typedefs. Use the struct instead.

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

# 29caf930 02-Sep-2022 Stefan Roese <sr@denx.de>

cyclic: Use schedule() instead of WATCHDOG_RESET()

Globally replace all occurances of WATCHDOG_RESET() with schedule(),
which handles the HW_WATCHDOG functionality and the cyclic
infrastructure.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Tom Rini <trini@konsulko.com> [am335x_evm, mx6cuboxi, rpi_3,dra7xx_evm, pine64_plus, am65x_evm, j721e_evm]

# 9c2e9128 28-Aug-2022 Simon Glass <sjg@chromium.org>

image: Drop some other #ifdefs in image-board.c

Remove all but a few that are difficult, relying on legacy CONFIG options
or optional global_data fields.

Drop the duplicate function name in the comment for boot_get_cmdline().

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

# 20f5d83f 28-Aug-2022 Simon Glass <sjg@chromium.org>

image: Correct indentation in select_ramdisk()

Finish off the refactoring by correcting the indent levels. Note that this
does not include any functional changes.

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

# ca78883f 28-Aug-2022 Simon Glass <sjg@chromium.org>

image: Drop remaining FIT #ifdef

Drop the last one of these, by using a done_select variable to control
whether to fall back to using 'select' as a hex value.

Note that the indentation is not adjusted, to make this easier to review.

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

# 1a68c039 28-Aug-2022 Simon Glass <sjg@chromium.org>

image: Drop another #ifdef for FIT

Drop the prenultimate one of these from select_ramdisk().

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

# f7659f69 28-Aug-2022 Simon Glass <sjg@chromium.org>

image: Drop one #ifdef for FIT

Drop the #ifdef from near the end of select_ramdisk(). Move some variables
to the top of the function to make this work.

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

# 0f81af48 28-Aug-2022 Simon Glass <sjg@chromium.org>

image: Drop #ifdefs for LEGACY_IMAGE_FORMAT

Use if() instead of the #ifdef in select_ramdisk().

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

# 4f2d9412 28-Aug-2022 Simon Glass <sjg@chromium.org>

image: Track when ramdisk processing is completed

The current switch default is tricky since it relies on #ifdefs to work.
Use a bool instead.

Also fix the comment on @select, since it has a dual purpose.

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

# 1ce8e10f 28-Aug-2022 Simon Glass <sjg@chromium.org>

image: Fix up ANDROID_BOOT_IMAGE ramdisk code

Convert this to an if(), fix the cast from an address to a pointer and
make sure that any error is returned correctly.

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

# 4e4bf944 31-Jul-2022 Simon Glass <sjg@chromium.org>

common: Drop display_options.h from common header

Move this out of the common header and include it only where needed.

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

# 282eed50 22-Jul-2022 Oleksandr Suvorov <oleksandr.suvorov@foundries.io>

fpga: pass compatible flags to fpga_load()

These flags may be used to check whether an FPGA driver is able to
load a particular FPGA bitstream image.

Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
Tested-by: Ricardo Salveti <ricardo@foundries.io>
Tested-by: Adrian Fiergolski <adrian.fiergolski@fastree3d.com>
Link: https://lore.kernel.org/r/20220722141614.297383-7-oleksandr.suvorov@foundries.io
Signed-off-by: Michal Simek <michal.simek@amd.com>

# 65168910 07-Jul-2022 Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>

zynqmp: Run board_get_usable_ram_top() only on main U-Boot

With commit ce39ee28ec31 ("zynqmp: Do not place u-boot to reserved memory
location"), the function board_get_usable_ram_top() is allocating
MMU_SECTION_SIZE of about 2MB using lmb_alloc(). But we dont have this
much memory in case of mini U-Boot.

Keep these functions which use lmb under CONFIG_LMB so that they are
compiled and used only when LMB is enabled.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/75e52def75f573e554a6b177a78504c128cb0c4a.1657183534.git.michal.simek@amd.com

# 6889412a 12-May-2022 Tom Rini <trini@konsulko.com>

Convert CONFIG_SYS_BARGSIZE to Kconfig

This converts the following to Kconfig:
CONFIG_SYS_BARGSIZE

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

# 185f812c 19-Jan-2022 Heinrich Schuchardt <xypron.glpk@gmx.de>

doc: replace @return by Return:

Sphinx expects Return: and not @return to indicate a return value.

find . -name '*.c' -exec \
sed -i 's/^\(\s\)\*\(\s*\)@return\(\s\)/\1*\2Return:\3/' {} \;

find . -name '*.h' -exec \
sed -i 's/^\(\s\)\*\(\s*\)@return\(\s\)/\1*\2Return:\3/' {} \;

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>

# 621158d1 20-Dec-2021 Tom Rini <trini@konsulko.com>

Revert "image: Remove #ifdefs from select_ramdisk()"

This reverts commit f33a2c1bd0fb371511a485cac1f182ba50db51be.

This causes a crash on some platforms as seen here:
https://lore.kernel.org/r/f153017b-c41a-0d32-67b9-f288e695f900@baylibre.com/

Reported-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 4b32531b 08-Nov-2021 Andy Shevchenko <andriy.shevchenko@linux.intel.com>

image: Explicitly declare do_bdinfo()

Compiler is not happy:

common/image-board.c: In function ‘boot_get_kbd’:
common/image-board.c:902:17: warning: implicit declaration of function ‘do_bdinfo’ [-Wimplicit-function-declaration]
902 | do_bdinfo(NULL, 0, 0, NULL);
| ^~~~~~~~~

Move the forward declaration to a header.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 19a91f24 14-Oct-2021 Simon Glass <sjg@chromium.org>

Create a new boot/ directory

Quite a lot of the code in common/relates to booting and images. Before
adding more it seems like a good time to move the code into its own
directory.

Most files with 'boot' or 'image' in them are moved, except:

- autoboot.c which relates to U-Boot automatically running a script
- bootstage.c which relates to U-Boot timing

Drop the removal of boot* files from the output directory, since this
interfers with the symlinks created by tools and there does not appear
to be any such file from my brief testing.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Artem Lapkin <email2tema@gmail.com>
Tested-by: Artem Lapkin <email2tema@gmail.com>

# 30f3333d 06-Jan-2023 Simon Glass <sjg@chromium.org>

image: Move common image code to image_board and command

We should use the cmd/ directory for commands rather than for common code
used elsewhere in U-Boot. Move the common 'source' code into
image-board.c to achieve this.

The image_source_script() function needs to call run_command_list() so
seems to belong better in the command library. Move and rename it.

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

# 65cc0e2a 16-Nov-2022 Tom Rini <trini@konsulko.com>

global: Move remaining CONFIG_SYS_* to CFG_SYS_*

The rest of the unmigrated CONFIG symbols in the CONFIG_SYS namespace do
not easily transition to Kconfig. In many cases they likely should come
from the device tree instead. Move these out of CONFIG namespace and in
to CFG namespace.

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

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

global: Move remaining CONFIG_SYS_SDRAM_* to CFG_SYS_SDRAM_*

The rest of the unmigrated CONFIG symbols in the CONFIG_SYS_SDRAM
namespace do not easily transition to Kconfig. In many cases they likely
should come from the device tree instead. Move these out of CONFIG
namespace and in to CFG namespace.

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

# f3543e69 06-Sep-2022 Simon Glass <sjg@chromium.org>

treewide: Drop image_header_t typedef

This is not needed and we should avoid typedefs. Use the struct instead
and rename it to indicate that it really is a legacy struct.

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

# d9d7c20b 06-Sep-2022 Simon Glass <sjg@chromium.org>

treewide: Drop bootm_headers_t typedef

This is not needed and we should avoid typedefs. Use the struct instead.

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

# 29caf930 02-Sep-2022 Stefan Roese <sr@denx.de>

cyclic: Use schedule() instead of WATCHDOG_RESET()

Globally replace all occurances of WATCHDOG_RESET() with schedule(),
which handles the HW_WATCHDOG functionality and the cyclic
infrastructure.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Tom Rini <trini@konsulko.com> [am335x_evm, mx6cuboxi, rpi_3,dra7xx_evm, pine64_plus, am65x_evm, j721e_evm]

# 9c2e9128 28-Aug-2022 Simon Glass <sjg@chromium.org>

image: Drop some other #ifdefs in image-board.c

Remove all but a few that are difficult, relying on legacy CONFIG options
or optional global_data fields.

Drop the duplicate function name in the comment for boot_get_cmdline().

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

# 20f5d83f 28-Aug-2022 Simon Glass <sjg@chromium.org>

image: Correct indentation in select_ramdisk()

Finish off the refactoring by correcting the indent levels. Note that this
does not include any functional changes.

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

# ca78883f 28-Aug-2022 Simon Glass <sjg@chromium.org>

image: Drop remaining FIT #ifdef

Drop the last one of these, by using a done_select variable to control
whether to fall back to using 'select' as a hex value.

Note that the indentation is not adjusted, to make this easier to review.

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

# 1a68c039 28-Aug-2022 Simon Glass <sjg@chromium.org>

image: Drop another #ifdef for FIT

Drop the prenultimate one of these from select_ramdisk().

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

# f7659f69 28-Aug-2022 Simon Glass <sjg@chromium.org>

image: Drop one #ifdef for FIT

Drop the #ifdef from near the end of select_ramdisk(). Move some variables
to the top of the function to make this work.

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

# 0f81af48 28-Aug-2022 Simon Glass <sjg@chromium.org>

image: Drop #ifdefs for LEGACY_IMAGE_FORMAT

Use if() instead of the #ifdef in select_ramdisk().

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

# 4f2d9412 28-Aug-2022 Simon Glass <sjg@chromium.org>

image: Track when ramdisk processing is completed

The current switch default is tricky since it relies on #ifdefs to work.
Use a bool instead.

Also fix the comment on @select, since it has a dual purpose.

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

# 1ce8e10f 28-Aug-2022 Simon Glass <sjg@chromium.org>

image: Fix up ANDROID_BOOT_IMAGE ramdisk code

Convert this to an if(), fix the cast from an address to a pointer and
make sure that any error is returned correctly.

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

# 4e4bf944 31-Jul-2022 Simon Glass <sjg@chromium.org>

common: Drop display_options.h from common header

Move this out of the common header and include it only where needed.

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

# 282eed50 22-Jul-2022 Oleksandr Suvorov <oleksandr.suvorov@foundries.io>

fpga: pass compatible flags to fpga_load()

These flags may be used to check whether an FPGA driver is able to
load a particular FPGA bitstream image.

Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
Tested-by: Ricardo Salveti <ricardo@foundries.io>
Tested-by: Adrian Fiergolski <adrian.fiergolski@fastree3d.com>
Link: https://lore.kernel.org/r/20220722141614.297383-7-oleksandr.suvorov@foundries.io
Signed-off-by: Michal Simek <michal.simek@amd.com>

# 65168910 07-Jul-2022 Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>

zynqmp: Run board_get_usable_ram_top() only on main U-Boot

With commit ce39ee28ec31 ("zynqmp: Do not place u-boot to reserved memory
location"), the function board_get_usable_ram_top() is allocating
MMU_SECTION_SIZE of about 2MB using lmb_alloc(). But we dont have this
much memory in case of mini U-Boot.

Keep these functions which use lmb under CONFIG_LMB so that they are
compiled and used only when LMB is enabled.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/75e52def75f573e554a6b177a78504c128cb0c4a.1657183534.git.michal.simek@amd.com

# 6889412a 12-May-2022 Tom Rini <trini@konsulko.com>

Convert CONFIG_SYS_BARGSIZE to Kconfig

This converts the following to Kconfig:
CONFIG_SYS_BARGSIZE

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

# 185f812c 19-Jan-2022 Heinrich Schuchardt <xypron.glpk@gmx.de>

doc: replace @return by Return:

Sphinx expects Return: and not @return to indicate a return value.

find . -name '*.c' -exec \
sed -i 's/^\(\s\)\*\(\s*\)@return\(\s\)/\1*\2Return:\3/' {} \;

find . -name '*.h' -exec \
sed -i 's/^\(\s\)\*\(\s*\)@return\(\s\)/\1*\2Return:\3/' {} \;

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>

# 621158d1 20-Dec-2021 Tom Rini <trini@konsulko.com>

Revert "image: Remove #ifdefs from select_ramdisk()"

This reverts commit f33a2c1bd0fb371511a485cac1f182ba50db51be.

This causes a crash on some platforms as seen here:
https://lore.kernel.org/r/f153017b-c41a-0d32-67b9-f288e695f900@baylibre.com/

Reported-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 4b32531b 08-Nov-2021 Andy Shevchenko <andriy.shevchenko@linux.intel.com>

image: Explicitly declare do_bdinfo()

Compiler is not happy:

common/image-board.c: In function ‘boot_get_kbd’:
common/image-board.c:902:17: warning: implicit declaration of function ‘do_bdinfo’ [-Wimplicit-function-declaration]
902 | do_bdinfo(NULL, 0, 0, NULL);
| ^~~~~~~~~

Move the forward declaration to a header.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 19a91f24 14-Oct-2021 Simon Glass <sjg@chromium.org>

Create a new boot/ directory

Quite a lot of the code in common/relates to booting and images. Before
adding more it seems like a good time to move the code into its own
directory.

Most files with 'boot' or 'image' in them are moved, except:

- autoboot.c which relates to U-Boot automatically running a script
- bootstage.c which relates to U-Boot timing

Drop the removal of boot* files from the output directory, since this
interfers with the symlinks created by tools and there does not appear
to be any such file from my brief testing.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Artem Lapkin <email2tema@gmail.com>
Tested-by: Artem Lapkin <email2tema@gmail.com>

# 65cc0e2a 16-Nov-2022 Tom Rini <trini@konsulko.com>

global: Move remaining CONFIG_SYS_* to CFG_SYS_*

The rest of the unmigrated CONFIG symbols in the CONFIG_SYS namespace do
not easily transition to Kconfig. In many cases they likely should come
from the device tree instead. Move these out of CONFIG namespace and in
to CFG namespace.

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

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

global: Move remaining CONFIG_SYS_SDRAM_* to CFG_SYS_SDRAM_*

The rest of the unmigrated CONFIG symbols in the CONFIG_SYS_SDRAM
namespace do not easily transition to Kconfig. In many cases they likely
should come from the device tree instead. Move these out of CONFIG
namespace and in to CFG namespace.

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

# f3543e69 06-Sep-2022 Simon Glass <sjg@chromium.org>

treewide: Drop image_header_t typedef

This is not needed and we should avoid typedefs. Use the struct instead
and rename it to indicate that it really is a legacy struct.

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

# d9d7c20b 06-Sep-2022 Simon Glass <sjg@chromium.org>

treewide: Drop bootm_headers_t typedef

This is not needed and we should avoid typedefs. Use the struct instead.

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

# 29caf930 02-Sep-2022 Stefan Roese <sr@denx.de>

cyclic: Use schedule() instead of WATCHDOG_RESET()

Globally replace all occurances of WATCHDOG_RESET() with schedule(),
which handles the HW_WATCHDOG functionality and the cyclic
infrastructure.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Tom Rini <trini@konsulko.com> [am335x_evm, mx6cuboxi, rpi_3,dra7xx_evm, pine64_plus, am65x_evm, j721e_evm]

# 9c2e9128 28-Aug-2022 Simon Glass <sjg@chromium.org>

image: Drop some other #ifdefs in image-board.c

Remove all but a few that are difficult, relying on legacy CONFIG options
or optional global_data fields.

Drop the duplicate function name in the comment for boot_get_cmdline().

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

# 20f5d83f 28-Aug-2022 Simon Glass <sjg@chromium.org>

image: Correct indentation in select_ramdisk()

Finish off the refactoring by correcting the indent levels. Note that this
does not include any functional changes.

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

# ca78883f 28-Aug-2022 Simon Glass <sjg@chromium.org>

image: Drop remaining FIT #ifdef

Drop the last one of these, by using a done_select variable to control
whether to fall back to using 'select' as a hex value.

Note that the indentation is not adjusted, to make this easier to review.

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

# 1a68c039 28-Aug-2022 Simon Glass <sjg@chromium.org>

image: Drop another #ifdef for FIT

Drop the prenultimate one of these from select_ramdisk().

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

# f7659f69 28-Aug-2022 Simon Glass <sjg@chromium.org>

image: Drop one #ifdef for FIT

Drop the #ifdef from near the end of select_ramdisk(). Move some variables
to the top of the function to make this work.

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

# 0f81af48 28-Aug-2022 Simon Glass <sjg@chromium.org>

image: Drop #ifdefs for LEGACY_IMAGE_FORMAT

Use if() instead of the #ifdef in select_ramdisk().

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

# 4f2d9412 28-Aug-2022 Simon Glass <sjg@chromium.org>

image: Track when ramdisk processing is completed

The current switch default is tricky since it relies on #ifdefs to work.
Use a bool instead.

Also fix the comment on @select, since it has a dual purpose.

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

# 1ce8e10f 28-Aug-2022 Simon Glass <sjg@chromium.org>

image: Fix up ANDROID_BOOT_IMAGE ramdisk code

Convert this to an if(), fix the cast from an address to a pointer and
make sure that any error is returned correctly.

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

# 4e4bf944 31-Jul-2022 Simon Glass <sjg@chromium.org>

common: Drop display_options.h from common header

Move this out of the common header and include it only where needed.

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

# 282eed50 22-Jul-2022 Oleksandr Suvorov <oleksandr.suvorov@foundries.io>

fpga: pass compatible flags to fpga_load()

These flags may be used to check whether an FPGA driver is able to
load a particular FPGA bitstream image.

Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
Tested-by: Ricardo Salveti <ricardo@foundries.io>
Tested-by: Adrian Fiergolski <adrian.fiergolski@fastree3d.com>
Link: https://lore.kernel.org/r/20220722141614.297383-7-oleksandr.suvorov@foundries.io
Signed-off-by: Michal Simek <michal.simek@amd.com>

# 65168910 07-Jul-2022 Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>

zynqmp: Run board_get_usable_ram_top() only on main U-Boot

With commit ce39ee28ec31 ("zynqmp: Do not place u-boot to reserved memory
location"), the function board_get_usable_ram_top() is allocating
MMU_SECTION_SIZE of about 2MB using lmb_alloc(). But we dont have this
much memory in case of mini U-Boot.

Keep these functions which use lmb under CONFIG_LMB so that they are
compiled and used only when LMB is enabled.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/75e52def75f573e554a6b177a78504c128cb0c4a.1657183534.git.michal.simek@amd.com

# 6889412a 12-May-2022 Tom Rini <trini@konsulko.com>

Convert CONFIG_SYS_BARGSIZE to Kconfig

This converts the following to Kconfig:
CONFIG_SYS_BARGSIZE

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

# 185f812c 19-Jan-2022 Heinrich Schuchardt <xypron.glpk@gmx.de>

doc: replace @return by Return:

Sphinx expects Return: and not @return to indicate a return value.

find . -name '*.c' -exec \
sed -i 's/^\(\s\)\*\(\s*\)@return\(\s\)/\1*\2Return:\3/' {} \;

find . -name '*.h' -exec \
sed -i 's/^\(\s\)\*\(\s*\)@return\(\s\)/\1*\2Return:\3/' {} \;

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>

# 621158d1 20-Dec-2021 Tom Rini <trini@konsulko.com>

Revert "image: Remove #ifdefs from select_ramdisk()"

This reverts commit f33a2c1bd0fb371511a485cac1f182ba50db51be.

This causes a crash on some platforms as seen here:
https://lore.kernel.org/r/f153017b-c41a-0d32-67b9-f288e695f900@baylibre.com/

Reported-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 4b32531b 08-Nov-2021 Andy Shevchenko <andriy.shevchenko@linux.intel.com>

image: Explicitly declare do_bdinfo()

Compiler is not happy:

common/image-board.c: In function ‘boot_get_kbd’:
common/image-board.c:902:17: warning: implicit declaration of function ‘do_bdinfo’ [-Wimplicit-function-declaration]
902 | do_bdinfo(NULL, 0, 0, NULL);
| ^~~~~~~~~

Move the forward declaration to a header.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 19a91f24 14-Oct-2021 Simon Glass <sjg@chromium.org>

Create a new boot/ directory

Quite a lot of the code in common/relates to booting and images. Before
adding more it seems like a good time to move the code into its own
directory.

Most files with 'boot' or 'image' in them are moved, except:

- autoboot.c which relates to U-Boot automatically running a script
- bootstage.c which relates to U-Boot timing

Drop the removal of boot* files from the output directory, since this
interfers with the symlinks created by tools and there does not appear
to be any such file from my brief testing.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Artem Lapkin <email2tema@gmail.com>
Tested-by: Artem Lapkin <email2tema@gmail.com>

# f3543e69 06-Sep-2022 Simon Glass <sjg@chromium.org>

treewide: Drop image_header_t typedef

This is not needed and we should avoid typedefs. Use the struct instead
and rename it to indicate that it really is a legacy struct.

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

# d9d7c20b 06-Sep-2022 Simon Glass <sjg@chromium.org>

treewide: Drop bootm_headers_t typedef

This is not needed and we should avoid typedefs. Use the struct instead.

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

# 29caf930 02-Sep-2022 Stefan Roese <sr@denx.de>

cyclic: Use schedule() instead of WATCHDOG_RESET()

Globally replace all occurances of WATCHDOG_RESET() with schedule(),
which handles the HW_WATCHDOG functionality and the cyclic
infrastructure.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Tom Rini <trini@konsulko.com> [am335x_evm, mx6cuboxi, rpi_3,dra7xx_evm, pine64_plus, am65x_evm, j721e_evm]

# 9c2e9128 28-Aug-2022 Simon Glass <sjg@chromium.org>

image: Drop some other #ifdefs in image-board.c

Remove all but a few that are difficult, relying on legacy CONFIG options
or optional global_data fields.

Drop the duplicate function name in the comment for boot_get_cmdline().

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

# 20f5d83f 28-Aug-2022 Simon Glass <sjg@chromium.org>

image: Correct indentation in select_ramdisk()

Finish off the refactoring by correcting the indent levels. Note that this
does not include any functional changes.

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

# ca78883f 28-Aug-2022 Simon Glass <sjg@chromium.org>

image: Drop remaining FIT #ifdef

Drop the last one of these, by using a done_select variable to control
whether to fall back to using 'select' as a hex value.

Note that the indentation is not adjusted, to make this easier to review.

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

# 1a68c039 28-Aug-2022 Simon Glass <sjg@chromium.org>

image: Drop another #ifdef for FIT

Drop the prenultimate one of these from select_ramdisk().

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

# f7659f69 28-Aug-2022 Simon Glass <sjg@chromium.org>

image: Drop one #ifdef for FIT

Drop the #ifdef from near the end of select_ramdisk(). Move some variables
to the top of the function to make this work.

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

# 0f81af48 28-Aug-2022 Simon Glass <sjg@chromium.org>

image: Drop #ifdefs for LEGACY_IMAGE_FORMAT

Use if() instead of the #ifdef in select_ramdisk().

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

# 4f2d9412 28-Aug-2022 Simon Glass <sjg@chromium.org>

image: Track when ramdisk processing is completed

The current switch default is tricky since it relies on #ifdefs to work.
Use a bool instead.

Also fix the comment on @select, since it has a dual purpose.

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

# 1ce8e10f 28-Aug-2022 Simon Glass <sjg@chromium.org>

image: Fix up ANDROID_BOOT_IMAGE ramdisk code

Convert this to an if(), fix the cast from an address to a pointer and
make sure that any error is returned correctly.

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

# 4e4bf944 31-Jul-2022 Simon Glass <sjg@chromium.org>

common: Drop display_options.h from common header

Move this out of the common header and include it only where needed.

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

# 282eed50 22-Jul-2022 Oleksandr Suvorov <oleksandr.suvorov@foundries.io>

fpga: pass compatible flags to fpga_load()

These flags may be used to check whether an FPGA driver is able to
load a particular FPGA bitstream image.

Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
Tested-by: Ricardo Salveti <ricardo@foundries.io>
Tested-by: Adrian Fiergolski <adrian.fiergolski@fastree3d.com>
Link: https://lore.kernel.org/r/20220722141614.297383-7-oleksandr.suvorov@foundries.io
Signed-off-by: Michal Simek <michal.simek@amd.com>

# 65168910 07-Jul-2022 Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>

zynqmp: Run board_get_usable_ram_top() only on main U-Boot

With commit ce39ee28ec31 ("zynqmp: Do not place u-boot to reserved memory
location"), the function board_get_usable_ram_top() is allocating
MMU_SECTION_SIZE of about 2MB using lmb_alloc(). But we dont have this
much memory in case of mini U-Boot.

Keep these functions which use lmb under CONFIG_LMB so that they are
compiled and used only when LMB is enabled.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/75e52def75f573e554a6b177a78504c128cb0c4a.1657183534.git.michal.simek@amd.com

# 6889412a 12-May-2022 Tom Rini <trini@konsulko.com>

Convert CONFIG_SYS_BARGSIZE to Kconfig

This converts the following to Kconfig:
CONFIG_SYS_BARGSIZE

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

# 185f812c 19-Jan-2022 Heinrich Schuchardt <xypron.glpk@gmx.de>

doc: replace @return by Return:

Sphinx expects Return: and not @return to indicate a return value.

find . -name '*.c' -exec \
sed -i 's/^\(\s\)\*\(\s*\)@return\(\s\)/\1*\2Return:\3/' {} \;

find . -name '*.h' -exec \
sed -i 's/^\(\s\)\*\(\s*\)@return\(\s\)/\1*\2Return:\3/' {} \;

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>

# 621158d1 20-Dec-2021 Tom Rini <trini@konsulko.com>

Revert "image: Remove #ifdefs from select_ramdisk()"

This reverts commit f33a2c1bd0fb371511a485cac1f182ba50db51be.

This causes a crash on some platforms as seen here:
https://lore.kernel.org/r/f153017b-c41a-0d32-67b9-f288e695f900@baylibre.com/

Reported-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 4b32531b 08-Nov-2021 Andy Shevchenko <andriy.shevchenko@linux.intel.com>

image: Explicitly declare do_bdinfo()

Compiler is not happy:

common/image-board.c: In function ‘boot_get_kbd’:
common/image-board.c:902:17: warning: implicit declaration of function ‘do_bdinfo’ [-Wimplicit-function-declaration]
902 | do_bdinfo(NULL, 0, 0, NULL);
| ^~~~~~~~~

Move the forward declaration to a header.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 19a91f24 14-Oct-2021 Simon Glass <sjg@chromium.org>

Create a new boot/ directory

Quite a lot of the code in common/relates to booting and images. Before
adding more it seems like a good time to move the code into its own
directory.

Most files with 'boot' or 'image' in them are moved, except:

- autoboot.c which relates to U-Boot automatically running a script
- bootstage.c which relates to U-Boot timing

Drop the removal of boot* files from the output directory, since this
interfers with the symlinks created by tools and there does not appear
to be any such file from my brief testing.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Artem Lapkin <email2tema@gmail.com>
Tested-by: Artem Lapkin <email2tema@gmail.com>

# 4e4bf944 31-Jul-2022 Simon Glass <sjg@chromium.org>

common: Drop display_options.h from common header

Move this out of the common header and include it only where needed.

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

# 282eed50 22-Jul-2022 Oleksandr Suvorov <oleksandr.suvorov@foundries.io>

fpga: pass compatible flags to fpga_load()

These flags may be used to check whether an FPGA driver is able to
load a particular FPGA bitstream image.

Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
Tested-by: Ricardo Salveti <ricardo@foundries.io>
Tested-by: Adrian Fiergolski <adrian.fiergolski@fastree3d.com>
Link: https://lore.kernel.org/r/20220722141614.297383-7-oleksandr.suvorov@foundries.io
Signed-off-by: Michal Simek <michal.simek@amd.com>

# 65168910 07-Jul-2022 Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>

zynqmp: Run board_get_usable_ram_top() only on main U-Boot

With commit ce39ee28ec31 ("zynqmp: Do not place u-boot to reserved memory
location"), the function board_get_usable_ram_top() is allocating
MMU_SECTION_SIZE of about 2MB using lmb_alloc(). But we dont have this
much memory in case of mini U-Boot.

Keep these functions which use lmb under CONFIG_LMB so that they are
compiled and used only when LMB is enabled.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/75e52def75f573e554a6b177a78504c128cb0c4a.1657183534.git.michal.simek@amd.com

# 6889412a 12-May-2022 Tom Rini <trini@konsulko.com>

Convert CONFIG_SYS_BARGSIZE to Kconfig

This converts the following to Kconfig:
CONFIG_SYS_BARGSIZE

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

# 185f812c 19-Jan-2022 Heinrich Schuchardt <xypron.glpk@gmx.de>

doc: replace @return by Return:

Sphinx expects Return: and not @return to indicate a return value.

find . -name '*.c' -exec \
sed -i 's/^\(\s\)\*\(\s*\)@return\(\s\)/\1*\2Return:\3/' {} \;

find . -name '*.h' -exec \
sed -i 's/^\(\s\)\*\(\s*\)@return\(\s\)/\1*\2Return:\3/' {} \;

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>

# 621158d1 20-Dec-2021 Tom Rini <trini@konsulko.com>

Revert "image: Remove #ifdefs from select_ramdisk()"

This reverts commit f33a2c1bd0fb371511a485cac1f182ba50db51be.

This causes a crash on some platforms as seen here:
https://lore.kernel.org/r/f153017b-c41a-0d32-67b9-f288e695f900@baylibre.com/

Reported-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 4b32531b 08-Nov-2021 Andy Shevchenko <andriy.shevchenko@linux.intel.com>

image: Explicitly declare do_bdinfo()

Compiler is not happy:

common/image-board.c: In function ‘boot_get_kbd’:
common/image-board.c:902:17: warning: implicit declaration of function ‘do_bdinfo’ [-Wimplicit-function-declaration]
902 | do_bdinfo(NULL, 0, 0, NULL);
| ^~~~~~~~~

Move the forward declaration to a header.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 19a91f24 14-Oct-2021 Simon Glass <sjg@chromium.org>

Create a new boot/ directory

Quite a lot of the code in common/relates to booting and images. Before
adding more it seems like a good time to move the code into its own
directory.

Most files with 'boot' or 'image' in them are moved, except:

- autoboot.c which relates to U-Boot automatically running a script
- bootstage.c which relates to U-Boot timing

Drop the removal of boot* files from the output directory, since this
interfers with the symlinks created by tools and there does not appear
to be any such file from my brief testing.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Artem Lapkin <email2tema@gmail.com>
Tested-by: Artem Lapkin <email2tema@gmail.com>

# 282eed50 22-Jul-2022 Oleksandr Suvorov <oleksandr.suvorov@foundries.io>

fpga: pass compatible flags to fpga_load()

These flags may be used to check whether an FPGA driver is able to
load a particular FPGA bitstream image.

Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
Tested-by: Ricardo Salveti <ricardo@foundries.io>
Tested-by: Adrian Fiergolski <adrian.fiergolski@fastree3d.com>
Link: https://lore.kernel.org/r/20220722141614.297383-7-oleksandr.suvorov@foundries.io
Signed-off-by: Michal Simek <michal.simek@amd.com>

# 65168910 07-Jul-2022 Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>

zynqmp: Run board_get_usable_ram_top() only on main U-Boot

With commit ce39ee28ec31 ("zynqmp: Do not place u-boot to reserved memory
location"), the function board_get_usable_ram_top() is allocating
MMU_SECTION_SIZE of about 2MB using lmb_alloc(). But we dont have this
much memory in case of mini U-Boot.

Keep these functions which use lmb under CONFIG_LMB so that they are
compiled and used only when LMB is enabled.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/75e52def75f573e554a6b177a78504c128cb0c4a.1657183534.git.michal.simek@amd.com

# 6889412a 12-May-2022 Tom Rini <trini@konsulko.com>

Convert CONFIG_SYS_BARGSIZE to Kconfig

This converts the following to Kconfig:
CONFIG_SYS_BARGSIZE

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

# 185f812c 19-Jan-2022 Heinrich Schuchardt <xypron.glpk@gmx.de>

doc: replace @return by Return:

Sphinx expects Return: and not @return to indicate a return value.

find . -name '*.c' -exec \
sed -i 's/^\(\s\)\*\(\s*\)@return\(\s\)/\1*\2Return:\3/' {} \;

find . -name '*.h' -exec \
sed -i 's/^\(\s\)\*\(\s*\)@return\(\s\)/\1*\2Return:\3/' {} \;

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>

# 621158d1 20-Dec-2021 Tom Rini <trini@konsulko.com>

Revert "image: Remove #ifdefs from select_ramdisk()"

This reverts commit f33a2c1bd0fb371511a485cac1f182ba50db51be.

This causes a crash on some platforms as seen here:
https://lore.kernel.org/r/f153017b-c41a-0d32-67b9-f288e695f900@baylibre.com/

Reported-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 4b32531b 08-Nov-2021 Andy Shevchenko <andriy.shevchenko@linux.intel.com>

image: Explicitly declare do_bdinfo()

Compiler is not happy:

common/image-board.c: In function ‘boot_get_kbd’:
common/image-board.c:902:17: warning: implicit declaration of function ‘do_bdinfo’ [-Wimplicit-function-declaration]
902 | do_bdinfo(NULL, 0, 0, NULL);
| ^~~~~~~~~

Move the forward declaration to a header.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 19a91f24 14-Oct-2021 Simon Glass <sjg@chromium.org>

Create a new boot/ directory

Quite a lot of the code in common/relates to booting and images. Before
adding more it seems like a good time to move the code into its own
directory.

Most files with 'boot' or 'image' in them are moved, except:

- autoboot.c which relates to U-Boot automatically running a script
- bootstage.c which relates to U-Boot timing

Drop the removal of boot* files from the output directory, since this
interfers with the symlinks created by tools and there does not appear
to be any such file from my brief testing.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Artem Lapkin <email2tema@gmail.com>
Tested-by: Artem Lapkin <email2tema@gmail.com>

# 6889412a 12-May-2022 Tom Rini <trini@konsulko.com>

Convert CONFIG_SYS_BARGSIZE to Kconfig

This converts the following to Kconfig:
CONFIG_SYS_BARGSIZE

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

# 185f812c 19-Jan-2022 Heinrich Schuchardt <xypron.glpk@gmx.de>

doc: replace @return by Return:

Sphinx expects Return: and not @return to indicate a return value.

find . -name '*.c' -exec \
sed -i 's/^\(\s\)\*\(\s*\)@return\(\s\)/\1*\2Return:\3/' {} \;

find . -name '*.h' -exec \
sed -i 's/^\(\s\)\*\(\s*\)@return\(\s\)/\1*\2Return:\3/' {} \;

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>

# 621158d1 20-Dec-2021 Tom Rini <trini@konsulko.com>

Revert "image: Remove #ifdefs from select_ramdisk()"

This reverts commit f33a2c1bd0fb371511a485cac1f182ba50db51be.

This causes a crash on some platforms as seen here:
https://lore.kernel.org/r/f153017b-c41a-0d32-67b9-f288e695f900@baylibre.com/

Reported-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 4b32531b 08-Nov-2021 Andy Shevchenko <andriy.shevchenko@linux.intel.com>

image: Explicitly declare do_bdinfo()

Compiler is not happy:

common/image-board.c: In function ‘boot_get_kbd’:
common/image-board.c:902:17: warning: implicit declaration of function ‘do_bdinfo’ [-Wimplicit-function-declaration]
902 | do_bdinfo(NULL, 0, 0, NULL);
| ^~~~~~~~~

Move the forward declaration to a header.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 19a91f24 14-Oct-2021 Simon Glass <sjg@chromium.org>

Create a new boot/ directory

Quite a lot of the code in common/relates to booting and images. Before
adding more it seems like a good time to move the code into its own
directory.

Most files with 'boot' or 'image' in them are moved, except:

- autoboot.c which relates to U-Boot automatically running a script
- bootstage.c which relates to U-Boot timing

Drop the removal of boot* files from the output directory, since this
interfers with the symlinks created by tools and there does not appear
to be any such file from my brief testing.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Artem Lapkin <email2tema@gmail.com>
Tested-by: Artem Lapkin <email2tema@gmail.com>

# 185f812c 19-Jan-2022 Heinrich Schuchardt <xypron.glpk@gmx.de>

doc: replace @return by Return:

Sphinx expects Return: and not @return to indicate a return value.

find . -name '*.c' -exec \
sed -i 's/^\(\s\)\*\(\s*\)@return\(\s\)/\1*\2Return:\3/' {} \;

find . -name '*.h' -exec \
sed -i 's/^\(\s\)\*\(\s*\)@return\(\s\)/\1*\2Return:\3/' {} \;

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>

# 621158d1 20-Dec-2021 Tom Rini <trini@konsulko.com>

Revert "image: Remove #ifdefs from select_ramdisk()"

This reverts commit f33a2c1bd0fb371511a485cac1f182ba50db51be.

This causes a crash on some platforms as seen here:
https://lore.kernel.org/r/f153017b-c41a-0d32-67b9-f288e695f900@baylibre.com/

Reported-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 4b32531b 08-Nov-2021 Andy Shevchenko <andriy.shevchenko@linux.intel.com>

image: Explicitly declare do_bdinfo()

Compiler is not happy:

common/image-board.c: In function ‘boot_get_kbd’:
common/image-board.c:902:17: warning: implicit declaration of function ‘do_bdinfo’ [-Wimplicit-function-declaration]
902 | do_bdinfo(NULL, 0, 0, NULL);
| ^~~~~~~~~

Move the forward declaration to a header.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 19a91f24 14-Oct-2021 Simon Glass <sjg@chromium.org>

Create a new boot/ directory

Quite a lot of the code in common/relates to booting and images. Before
adding more it seems like a good time to move the code into its own
directory.

Most files with 'boot' or 'image' in them are moved, except:

- autoboot.c which relates to U-Boot automatically running a script
- bootstage.c which relates to U-Boot timing

Drop the removal of boot* files from the output directory, since this
interfers with the symlinks created by tools and there does not appear
to be any such file from my brief testing.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Artem Lapkin <email2tema@gmail.com>
Tested-by: Artem Lapkin <email2tema@gmail.com>

# 621158d1 20-Dec-2021 Tom Rini <trini@konsulko.com>

Revert "image: Remove #ifdefs from select_ramdisk()"

This reverts commit f33a2c1bd0fb371511a485cac1f182ba50db51be.

This causes a crash on some platforms as seen here:
https://lore.kernel.org/r/f153017b-c41a-0d32-67b9-f288e695f900@baylibre.com/

Reported-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 4b32531b 08-Nov-2021 Andy Shevchenko <andriy.shevchenko@linux.intel.com>

image: Explicitly declare do_bdinfo()

Compiler is not happy:

common/image-board.c: In function ‘boot_get_kbd’:
common/image-board.c:902:17: warning: implicit declaration of function ‘do_bdinfo’ [-Wimplicit-function-declaration]
902 | do_bdinfo(NULL, 0, 0, NULL);
| ^~~~~~~~~

Move the forward declaration to a header.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 19a91f24 14-Oct-2021 Simon Glass <sjg@chromium.org>

Create a new boot/ directory

Quite a lot of the code in common/relates to booting and images. Before
adding more it seems like a good time to move the code into its own
directory.

Most files with 'boot' or 'image' in them are moved, except:

- autoboot.c which relates to U-Boot automatically running a script
- bootstage.c which relates to U-Boot timing

Drop the removal of boot* files from the output directory, since this
interfers with the symlinks created by tools and there does not appear
to be any such file from my brief testing.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Artem Lapkin <email2tema@gmail.com>
Tested-by: Artem Lapkin <email2tema@gmail.com>

# 4b32531b 08-Nov-2021 Andy Shevchenko <andriy.shevchenko@linux.intel.com>

image: Explicitly declare do_bdinfo()

Compiler is not happy:

common/image-board.c: In function ‘boot_get_kbd’:
common/image-board.c:902:17: warning: implicit declaration of function ‘do_bdinfo’ [-Wimplicit-function-declaration]
902 | do_bdinfo(NULL, 0, 0, NULL);
| ^~~~~~~~~

Move the forward declaration to a header.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 19a91f24 14-Oct-2021 Simon Glass <sjg@chromium.org>

Create a new boot/ directory

Quite a lot of the code in common/relates to booting and images. Before
adding more it seems like a good time to move the code into its own
directory.

Most files with 'boot' or 'image' in them are moved, except:

- autoboot.c which relates to U-Boot automatically running a script
- bootstage.c which relates to U-Boot timing

Drop the removal of boot* files from the output directory, since this
interfers with the symlinks created by tools and there does not appear
to be any such file from my brief testing.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Artem Lapkin <email2tema@gmail.com>
Tested-by: Artem Lapkin <email2tema@gmail.com>

# 19a91f24 14-Oct-2021 Simon Glass <sjg@chromium.org>

Create a new boot/ directory

Quite a lot of the code in common/relates to booting and images. Before
adding more it seems like a good time to move the code into its own
directory.

Most files with 'boot' or 'image' in them are moved, except:

- autoboot.c which relates to U-Boot automatically running a script
- bootstage.c which relates to U-Boot timing

Drop the removal of boot* files from the output directory, since this
interfers with the symlinks created by tools and there does not appear
to be any such file from my brief testing.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Artem Lapkin <email2tema@gmail.com>
Tested-by: Artem Lapkin <email2tema@gmail.com>