]> git.dujemihanovic.xyz Git - u-boot.git/log
u-boot.git
8 months agommc: Drop unused mmc_send_tuning() cmd_error parameter
Marek Vasut [Tue, 20 Feb 2024 08:36:23 +0000 (09:36 +0100)]
mmc: Drop unused mmc_send_tuning() cmd_error parameter

The cmd_error parameter is not used, remove it.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
8 months agommc: arm_pl180_mmci: Rely on DM
Linus Walleij [Thu, 8 Feb 2024 09:33:43 +0000 (10:33 +0100)]
mmc: arm_pl180_mmci: Rely on DM

The PL180/MMCI driver is implied to use CONFIG_DM and the ARM
defconfigs such as configs/vexpress_ca9x4_defconfig will get it
as well.

With a simple oneline to default to not being the v2 variant,
the original ARM MMCI variant works fine with the driver as well.
The IP version actually needs to be read out from a register on
the ARM versions, but we will simply assume we are running on the
original hardware if arm,primecell-periphid is not explicitly
specified in the device tree.

Drop the !CONFIG_DM code and depend on DM_MMC.

Tested on the Versatile Express CA9x4 board.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
8 months agommc: Add SPL_MMC_PWRSEQ to fix link issue when building SPL
Jonas Karlman [Sat, 27 Jan 2024 17:12:35 +0000 (17:12 +0000)]
mmc: Add SPL_MMC_PWRSEQ to fix link issue when building SPL

With MMC_PWRSEQ enabled the following link issue may happen when
building SPL and SPL_PWRSEQ is not enabled.

  aarch64-linux-gnu-ld.bfd: drivers/mmc/meson_gx_mmc.o: in function `meson_mmc_probe':
  drivers/mmc/meson_gx_mmc.c:295: undefined reference to `pwrseq_set_power'

Fix this by adding a SPL_MMC_PWRSEQ Kconfig option used to enable mmc
pwrseq support in SPL.

Also add depends on DM_GPIO to fix following link issue:

  aarch64-linux-gnu-ld.bfd: drivers/mmc/mmc-pwrseq.o: in function `mmc_pwrseq_set_power':
  drivers/mmc/mmc-pwrseq.c:26: undefined reference to `gpio_request_by_name'
  aarch64-linux-gnu-ld.bfd: drivers/mmc/mmc-pwrseq.c:29: undefined reference to `dm_gpio_set_value'
  aarch64-linux-gnu-ld.bfd: drivers/mmc/mmc-pwrseq.c:31: undefined reference to `dm_gpio_set_value'

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Acked-by: Ferass El Hafidi <vitali64pmemail@protonmail.com>
8 months agommc: Don't suggest to build modules in Kconfig.
Heinrich Schuchardt [Tue, 23 Jan 2024 16:18:16 +0000 (17:18 +0100)]
mmc: Don't suggest to build modules in Kconfig.

U-Boot does not support building kernel modules.

Fixes: 3c0dbed232bd ("mmc: arm_pl180_mmci: adapt driver to DM usage")
Fixes: 36645f45a048 ("drivers: mmc: Add sdhci driver for Broadcom iProc platform")
Fixes: dadd43c14368 ("mmc: synquacer: Add SynQuacer F_SDH30 SDHCI driver")
Fixes: b312c590bcd8 ("mmc: Add MMC support for stm32h7 Socs")
Fixes: d24b69395949 ("mmc: mtk-sd: add SD/MMC host controller driver for MT7623 SoC")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
8 months agommc: Avoid buffer overrun in mmc_startup()
Heinrich Schuchardt [Thu, 4 Jan 2024 03:49:42 +0000 (04:49 +0100)]
mmc: Avoid buffer overrun in mmc_startup()

If the CSD register contains a reserved value (4 - 7) in bits 0:2 of the
TRAN_SPEED field, a buffer overrun occurs. Resize the mapping table.

According to the original report
https://lore.kernel.org/u-boot/20180826231332.2491-11-erosca@de.adit-jv.com/
reserved values have been observed resulting in a buffer overrun.

Reported-by: Eugeniu Rosca <erosca@de.adit-jv.com>
Fixes: 272cc70b211e ("Add MMC Framework")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
8 months agoMerge https://source.denx.de/u-boot/custodians/u-boot-usb
Tom Rini [Sun, 14 Apr 2024 21:58:31 +0000 (15:58 -0600)]
Merge https://source.denx.de/u-boot/custodians/u-boot-usb

8 months agoMerge tag 'u-boot-nand-20240414' of https://source.denx.de/u-boot/custodians/u-boot...
Tom Rini [Sun, 14 Apr 2024 18:26:42 +0000 (12:26 -0600)]
Merge tag 'u-boot-nand-20240414' of https://source.denx.de/u-boot/custodians/u-boot-nand-flash

The first patch is by Weizhao Ouyang and avoids sf probe crashes.

The second patch is by Arseniy Krasnov and adds basic support for Amlogic
Meson NAND controller on AXG.

The following four patches are by Alexander Dahl and apply some fixes to
drivers/mtd/nand/raw/ and port some changes applied in Linux.

The following patch is by Bruce Suen and adds support for XTX SPINAND.

Finally, the last patch is again by Arseniy Krasnov and adds access to
OTP region, supporting info, dump, write and lock operations.

8 months agocmd: mtd: OTP access support
Arseniy Krasnov [Tue, 26 Mar 2024 22:39:19 +0000 (01:39 +0300)]
cmd: mtd: OTP access support

Add access to OTP region. It supports info, dump, write and lock
operations. Usage example:

'mtd otpread nand0 u 0 1024' - dump 1024 bytes of user area starting
 from offset 0 of device 'nand0'.

'mtd otpwrite nand0 10 11223344' - write binary data 0x11, 0x22, 0x33,
 0x44 to offset 10 to user area of device 'nand0'.

'mtd otplock nand0 0 1024' - lock 1024 bytes of user area starting
 from offset 0 of device 'nand0'.

'mtd otpinfo nand0 f' - show info about factory area of device 'nand0'.

Link: https://lore.kernel.org/all/20240326223919.3781-1-avkrasnov@salutedevices.com
Signed-off-by: Arseniy Krasnov <avkrasnov@salutedevices.com>
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
8 months agomtd: spinand: Add support for XTX SPINAND
Bruce Suen [Tue, 12 Mar 2024 01:43:14 +0000 (21:43 -0400)]
mtd: spinand: Add support for XTX SPINAND

Add support for XTX XT26G0xA and XT26xxxD. The driver is ported from
linux-6.7.1. This driver is tested on Banana BPI-R3 with XT26G01A and
XT26G12D.

Link: https://lore.kernel.org/all/20240312014314.15454-1-bruce_suen@163.com
Signed-off-by: Bruce Suen <bruce_suen@163.com>
Reviewed-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
8 months agomtd: nand: raw: atmel: Fix comment in timings preparation
Alexander Dahl [Wed, 20 Mar 2024 09:02:13 +0000 (10:02 +0100)]
mtd: nand: raw: atmel: Fix comment in timings preparation

