]> git.ipfire.org Git - thirdparty/u-boot.git/log
thirdparty/u-boot.git
5 weeks agosandbox: move sandbox specifics to booti_setup()
Heinrich Schuchardt [Thu, 11 Jan 2024 08:03:43 +0000 (09:03 +0100)] 
sandbox: move sandbox specifics to booti_setup()

Instead of checking a configuration setting in booti_start() adjust the
sandbox implementation of booti_setup().

Write a console message when trying to run the booti command on the sandbox
indicating that it is not supported.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
5 weeks agosandbox: missing return value checks in eth-raw-os
Heinrich Schuchardt [Sun, 7 Jan 2024 08:27:12 +0000 (09:27 +0100)] 
sandbox: missing return value checks in eth-raw-os

We should check the return value of fcntl().

Addresses-Coverity-ID: 131108 ("Unchecked return value from library")
Addresses-Coverity-ID: 131109 ("Unchecked return value from library")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
5 weeks agoboard: phycore-am62x: Extend for better environment handling
Wadim Egorov [Wed, 3 Apr 2024 13:59:11 +0000 (15:59 +0200)] 
board: phycore-am62x: Extend for better environment handling

Select environment location based on the device we boot from.
Also, introduce a "boot" variable that represents the current boot
device and can be used by scripts.

Signed-off-by: Wadim Egorov <w.egorov@phytec.de>
5 weeks agoarm: mach-k3: am625: Provide a way to obtain boot device for non SPLs
Wadim Egorov [Wed, 3 Apr 2024 13:59:10 +0000 (15:59 +0200)] 
arm: mach-k3: am625: Provide a way to obtain boot device for non SPLs

Introduce get_boot_device() to obtain the booting device. Make it also
available for non SPL builds so u-boot can also know the device it is
booting from.

Signed-off-by: Wadim Egorov <w.egorov@phytec.de>
5 weeks agoarm: mach-k3: am625: copy bootindex to OCRAM for main domain SPL
Wadim Egorov [Wed, 3 Apr 2024 13:59:09 +0000 (15:59 +0200)] 
arm: mach-k3: am625: copy bootindex to OCRAM for main domain SPL

Relocate booindex to OCRAM region after it gets opened by TIFS so
the main domain bootloaders can have access to this data.

Signed-off-by: Wadim Egorov <w.egorov@phytec.de>
5 weeks agoarm: dts: k3: binman: am625: add support for signing TIFSSTUB Images
Kamlesh Gurudasani [Wed, 3 Apr 2024 12:03:10 +0000 (17:33 +0530)] 
arm: dts: k3: binman: am625: add support for signing TIFSSTUB Images

Add support for signing of TIFSSTUB images for HSSE, HSFS and GP devices
and include them in tispl.bin and tispl.bin_unsigned.

Signed-off-by: Kamlesh Gurudasani <kamlesh@ti.com>
Signed-off-by: Dhruva Gole <d-gole@ti.com>
Reviewed-by: Neha Malcom Francis <n-francis@ti.com>
5 weeks agoarm: mach-k3: add support for detecting TIFSSTUB images
Kamlesh Gurudasani [Wed, 3 Apr 2024 12:03:09 +0000 (17:33 +0530)] 
arm: mach-k3: add support for detecting TIFSSTUB images

Add support for detecting and processing TIFSSTUB images for HS, HSFS
and GP devices.

TIFSSTUB image for related device type will be loaded, rest TIFSSTUB
images will be discarded.

Example, for GP device, tifsstub-gp will be loaded, tifsstub-hs and
tifsstub-fs will be discarded.

Signed-off-by: Kamlesh Gurudasani <kamlesh@ti.com>
Signed-off-by: Dhruva Gole <d-gole@ti.com>
Reviewed-by: Neha Malcom Francis <n-francis@ti.com>
5 weeks agoverdin-am62: move verdin am62 to OF_UPSTREAM
Marcel Ziswiler [Wed, 3 Apr 2024 07:15:10 +0000 (09:15 +0200)] 
verdin-am62: move verdin am62 to OF_UPSTREAM

Move verdin-am62 to OF_UPSTREAM:
- handle the fact that dtbs now have a 'ti/' prefix
- imply OF_UPSTREAM
- remove redundant files from arch/arm/dts leaving only the
  *-u-boot.dtsi files
- update MAINTAINERS file

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Dhruva Gole <d-gole@ti.com>
Reviewed-by: Neha Malcom Francis <n-francis@ti.com>
Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
5 weeks agoarm: dts: k3: Remove unneeded ti, sci-sysreset binding and nodes
Andrew Davis [Tue, 2 Apr 2024 16:09:08 +0000 (11:09 -0500)] 
arm: dts: k3: Remove unneeded ti, sci-sysreset binding and nodes

This extra binding is non-standard and now unneeded as we bind the
sysreset driver automatically. This matches what is done in Linux
and allows us to more closely match the DTBs. Remove the binding
and all users.

Signed-off-by: Andrew Davis <afd@ti.com>
Reviewed-by: Neha Malcom Francis <n-francis@ti.com>
Tested-by: Jonathan Humphreys <j-humphreys@ti.com>
5 weeks agofirmware: ti_sci: Bind sysreset driver when enabled
Andrew Davis [Tue, 2 Apr 2024 16:09:07 +0000 (11:09 -0500)] 
firmware: ti_sci: Bind sysreset driver when enabled

The sysreset TI-SCI API is available with TI-SCI always, there is no need
for a DT node to describe the availability of this. If the sysreset driver
is available then bind it during ti-sci probe.

Remove the unneeded device tree matching.

Signed-off-by: Andrew Davis <afd@ti.com>
Tested-by: Jonathan Humphreys <j-humphreys@ti.com>
Reviewed-by: Neha Malcom Francis <n-francis@ti.com>
5 weeks agonet: ti: am65-cpsw: Fix buffer overflow
Michael Walle [Wed, 3 Apr 2024 14:31:55 +0000 (16:31 +0200)] 
net: ti: am65-cpsw: Fix buffer overflow

The device name is a concatenation of the device node name of the cpsw
device and of the device node name of the port. In my case that is

  ethernet@8000000
  port@1

First the buffer is really too small, but more importantly, there is no
boundary check. Use snprintf() and increase the buffer size.

Fixes: 38922b1f4acc ("net: ti: am65-cpsw: Add support for multi port independent MAC mode")
Signed-off-by: Michael Walle <mwalle@kernel.org>
5 weeks agoarm: mach-k3: common: EFI loader map memory below ram top
Vitor Soares [Thu, 28 Mar 2024 10:05:48 +0000 (10:05 +0000)] 
arm: mach-k3: common: EFI loader map memory below ram top

