]> git.dujemihanovic.xyz Git - u-boot.git/log
u-boot.git
13 months agospl: Convert mmc to spl_load
Sean Anderson [Wed, 8 Nov 2023 16:48:50 +0000 (11:48 -0500)]
spl: Convert mmc to spl_load

This converts the mmc loader to spl_load. Legacy images are handled by
spl_load (via spl_parse_image_header), so mmc_load_legacy can be
omitted. To accurately determine whether mmc_load_image_raw_sector is used
(which might not be the case if SYS_MMCSD_FS_BOOT is enabled), we introduce
a helper config SYS_MMCSD_RAW_MODE. This ensures we can inline spl_load
correctly when a board only boots from filesystems. We still need to check
for SPL_MMC, since some boards enable configure raw mode even without MMC
support.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
13 months agospl: Convert fat to spl_load
Sean Anderson [Wed, 8 Nov 2023 16:48:49 +0000 (11:48 -0500)]
spl: Convert fat to spl_load

This converts the fat loader to use spl_load. Some platforms are very
tight on space, so we take care to only include the code we really need.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
13 months agospl: Convert ext to use spl_load
Sean Anderson [Wed, 8 Nov 2023 16:48:48 +0000 (11:48 -0500)]
spl: Convert ext to use spl_load

This converts the ext load method to use spl_load. As a consequence, it
also adds support for FIT and IMX images.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
13 months agospl: Add generic spl_load function
Sean Anderson [Wed, 8 Nov 2023 16:48:47 +0000 (11:48 -0500)]
spl: Add generic spl_load function

Implementers of SPL_LOAD_IMAGE_METHOD have to correctly determine what
type of image is being loaded and then call the appropriate image load
function correctly. This is tricky, because some image load functions
expect the whole image to already be loaded (CONFIG_SPL_LOAD_FIT_FULL),
some will load the image automatically using spl_load_info.read()
(CONFIG_SPL_LOAD_FIT/CONFIG_SPL_LOAD_IMX_CONTAINER), and some just parse
the header and expect the caller to do the actual loading afterwards
(legacy/raw images). Load methods often only support a subset of the
above methods, meaning that not all image types can be used with all
load methods. Further, the code to invoke these functions is
duplicated between different load functions.

To address this problem, this commit introduces a "spl_load" function.
It aims to handle image detection and correct invocation of each of the
parse/load functions.

Although this function generally results in a size reduction with
several users, it tends to bloat boards with only a single user.
This is generally because programmers open-coding the contents of this
function can make optimizations based on the specific loader. For
example, NOR flash is memory-mapped, so it never bothers calling
load->read. The compiler can't really make these optimizations across
translation units. LTO solves this, but it is only available on some
arches. To address this, perform "pseudo-LTO" by inlining spl_load when
there are one or fewer users. At the moment, there are no users, so
define SPL_LOAD_USERS to be 0.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
13 months agotest: spl: Support testing LEGACY_LZMA filesystem images
Sean Anderson [Wed, 8 Nov 2023 16:48:46 +0000 (11:48 -0500)]
test: spl: Support testing LEGACY_LZMA filesystem images

These will soon be supported, so we need to be able to test it. Export the
lzma data and generally use the same process in spl_test_mmc_fs as
do_spl_test_load.  If we end up needing this in third place in the future,
it would probably be good to refactor things out.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
13 months agospl: legacy: Split off LZMA decompression into its own function
Sean Anderson [Wed, 8 Nov 2023 16:48:45 +0000 (11:48 -0500)]
spl: legacy: Split off LZMA decompression into its own function

To allow for easier reuse of this functionality, split it off into its
own function.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
13 months agospl: nand: Remove spl_nand_legacy_read
Sean Anderson [Wed, 8 Nov 2023 16:48:44 +0000 (11:48 -0500)]
spl: nand: Remove spl_nand_legacy_read

Now that spl_nand_fit_read works in units of bytes, it can be combined with
spl_nand_legacy_read. Rename the resulting function spl_nand_read, since it
is no longer FIT-specific.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
13 months agospl: Only support bl_len when we have to
Sean Anderson [Wed, 8 Nov 2023 16:48:43 +0000 (11:48 -0500)]
spl: Only support bl_len when we have to

Aligning addresses and sizes causes overhead which is unnecessary when we
are not loading from block devices. Remove bl_len when it is not needed.

For example, on iot2050 we save 144 bytes with this patch (once the rest of
this series is applied):

add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-144 (-144)
Function                                     old     new   delta
spl_load_simple_fit                          920     904     -16
load_simple_fit                              496     444     -52
spl_spi_load_image                           384     308     -76
Total: Before=87431, After=87287, chg -0.16%

We use panic() instead of BUILD_BUG_ON in spl_set_bl_len because we still
need to be able to compile it for things like mmc_load_image_raw_sector,
even if that function will not be used.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
13 months agospl: Remove filename from spl_load_info
Sean Anderson [Wed, 8 Nov 2023 16:48:42 +0000 (11:48 -0500)]
spl: Remove filename from spl_load_info

For filesystems, filename serves the same purpose as priv. However,
spl_load_fit_image also uses it to determine whether to use a DMA-aligned
buffer. This is beneficial for FAT, which uses a bounce-buffer if the
destination is not DMA-aligned. However, this is unnecessary now that
filesystems set bl_len to ARCH_DMA_MINALIGN instead. With this done, we can
remove filename entirely.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
13 months agospl: Set FAT bl_len to ARCH_DMA_MINALIGN
Sean Anderson [Wed, 8 Nov 2023 16:48:41 +0000 (11:48 -0500)]
spl: Set FAT bl_len to ARCH_DMA_MINALIGN

Instead of relying on the presence of filename to determine whether we are
dealing with a FAT filesystem (and should DMA-align the buffer), have FAT set
bl_len to ARCH_DMA_MINALIGN instead. With this done, we can remove the
special-case logic checking for the presence of filename.

Because filesystems are not block-based, we may read less than the size passed
to spl_load_info.read. This can happen if the file size is not DMA-aligned. This
is fine as long as we read the amount we originally wanted to. Modify the
conditions for callers of spl_load_info.read to check against the original,
unaligned size to avoid failing spuriously.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
13 months agospl: Refactor spl_load_info->read to use units of bytes
Sean Anderson [Wed, 8 Nov 2023 16:48:40 +0000 (11:48 -0500)]
spl: Refactor spl_load_info->read to use units of bytes