Introduced with commit 6a8dfd57220d ("nand: atmel: Add DM based NAND
driver") when driver was initially ported from Linux.  The context
around this and especially the code itself suggests 'read' is meant
instead of write.

The fix is the same as accepted in Linux already with mainline Linux
kernel commit 1c60e027ffde ("mtd: nand: raw: atmel: Fix comment in
timings preparation").

Link: https://lore.kernel.org/all/20240320090214.40465-6-ada@thorsis.com
Link: https://lore.kernel.org/linux-mtd/20240307172835.3453880-1-miquel.raynal@bootlin.com/T/#t
Signed-off-by: Alexander Dahl <ada@thorsis.com>
Reviewed-by: Michael Trimarchi <michael@amarulasolutions.com>
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
8 months agomtd: nand: raw: Fix (most) Kconfig indentation
Alexander Dahl [Wed, 20 Mar 2024 09:02:11 +0000 (10:02 +0100)]
mtd: nand: raw: Fix (most) Kconfig indentation

One tab in general.  One tab plus two spaces for help text.

Link: https://lore.kernel.org/all/20240320090214.40465-4-ada@thorsis.com
Signed-off-by: Alexander Dahl <ada@thorsis.com>
Reviewed-by: Michael Trimarchi <michael@amarulasolutions.com>
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
8 months agomtd: nand: raw: Port another option flag from Linux
Alexander Dahl [Wed, 20 Mar 2024 09:02:10 +0000 (10:02 +0100)]
mtd: nand: raw: Port another option flag from Linux

Introduced in upstream Linux with commit 7a08dbaedd365 for release v5.0.

When the new atmel nand driver was backported to U-Boot with commit
6a8dfd57220d ("nand: atmel: Add DM based NAND driver") that definition
was added to the driver instead of the header file.  Move it over to the
other definitions with the same help text it has in Linux.

Code actually using this has not been ported over to raw nand base yet.

Link: https://lore.kernel.org/all/20240320090214.40465-3-ada@thorsis.com
Signed-off-by: Alexander Dahl <ada@thorsis.com>
Reviewed-by: Michael Trimarchi <michael@amarulasolutions.com>
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
8 months agomtd: nand: raw: Use macro nand_to_mtd() where appropriate
Alexander Dahl [Wed, 20 Mar 2024 09:02:09 +0000 (10:02 +0100)]
mtd: nand: raw: Use macro nand_to_mtd() where appropriate

In every other place in this file the macro is used, make it consistent.

Link: https://lore.kernel.org/all/20240320090214.40465-2-ada@thorsis.com
Fixes: 9d1806fadc24 ("mtd: nand: Get rid of mtd variable in function calls")
Signed-off-by: Alexander Dahl <ada@thorsis.com>
Reviewed-by: Michael Trimarchi <michael@amarulasolutions.com>
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
8 months agomtd: rawnand: Meson NAND controller support
Arseniy Krasnov [Sat, 10 Feb 2024 22:39:27 +0000 (01:39 +0300)]
mtd: rawnand: Meson NAND controller support

Basic support for Amlogic Meson NAND controller on AXG. This version
works at only first EDO mode.

Based on Linux version 6.7.0-rc4.

Link: https://lore.kernel.org/all/20240210223927.570043-1-avkrasnov@salutedevices.com
Signed-off-by: Arseniy Krasnov <avkrasnov@salutedevices.com>
Reviewed-by: Michael Trimarchi <michael@amarulasolutions.com>
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
8 months agocmd: sf: Fix sf probe crash
Weizhao Ouyang [Thu, 4 Jan 2024 11:46:19 +0000 (11:46 +0000)]
cmd: sf: Fix sf probe crash

Handle the return value of spi_flash_probe_bus_cs() to avoid sf probe
crashes.

Link: https://lore.kernel.org/all/20240104114619.280513-1-o451686892@gmail.com
Signed-off-by: Weizhao Ouyang <o451686892@gmail.com>
Reviewed-by: Michael Trimarchi <michael@amarulasolutions.com>
Acked-by: Michal Simek <michal.simek@amd.com>
Reviewed-by: Jonas Karlman <jonas@kwiboo.se>
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
8 months agoMerge tag 'efi-2024-07-rc1-2' of https://source.denx.de/u-boot/custodians/u-boot-efi
Tom Rini [Sat, 13 Apr 2024 16:18:38 +0000 (10:18 -0600)]
Merge tag 'efi-2024-07-rc1-2' of https://source.denx.de/u-boot/custodians/u-boot-efi

Pull request efi-2024-07-rc1-2

Documentation:

* bump build dependency idna to 3.7
* update docker image reference to latest
* fix section levels in gen_compile_commands
* fix references to trace doc

UEFI:

* eliminate duplicate runtime section definitions
* let 'EFI using ACPI tables at' be a debug message
* sanitize efi_tcg2_final_events_table definition
* move efi_var_collect to common functions
* improve error messages in variables unit test by using
  EFI_UNSUPPORTED for private authenticated variables

8 months agodoc/sphinx: Bump idna to 3.7
Tom Rini [Fri, 12 Apr 2024 14:23:17 +0000 (08:23 -0600)]
doc/sphinx: Bump idna to 3.7

While we unlikely to have an issue with CVE-2024-3651, it is simple
enough to bump our version of idna to receive the fix, do so.

Reported-by: GitHub dependabot
Signed-off-by: Tom Rini <trini@konsulko.com>
Tested-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
8 months agoFix references to trace doc
Vincent Stehlé [Thu, 11 Apr 2024 16:44:02 +0000 (18:44 +0200)]
Fix references to trace doc

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

Signed-off-by: Vincent Stehlé <vincent.stehle@arm.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
8 months agoefi_loader: sanitize efi_tcg2_final_events_table definition
Heinrich Schuchardt [Wed, 10 Apr 2024 22:50:43 +0000 (00:50 +0200)]
efi_loader: sanitize efi_tcg2_final_events_table definition

The length of the variable name typically is not 1.
Neither the length of the variable name nor the size of the appended
data is known in the include.

* Define the size of element variable_name as variable.
* Remove the unusable element variable_data.

Addresses-Coverity-ID: 467400 Out-of-bounds read
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
8 months agoefi_loader: using EFI_UNSUPPORTED for private authenticated variables
Weizhao Ouyang [Wed, 10 Apr 2024 12:19:33 +0000 (12:19 +0000)]
efi_loader: using EFI_UNSUPPORTED for private authenticated variables

Improve error message for UEFI SCT tests.

Signed-off-by: Weizhao Ouyang <o451686892@gmail.com>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
8 months agoefi_loader: 'EFI using ACPI tables at' should be debug message
Heinrich Schuchardt [Tue, 9 Apr 2024 20:48:24 +0000 (22:48 +0200)]
efi_loader: 'EFI using ACPI tables at' should be debug message

The message "EFI using ACPI tables at %lx\n" is only of interest when
debugging. Make it a debug message.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
8 months agoefi_loader: eliminate duplicate runtime section definitions
Heinrich Schuchardt [Fri, 5 Apr 2024 08:12:57 +0000 (10:12 +0200)]
efi_loader: eliminate duplicate runtime section definitions

The following symbols are defined in two includes:

* __efi_runtime_start[]
* __efi_runtime_stop[]
* __efi_runtime_rel_start[]
* __efi_runtime_rel_stop[]

Eliminate the definitions in efi_loader.h.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
8 months agoefi_loader: move efi_var_collect to common functions
Ilias Apalodimas [Fri, 5 Apr 2024 06:50:58 +0000 (09:50 +0300)]
efi_loader: move efi_var_collect to common functions

efi_var_collect() was initially placed in efi_var_file.c, since back
then we only supported efi variables stored in a file. Since then we
support variables stored in an RPMB as well and use that function to
collect variables that should be present at runtime.

So let's move it around in efi_var_common.c which makes more sense

Suggested-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Ilias Apalodimas <apalos@gmail.com>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
8 months agodoc: build: fix gen_compile_commands section level
Mattijs Korpershoek [Fri, 5 Apr 2024 06:18:42 +0000 (08:18 +0200)]
doc: build: fix gen_compile_commands section level

The 2 subsections of this page ("Compatible IDEs" and "Usage") are using
the same header level as the title (with "===").
Because of this, they always appear in the HTML rendered ToC.

Drop the subsections one level lower by replacing "=" by "-".
This fixes the HTML rendering.

Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
8 months agodoc: build: update docker image to latest
Mattijs Korpershoek [Fri, 5 Apr 2024 06:16:19 +0000 (08:16 +0200)]
doc: build: update docker image to latest

commit cacc0b2678c0 ("CI: Move to latest container image") updated the
docker container image.

Reflect the change in the documentation.

Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
8 months agoMerge patch series "mcheck implementation for U-Boot"
Tom Rini [Fri, 12 Apr 2024 22:23:19 +0000 (16:23 -0600)]
Merge patch series "mcheck implementation for U-Boot"

Eugene Uriev <eugeneuriev@gmail.com> says:

There was no "mcheck" for U-Boot before.

Since U-Boot has only 1 thread, and normally makes 4000+ - 6000+
mallocs, it's better to use havier canaries to protect heap-chunks.
My variant uses 2x8 = 16byte-long protector. And
the multiplier could be changed to tune speed/protection tradeoff.
This protects not only against memset()-s, but against "near" wild
pointers too, and makes more probable to catch "distant" ones.

The core file of the set is included into the C-file, not complied
separately in order to enable (potential) coexisting of
mcheck-protectors, e.g. malloc_simple(.) and dlmalloc simultaneously.

My tests were for ARM SoC, 64bit, so the patch is
aware of alignment.

Primary this patch is for using by developers: to verify,
if a change doesn't break the heap integrity.
By default the mcheck is disabled and wouldn't affect the boot.

I used pedantic mode, canary=16byte, registry-size=6608.
For my system the overhead was 230ms.

8 months agomcheck: let mcheck_abortfunc_t print the pointer
Eugene Uriev [Sun, 31 Mar 2024 20:03:27 +0000 (23:03 +0300)]
mcheck: let mcheck_abortfunc_t print the pointer

Signed-off-by: Eugene Uriev <eugeneuriev@gmail.com>
8 months agomcheck: add stats, add a comment with test results
Eugene Uriev [Sun, 31 Mar 2024 20:03:26 +0000 (23:03 +0300)]
mcheck: add stats, add a comment with test results

My tests have been run on an U-Boot (of older version)
for ARM (64bits).

Signed-off-by: Eugene Uriev <eugeneuriev@gmail.com>
8 months agomcheck: introduce mcheck_on_ramrelocation(.)
Eugene Uriev [Sun, 31 Mar 2024 20:03:25 +0000 (23:03 +0300)]
mcheck: introduce mcheck_on_ramrelocation(.)

The using of pre-reloc/malloc_simple heap is
too hard to follow after the relocation.

So lets drop it from the pedantic registry
and switch to dlmalloc, when moved.

The offset is ignored, but kept in the API
for the probable case, when that early
heap is relocated too.

Signed-off-by: Eugene Uriev <eugeneuriev@gmail.com>
8 months agomcheck: add pedantic mode support
Eugene Uriev [Sun, 31 Mar 2024 20:03:24 +0000 (23:03 +0300)]
mcheck: add pedantic mode support

The pedantic mode is run-time contolled, so
appropriate registry take place everytime.

Maybe it's worth to use compile-time control only.
So, the registry could be optimized out by an #ifdef.

Signed-off-by: Eugene Uriev <eugeneuriev@gmail.com>
8 months agomcheck: support memalign
Eugene Uriev [Sun, 31 Mar 2024 20:03:23 +0000 (23:03 +0300)]
mcheck: support memalign

Signed-off-by: Eugene Uriev <eugeneuriev@gmail.com>
8 months agomcheck: integrate mcheck into dlmalloc.c
Eugene Uriev [Sun, 31 Mar 2024 20:03:22 +0000 (23:03 +0300)]
mcheck: integrate mcheck into dlmalloc.c

This changes are probable worth to be generalized in a
separate .h-file so, making it able to cover
libc-mallocs and others, without too much copy-paste.

But the malloc<=>mALLOc substitutions interfere
with an elegant way to do this.

Signed-off-by: Eugene Uriev <eugeneuriev@gmail.com>
8 months agomcheck: introduce essentials of mcheck
Eugene Uriev [Sun, 31 Mar 2024 20:03:21 +0000 (23:03 +0300)]
mcheck: introduce essentials of mcheck

The core part of mcheck, but without memalign.
memalign - to be added in ensuing commits.

Signed-off-by: Eugene Uriev <eugeneuriev@gmail.com>
8 months agomcheck: Use memset/memcpy instead of MALLOC_ZERO/MALLOC_COPY for mcheck.
Eugene Uriev [Sun, 31 Mar 2024 20:03:20 +0000 (23:03 +0300)]
mcheck: Use memset/memcpy instead of MALLOC_ZERO/MALLOC_COPY for mcheck.

These fast helpers sometimes breach mem-chunk boundaries.
Thus they trigger mcheck alarm. Standard ones are accurate though.

Signed-off-by: Eugene Uriev <eugeneuriev@gmail.com>
8 months agomcheck: prepare +1 tier for mcheck-wrappers, in dl-*alloc commands
Eugene Uriev [Sun, 31 Mar 2024 20:03:19 +0000 (23:03 +0300)]
mcheck: prepare +1 tier for mcheck-wrappers, in dl-*alloc commands

Signed-off-by: Eugene Uriev <eugeneuriev@gmail.com>
8 months agonet: designware: Pass all multicast frames in designware driver
Jim Liu [Mon, 8 Apr 2024 08:50:17 +0000 (16:50 +0800)]
net: designware: Pass all multicast frames in designware driver

Allowing multicast packets is required for IPv6 neighbor discovery
protocol.

Signed-off-by: Parvathi Bhogaraju <pbhogaraju@microsoft.com>
Signed-off-by: Jim Liu <JJLIU0@nuvoton.com>
8 months agonet: designware: Invalidate RX buffer cache before freeing the DMA descriptor
Jim Liu [Mon, 8 Apr 2024 08:49:02 +0000 (16:49 +0800)]
net: designware: Invalidate RX buffer cache before freeing the DMA descriptor

In IPv6 context, the ICMP and UDP checksum byte in the RX packet
is initially set to 0, recaclculated, and then re-inserted.
This process can result in a dirty cache line. To prevent issues,
it is essential to invalidate cache for the RX buffer before freeing
the descriptor for next DMA transfer.
This ensure that the dirty cache line doesn't inadvertently written back
due to cache eviction, there by corrupting the RX buffer

Signed-off-by: Parvathi Bhogaraju <pbhogaraju@microsoft.com>
Signed-off-by: Jim Liu <JJLIU0@nuvoton.com>
8 months agonet: dwc_eth_qos: Fix compilation warning in eqos_free_pkt()
Patrice Chotard [Fri, 5 Apr 2024 16:15:29 +0000 (18:15 +0200)]
net: dwc_eth_qos: Fix compilation warning in eqos_free_pkt()

Fix compilation warning:

../arch/arm/include/asm/io.h: In function 'eqos_free_pkt':
../arch/arm/include/asm/io.h:103:32: warning: 'rx_desc' may be used uninitialized [-Wmaybe-uninitialized]
  103 | #define writel(v,c)     ({ u32 __v = v; __iowmb(); __arch_putl(__v,c); __v; })
      |                                ^~~
../drivers/net/dwc_eth_qos.c:1220:27: note: 'rx_desc' was declared here
 1220 |         struct eqos_desc *rx_desc;
      |                           ^~~~~~~

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
8 months agoMerge patch series "Introduce ICSSG Ethernet driver"
Tom Rini [Fri, 12 Apr 2024 19:54:51 +0000 (13:54 -0600)]
Merge patch series "Introduce ICSSG Ethernet driver"

MD Danish Anwar <danishanwar@ti.com> says:

Introduce ICSSG PRUETH support in uboot. The ICSSG driver is used in TI
AM654 SR2.0.

The ICSSG PRU Sub-system runs on EMAC firmware. This series Introduces
support for ICSSG driver in uboot.

This series has been tested on AM65x SR2.0, and the ICSSG interface is
able to ping / dhcp and boot kernel using tftp in uboot.

To use ICSSG2 ethernet, the ICSSG firmware needs to be loaded to PRU RPROC
cores and RPROC cores need to be booted with the firmware. This step is
done inside driver similar to kernel.

The remoteproc driver uses request_fw_into_buf() API from fs-loader driver
to load and start rproc with the required firmwares.

This series only introduces driver files. The device tree and config
changes to enable ICSSG driver will be introduced later.

8 months agonet: ti: icssg: Add support sending FDB command to update rx_flow_id
MD Danish Anwar [Thu, 4 Apr 2024 07:08:03 +0000 (12:38 +0530)]
net: ti: icssg: Add support sending FDB command to update rx_flow_id

ICSSG firmware supports FDB commands. Add support to send FDB commands
from driver. Once rx_flow_id is obtained from dma, let firmware know that
we are using this rx_flow_id by sending a FDB command.

Reviewed-by: Ravi Gunasekaran <r-gunasekaran@ti.com>
Signed-off-by: MD Danish Anwar <danishanwar@ti.com>
8 months agonet: ti: icssg: Add ICSSG ethernet driver
MD Danish Anwar [Thu, 4 Apr 2024 07:08:02 +0000 (12:38 +0530)]
net: ti: icssg: Add ICSSG ethernet driver

This is the PRUSS Ethernet driver for TI AM654 SR2.0 and later SoCs with
the ICSSG PRU Sub-system running EMAC firmware. ICSSG Subsystem supports
two slices per instance. This driver caters to both slices / ports of
the icssg subsystem.

Since it is not possible for Ethernet driver to register more than one
port for a given instance, this patch introduces top level PRUETH as
UCLASS_MISC and binds UCLASS_ETH to individual ports in order to support
bringing up more than one Ethernet interface in U-Boot.

Since top level driver is UCLASS_MISC, board files would need to
instantiate the driver explicitly.

Signed-off-by: MD Danish Anwar <danishanwar@ti.com>
Reviewed-by: Ravi Gunasekaran <r-gunasekaran@ti.com>
8 months agonet: ti: icssg: Add icssg queues APIs and macros
MD Danish Anwar [Thu, 4 Apr 2024 07:08:01 +0000 (12:38 +0530)]
net: ti: icssg: Add icssg queues APIs and macros

Add icssg_queue.c file. This file introduces macros and APIs related to
ICSSG queues. These will be used by ICSSG Ethernet driver.

Reviewed-by: Ravi Gunasekaran <r-gunasekaran@ti.com>
Signed-off-by: MD Danish Anwar <danishanwar@ti.com>
8 months agonet: ti: icssg: Add Firmware config and classification APIs.
MD Danish Anwar [Thu, 4 Apr 2024 07:08:00 +0000 (12:38 +0530)]
net: ti: icssg: Add Firmware config and classification APIs.

Add icssg_config.h / .c and icssg_classifier.c files. These are firmware
configuration and classification related files. Add MII helper APIs and
MACROs. These APIs and MACROs will be later used by ICSSG Ethernet driver.
Also introduce icssg_prueth.h which has definition of prueth related
structures.

Signed-off-by: MD Danish Anwar <danishanwar@ti.com>
Reviewed-by: Ravi Gunasekaran <r-gunasekaran@ti.com>
8 months agonet: ti: icssg: Add Firmware Interface for ICSSG Ethernet driver.
MD Danish Anwar [Thu, 4 Apr 2024 07:07:59 +0000 (12:37 +0530)]
net: ti: icssg: Add Firmware Interface for ICSSG Ethernet driver.

Add firmware interface related headers and macros for ICSSG Ethernet
driver. These macros will be later used by the ICSSG ethernet driver.

Reviewed-by: Ravi Gunasekaran <r-gunasekaran@ti.com>
Signed-off-by: MD Danish Anwar <danishanwar@ti.com>
8 months agoMerge patch series "zlib: Address CVE-2016-9841"
Tom Rini [Fri, 12 Apr 2024 18:57:13 +0000 (12:57 -0600)]
Merge patch series "zlib: Address CVE-2016-9841"

Michal Simek <michal.simek@amd.com> says:

It looks like that only CVE-2016-9841 is not fixed and this series is
trying to address it. The first two patches are just preparation based on
changes which happened in past. The third one is actual fix and the last
one is following what has been done in Linux kernel long time ago and don't
use incorrect zlib version string.

I tested it with and I can't see any issue.
./test/py/test.py --bd sandbox --build -s

And gitlab CI is also not showing any issue.

8 months agozlib: Remove incorrect ZLIB_VERSION
Michal Simek [Wed, 27 Mar 2024 14:14:53 +0000 (15:14 +0100)]
zlib: Remove incorrect ZLIB_VERSION

Get rid of zlib version which is not correct because of U-Boot related
changes and various CVE backports.

The change in inspired by Linux kernel commit 4f3865fb57a0 ("[PATCH]
zlib_inflate: Upgrade library code to a recent version") which described
ZLIB_VERSION removal as

"This patch also removes ZLIB_VERSION as it no longer has a correct value.
We don't need version checks anyway as the kernel's module handling will
take care of that for us.  This removal is also more in keeping with the
zlib author's wishes (http://www.zlib.net/zlib_faq.html#faq24) and I've
added something to the zlib.h header to note its a modified version."

Author describes wish to follow this guidance at
https://www.zlib.net/zlib_faq.html#faq24:
"The license says that altered source versions must be "plainly marked". So
what exactly do I need to do to meet that requirement?

You need to change the ZLIB_VERSION and ZLIB_VERNUM #defines in zlib.h. In
particular, the final version number needs to be changed to f, and an
identification string should be appended to ZLIB_VERSION. Version numbers
x.x.x.f are reserved for modifications to zlib by others than the zlib
maintainers. For example, if the version of the base zlib you are altering
is 1.2.3.4, then in zlib.h you should change ZLIB_VERNUM to 0x123f, and
ZLIB_VERSION to something like 1.2.3.f-zachary-mods-v3. You can also update
the version strings in deflate.c and inftrees.c."

But U-Boot is not exact version that's why following the same style which
has been used by Linux kernel where ZLIB_VERSION is completely removed.

Signed-off-by: Michal Simek <michal.simek@amd.com>
8 months agozlib: Port fix for CVE-2016-9841 to U-Boot
Michal Simek [Wed, 27 Mar 2024 14:14:52 +0000 (15:14 +0100)]
zlib: Port fix for CVE-2016-9841 to U-Boot

The patch corresponds to zlib commit at
https://github.com/madler/zlib/commit/9aaec95e82117c1cb0f9624264c3618fc380cecb
which declares that it is fixing CVE-2016-9841.
Here is c&p description from zlib:
"Use post-increment only in inffast.c.

An old inffast.c optimization turns out to not be optimal anymore
with modern compilers, and furthermore was not compliant with the
C standard, for which decrementing a pointer before its allocated
memory is undefined. Per the recommendation of a security audit of
the zlib code by Trail of Bits and TrustInSoft, in support of the
Mozilla Foundation, this "optimization" was removed, in order to
avoid the possibility of undefined behavior."

Origin patch also updates the code when
INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR is present but this code is not
the part of U-Boot hence it is ignored.
Also do not deal with state->sane variable which requires other changes
which are also not the part of zlib.

Commit 92faa8b10918 ("zlib: handle overflow while calculating available
stream input size") is kept in inffast.c too not to break described case.

Signed-off-by: Michal Simek <michal.simek@amd.com>
8 months agozlib: Rename write variable to wnext (window write index)
Michal Simek [Wed, 27 Mar 2024 14:14:51 +0000 (15:14 +0100)]
zlib: Rename write variable to wnext (window write index)

There is no particular patch/description which described the reason for
this change but it was done as the part of zlib 1.2.3.5 release done by
zlib commit d004b047838a ("zlib 1.2.3.5"). It is preparation for followup
patch.

Signed-off-by: Michal Simek <michal.simek@amd.com>
8 months agozlib: Rename this variable to here (current decoding table entry)
Michal Simek [Wed, 27 Mar 2024 14:14:50 +0000 (15:14 +0100)]
zlib: Rename this variable to here (current decoding table entry)

There is no particular patch/description which described the reason for
this change but it was done as the part of zlib 1.2.3.5 release done by
zlib commit 639be997883d ("zlib 1.2.3.3") It is preparation for followup
patch.

Signed-off-by: Michal Simek <michal.simek@amd.com>
8 months agoMerge branch '2024-04-12-assorted-updates'
Tom Rini [Fri, 12 Apr 2024 18:50:57 +0000 (12:50 -0600)]
Merge branch '2024-04-12-assorted-updates'

- Assorted sandbox fixes, cleanup some of the partition table code and a
  few other fixes

8 months agoARM: uniphier: Move uniphier_mem_map_init() call into dram_init()
Kunihiko Hayashi [Fri, 5 Apr 2024 08:37:15 +0000 (17:37 +0900)]
ARM: uniphier: Move uniphier_mem_map_init() call into dram_init()

The function uniphier_mem_map_init() is to change global variable
'mem_map', which is referenced to get_page_table_size() to calculate
the size of page table.

However, uniphier_mem_map_init() is called after get_page_table_size(),
so the size of page table and 'mem_map' become inconsist each other.
After all, U-Boot fails to boot on chip with memory map different from
default map,

uniphier_mem_map_init() should be moved to dram_init(), which is
called before get_page_table_size().

Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
8 months agodisk: simplify print_part_header()
Heinrich Schuchardt [Wed, 3 Apr 2024 11:40:47 +0000 (13:40 +0200)]
disk: simplify print_part_header()

Using uclass_get_name() reduces the code size.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
8 months agotest: remove unused import from pkg_resources
Heinrich Schuchardt [Wed, 3 Apr 2024 11:11:41 +0000 (13:11 +0200)]
test: remove unused import from pkg_resources

load_entry_point is not used.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
8 months agofdt: Fix fdt_pack_reg() on 64-bit platforms
Sam Protsenko [Sat, 30 Mar 2024 00:55:53 +0000 (19:55 -0500)]
fdt: Fix fdt_pack_reg() on 64-bit platforms

When "memory" node is being processed in fdt_pack_reg() on ARM64
platforms, an unaligned bus access might happen, which leads to
"synchronous abort" CPU exception. Consider next dts example:

    / {
        #address-cells = <2>;
        #size-cells = <1>;

        memory@80000000 {
            device_type = "memory";
            reg = <0x0 0x80000000 0x3ab00000>,
                  <0x0 0xc0000000 0x40000000>,
                  <0x8 0x80000000 0x80000000>;
        };
    };

After fdt_pack_reg() reads the first addr/size entry from such memory
node, the "p" pointer becomes 12 bytes shifted from its original value
(8 bytes for two address cells + 4 bytes for one size cell). So now it's
not 64-bit aligned, and an attempt to do 64-bit bus access to that
address will cause an abort like this:

    "Synchronous Abort" handler, esr 0x96000021, far 0xba235efc

This issue was originally reported by David Virag [1] who observed it
happening on Samsung Exynos7885 SoC (ARM64), and later the same issue
was observed on Samsung Exynos850 (ARM64).

Fix the issue by using put_unaligned_be64() helper, which takes care of
possible unaligned 64-bit accesses. That solution was proposed by Simon
Glass in the original thread [1].

[1] https://lists.denx.de/pipermail/u-boot/2023-July/522074.html

Fixes: 739a01ed8e02 ("fdt_support: fix an endian bug of fdt_fixup_memory_banks")
Suggested-by: Simon Glass <sjg@google.com>
Reported-by: David Virag <virag.david003@gmail.com>
Closes: https://lists.denx.de/pipermail/u-boot/2023-July/522074.html
Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
8 months agocli: always show cursor
Heinrich Schuchardt [Fri, 29 Mar 2024 16:09:22 +0000 (17:09 +0100)]
cli: always show cursor

We may enter the command line interface in a state where on the remote
console the cursor is not shown. Send an escape sequence to enable it.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
8 months agopart: Check all partitions in part_get_info_by_name()
Sam Protsenko [Thu, 28 Mar 2024 22:29:50 +0000 (17:29 -0500)]
part: Check all partitions in part_get_info_by_name()

In part_get_info_by_name() the inability to get some partition info
shouldn't be a reason for dropping out of the loop. That might happen
e.g. if the partition is hidden or unused. An example of such case are
Samsung devices, where they use the "unused" GUID type
(00000000-0000-0000-0000-000000000000) to indicate that the partition
should be hidden from the OS. Such partitions might not be seen in
"part list" output, which creates "gaps" in numbering in between of the
visible partitions:

    Part    Start LBA       End LBA         Name
      1     0x00000400      0x0000a3ff      "efs"
      5     0x00026420      0x00026c1f      "dtbo"
     12     0x0003f390      0x0074738f      "super"

In that case, the loop in part_get_info_by_name() would break after
partition #1, so any attempt to obtain "dtbo" or "super" partition will
fail. Fix that by continuing to iterate over the remaining partitions to
make sure none of the visible ones is missed. That makes "part" command
(e.g. "part start", "part size") able to work with such tables.

Fixes: 87b8530fe244 ("disk: part: implement generic function part_get_info_by_name()")
Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
8 months agoimage-host: Fix error value paths and emit error messages to stderr.
Hugo Cornelis [Thu, 21 Mar 2024 11:22:22 +0000 (12:22 +0100)]
image-host: Fix error value paths and emit error messages to stderr.

A recent refactoring in image-host.c messed up the return values of
the function that reads the encryptiong keys.  This patch fixes this
and also makes sure that error output goes to stderr instead of to
stdout.

Signed-off-by: Hugo Cornelis <hugo.cornelis@essensium.com>
8 months agosandbox: improve description of CONFIG_SANDBOX_CRASH_RESET
Heinrich Schuchardt [Mon, 12 Feb 2024 08:37:30 +0000 (09:37 +0100)]
sandbox: improve description of CONFIG_SANDBOX_CRASH_RESET

Mentions that command line option --signal is needed to make use of this
configuration option.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
8 months 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>
8 months 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>
8 months agousb: kbd: Add probe quirk for Apple and Keychron keyboards
Janne Grunau [Thu, 4 Apr 2024 06:25:54 +0000 (08:25 +0200)]
usb: kbd: Add probe quirk for Apple and Keychron keyboards

Those keyboards do not return the current device state. Polling will
timeout unless there are key presses. This is not a problem during
operation but the initial device state query during probing will fail.
Skip this step in usb_kbd_probe_dev() to make these devices useable.
Not all Apple keyboards behave like this. A keyboard with USB
vendor/product ID 05ac:0221 is reported to work with the current code.
Unfortunately some Keychron keyboards "re-use" Apple's vendor ID and
show the same behavior (Keychron C2, 05ac:024f for example).

Reviewed-by: Marek Vasut <marex@denx.de>
Reviewed-by: Neal Gompa <neal@gompa.dev>
Signed-off-by: Janne Grunau <j@jannau.net>
8 months agousb: kbd: support Apple Magic Keyboards (2021)
Janne Grunau [Thu, 4 Apr 2024 06:25:53 +0000 (08:25 +0200)]
usb: kbd: support Apple Magic Keyboards (2021)

Apple USB keyboards (Magic Keyboard from 2021 (product id 0x029c)) carry
the HID keyboard boot protocol on the second interface descriptor.
Probe via vendor and product IDs since the class/subclass/protocol match
uses the first interface descriptor.
Probe the two first interface descriptors for the HID keyboard boot
protocol.

USB configuration descriptor for reference:

| Bus 003 Device 002: ID 05ac:029c Apple, Inc. Magic Keyboard
| Device Descriptor:
|   bLength                18
|   bDescriptorType         1
|   bcdUSB               2.00
|   bDeviceClass            0 [unknown]
|   bDeviceSubClass         0 [unknown]
|   bDeviceProtocol         0
|   bMaxPacketSize0        64
|   idVendor           0x05ac Apple, Inc.
|   idProduct          0x029c Magic Keyboard
|   bcdDevice            3.90
|   iManufacturer           1 Apple Inc.
|   iProduct                2 Magic Keyboard
|   iSerial                 3 ...
|   bNumConfigurations      1
|   Configuration Descriptor:
|     bLength                 9
|     bDescriptorType         2
|     wTotalLength       0x003b
|     bNumInterfaces          2
|     bConfigurationValue     1
|     iConfiguration          4 Keyboard
|     bmAttributes         0xa0
|       (Bus Powered)
|       Remote Wakeup
|     MaxPower              500mA
|     Interface Descriptor:
|       bLength                 9
|       bDescriptorType         4
|       bInterfaceNumber        0
|       bAlternateSetting       0
|       bNumEndpoints           1
|       bInterfaceClass         3 Human Interface Device
|       bInterfaceSubClass      0 [unknown]
|       bInterfaceProtocol      0
|       iInterface              5 Device Management
|         HID Device Descriptor:
|           bLength                 9
|           bDescriptorType        33
|           bcdHID               1.10
|           bCountryCode            0 Not supported
|           bNumDescriptors         1
|           bDescriptorType        34 Report
|           wDescriptorLength      83
|           Report Descriptors:
|             ** UNAVAILABLE **
|       Endpoint Descriptor:
|         bLength                 7
|         bDescriptorType         5
|         bEndpointAddress     0x81  EP 1 IN
|         bmAttributes            3
|           Transfer Type            Interrupt
|           Synch Type               None
|           Usage Type               Data
|         wMaxPacketSize     0x0010  1x 16 bytes
|         bInterval               8
|     Interface Descriptor:
|       bLength                 9
|       bDescriptorType         4
|       bInterfaceNumber        1
|       bAlternateSetting       0
|       bNumEndpoints           1
|       bInterfaceClass         3 Human Interface Device
|       bInterfaceSubClass      1 Boot Interface Subclass
|       bInterfaceProtocol      1 Keyboard
|       iInterface              6 Keyboard / Boot
|         HID Device Descriptor:
|           bLength                 9
|           bDescriptorType        33
|           bcdHID               1.10
|           bCountryCode           13 International (ISO)
|           bNumDescriptors         1
|           bDescriptorType        34 Report
|           wDescriptorLength     207
|           Report Descriptors:
|             ** UNAVAILABLE **
|       Endpoint Descriptor:
|         bLength                 7
|         bDescriptorType         5
|         bEndpointAddress     0x82  EP 2 IN
|         bmAttributes            3
|           Transfer Type            Interrupt
|           Synch Type               None
|           Usage Type               Data
|         wMaxPacketSize     0x0010  1x 16 bytes
|         bInterval               8

Reviewed-by: Marek Vasut <marex@denx.de>
Reviewed-by: Neal Gompa <neal@gompa.dev>
Signed-off-by: Janne Grunau <j@jannau.net>
8 months agousb: Add environment based device ignorelist
Janne Grunau [Thu, 4 Apr 2024 06:25:52 +0000 (08:25 +0200)]
usb: Add environment based device ignorelist

Add the environment variable "usb_ignorelist" to prevent USB devices
listed in it from being bound to drivers. This allows to ignore devices
which are undesirable or trigger bugs in u-boot's USB stack.
Devices emulating keyboards are one example of undesirable devices as
u-boot currently supports only a single USB keyboard device. Most
commonly, people run into this with Yubikeys, so let's ignore those in
the default environment.

Based on previous USB keyboard specific patches for the same purpose.

Link: https://lore.kernel.org/u-boot/7ab604fb-0fec-4f5e-8708-7a3a7e2cb568@denx.de/
Reviewed-by: Neal Gompa <neal@gompa.dev>
Reviewed-by: Marek Vasut <marex@denx.de>
Signed-off-by: Janne Grunau <j@jannau.net>
8 months 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>
8 months 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>
8 months 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>
8 months 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>
8 months 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>
8 months 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>
8 months 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>
8 months 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>
8 months 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>
8 months 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>
8 months 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>
8 months 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>
8 months 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>
8 months 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>
8 months 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>
8 months 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>
8 months 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"

8 months 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>
8 months 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>
8 months 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>
8 months 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>
8 months 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>
8 months 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>
8 months 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.

8 months 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>
8 months 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>
8 months 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>
8 months 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>
8 months 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>
8 months 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>
8 months 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>
8 months 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>
8 months 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.

8 months 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>
8 months 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>
8 months 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>
8 months 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>