During the boot, the EFI loader maps the memory from ram_top to ram_end
as EFI_BOOT_SERVICES_DATA. When LMB does boot_fdt_add_mem_rsv_regions()
to OPTEE, TFA, R5, and M4F DMA/memory "no-map" for the kernel it produces
the following error message:

ERROR: reserving fdt memory region failed (addr=9cb00000 size=100000 flags=4)
ERROR: reserving fdt memory region failed (addr=9cc00000 size=e00000 flags=4)
ERROR: reserving fdt memory region failed (addr=9da00000 size=100000 flags=4)
ERROR: reserving fdt memory region failed (addr=9db00000 size=c00000 flags=4)
ERROR: reserving fdt memory region failed (addr=9e780000 size=80000 flags=4)
ERROR: reserving fdt memory region failed (addr=9e800000 size=1800000 flags=4)

To avoid this, don't flag with EFI_BOOT_SERVICES_DATA the memory from
ram_top to ram_end by the EFI loader.

Signed-off-by: Vitor Soares <vitor.soares@toradex.com>
5 weeks agoam625x_evm_a53: Tweak boot command to set fdt
Martyn Welch [Tue, 26 Mar 2024 14:26:33 +0000 (14:26 +0000)] 
am625x_evm_a53: Tweak boot command to set fdt

With the current config for tha SK-AM62, fdtfile isn't set in the U-Boot
environment. When using bootflow to boot from a block device, where the
extlinux.conf file specifies `fdtdir`, a fallback device tree is being
constructed from the `soc` (`k3`) and `board` (`am62x`) environment
variables, resulting in u-Boot trying to retrieve
`/dtbs/6.8.1+/k3-am62x.dtb`. This file doesn't exist.

The environment variables `default_device_tree` and
`default_device_tree_arch` are set in the config, the `findfdt` script
can be called to construct `fdtfile` from the environment variables set
by these config options, however this script currently isn't being run.

Calling this script results in the correct device tree being retrieved:

   Retrieving file: /dtbs/6.8.1+/ti/k3-am625-sk.dtb

Many boards are calling this script as part of their boot command. The
am62x currently isn't. Rectify this so that booting works correctly.

Signed-off-by: Martyn Welch <martyn.welch@collabora.com>
Reviewed-by: Christopher Obbard <chris.obbard@collabora.com>
5 weeks agotools: binman: ti_board_cfg: improve error message
Michael Walle [Tue, 26 Mar 2024 09:39:34 +0000 (10:39 +0100)] 
tools: binman: ti_board_cfg: improve error message

When there is a lint error the user gets the following cryptic message:

  binman: Node '/path/to/some/node': Yamllint error: 18: comments

This isn't very helpful. Improve the message to tell the user that the
number is actually a line number and also tell the user in which file
they have to look.

Signed-off-by: Michael Walle <mwalle@kernel.org>
Reviewed-by: Neha Malcom Francis <n-francis@ti.com>
5 weeks agobinman: ti-secure: Enable debug extension for combined boot
Manorit Chawdhry [Tue, 26 Mar 2024 08:07:06 +0000 (13:37 +0530)] 
binman: ti-secure: Enable debug extension for combined boot

To debug using jtag, ROM needs to unlock jtag debugging on HS devices
and it does that looking at this debug extension.

Add the debug extension and enable it by default.

Link: https://software-dl.ti.com/tisci/esd/latest/2_tisci_msgs/security/sec_cert_format.html?highlight=debug#sysfw-debug-ext
Signed-off-by: Manorit Chawdhry <m-chawdhry@ti.com>
Reviewed-by: Neha Malcom Francis <n-francis@ti.com>
5 weeks agoarm: mach-k3: am625: Fixup a53 cpu frequency by speed grade
Joao Paulo Goncalves [Wed, 20 Mar 2024 12:16:32 +0000 (09:16 -0300)] 
arm: mach-k3: am625: Fixup a53 cpu frequency by speed grade

The maximum frequency of the A53 CPU on the AM62 depends on the speed
grade of the SoC. However, this value is hardcoded in the DT for all
AM62 variants, potentially causing specifications to be exceeded. Moreover,
setting a common lower frequency for all variants increases boot time.
To prevent these issues, modify the DT at runtime from the R5 core to
adjust the A53 CPU frequency based on its speed grade.

Suggested-by: Vignesh Raghavendra <vigneshr@ti.com>
Signed-off-by: Joao Paulo Goncalves <joao.goncalves@toradex.com>
5 weeks agoarm: mach-k3: am62: Get a53 max cpu frequency by speed grade
Joao Paulo Goncalves [Wed, 20 Mar 2024 12:16:31 +0000 (09:16 -0300)] 
arm: mach-k3: am62: Get a53 max cpu frequency by speed grade

AM62 SoC has multiple speed grades. Add function to return max A53 CPU
frequency based on grade. Fastest grade's max frequency also depends on
PMIC voltage, to simplify implementation use the smaller value.

Suggested-by: Vignesh Raghavendra <vigneshr@ti.com>
Signed-off-by: Joao Paulo Goncalves <joao.goncalves@toradex.com>
5 weeks agoconfigs: am6*_evm_a53_defconfig: Enable config to support mmc rescan
Judith Mendez [Tue, 19 Mar 2024 18:43:43 +0000 (13:43 -0500)] 
configs: am6*_evm_a53_defconfig: Enable config to support mmc rescan

Enable MMC_SPEED_MODE_SET config option in defconfig to enable
mmc rescan for various Sitara devices.

Signed-off-by: Judith Mendez <jm@ti.com>
5 weeks agoMerge patch series "boot: fdt: Change type of env_get_bootm_low() to phys_addr_t"
Tom Rini [Thu, 11 Apr 2024 15:39:04 +0000 (09:39 -0600)] 
Merge patch series "boot: fdt: Change type of env_get_bootm_low() to phys_addr_t"

5 weeks agoboot: fdt: Move usable variable below updated comment
Marek Vasut [Tue, 26 Mar 2024 22:13:16 +0000 (23:13 +0100)] 
boot: fdt: Move usable variable below updated comment

Move the variable below comment which explains what the variable means.
Update the comment. No functional change.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
5 weeks agoboot: fdt: Drop lmb_alloc*() typecasts
Marek Vasut [Tue, 26 Mar 2024 22:13:15 +0000 (23:13 +0100)] 
boot: fdt: Drop lmb_alloc*() typecasts