Simplify things a bit for callers of spl_load_info->read by refactoring it
to use units of bytes instead of bl_len. This generally simplifies the
logic, as MMC is the only loader which actually works in sectors. It will
also allow further refactoring to remove the special-case handling of
filename.  spl_load_legacy_img already works in units of bytes (oops) so it
doesn't need to be changed.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
13 months agospl: Take advantage of bl_len's power-of-twoness
Sean Anderson [Wed, 8 Nov 2023 16:48:39 +0000 (11:48 -0500)]
spl: Take advantage of bl_len's power-of-twoness

bl_len must be a power of two, so we can use ALIGN instead of roundup and
similar tricks to avoid divisions.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
13 months agospl: Remove dev from spl_load_info
Sean Anderson [Wed, 8 Nov 2023 16:48:38 +0000 (11:48 -0500)]
spl: Remove dev from spl_load_info

dev and priv serve the same purpose, and are never set at the same time.
Remove dev and convert all users to priv. While we're at it, reorder bl_len
to be last for better alignment.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
13 months agospl: Remove NULL assignments in spl_load_info
Sean Anderson [Wed, 8 Nov 2023 16:48:37 +0000 (11:48 -0500)]
spl: Remove NULL assignments in spl_load_info

Remove NULL assignments to fields in spl_load_info when .load doesn't
reference these fields. This can result in more efficient code. filename
must stay even if it is unused, since load_simple_fit uses it.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
13 months agospl: semihosting: Don't close fd before spl_load_simple_fit
Sean Anderson [Wed, 8 Nov 2023 16:48:36 +0000 (11:48 -0500)]
spl: semihosting: Don't close fd before spl_load_simple_fit

On real hardware, semihosting calls tend to have a large constant
overhead (on the order of tens of milliseconds). Reduce the number of
calls by one by reusing the existing fd in smh_fit_read, and closing it
at the end of spl_smh_load_image.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
13 months agospl: Make SHOW_ERRORS depend on LIBCOMMON
Sean Anderson [Wed, 8 Nov 2023 16:48:35 +0000 (11:48 -0500)]
spl: Make SHOW_ERRORS depend on LIBCOMMON

The purpose of SHOW_ERRORS is to print extra information. Make it depend
on LIBCOMMON to avoid having to check for two configs.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
13 months agoarm: Disable SPL_FS_FAT when it isn't used
Sean Anderson [Wed, 8 Nov 2023 16:48:34 +0000 (11:48 -0500)]
arm: Disable SPL_FS_FAT when it isn't used

Several boards enable SPL_FS_FAT and SPL_LIBDISK_SUPPORT when they can't be
used (as there is no block device support enabled). Disable these configs.
The list of boards was generated with the following command:

    $ tools/qconfig.py -f SPL SPL_FS_FAT ~SPL_MMC ~SPL_BLK_FS ~SPL_SATA \
                          ~SPL_USB_STORAGE ~ENV_IS_IN_FAT ~EFI

LIBDISK was left enabled for the am* boards, since it seems to result in
actual size reduction, indicating that partitions are being used for
something.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Michal Simek <michal.simek@amd.com>
13 months agospl: blk_fs: Fix uninitialized return value when we can't get a blk_desc
Sean Anderson [Wed, 8 Nov 2023 16:48:33 +0000 (11:48 -0500)]
spl: blk_fs: Fix uninitialized return value when we can't get a blk_desc

Initialize ret to avoid returning garbage if blk_get_devnum_by_uclass_id
fails.

Fixes: 8ce6a2e1757 ("spl: blk: Support loading images from fs")
Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
13 months agoMerge patch series "nand: Add sandbox tests"
Tom Rini [Thu, 16 Nov 2023 17:46:09 +0000 (12:46 -0500)]
Merge patch series "nand: Add sandbox tests"

To quote the author:

This series tests raw nand flash in sandbox and fixes various bugs discovered in
the process. I've tried to do things in a contemporary manner, avoiding the
(numerous) variations present on only a few boards. The test is pretty minimal.
Future work could test the rest of the nand API as well as the MTD API.

Bloat (for v1) at [1] (for boards with SPL_NAND_SUPPORT enabled). Almost
everything grows by a few bytes due to nand_page_size. A few boards grow more,
mostly those using nand_spl_loaders.c. CI at [2].

[1] https://gist.github.com/Forty-Bot/9694f3401893c9e706ccc374922de6c2
[2] https://source.denx.de/u-boot/custodians/u-boot-clk/-/pipelines/18443

13 months agoarm: Enable SYS_THUMB_BUILD on AT91
Sean Anderson [Sun, 5 Nov 2023 02:27:42 +0000 (22:27 -0400)]
arm: Enable SYS_THUMB_BUILD on AT91

Several AT91 boards are quite close to their SPL size limit. For example,
sama5d27_wlsom1_ek_mmc is just 173 bytes short of its limit and doesn't
even fit with older GCCs.

All AT91 processors should have thumb support. Enable SYS_THUMB_BUILD. This
shrinks SPL by around 30%.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
13 months agotest: spl: Add a test for NAND
Sean Anderson [Sat, 4 Nov 2023 20:37:53 +0000 (16:37 -0400)]
test: spl: Add a test for NAND

Add a SPL test for the NAND load method. We use some different functions to
do the writing from the main test since things like nand_write_skip_bad
aren't available in SPL.

We disable BBT scanning, since scan_bbt is only populated when not in SPL.
We use nand_spl_loaders.c as it seems to be common to at least a few boards
already. However, we do not use nand_spl_simple.c because it would require
us to implement cmd_ctrl.  The various nand load functions are adapted from
omap_gpmc. However, they have been modified for simplicity/correctness.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
13 months agonand: Add sandbox driver
Sean Anderson [Sat, 4 Nov 2023 20:37:52 +0000 (16:37 -0400)]
nand: Add sandbox driver

Add a sandbox NAND flash driver to facilitate testing. This driver supports
any number of devices, each using a single chip-select. The OOB data is
stored in-band, with the separation enforced through the API.

For now, create two devices to test with. The first is a very small device
with basic ECC. The second is an 8G device (chosen to be larger than 32
bits). It uses ONFI, with the values copied from the datasheet. It also
doesn't need too strong ECC, which speeds things up.