The lmb_alloc_base() returns phys_addr_t , map_sysmem() accepts
phys_addr_t as first parameter. Declare 'addr' as phys_addr_t and
get rid of the casts.

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>
5 weeks agoboot: fdt: Clean up env_get_bootm_mapsize()
Marek Vasut [Tue, 26 Mar 2024 22:13:14 +0000 (23:13 +0100)] 
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>
5 weeks agoboot: fdt: Fix tmp type in env_get_bootm_size() and rename to low
Marek Vasut [Tue, 26 Mar 2024 22:13:13 +0000 (23:13 +0100)] 
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>
5 weeks agoboot: fdt: Clean up env_get_bootm_size()
Marek Vasut [Tue, 26 Mar 2024 22:13:12 +0000 (23:13 +0100)] 
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>
5 weeks agoboot: fdt: Change type of env_get_bootm_low() to phys_addr_t
Marek Vasut [Tue, 26 Mar 2024 22:13:11 +0000 (23:13 +0100)] 
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>
5 weeks agoMerge patch series "Resolve issues with booting distros on x86"
Tom Rini [Thu, 11 Apr 2024 02:01:42 +0000 (20:01 -0600)] 
Merge patch series "Resolve issues with booting distros on x86"

Simon Glass <sjg@chromium.org> says:

This little series reprises the EFI-video fix, fixes a USB problem and
enables a boot script for coreboot.

It also moves to truetype fonts for coreboot and qemu-x86, since the
menus look much better and there are no strong size constraints.

With these changes it is possible to boot a Linux distro automatically
with U-Boot on x86, including when U-Boot is the second-stage
bootloader.

5 weeks agox86: qemu: Enable truetype fonts
Simon Glass [Thu, 4 Jan 2024 15:10:42 +0000 (08:10 -0700)] 
x86: qemu: Enable truetype fonts

Enable this feature to provide a larger font choice and more attractive
menus. Expand the ROM for x86_64 to 2MB to make space for the font.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 weeks agox86: qemu: Expand ROM size
Simon Glass [Thu, 4 Jan 2024 15:10:41 +0000 (08:10 -0700)] 
x86: qemu: Expand ROM size

Expand the ROM for x86_64 to 2MB to make space for the font, as it is
already on the edge.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 weeks agox86: coreboot: Enable truetype fonts
Simon Glass [Thu, 4 Jan 2024 15:10:40 +0000 (08:10 -0700)] 
x86: coreboot: Enable truetype fonts

Truetype fonts look better in the menu, so enable them.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 weeks agox86: Enable SSE in 64-bit mode
Simon Glass [Thu, 4 Jan 2024 15:10:39 +0000 (08:10 -0700)] 
x86: Enable SSE in 64-bit mode

This is needed to support Truetype fonts. In any case, the compiler
expects SSE to be available in 64-bit mode. Provide an option to enable
SSE so that hardware floating-point arithmetic works.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
Suggested-by: Bin Meng <bmeng.cn@gmail.com>
5 weeks agovideo: Drop unnecessary truetype operations from SPL
Simon Glass [Thu, 4 Jan 2024 15:10:38 +0000 (08:10 -0700)] 
video: Drop unnecessary truetype operations from SPL

Saving and restoring entries is used for expo and for the command line,
which we don't use in SPL. Drop these methods.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Anatolij Gustschin <agust@denx.de>
5 weeks agovideo: Correct setting of cursor position
Simon Glass [Thu, 4 Jan 2024 15:10:37 +0000 (08:10 -0700)] 
video: Correct setting of cursor position

The ANSI codes are not correctly handled at present, in that the
requested X position is added to the current one.

Correct this and also call vidconsole_entry_start() to start a new text
line.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>
5 weeks agox86: coreboot: Add a boot script
Simon Glass [Thu, 4 Jan 2024 15:10:36 +0000 (08:10 -0700)] 
x86: coreboot: Add a boot script

Provide the user with a list of available boot options. Selecting one
causes it to be booted. Pressing <ESC> causes U-Boot to return to the
command-line prompt.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
5 weeks agofastboot: Update help text with respect to CMDLINE
Tom Rini [Thu, 11 Apr 2024 02:00:32 +0000 (20:00 -0600)] 
fastboot: Update help text with respect to CMDLINE

This hunk of the patch was missed when using "b4" to apply the series.

Signed-off-by: Tom Rini <trini@konsulko.com>
5 weeks agoMerge patch series "pxe: Allow extlinux booting without CMDLINE enabled"
Tom Rini [Wed, 10 Apr 2024 23:06:27 +0000 (17:06 -0600)] 
Merge patch series "pxe: Allow extlinux booting without CMDLINE enabled"

Simon Glass <sjg@chromium.org> says:

This series is the culmanation of the current line of refactoring
series. It adjusts pxe to call the booting functionality directly
rather than going through the command-line interface.

With this is is possible to boot using the extlinux bootmeth without
the command line enabled.

It also updates fastboot to do a similar thing.

5 weeks agox86: Drop message about features being missing with 64-bit
Simon Glass [Fri, 15 Dec 2023 04:19:14 +0000 (21:19 -0700)] 
x86: Drop message about features being missing with 64-bit

At this point most things work, including booting a distro, so drop
this message.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 weeks agopxe: Allow booting without CMDLINE for the zboot method
Simon Glass [Fri, 15 Dec 2023 04:19:13 +0000 (21:19 -0700)] 
pxe: Allow booting without CMDLINE for the zboot method

Use zboot_run() to boot rather than the command line. This allows
extlinux to be used (on x86) without CMDLINE being enabled.

Collect any error but do not return it, to match the existing code.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 weeks agopxe: Allow booting without CMDLINE for bootm methods
Simon Glass [Fri, 15 Dec 2023 04:19:12 +0000 (21:19 -0700)] 
pxe: Allow booting without CMDLINE for bootm methods

Use bootm_run() and booti_run() to boot rather than the command line.
This allows extlinux to be used without CMDLINE being enabled.

Collect any error but do not return it, to match the existing code.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 weeks agopxe: Move calculation of FDT file into a function
Simon Glass [Fri, 15 Dec 2023 04:19:11 +0000 (21:19 -0700)] 
pxe: Move calculation of FDT file into a function

This code undertakes a separate task from the main logic of
label_run_boot() so move it into its own function.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 weeks agopxe: Refactor to avoid over-using bootm_argv
Simon Glass [Fri, 15 Dec 2023 04:19:10 +0000 (21:19 -0700)] 
pxe: Refactor to avoid over-using bootm_argv

The bootm_argv[3] expression is used in many places. It is the FDT
address, so use that name throughout.

Assign it to bootm_argv[3] only at the end, when all the conditions are
resolved.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 weeks agopxe: Refactor to reduce the size of label_boot()
Simon Glass [Fri, 15 Dec 2023 04:19:09 +0000 (21:19 -0700)] 
pxe: Refactor to reduce the size of label_boot()

This function is far too long and complicated. Split out the part
which actually calls the boot commands into a separate function.

Change a strncpy() to strlcpy() to keep checkpatch happy.

No functional change is intended.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 weeks agopxe: Use strlcpy() instead of strcpy() in label_boot()
Simon Glass [Fri, 15 Dec 2023 04:19:08 +0000 (21:19 -0700)] 
pxe: Use strlcpy() instead of strcpy() in label_boot()

The intention here is to nul-terminate the result string, so use the
correct function for that.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 weeks agodoc: Mention fastboot dependency on CMDLINE
Simon Glass [Fri, 15 Dec 2023 04:19:07 +0000 (21:19 -0700)] 
doc: Mention fastboot dependency on CMDLINE

The fastboot 'boot' command only supports running a U-Boot command if
CONFIG_CMDLINE is enabled. Mention this in the documentation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Suggested-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>
5 weeks agofastboot: Remove dependencies on CMDLINE
Simon Glass [Fri, 15 Dec 2023 04:19:06 +0000 (21:19 -0700)] 
fastboot: Remove dependencies on CMDLINE

It is possible to boot a kernel without CMDLINE being enabled. Update
the implementation to handle this, and drop the condition from the
FASTBOOT config.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
5 weeks agobootm: Make cmdline optional with bootm_boot_start()
Simon Glass [Fri, 15 Dec 2023 04:19:05 +0000 (21:19 -0700)] 
bootm: Make cmdline optional with bootm_boot_start()

Allow the default command line to be used when booting the OS. This is
needed by fastboot.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 weeks agofastboot: Change fastboot_buf_addr to an address
Simon Glass [Fri, 15 Dec 2023 04:19:04 +0000 (21:19 -0700)] 
fastboot: Change fastboot_buf_addr to an address

Given the name of this variable, it should be an address, not a
pointer. Update this, to make it easier to use with sandbox.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Dmitrii Merkurev <dimorinny@google.com>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Tested-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> # on vim3
5 weeks agoboot: Update SYS_BOOTM_LEN to depend on BOOTM
Simon Glass [Fri, 15 Dec 2023 04:19:03 +0000 (21:19 -0700)] 
boot: Update SYS_BOOTM_LEN to depend on BOOTM

Use the new CONFIG_BOOTM symbol to determine whether SYS_BOOT_LEN is
visible or not, since we want to support decompression when CMDLINE is
disabled.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 weeks agotreewide: Make arch-specific bootm code depend on BOOTM
Simon Glass [Fri, 15 Dec 2023 04:19:02 +0000 (21:19 -0700)] 
treewide: Make arch-specific bootm code depend on BOOTM

Allow these functions to be compiled in when CONFIG_BOOTM is enabled,
even if CONFIG_CMD_BOOTM is not.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Angelo Dureghello <angelo@kernel-space.org>
5 weeks agobootm: Make OS booting dependent on BOOTM
Simon Glass [Fri, 15 Dec 2023 04:19:01 +0000 (21:19 -0700)] 
bootm: Make OS booting dependent on BOOTM

Booting an OS does not require the 'bootm' command, so change the
condition for these options.

Move them into boot/ so they don't depend on CMDLINE

Note that CMD_BOOTM_PRE_LOAD has been put directly into the bootm code
so will need some additional refactoring (and a test!) to allow it to
change over.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
5 weeks agobootm: Add a Kconfig option for bootm functionality
Simon Glass [Fri, 15 Dec 2023 04:19:00 +0000 (21:19 -0700)] 
bootm: Add a Kconfig option for bootm functionality

Create a separate Kconfig option which enables the bootm logic,
separate from the 'bootm' command. This will eventually allow booting
without CMDLINE enabled.

Update boards which disable CMD_BOOTM to disable BOOTM instead, since
CMD_BOOTM now depends on BOOTM

Signed-off-by: Simon Glass <sjg@chromium.org>
5 weeks agoboot: Reorder FIT and BOOTSTD to be first
Simon Glass [Fri, 15 Dec 2023 04:18:59 +0000 (21:18 -0700)] 
boot: Reorder FIT and BOOTSTD to be first

The boot menu shows Android first and then a timestamp option. Move
these later since they are less commonly used.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 weeks agoMerge patch series "Complete decoupling of zboot logic from commands"
Tom Rini [Wed, 10 Apr 2024 19:49:35 +0000 (13:49 -0600)] 
Merge patch series "Complete decoupling of zboot logic from commands"

Simon Glass <sjg@chromium.org> says:

This series refactors the zboot code to allow it to be used with
CONFIG_COMMAND disabled.

A new zboot_run() function is used to boot a zimage.

5 weeks agox86: zboot: Tidy up the comment for zboot_run()
Simon Glass [Mon, 4 Dec 2023 00:29:38 +0000 (17:29 -0700)] 
x86: zboot: Tidy up the comment for zboot_run()

The current use case (ChromeOS) is the uncommon case. Document how this
function is more normally used, where base is 0 and cmdline is NULL

Signed-off-by: Simon Glass <sjg@chromium.org>
5 weeks agox86: zboot: Use zboot_start() in zboot_run()
Simon Glass [Mon, 4 Dec 2023 00:29:37 +0000 (17:29 -0700)] 
x86: zboot: Use zboot_start() in zboot_run()

Now that we have a function to start the process of booting a zimage,
use it in zboot_run() to avoid duplicated logic.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 weeks agox86: zboot: Separate logic functions from commands
Simon Glass [Mon, 4 Dec 2023 00:29:36 +0000 (17:29 -0700)] 
x86: zboot: Separate logic functions from commands

Move zboot_start() and zboot_info() in with the other logic functions.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
5 weeks agox86: zboot: Rename zboot_start() to zboot_run()
Simon Glass [Mon, 4 Dec 2023 00:29:35 +0000 (17:29 -0700)] 
x86: zboot: Rename zboot_start() to zboot_run()

The term 'start' is used withint bootm and zboot to indicate the first
phase of booting an image.

Since zboot_start() does the whole boot, rename it to zboot_run() to
align with bootm_run() etc.

Fix a log message while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 weeks agox86: zboot: Move argument processing outside zboot_start()
Simon Glass [Mon, 4 Dec 2023 00:29:34 +0000 (17:29 -0700)] 
x86: zboot: Move argument processing outside zboot_start()

Process the arguments before calling zboot_start() so that we can
separate the command line from the internal logic.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 weeks agox86: zboot: Drop intermediate zboot_go() function
Simon Glass [Mon, 4 Dec 2023 00:29:33 +0000 (17:29 -0700)] 
x86: zboot: Drop intermediate zboot_go() function