Although the nand subsystem determines the parameters of a chip based on
the ID, the driver itself requires devicetree properties for each
parameter. We do not derive parameters from the ID because parsing the ID
is non-trivial. We do not just use the parameters that the nand subsystem
has calculated since that is something we should be testing. An exception
is made for the ECC layout, since that is difficult to encode in the device
tree and is not a property of the device itself.

Despite using file I/O to access the backing data, we do not support using
external files. In my experience, these are unnecessary for testing since
tests can generally be written to write their expected data beforehand.
Additionally, we would need to store the "programmed" information somewhere
(complicating the format and the programming process) or try to detect
whether block are erased at runtime (degrading probe speeds).

Information about whether each page has been programmed is stored in an
in-memory buffer. To simplify the implementation, we only support a single
program per erase. While this is accurate for many larger flashes, some
smaller flashes (512 byte) support multiple programs and/or subpage
programs. Support for this could be added later as I believe some
filesystems expect this.

To test ECC, we support error-injection. Surprisingly, only ECC bytes in
the OOB area are protected, even though all bytes are equally susceptible
to error. Because of this, we take care to only corrupt ECC bytes.
Similarly, because ECC covers "steps" and not the whole page, we must take
care to corrupt data in the same way.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
13 months agoarch: sandbox: Add function to create temporary files
Sean Anderson [Sat, 4 Nov 2023 20:37:51 +0000 (16:37 -0400)]
arch: sandbox: Add function to create temporary files

When working with sparse data buffers that may be larger than the address
space, it is convenient to work with files instead. Add a function to create
temporary files of a certain size.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
13 months agonand: Allow reinitialization
Sean Anderson [Sat, 4 Nov 2023 20:37:50 +0000 (16:37 -0400)]
nand: Allow reinitialization

NAND devices are destroyed in between unit tests. Provide a function to
reinitialize the subsystem at the beginning of each test.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
13 months agonand: Add function to unregister NAND devices
Sean Anderson [Sat, 4 Nov 2023 20:37:49 +0000 (16:37 -0400)]
nand: Add function to unregister NAND devices

This performs the opposite of nand_register, allowing drivers to unregister
nand devices. This is probably unnecessary for most regular drivers, but we
expect sandbox drivers to get repeatedly bound/unbound, so this will help
avoid dangling pointers.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
13 months agomtd: Add some fallbacks for add/del_mtd_device
Sean Anderson [Sat, 4 Nov 2023 20:37:48 +0000 (16:37 -0400)]
mtd: Add some fallbacks for add/del_mtd_device

This allows using these functions without ifdefs. OneNAND depends on MTD,
so this ifdef was redundant in the first place.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
13 months agomtd: Rename SPL_MTD_SUPPORT to SPL_MTD
Sean Anderson [Sat, 4 Nov 2023 20:37:47 +0000 (16:37 -0400)]
mtd: Rename SPL_MTD_SUPPORT to SPL_MTD

Rename SPL_MTD_SUPPORT to SPL_MTD in order to match MTD. This allows using
CONFIG_IS_ENABLED to test for MTD support.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
13 months agospl: nand: Map memory before accessing it
Sean Anderson [Sat, 4 Nov 2023 20:37:46 +0000 (16:37 -0400)]
spl: nand: Map memory before accessing it

In sandbox we must map memory before accessing it. Do so for the NAND load
method.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
13 months agocmd: nand: Map memory before accessing it
Sean Anderson [Sat, 4 Nov 2023 20:37:45 +0000 (16:37 -0400)]
cmd: nand: Map memory before accessing it

In sandbox, all memory must be mapped before accessing it. Do so for the
nand command.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
13 months agospl: nand: Set bl_len to page size
Sean Anderson [Sat, 4 Nov 2023 20:37:44 +0000 (16:37 -0400)]
spl: nand: Set bl_len to page size