This function only calls zboot_go() so drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 weeks agox86: zboot: Drop intermediate zboot_setup() function
Simon Glass [Mon, 4 Dec 2023 00:29:32 +0000 (17:29 -0700)] 
x86: zboot: Drop intermediate zboot_setup() function

Move error checking into the caller so that do_zboot_setup() can call
zboot_setup() directly.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 weeks agox86: zboot: Move environment setting into zboot_load()
Simon Glass [Mon, 4 Dec 2023 00:29:31 +0000 (17:29 -0700)] 
x86: zboot: Move environment setting into zboot_load()

The only difference between the command and the underlying logic is the
setting of envrionment variables. Move this out of the command
processing since it needs to be done in any case.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 weeks agox86: zboot: Create separate functions for the logic
Simon Glass [Mon, 4 Dec 2023 00:29:30 +0000 (17:29 -0700)] 
x86: zboot: Create separate functions for the logic

Separate out the commands from the logic. This will eventually allow
the logic to be used when CONFIG_CMDLINE is not enabled.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 weeks agox86: zboot: Avoid iteration in do_zboot_states()
Simon Glass [Mon, 4 Dec 2023 00:29:29 +0000 (17:29 -0700)] 
x86: zboot: Avoid iteration in do_zboot_states()

Drop the iteration and write out each state in full. This will allow
the arguments to be reduced and adjusted in future patches.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 weeks agox86: zboot: Create a separate ZBOOT option for zboot logic
Simon Glass [Mon, 4 Dec 2023 00:29:28 +0000 (17:29 -0700)] 
x86: zboot: Create a separate ZBOOT option for zboot logic

Most of the functionality of zboot is contained in the logic which
handles a zimage. Create a separate Kconfig for the logic so that it can
(later) be used without the command itself being enabled.

Enable ZBOOT by default on x86, with the command depending on that. The
existing 'imply' can therefore be removed.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
5 weeks agox86: zboot: Move command code into its own file
Simon Glass [Mon, 4 Dec 2023 00:29:27 +0000 (17:29 -0700)] 
x86: zboot: Move command code into its own file

Much of the code in zimage.c deals with the zboot command. Move it into
a sepatate zboot.c file within the cmd/ directory. This will eventually
allow use of the zimage logic without the command being enabled.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 weeks agox86: zboot: Move zimage definitions to the header file
Simon Glass [Mon, 4 Dec 2023 00:29:26 +0000 (17:29 -0700)] 
x86: zboot: Move zimage definitions to the header file

In preparation for splitting the zboot-command code into a separate
file, move the definitions into the header file.

While we are here, mention when load_address and base_ptr are set up
and explain bzimage_addr better. Make cmdline const since it cannot be
changed.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 weeks agoMerge tag 'xilinx-for-v2024.07-rc1' of https://source.denx.de/u-boot/custodians/u...
Tom Rini [Wed, 10 Apr 2024 17:51:58 +0000 (11:51 -0600)] 
Merge tag 'xilinx-for-v2024.07-rc1' of https://source.denx.de/u-boot/custodians/u-boot-microblaze

Xilinx changes for v2024.07-rc1

xilinx:
- Do not call env_get_location when !ENV_IS_NOWHERE
- Add FDT_FIXUP_PARTITIONS support
- Fix legacy format MAC decoding

zynqmp:
- Enable semihosting SPL support
- DT updates
- Kconfig resort/cleanup
- Don't describe second image/capsule if !SPL
- Add support for dfu/capsule description via MTD
- Support JTAG as alternative boot mode
- Add support for TEG soc variant

zynqmp-kria:
- Wire usb4 boot device
- Update SDIO tristate pin configuration
- Disable SPI_FLASH_BAR to avoid issue with SPI after update

mbv:
- Enable SPL and binman
- Small platform changes

zynqmp-nand:
- Error out in case of unsupported SW ECC
- Clean error path

versal-net:
- Support multiple locations for variables

5 weeks agotrace: use dynamic string buffer in make_flamegraph()
Vincent Stehlé [Tue, 2 Apr 2024 11:29:16 +0000 (13:29 +0200)] 
trace: use dynamic string buffer in make_flamegraph()

The str[] buffer declared in make_flamegraph() is used to hold strings
representing the full call-stacks recorded in traces. The size of this
buffer is currently 500 characters and this works well for the documented
examples.

However, it is possible to exhaust this buffer when processing traces
captured when running the UEFI shell on aarch64 sandbox for example.
Indeed, the maximum length needed for such traces can reach 780 characters.

As it is difficult to evaluate the maximum size that would ever be needed
for all the possible traces, let's use a dynamically allocated `abuf'
instead, which we reallocate when needed.

This fixes the following error:

  String too short (500 chars)

While at it, fix a few typos in strings and comments.

Signed-off-by: Vincent Stehlé <vincent.stehle@arm.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Michal Simek <michal.simek@amd.com>
5 weeks agonet: dw_eth_qos: Add missing \n in error messages.
Heinrich Schuchardt [Tue, 2 Apr 2024 08:39:34 +0000 (10:39 +0200)] 
net: dw_eth_qos: Add missing \n in error messages.

Missing line-feeds in error messages lead to output like:

    phy_startup() failed: -110FAILED: -110=>

Output like the following is much easier to read:

    phy_startup() failed: -110
    FAILED: -110
    =>

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
5 weeks agolib: add missing line breaks in debug messages
Maxim Moskalets [Sat, 30 Mar 2024 11:11:21 +0000 (14:11 +0300)] 
lib: add missing line breaks in debug messages

Add missing line breaks to improve debug log readability.

Signed-off-by: Maxim Moskalets <maximmosk4@gmail.com>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 weeks agofs: ext4: all file paths are absolute
Heinrich Schuchardt [Wed, 27 Mar 2024 08:09:27 +0000 (09:09 +0100)] 
fs: ext4: all file paths are absolute

U-Boot only knows absolute file paths. It is inconsistent to require that
saving to an ext4 file system should use a leading '/' while reading does
not. Remove the superfluous check.

Reported-by: Patrice Chotard <patrice.chotard@foss.st.com>
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Tested-by: Patrice Chotard <patrice.chotard@foss.st.com>
5 weeks agonet: nfs: fix file handle length in NFSv3
Sébastien Szymanski [Tue, 26 Mar 2024 09:34:31 +0000 (10:34 +0100)] 
net: nfs: fix file handle length in NFSv3

The NFS protocol uses file handles to refer to file or directory.
In NFSv2 file handles have a fixed size of 32 bytes.
In NFSv3 file handles have a variable length up to 64 bytes. This is
also true for the MOUNT protocol. [1]
When the NFSv3 server replies with a file handle length > 32 bytes, U-Boot
only copies 32 bytes of that file handle and the next LOOKUP Call fails:

BIOS> nfs ${loadaddr} 192.168.1.51:/nfsroot/opos93dev-br/boot/Image
Using ethernet@428a0000 device
File transfer via NFS from server 192.168.1.51; our IP address is 192.168.1.133
Filename '/nfsroot/opos93dev-br/boot/Image'.
Load address: 0x80400000
Loading: *** ERROR: File lookup fail

done
BIOS>

Looking at this transfer in Wireshark, we can see that the server
replies with the following file handle:

    length: 36
    [hash (CRC-32): 0x230ac67b]
    FileHandle: 0100070101005e000000000091763911f87c449fa73c298552db19ba0c9f60002980cfd2

and U-Boot sends the following file handle in the next LOOKUP Call:

    length: 32
    [hash (CRC-32): 0x6314131b]
    FileHandle: 000000240100070101005e000000000091763911f87c449fa73c298552db19ba

Fix this by using a variable length file handle for dirfh.

[1] https://www.rfc-editor.org/rfc/rfc1813.html#page-106

Fixes: b0baca982048 ("net: NFS: Add NFSv3 support")
Signed-off-by: Sébastien Szymanski <sebastien.szymanski@armadeus.com>
Tested-by: Andrew Davis <afd@ti.com>
5 weeks agortc: goldfish_rtc_probe should be static
Heinrich Schuchardt [Thu, 21 Mar 2024 20:16:13 +0000 (21:16 +0100)] 
rtc: goldfish_rtc_probe should be static

There is no need to export goldfish_rtc_probe().

Fixes: 2d6dc19fd25d ("rtc: driver for Goldfish RTC")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
5 weeks agotools: open FIT image read-only
Ahelenia Ziemiańska [Thu, 21 Mar 2024 18:31:54 +0000 (19:31 +0100)] 
tools: open FIT image read-only

Open for reading as O_RDONLY instead of O_RDWR:
the only usage of the fd is for the single read() below;
this prevented
mkimage -f auto -A arm64 \
-T kernel -C lz4 -d Image-6.6.15.lz4 \
-b mt8173-elm-hana-6.6.15.dtb outf
when the inputs were unwritable.

Link: https://bugs.debian.org/1063097
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Reviewed-by: Dragan Simic <dsimic@manjaro.org>
5 weeks agofs: ext4: make "File System is consistent\n" a debug message
Heinrich Schuchardt [Wed, 20 Mar 2024 13:23:52 +0000 (14:23 +0100)] 
fs: ext4: make "File System is consistent\n" a debug message

When accessing an ext2 system the message "File System is consistent\n" is
shown after each write. This is superfluous noise. Only write a debug
message.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
5 weeks agobuild: Revive and update LDR format support
Greg Malysa [Wed, 20 Mar 2024 02:16:07 +0000 (22:16 -0400)] 
build: Revive and update LDR format support

LDR format files are used primarily by Analog Devices processors but may
be of interest to other vendors. Previously support existed for this
format as part of the U-Boot build, but it has been unmaintained and
unused for a long time. In preparation for adding support for modern ADI
processors that use LDR, modernize the LDR support:

- Introduce CONFIG_LDR_CPU as the CPU string recognized by the LDR tool
  may not be the same as CONFIG_CPU
- Add an SPL target that repackages u-boot-spl inside an LDR file

An almost identical target for packaging u-boot into an LDR file already
exists and did not need to be created.

Co-developed-by: Nathan Barrett-Morrison <nathan.morrison@timesys.com>
Signed-off-by: Nathan Barrett-Morrison <nathan.morrison@timesys.com>
Signed-off-by: Ian Roberts <ian.roberts@timesys.com>
Signed-off-by: Greg Malysa <greg.malysa@timesys.com>
5 weeks agoscripts/Makefile.spl: Use 'sort' in SHRUNK_ARCH_DTB rule
Tom Rini [Tue, 19 Mar 2024 16:51:31 +0000 (12:51 -0400)] 
scripts/Makefile.spl: Use 'sort' in SHRUNK_ARCH_DTB rule

With configs such as "am64x_evm_a53" or "imx8mp_venice" which list
multiple device trees to build we get a warning such as:
scripts/Makefile.spl:578: target 'spl/dts/freescale/' given more than once in the same rule

If we sort this list first the warning goes away.

Tested-by: Michal Simek <michal.simek@amd.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
5 weeks agofs: ext4: Change the Settings of file permissions
Jixiong Hu [Tue, 19 Mar 2024 09:20:40 +0000 (17:20 +0800)] 
fs: ext4: Change the Settings of file permissions

When a file is created in the linux and corresponding file permission
is set, if the file needs to be modified in uboot during the startup
process, the modified file permission will be reset to 755. Therefore,
when the ext4fs_write() function is called, if the file already exists,
the file permission of the new file is equal to the file permission of
the existing file.

5 weeks agocmd: sysboot: null check filename
Caleb Connolly [Mon, 18 Mar 2024 23:16:36 +0000 (23:16 +0000)] 
cmd: sysboot: null check filename

Currently if ${bootfile} is unset and sysboot is invoked with no
filename specified then U-Boot will crash will a null-pointer
dereference. Add the missing check and a matching error print.

Fixes: 993c912d304d ("cmd: sysboot: Create a sysboot command dedicated file")
Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
5 weeks agoarm64: Fix map_range() not splitting mapped blocks
Pierre-Clément Tosi [Mon, 18 Mar 2024 19:35:49 +0000 (19:35 +0000)] 
arm64: Fix map_range() not splitting mapped blocks

The implementation of map_range() creates the requested mapping by
walking the page tables, iterating over multiple PTEs and/or descending
into existing table mappings as needed. When doing so, it assumes any
pre-existing valid PTE to be a table mapping. This assumption is wrong
if the platform code attempts to successively map two overlapping ranges
where the latter intersects a block mapping created for the former.

As a result, map_range() treats the existing block mapping as a table
mapping and descends into it i.e. starts interpreting the
previously-mapped range as an array of PTEs, writing to them and
potentially even descending further (extra fun with MMIO ranges!).

Instead, pass any valid non-table mapping to split_block(), which
ensures that it actually was a block mapping (calls panic() otherwise)
before splitting it.