Since commit 34793598c83 ("mtd: nand: mxs_nand_spl: Remove the page aligned
access") there are no longer any users of nand_get_mtd. However, it is
still important to know what the page size is so we can allocate a
large-enough buffer. If the image size is not page-aligned, we will go off
the end of the buffer and clobber some memory.

Introduce a new function nand_page_size which returns the page size. For
most drivers it is easy to determine the page size. However, a few need to
be modified since they only keep the page size around temporarily.

It's possible that this patch could cause a regression on some platforms if
the offset is non-aligned and there is invalid address space immediately
before the load address. spl_load_legacy_img does not (except when
compressing) respect bl_len, so only boards with SPL_LOAD_FIT (8 boards) or
SPL_LOAD_IMX_CONTAINER (none in tree) would be affected.

defconfig               CONFIG_TEXT_BASE
======================= ================
am335x_evm              0x80800000
am43xx_evm              0x80800000
am43xx_evm_rtconly      0x80800000
am43xx_evm_usbhost_boot 0x80800000
am43xx_hs_evm           0x80800000
dra7xx_evm              0x80800000
gwventana_nand          0x17800000
imx8mn_bsh_smm_s2       0x40200000

All the sitara boards have DDR mapped at 0x80000000. gwventana is an i.MX6Q
which has DDR at 0x10000000. I don't have the IMX8MNRM handy, but on the
i.MX8M DDR starts at 0x40000000. Therefore all of these boards can handle a
little underflow.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
13 months agospl: legacy: Honor bl_len when decompressing
Sean Anderson [Sat, 4 Nov 2023 20:37:43 +0000 (16:37 -0400)]
spl: legacy: Honor bl_len when decompressing

When allocating a buffer to load compressed data into, we need to ensure we
have enough space for over- and under-flow due to alignment. Otherwise we
will clobber the malloc bookkeeping data. Calculate the correct amount of
overhead and use it when determining the size.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
13 months agonand: spl_loaders: Only read enough pages to load the image
Sean Anderson [Sat, 4 Nov 2023 20:37:42 +0000 (16:37 -0400)]
nand: spl_loaders: Only read enough pages to load the image

All other implementations of nand_spl_load_image only read as many pages as
are necessary to load the image. However, nand_spl_loaders.c loads the full
block. Align it with other load functions so that it is easier to
determine how large of a load buffer we need.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Michael Trimarchi <michael@amarulasolutions.com>
13 months agonand: Calculate SYS_NAND_BLOCK_PAGES (neeĢ SYS_NAND_PAGE_COUNT) automatically
Sean Anderson [Sat, 4 Nov 2023 20:37:41 +0000 (16:37 -0400)]
nand: Calculate SYS_NAND_BLOCK_PAGES (neeĢ SYS_NAND_PAGE_COUNT) automatically

Contrary to what the help message says, this is the number of pages per
block. Calculate it automatically based on SYS_NAND_BLOCK_SIZE and
SYS_NAND_PAGE_SIZE. To better reflect its semantics, rename it to
SYS_NAND_BLOCK_PAGES.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
13 months agonand: Don't dereference NULL manufacturer_desc
Sean Anderson [Sat, 4 Nov 2023 20:37:40 +0000 (16:37 -0400)]
nand: Don't dereference NULL manufacturer_desc

When no manufacturer is matched, manufacturer_desc is NULL. Avoid
dereferencing it in that case.

Fixes: 4e67c571252 ("mtd,ubi,ubifs: sync with linux v3.15")
Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Michael Trimarchi <michael@amarulasolutions.com>
13 months agospl: nand: Fix NULL-pointer dereference
Sean Anderson [Sat, 4 Nov 2023 20:37:39 +0000 (16:37 -0400)]
spl: nand: Fix NULL-pointer dereference

spl_nand_fit_read unconditionally accesses load->priv. Ensure it is set.

Fixes: 00e180cc513 ("spl: nand: support loading i.MX container format file")
Signed-off-by: Sean Anderson <seanga2@gmail.com>
13 months agoMerge tag 'u-boot-stm32-20231113' of https://source.denx.de/u-boot/custodians/u-boot...
Tom Rini [Mon, 13 Nov 2023 14:07:23 +0000 (09:07 -0500)]
Merge tag 'u-boot-stm32-20231113' of https://source.denx.de/u-boot/custodians/u-boot-stm into next

Introduce STM32MP2 SoCs family support
Add STM32MP257F-EV1 board

[trini: Adjust some includes]
Signed-off-by: Tom Rini <trini@konsulko.com>
13 months agostm32mp2: initial support
Patrice Chotard [Fri, 27 Oct 2023 14:43:04 +0000 (16:43 +0200)]
stm32mp2: initial support

Add initial support for STM32MP2 SoCs family.

SoCs information are available here :
https://www.st.com/content/st_com/en/campaigns/microprocessor-stm32mp2.html

Migrate all MP1 related code into stm32mp1/ directory
Create stm32mp2 directory dedicated for STM32MP2 SoCs.

Common code to MP1, MP13 and MP25 is kept into
arch/arm/mach-stm32/mach-stm32mp directory :
  - boot_params.c
  - bsec
  - cmd_stm32key
  - cmd_stm32prog
  - dram_init.c
  - syscon.c
  - ecdsa_romapi.c

For STM32MP2, it also :
  - adds memory region description needed for ARMv8 MMU.
  - enables early data cache before relocation.
    During the transition before/after relocation, the MMU, initially setup
    at the beginning of DDR, must be setup again at a correct address after
    relocation. This is done in enables_caches() by disabling cache, force
    arch.tlb_fillptr to NULL which will force the MMU to be setup again but
    with a new value for gd->arch.tlb_addr. gd->arch.tlb_addr has been
    updated after relocation in arm_reserve_mmu().

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
13 months agoARM: dts: stm32: Add STM32MP257F Evaluation board support
Patrice Chotard [Fri, 27 Oct 2023 14:43:03 +0000 (16:43 +0200)]
ARM: dts: stm32: Add STM32MP257F Evaluation board support

Add STM32MP257F Evaluation board support. It embeds a STM32MP257FAI SoC,
with 4GB of DDR4, TSN switch (2+1 ports), 2*USB typeA, 1*USB2 typeC,
SNOR OctoSPI, mini PCIe, STPMIC2 for power distribution ...

Sync device tree with kernel v6.6-rc1.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
13 months agopinctrl: pinctrl_stm32: Add stm32mp2 support
Patrice Chotard [Fri, 27 Oct 2023 14:43:02 +0000 (16:43 +0200)]
pinctrl: pinctrl_stm32: Add stm32mp2 support

Add stm32mp2 compatible.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
13 months agoserial: stm32: Fix AARCH64 compilation warnings
Patrice Chotard [Fri, 27 Oct 2023 14:43:01 +0000 (16:43 +0200)]
serial: stm32: Fix AARCH64 compilation warnings

When building with AARCH64 defconfig, we got warnings, fix them
by using registers base address defined as void __iomem * instead of
fdt_addr_t.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
13 months agostm32mp: bsec: Fix AARCH64 compilation warnings
Patrice Chotard [Fri, 27 Oct 2023 14:43:00 +0000 (16:43 +0200)]
stm32mp: bsec: Fix AARCH64 compilation warnings

When building with AARCH64 defconfig, we got warnings, fix them.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
13 months agostm32mp: dram_init: Limit DDR usage under 4GB boundary for STM32MP
Patrice Chotard [Fri, 27 Oct 2023 14:42:59 +0000 (16:42 +0200)]
stm32mp: dram_init: Limit DDR usage under 4GB boundary for STM32MP

Limit DDR usage under 4GB boundary on STM32MP regardless of
memory size declared in device tree.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
13 months agostm32mp: dram_init: Fix AARCH64 compilation warnings
Patrick Delaunay [Fri, 27 Oct 2023 14:42:58 +0000 (16:42 +0200)]
stm32mp: dram_init: Fix AARCH64 compilation warnings

When building with AARCH64 defconfig, we got warnings for debug
message
- format '%x' expects argument of type 'unsigned int',
   but argument 3 has type 'size_t' {aka 'long unsigned int'}).