Fixes: 41e2787f5ec4 ("arm64: Reduce add_map() complexity")
Signed-off-by: Pierre-Clément Tosi <ptosi@google.com>
Tested-by: Fabio Estevam <festevam@gmail.com>
Tested-by: Hiago De Franco <hiago.franco@toradex.com> # Toradex Verdin AM62
Reviewed-by: Marc Zyngier <maz@kernel.org>
5 weeks agoxilinx: common: Fix MAC address read from EEPROM
Petr Zejdl [Thu, 4 Apr 2024 11:44:22 +0000 (13:44 +0200)] 
xilinx: common: Fix MAC address read from EEPROM

The upper-to-lowercase character conversion now avoids altering the
MAC address field. In the previous version, this alteration corrupted
the MAC address.

Signed-off-by: Petr Zejdl <petr.zejdl@cern.ch>
Link: https://lore.kernel.org/r/20240404114422.2905194-1-petr.zejdl@cern.ch
Signed-off-by: Michal Simek <michal.simek@amd.com>
5 weeks agoconfigs: zynqmp_kria: Deactivate CONFIG_SPI_FLASH_BAR
Tejas Bhumkar [Tue, 9 Apr 2024 09:48:26 +0000 (15:18 +0530)] 
configs: zynqmp_kria: Deactivate CONFIG_SPI_FLASH_BAR

The Kria board features a recovery application that activates
when the FW_EN button is pressed.
Upon power-up flash operates in 3B mode, However, the recovery
application changes it back to 4B mode.
Currently, after a reset, u-boot activates CONFIG_SPI_FLASH_BAR
and assumes the flash is in 3B mode. However, there's no code
or reset lines connected to the flash that could return it to
3B mode. To resolve this issue, changes were made to disable
CONFIG_SPI_FLASH_BAR, which activates 4-byte opcodes.

Signed-off-by: Tejas Bhumkar <tejas.arvind.bhumkar@amd.com>
Link: https://lore.kernel.org/r/20240409094826.4131643-1-tejas.arvind.bhumkar@amd.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
5 weeks agoMerge branch 'master' of https://source.denx.de/u-boot/custodians/u-boot-riscv
Tom Rini [Tue, 9 Apr 2024 20:18:55 +0000 (14:18 -0600)] 
Merge branch 'master' of https://source.denx.de/u-boot/custodians/u-boot-riscv

CI: https://source.denx.de/u-boot/custodians/u-boot-riscv/-/pipelines/20256

- RISC-V: Support backtrace and improve isa extension parsing
- cpu: Add cv1800b SoC support
- board: Add Milk-V Mars board support
- board: Add Milk-V Duo SD card support

5 weeks agodoc: describe Milk-V Mars board
Heinrich Schuchardt [Tue, 2 Apr 2024 08:49:12 +0000 (10:49 +0200)] 
doc: describe Milk-V Mars board

Add instructions to build U-Boot for the Milk-V Mars board

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
5 weeks agoriscv: starfive: avoid including common.h
Heinrich Schuchardt [Tue, 2 Apr 2024 08:49:11 +0000 (10:49 +0200)] 
riscv: starfive: avoid including common.h

The usage of common.h is deprecated. Remove it from board files.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
5 weeks agoboard: starfive: support Milk-V Mars board
Heinrich Schuchardt [Tue, 2 Apr 2024 08:49:10 +0000 (10:49 +0200)] 
board: starfive: support Milk-V Mars board

The differences between the Milk-V Mars board and the VisionFive 2 board
are small enough that we can support both using the same U-Boot build.

* The model and compatible property are taken from proposed Linux patches.
* The EEPROM is atmel,24c02 according to the vendor U-Boot.
* The second Ethernet port is not available.

usb@10100000 does not exist in U-Boot yet. So we don't have to reflect
differences in usage here.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
5 weeks agoriscv: set fdtfile on Milk-V Mars
Heinrich Schuchardt [Tue, 2 Apr 2024 08:49:09 +0000 (10:49 +0200)] 
riscv: set fdtfile on Milk-V Mars

Set environment variable fdtfile to the correct value for the Milk-V Mars
board.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
5 weeks agoeeprom: starfive: function get_product_id_from_eeprom()
Heinrich Schuchardt [Tue, 2 Apr 2024 08:49:08 +0000 (10:49 +0200)] 
eeprom: starfive: function get_product_id_from_eeprom()

Export a function get_product_id_from_eeprom() to read the product ID.
This value can be used for fixing up the device-tree on JH7110 based
products.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
5 weeks agoriscv: do not set default fdt for VisionFive 2
Heinrich Schuchardt [Tue, 2 Apr 2024 08:49:07 +0000 (10:49 +0200)] 
riscv: do not set default fdt for VisionFive 2

Currently in set_fdtfile() we set the value of environment variable fdtfile
unconditionally. The implies that a value in the environment will be
ignored.

With the patch environment variable fdtfile will only be set if it does not
yet exist. This requires that CONFIG_DEFAULT_FDT_FILE is not set.

Now the user can either set and save fdtfile interactively or in the U-Boot
configuration to overrule the device-tree name chosen based on the
hardware in set_fdtfile().

Reported-by: E Shattow <lucent@gmail.com>
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
5 weeks agoriscv: starfive: MMC card detect
Heinrich Schuchardt [Thu, 28 Mar 2024 21:46:15 +0000 (22:46 +0100)] 
riscv: starfive: MMC card detect

The VisionFive 2 board uses GPIO 41 as card detect as documented in
https://doc-en.rvspace.org/VisionFive2/PDF/SCH_RV002_V1.2A_20221216.pdf.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Acked-by: Minda Chen <minda.chen@starfivetech.com>
5 weeks agoriscv: Move virtio scan to board_late_init()
Łukasz Stelmach [Thu, 28 Mar 2024 09:58:24 +0000 (10:58 +0100)] 
riscv: Move virtio scan to board_late_init()

When virtio_init() gets called from board_init() PCI isn't ready. Thus,
virtio-over-PCI (e.g. network interfaces) devices can't be detected and
used without additional `virtio scan` scan in the shell or a script.

Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
5 weeks agoriscv: support extension probing using riscv, isa-extensions
Conor Dooley [Mon, 18 Mar 2024 15:16:03 +0000 (15:16 +0000)] 
riscv: support extension probing using riscv, isa-extensions

A new property has been added, with an extensive rationale at [1], that
can be used in place of "riscv,isa" to indicate what extensions are
supported by a given platform that is a list of strings rather than a
single string. There are some differences between the new property,
"riscv,isa-extensions" and the incumbent "riscv,isa" - chief among them
for the sake of parsing being the list of strings, as opposed to a
string. Another advantage is strictly defined meanings for each string
in a dt-binding, rather than deriving meaning from RVI standards. This
will likely to some divergence over time, but U-Boot's current use of
extension detection is very limited - there are just four callsites of
supports_extension() in mainline U-Boot.

These checks are limited to two checks for FPU support and two checks
for "s" and "u". "s" and "u" are not supported by the new property, but
they were also not permitted in "riscv,isa". These checks are only
meaningful (or run) in M-Mode, in which case supports_extension() does
not parse the devicetree anyway.

Add support for the new property in U-Boot, prioritising it, before
falling back to the, now deprecated, "riscv,isa" property if it is not
present.

Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
5 weeks agoriscv: don't read riscv, isa in the riscv cpu's get_desc()
Conor Dooley [Mon, 18 Mar 2024 15:16:02 +0000 (15:16 +0000)] 
riscv: don't read riscv, isa in the riscv cpu's get_desc()

cpu_get_desc() for the RISC-V CPU currently reads "riscv,isa" to get
the description, but it is no longer a required property and cannot be
assummed to always be present, as the new "riscv,isa-extensions" and
"riscv,isa-base" properties may be present instead.

On RISC-V, cpu_get_desc() has two main uses - firstly providing an
informational name for the CPU for smbios or at boot with
DISPLAY_CPUINFO etc and secondly it forms the basis of ISA extension
detection in supports_extension() as it returns (a portion of) an ISA
string.

cpu_get_desc() returns a string, which aligned with "riscv,isa" but
the new property is a list of strings. Rather than add support for
the list of strings property, which would require creating an isa
string from "riscv,isa-extensions", modify the RISC-V CPU's
implementaion of cpu_get_desc() return the first compatible as the
cpu description instead. This may be fine for the informational cases,
but it would break extension dtection, given supports_extension()
expects cpu_get_desc() to return an ISA string.

Call dev_read_string() directly in supports_extension() to get the
contents of "riscv,isa" so that extension detection remains functional.
As a knock-on affect of this change, extension detection is no longer
broken for long ISA strings. Previously if the ISA string exceeded the
32 element array that supports_extension() passed to cpu_get_desc(),
it would return ENOSPC and no extensions would be detected.
This bug probably had no impact as U-Boot does not currently do anything
meaningful with the results of supports_extension() and most SoCs
supported by U-Boot don't have anywhere near that complex of an ISA
string. The QEMU virt machine's CPUs do however, so extension detection
doesn't work there.

Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>

5 weeks agoconfigs: milkv_duo: Add SD card configs
Kongyang Liu [Sat, 9 Mar 2024 17:51:57 +0000 (01:51 +0800)] 
configs: milkv_duo: Add SD card configs

Add configs related to sdhci and mmc for Sophgo Milk-V Duo board

Signed-off-by: Kongyang Liu <seashell11234455@gmail.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
5 weeks agoriscv: dts: sophgo: Add clk node and sdhci node
Kongyang Liu [Sat, 9 Mar 2024 17:51:56 +0000 (01:51 +0800)] 
riscv: dts: sophgo: Add clk node and sdhci node

Add clk node and sdhci node for cv18xx SoCs according to patches from Linux
kernel.

clk: https://lore.kernel.org/all/IA1PR20MB4953F9AD6792013B54636F05BB4F2@IA1PR20MB4953.namprd20.prod.outlook.com/
sdhci: https://lore.kernel.org/all/20240217144826.3944-1-jszhang@kernel.org/

Signed-off-by: Kongyang Liu <seashell11234455@gmail.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
5 weeks agommc: cv1800b: Add sdhci driver support for cv1800b SoC
Kongyang Liu [Sat, 9 Mar 2024 17:51:55 +0000 (01:51 +0800)] 
mmc: cv1800b: Add sdhci driver support for cv1800b SoC

Add sdhci driver for cv1800b SoC.

Signed-off-by: Kongyang Liu <seashell11234455@gmail.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
5 weeks agoriscv: cache: Implement dcache for cv1800b
Kongyang Liu [Sat, 9 Mar 2024 16:54:57 +0000 (00:54 +0800)] 
riscv: cache: Implement dcache for cv1800b

Add dcache operations invalidate_dcache_range and flush_dcache_range for
cv1800b.

Signed-off-by: Kongyang Liu <seashell11234455@gmail.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
5 weeks agoriscv: cpu: cv1800b: Add support for cv1800b SoC
Kongyang Liu [Sat, 9 Mar 2024 16:54:56 +0000 (00:54 +0800)] 
riscv: cpu: cv1800b: Add support for cv1800b SoC

Add Sophgo cv1800b SoC to support RISC-V arch.

Signed-off-by: Kongyang Liu <seashell11234455@gmail.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
5 weeks agoriscv: add backtrace support
Ben Dooks [Tue, 5 Sep 2023 12:12:53 +0000 (13:12 +0100)] 
riscv: add backtrace support

When debugging, it is useful to have a backtrace to find
out what is in the call stack as the previous function (RA)
may not have been the culprit.

Since this adds size to the build, do not add it by default
and avoid putting it in the SPL build if not needed.

Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
Tested-by: Leo Yu-Chi Liang <ycliang@andestech.com>
6 weeks agoMerge tag 'efi-2024-07-rc1' of https://source.denx.de/u-boot/custodians/u-boot-efi
Tom Rini [Mon, 8 Apr 2024 20:33:59 +0000 (14:33 -0600)] 
Merge tag 'efi-2024-07-rc1' of https://source.denx.de/u-boot/custodians/u-boot-efi

Pull request efi-2024-07-rc1

Documentation:

* improve description of FAT partition name generation
* add missing :: in doc/usage/cmd/itest.rst

UEFI:

* fix address mode for __efi_runtime_start/stop,
  __efi_runtime_rel_start/stop
* fix size of variable attribute constants
* enable booting via EFI boot manager by default
* correct the sequence of the EFI boot methods
* correct finding the default EFI binary
* don't delete variable from memory if update failed
* fix append write behavior to non-existent variable
* Use binman for testing capsule updates on the sandbox
* Consider capsule test files in .gitignore and make clean

6 weeks agoefi_loader: access __efi_runtime_rel_start/stop without &
Ilias Apalodimas [Thu, 4 Apr 2024 06:37:37 +0000 (09:37 +0300)] 
efi_loader: access __efi_runtime_rel_start/stop without &

A symbol defined in a linker script (e.g. __efi_runtime_rel_start = .;)
is only a symbol, not a variable and should not be dereferenced.
The common practice is either define it as
extern uint32_t __efi_runtime_rel_start or
extern char __efi_runtime_rel_start[] and access it as
&__efi_runtime_rel_start or __efi_runtime_rel_start respectively.

So let's access it properly since we define it as an array

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>