- format '%lx' expects argument of type 'long unsigned int',
  but argument 2 has type 'phys_addr_t' {aka 'long long unsigned
  int'}

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
13 months agostm32mp: dram_init: Get RAM size from DT if no RAM driver found
Patrice Chotard [Fri, 27 Oct 2023 14:42:57 +0000 (16:42 +0200)]
stm32mp: dram_init: Get RAM size from DT if no RAM driver found

In case there is no RAM driver retrieve RAM size from DT as fallback.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
13 months agoarm: caches: Make DCACHE_DEFAULT_OPTION accessible for ARM64 arch
Patrice Chotard [Fri, 27 Oct 2023 14:42:56 +0000 (16:42 +0200)]
arm: caches: Make DCACHE_DEFAULT_OPTION accessible for ARM64 arch

This fixes the following compilation error in ARM64:
arch/arm/mach-stm32mp/dram_init.c: In function ā€˜board_get_usable_ram_topā€™:
arch/arm/mach-stm32mp/dram_init.c:59:45: error: ā€˜DCACHE_DEFAULT_OPTIONā€™ undeclared (first use in this function)
   59 |  mmu_set_region_dcache_behaviour(reg, size, DCACHE_DEFAULT_OPTION);
      |                                             ^~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
13 months agoMerge branch '2023-11-10-improve-semihosting-armv6' into next
Tom Rini [Fri, 10 Nov 2023 16:55:28 +0000 (11:55 -0500)]
Merge branch '2023-11-10-improve-semihosting-armv6' into next

To quote the author:
This series has a few fixes for semihosting on ARMv6 and older CPUs. The
first two patches address problems regarding the stack pointer and link
register. U-Boot runs in supervisor mode, so taking a software interrupt
will clobber sp/lr. I think we really should run in system mode, since
it has separate sp/lr registers. To quote ARM DDI 0100I:

> The remaining mode is System mode, which is not entered by any
> exception and has exactly the same registers available as User mode.
> However, it is a privileged mode and is therefore not subject to the
> User mode restrictions. It is intended for use by operating system
> tasks that need access to system resources, but wish to avoid using
> the additional registers associated with the exception modes. Avoiding
> such use ensures that the task state is not corrupted by the
> occurrence of any exception.

However, the processor mode has been supervisor for such a long time
(since relocation got introduced) that I would rather not touch it.

13 months agoarm: semihosting: Support semihosting fallback on 32-bit ARM
Sean Anderson [Fri, 27 Oct 2023 20:40:15 +0000 (16:40 -0400)]
arm: semihosting: Support semihosting fallback on 32-bit ARM

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

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
13 months agoarm: semihosting: Fix returning from traps on ARMv6 and lower
Sean Anderson [Fri, 27 Oct 2023 20:40:14 +0000 (16:40 -0400)]
arm: semihosting: Fix returning from traps on ARMv6 and lower

U-Boot runs in supervisor mode. On ARMv6 and lower, software interrupts
are taken in supervisor mode. When entering an interrupt, the link
register is set to the address of the next instruction. However, if we
are already in supervisor mode, this clobbers the link register. The
debugger can't help us, since by the time it notices we've taken a
software interrupt, the link register is already gone. Work around this
by moving the return address to another register.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
13 months agoarm: Fix software interrupt handler
Sean Anderson [Fri, 27 Oct 2023 20:40:13 +0000 (16:40 -0400)]
arm: Fix software interrupt handler

When we take a software interrupt, we are already in supervisor mode.
get_bad_stack assumes we are not in supervisor mode so it can clobber
the stack pointer. This causes us to have an invalid stack once that
macro finishes. Revert back to the get_bad_stack_swi macro which was
previously removed.

Fixes: 41623c91b09 ("arm: move exception handling out of start.S files")
Signed-off-by: Sean Anderson <sean.anderson@seco.com>
13 months agoscsi: Forceably finish migration to DM_SCSI
Tom Rini [Sat, 28 Oct 2023 00:59:51 +0000 (20:59 -0400)]
scsi: Forceably finish migration to DM_SCSI

The migration deadline for moving to DM_SCSI was v2023.04. A further
reminder was sent out in August 2023 to the remaining platforms that had
not migrated already, and that a few more over the line (or configs
deleted).

With this commit we:
- Rename CONFIG_DM_SCSI to CONFIG_SCSI.
- Remove all of the non-DM SCSI code. This includes removing other
  legacy symbols and code and removes some legacy non-DM AHCI code.
- Some platforms that had previously been DM_SCSI=y && SCSI=n are now
  fully migrated to DM_SCSI as a few corner cases in the code assumed
  DM_SCSI=y meant SCSI=y.

Signed-off-by: Tom Rini <trini@konsulko.com>
13 months agoMerge branch '2023-11-07-assorted-big-cleanups' into next
Tom Rini [Tue, 7 Nov 2023 23:33:09 +0000 (18:33 -0500)]
Merge branch '2023-11-07-assorted-big-cleanups' into next

- Merge in changes such that CONFIG_CMDLINE can be disabled and merge
  in a series that starts to remove <common.h> usage.

13 months agox86: Drop <common.h> from remaining header files
Tom Rini [Wed, 1 Nov 2023 16:28:24 +0000 (12:28 -0400)]
x86: Drop <common.h> from remaining header files

None of these header files need to include <common.h> so we can just
drop that entirely.

Signed-off-by: Tom Rini <trini@konsulko.com>
13 months agoarm: Drop <common.h> from remaining header files
Tom Rini [Wed, 1 Nov 2023 16:28:23 +0000 (12:28 -0400)]
arm: Drop <common.h> from remaining header files

None of these header files need to include <common.h> so we can just
drop that entirely.

Signed-off-by: Tom Rini <trini@konsulko.com>
13 months agosandbox: Drop <common.h>
Tom Rini [Wed, 1 Nov 2023 16:28:22 +0000 (12:28 -0400)]
sandbox: Drop <common.h>

None of these headers need <common.h> to be included, drop it.

Signed-off-by: Tom Rini <trini@konsulko.com>
13 months agoti: k3: Drop <common.h> usage
Tom Rini [Wed, 1 Nov 2023 16:28:21 +0000 (12:28 -0400)]
ti: k3: Drop <common.h> usage

None of these files need <common.h> to be included, drop it.

Signed-off-by: Tom Rini <trini@konsulko.com>
13 months agoinclude: Drop <common.h> from include lists
Tom Rini [Wed, 1 Nov 2023 16:28:20 +0000 (12:28 -0400)]
include: Drop <common.h> from include lists

At this point, we don't need to have <common.h> be included because of
properties in the header itself, it only includes other common header
files. We've also audited the code enough at this point that we can drop
<common.h> from being included in headers and rely on code to have the
correct inclusions themselves, or at least <common.h>.

Signed-off-by: Tom Rini <trini@konsulko.com>
13 months agoinclude/linux/mii.h: Add <linux/types.h>
Tom Rini [Wed, 1 Nov 2023 16:28:19 +0000 (12:28 -0400)]
include/linux/mii.h: Add <linux/types.h>

As this file uses u8/u16 we need to bring in <linux/types.h> here.

Signed-off-by: Tom Rini <trini@konsulko.com>
13 months agofsl-mc: Add prototype for bd_info
Tom Rini [Wed, 1 Nov 2023 16:28:18 +0000 (12:28 -0400)]
fsl-mc: Add prototype for bd_info

As the functions fsl_mc_ldpaa_init/fsl_mc_ldpaa_exit take a bd_info as
an argument, add a struct bd_info to this header file rather than add
<asm/u-boot.h> to the overall chain.

Signed-off-by: Tom Rini <trini@konsulko.com>
13 months agols2080aqds: Add missing headers to eth_ls1088aqds.c
Tom Rini [Wed, 1 Nov 2023 16:28:17 +0000 (12:28 -0400)]
ls2080aqds: Add missing headers to eth_ls1088aqds.c

As we call sprintf in this file we need to include vsprintf.h in order
to get the function prototype and we need linux/string.h for strcmp.

Signed-off-by: Tom Rini <trini@konsulko.com>
13 months agols1088a: Add missing headers to eth_ls1088aqds.c
Tom Rini [Wed, 1 Nov 2023 16:28:16 +0000 (12:28 -0400)]
ls1088a: Add missing headers to eth_ls1088aqds.c

As we call sprintf in this file we need to include vsprintf.h in order
to get the function prototype and we need linux/string.h for strcmp.

Signed-off-by: Tom Rini <trini@konsulko.com>
13 months agopg-wcom-ls102xa: Include <config.h> in the board file
Tom Rini [Wed, 1 Nov 2023 16:28:15 +0000 (12:28 -0400)]
pg-wcom-ls102xa: Include <config.h> in the board file

Given that this file references CFG_* defines, we need to be explicit in
our inclusion of config.h, so that these will be defined.

Reviewed-by: Aleksandar Gerasimovski <aleksandar.gerasimovski@hitacienergy.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
13 months agopowerpc: Rework <asm/fsl_lbc.h> includes
Tom Rini [Wed, 1 Nov 2023 16:28:14 +0000 (12:28 -0400)]
powerpc: Rework <asm/fsl_lbc.h> includes

This file should not include <config.h> nor should it include <common.h>
so remove both.

Signed-off-by: Tom Rini <trini@konsulko.com>
13 months agoqe: Add <asm/ppc.h> on PowerPC
Tom Rini [Wed, 1 Nov 2023 16:28:13 +0000 (12:28 -0400)]
qe: Add <asm/ppc.h> on PowerPC

This driver needs <asm/ppc.h> when building on PowerPC, add it.

Signed-off-by: Tom Rini <trini@konsulko.com>
13 months agompc85xx: Add missing include in mpc85xx_sleep.c
Tom Rini [Wed, 1 Nov 2023 16:28:12 +0000 (12:28 -0400)]
mpc85xx: Add missing include in mpc85xx_sleep.c

This file needs the include file that provides the prototypes for
flush_dcache() and others.

Signed-off-by: Tom Rini <trini@konsulko.com>
13 months agopowerpc: mpc83xx: Rework includes slightly
Tom Rini [Wed, 1 Nov 2023 16:28:11 +0000 (12:28 -0400)]
powerpc: mpc83xx: Rework includes slightly

In order to not rely on common.h providing a number of common includes,
cleanup what we include directly in order to be able to drop common.h
later.

Signed-off-by: Tom Rini <trini@konsulko.com>
13 months agospi: Add <errno.h> to spi-mem-nodm.c
Tom Rini [Wed, 1 Nov 2023 16:28:10 +0000 (12:28 -0400)]
spi: Add <errno.h> to spi-mem-nodm.c

This file uses errno return values in functions, so include <errno.h>
here rather than rely on indirect inclusion.

Signed-off-by: Tom Rini <trini@konsulko.com>
13 months agoomap3: Add <asm/arch/omap3.h> to <asm/arch/cpu.h>
Tom Rini [Wed, 1 Nov 2023 16:28:09 +0000 (12:28 -0400)]
omap3: Add <asm/arch/omap3.h> to <asm/arch/cpu.h>

The include <asm/arch/cpu.h> references values in <asm/arch/omap3.h> and
so include it directly here rather than rely on indirect inclusion.

Signed-off-by: Tom Rini <trini@konsulko.com>
13 months agofsl_qe: Drop common.h
Tom Rini [Wed, 1 Nov 2023 16:28:08 +0000 (12:28 -0400)]
fsl_qe: Drop common.h

In both include/fsl_qe.h and then also remove common.h from the files
which had included fsl_qe.h

Signed-off-by: Tom Rini <trini@konsulko.com>
13 months agodisplay_options.h: Correct includes
Tom Rini [Wed, 1 Nov 2023 16:28:07 +0000 (12:28 -0400)]
display_options.h: Correct includes

First, a header should never include itself so remove that. Second, this
header needs <linux/types.h> to be included as the function prototypes
use types that we get via that header.

Signed-off-by: Tom Rini <trini@konsulko.com>
13 months agopowerpc: Switch <asm/global_data.h> to <linux/types.h>
Tom Rini [Wed, 1 Nov 2023 16:28:06 +0000 (12:28 -0400)]
powerpc: Switch <asm/global_data.h> to <linux/types.h>

In matching other architectures that have their global_data.h need to
bring in a types.h header, switch to <linux/types.h> on PowerPC.

Signed-off-by: Tom Rini <trini@konsulko.com>
13 months agom68k: Remove CONFIG_FSLDMAFEC
Tom Rini [Wed, 1 Nov 2023 16:28:05 +0000 (12:28 -0400)]
m68k: Remove CONFIG_FSLDMAFEC

There are no platforms which enable this feature, so remove it.

Signed-off-by: Tom Rini <trini@konsulko.com>
13 months agoCI, pytest: Add a test for sandbox without LTO
Tom Rini [Thu, 26 Oct 2023 18:31:38 +0000 (14:31 -0400)]
CI, pytest: Add a test for sandbox without LTO

The primary motivation for having a sandbox without LTO build in CI is
to ensure that we don't have that option break. We now have the ability
to run tests of specific options being enabled/disabled, so drop the
parts of CI that build and test that configuration specifically and add
a build test instead. We still test that "NO_LTO=1" rather than editing
the config file works via the ftrace tests.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Rini <trini@konsulko.com>
13 months agosandbox: Add a test for disabling CONFIG_CMDLINE
Simon Glass [Thu, 26 Oct 2023 18:31:37 +0000 (14:31 -0400)]
sandbox: Add a test for disabling CONFIG_CMDLINE

Now that everything is working, add a test to make sure that this
builds correctly.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
13 months agoclk_k210.c: Clean up how we handle nop
Tom Rini [Thu, 26 Oct 2023 18:31:36 +0000 (14:31 -0400)]
clk_k210.c: Clean up how we handle nop

Now that sandbox has <asm/barrier.h> and defines nop() there we should
include that in our driver for clarity and then remove our local nop()
from <k210/pll.h>.

Reviewed-by: Sean Anderson <seanga2@gmail.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
13 months agosandbox: Add <asm/barrier.h>
Tom Rini [Thu, 26 Oct 2023 18:31:35 +0000 (14:31 -0400)]
sandbox: Add <asm/barrier.h>

Add a mostly empty asm/barrier.h file for sandbox where we define nop() to
be an empty function.

Reviewed-by: Sean Anderson <seanga2@gmail.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
13 months agosandbox: Avoid requiring CMDLINE
Simon Glass [Thu, 26 Oct 2023 18:31:34 +0000 (14:31 -0400)]
sandbox: Avoid requiring CMDLINE

Add some dependencies on features that we had been selecting so that we
can still disable CMDLINE.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Rini <trini@konsulko.com>
13 months agosandbox: Disable CONFIG_DISTRO_DEFAULTS
Simon Glass [Thu, 26 Oct 2023 18:31:33 +0000 (14:31 -0400)]
sandbox: Disable CONFIG_DISTRO_DEFAULTS

This is not used for sandbox, so drop it. Enable the things that it
controls to avoid dstrastic changes in the config settings for
sandbox builds.

The end result is that these are enabled:

   BOOTMETH_DISTRO
   BOOTSTD_DEFAULTS

and these are disabled:

   USE_BOOTCOMMAND
   BOOTCOMMAND (was "run distro_bootcmd")
   DISTRO_DEFAULTS

Note that the tools-only build has already disabled DISTRO_DEFAULTS
and BOOTSTD_FULL

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Rini <trini@konsulko.com>
13 months agoblock: rkmtd: select CONFIG_RANDOM_UUID explicitly
AKASHI Takahiro [Thu, 26 Oct 2023 18:31:32 +0000 (14:31 -0400)]
block: rkmtd: select CONFIG_RANDOM_UUID explicitly

This option is necessary to compile any way.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
13 months agolib: uuid: move CONFIG_RANDOM_UUID
AKASHI Takahiro [Thu, 26 Oct 2023 18:31:31 +0000 (14:31 -0400)]
lib: uuid: move CONFIG_RANDOM_UUID

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

It would be better to remove this configuration.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
13 months agofastboot: Depend on CMDLINE
Tom Rini [Thu, 26 Oct 2023 18:31:30 +0000 (14:31 -0400)]
fastboot: Depend on CMDLINE

Much of the functionality of fastboot relies on being able to run
commands as defined in the environment. This means it does depend on
CMDLINE being enabled.

Signed-off-by: Tom Rini <trini@konsulko.com>
13 months agocmd: Make most commands depend on CMDLINE
Simon Glass [Thu, 26 Oct 2023 18:31:29 +0000 (14:31 -0400)]
cmd: Make most commands depend on CMDLINE

If we disable CMDLINE then we should not ask about enabling the hush
parser nor any of the commands that would be run on the command line as
it is no longer available. Convert the CMDLINE option into a menuconfig
and make every command referenced under cmd/Kconfig depend on it.

This leaves as future work moving the commands that are not under the
cmd/ hierarchy as future work.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Rini <trini@konsulko.com>
13 months agoboot: Make preboot and bootcmd require CMDLINE
Tom Rini [Thu, 26 Oct 2023 18:31:28 +0000 (14:31 -0400)]
boot: Make preboot and bootcmd require CMDLINE

In order for a predefined "preboot" or "bootcmd" to be executed by the
running system we must have a command line.  Add CMDLINE as a
dependency.

Signed-off-by: Tom Rini <trini@konsulko.com>
13 months agobootmeth_script: Depend on CMDLINE
Tom Rini [Thu, 26 Oct 2023 18:31:27 +0000 (14:31 -0400)]
bootmeth_script: Depend on CMDLINE

As this particular bootmeth requires the command line and assorted
commands to function, make sure we have CMDLINE enabled.

Signed-off-by: Tom Rini <trini@konsulko.com>
13 months agobootmeth_cros: Require bootm.o and bootm_os.o
Tom Rini [Thu, 26 Oct 2023 18:31:26 +0000 (14:31 -0400)]
bootmeth_cros: Require bootm.o and bootm_os.o

In order to use bootmeth_cros, at least on non-X86, we need to be able
to start any type of kernel that the "bootm" code paths can handle.  Add
these objects to the required list for this option.

Signed-off-by: Tom Rini <trini@konsulko.com>
13 months agoboot: Move SYS_BOOTM_LEN to be by LEGACY_IMAGE_FORMAT
Tom Rini [Thu, 26 Oct 2023 18:31:25 +0000 (14:31 -0400)]
boot: Move SYS_BOOTM_LEN to be by LEGACY_IMAGE_FORMAT

This particular option is required for booting all image types,
regardless of if we are starting an OS via command line or something
else.  Move the question for SYS_BOOTM_LEN to be by the question for
LEGACY_IMAGE_FORMAT, as that's where our generic OS questions start.

Signed-off-by: Tom Rini <trini@konsulko.com>
13 months agoboot: Rework BOOT_DEFAULTS to allow for CMDLINE to be disabled
Tom Rini [Thu, 26 Oct 2023 18:31:24 +0000 (14:31 -0400)]
boot: Rework BOOT_DEFAULTS to allow for CMDLINE to be disabled

We split BOOT_DEFAULTS to have BOOT_DEFAULTS_FEATURES and
BOOT_DEFAULTS_CMDS that in turn list general features or commands that
we want enabled when BOOT_DEFAULTS is selected.  We only select
BOOT_DEFAULTS_CMDS if CMDLINE is set.

Signed-off-by: Tom Rini <trini@konsulko.com>
13 months agoboot: Make DISTRO_DEFAULTS select CMDLINE
Tom Rini [Thu, 26 Oct 2023 18:31:23 +0000 (14:31 -0400)]
boot: Make DISTRO_DEFAULTS select CMDLINE

The implementation of DISTRO_DEFAULTS is done in environment scripts and
requires the command line in order to work. Because of this, select
CMDLINE here.

Signed-off-by: Tom Rini <trini@konsulko.com>
13 months agoautoboot: Correct dependencies on CMDLINE
Simon Glass [Thu, 26 Oct 2023 18:31:22 +0000 (14:31 -0400)]
autoboot: Correct dependencies on CMDLINE

Make AUTOBOOT depend on CMDLINE since it is mostly meaningless without it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
13 months agobootmeth: Make BOOTMETH_EFILOADER depend on CMD_BOOTEFI
Tom Rini [Thu, 26 Oct 2023 18:31:21 +0000 (14:31 -0400)]
bootmeth: Make BOOTMETH_EFILOADER depend on CMD_BOOTEFI

Today, the bootmeth for using the EFI loader via bootefi depends on
calling the bootefi command directly, so make this in turn depend on
CMD_BOOTEFI.

Signed-off-by: Tom Rini <trini@konsulko.com>
13 months agoefi: Rearrange the Kconfig for CMD_BOOTEFI_BOOTMGR
Simon Glass [Thu, 26 Oct 2023 18:31:20 +0000 (14:31 -0400)]
efi: Rearrange the Kconfig for CMD_BOOTEFI_BOOTMGR

The command should not be used to enable library functionality. Add a
new BOOTEFI_BOOTMGR Kconfig for that. Adjust the conditions so that the
same code is built.

Signed-off-by: Simon Glass <sjg@chromium.org>
Suggested-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
13 months agocli_simple: Rework this support slightly
Tom Rini [Thu, 26 Oct 2023 18:31:19 +0000 (14:31 -0400)]
cli_simple: Rework this support slightly

The interactive portion of our non-HUSH 'simple' parser is guarded by
CONFIG_CMDLINE already.  Much of the code behind this simple parser is
also used as "input" parser, such as from menu interfaces and so forth
and not strictly command line input.  To support this, always build the
assorted cli object files, but guard the interactive portions of
cli_simple.c with a CMDLINE check.

Signed-off-by: Tom Rini <trini@konsulko.com>
13 months agovideo: Don't require the font command
Simon Glass [Thu, 26 Oct 2023 18:31:18 +0000 (14:31 -0400)]
video: Don't require the font command

While it is nice to have the font command, using 'select' makes it
impossible to build the console code without it. Stop using 'select' and
make it default if CONSOLE_TRUETYPE is enabled when asking the command.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Rini <trini@konsulko.com>
13 months agotest: Make UNIT_TEST depend on CMDLINE
Simon Glass [Thu, 26 Oct 2023 18:31:17 +0000 (14:31 -0400)]
test: Make UNIT_TEST depend on CMDLINE

Many tests make some use of the command line, so require it for all test
code.

This could be teased apart, perhaps with a test flag indicating that it
uses the command line. Leave that for later.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
13 months agoenv: Move env_set() out of cmd/nvedit.c and in to env/common.c
Tom Rini [Thu, 26 Oct 2023 18:31:16 +0000 (14:31 -0400)]
env: Move env_set() out of cmd/nvedit.c and in to env/common.c

Inside of env/common.c we already have our helper env_set_xxx functions,
and even have a comment that explains why env_set() itself wasn't moved.
We now handle that move. This requires that we rename the previous
_do_env_set() to env_do_env_set() and note it as an internal env
function. Add comments about this function to explain why we do this
when we add the prototype. Add a new function, env_inc_id() to allow for
the counter to be updated by both commands and callers, and document
this as well by the prototype.

Signed-off-by: Tom Rini <trini@konsulko.com>
13 months agoKconfig: Move CONFIG_SYS_[CP]BSIZE to common/Kconfig
Tom Rini [Thu, 26 Oct 2023 18:31:15 +0000 (14:31 -0400)]
Kconfig: Move CONFIG_SYS_[CP]BSIZE to common/Kconfig

Move CONFIG_SYS_CBSIZE (console buffer size) and CONFIG_SYS_PBSIZE
(console print buffer size) out of cmd/Kconfig and in to common/Kconfig.
Create help entries for both which explain their usage and why they are
both not entirely command centric.

Signed-off-by: Tom Rini <trini@konsulko.com>
13 months agoqemu: Correct CMD_QFW dependencies in Kconfig
Tom Rini [Thu, 26 Oct 2023 18:31:14 +0000 (14:31 -0400)]
qemu: Correct CMD_QFW dependencies in Kconfig

Rather than selecting CMD_QFW, we should make the option itself by
enabled by default on these platforms.  Then in the board-specific
Kconfig we should select the appropriate back-end as needed if the
command is enabled.

Signed-off-by: Tom Rini <trini@konsulko.com>
13 months agoversion: Separate our version string from the version command
Tom Rini [Thu, 26 Oct 2023 18:31:13 +0000 (14:31 -0400)]
version: Separate our version string from the version command

In order to be able to disable all commands we need to construct our
version string in a common file, and have the version command reference
that string, like the other users of it do.  Create common/version.c
with just the strings.

Signed-off-by: Tom Rini <trini@konsulko.com>
13 months agodfu: Make DFU_TFTP depend on NETDEVICES
Tom Rini [Thu, 26 Oct 2023 18:31:12 +0000 (14:31 -0400)]
dfu: Make DFU_TFTP depend on NETDEVICES

In order to do a DFU update over TFTP we need to have some network
device available, so make this depend on NETDEVICES

Signed-off-by: Tom Rini <trini@konsulko.com>
13 months agovirtio: Make VIRTIO_NET depend on NETDEVICES
Tom Rini [Thu, 26 Oct 2023 18:31:11 +0000 (14:31 -0400)]
virtio: Make VIRTIO_NET depend on NETDEVICES

As VIRTIO_NET is the symbol for enabling network devices, make this
depend on NETDEVICES

Signed-off-by: Tom Rini <trini@konsulko.com>
13 months agobuildman: Use oldconfig when adjusting the config
Simon Glass [Thu, 26 Oct 2023 18:31:10 +0000 (14:31 -0400)]
buildman: Use oldconfig when adjusting the config

We cannot be sure that the new config is consistent, particularly when
changing a major item like CONFIG_CMDLINE. Use 'make oldconfig' to
check that and avoid any such problems.

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