Commit Graph

92333 Commits

Author SHA1 Message Date
Tom Rini
b03b49046a Merge https://source.denx.de/u-boot/custodians/u-boot-usb 2024-04-14 15:58:31 -06:00
Tom Rini
57cb92de7a 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.
 -----BEGIN PGP SIGNATURE-----
 
 iQJYBAABCgBCFiEE6GOTDNYiFygVXvMmQBtB6IWRjvEFAmYb2iwkHGRhcmlvLmJp
 bmFjY2hpQGFtYXJ1bGFzb2x1dGlvbnMuY29tAAoJEEAbQeiFkY7xQsIQAKCD8fbL
 swGIcqJhC4uzF9mi1aeElCRYIy4uXYsu5ZBVM3dXjzxOH6J0luskEbIqJLpP5RWY
 wKtE09qBM5jZWmSAaH338SJdAqb/YR8+OC8mkAlYxx6Z77JNyb7zYePixRVceBUr
 zSRMlU6S1V+t3yWfv+hB7PWSoD5mpqRMK72UGeDjn+MBppsaGzghPKkSj8TMYRPE
 VPjZ/0qCdUdE7D2/4JNDdLsWZGTby+xz9wZ7xh/MXRgBG+TnZe1hf9+jxp5XW4Mw
 Mig44gBp97z0HgQYPv3K7COUY+Ljhq8S/kUw6gIajS9/mrHHNGy5Afh+bSUezwY1
 Bn5+c2DvNfMln+jIFsstZfd0RKioxYm9xyBGnIIJbJAXofEK58UcBtABd4Bwjz5O
 2/twvLZtGwLRHfzqSxNg29Nuccn9HXHVYYiCsiXs5S5FBAAJO4TzN1dQZdsY9bmH
 H1LO+jn0KkGPtUZHTeNYEJL/t7vQwrdc05ZLF/chx72IxDf6ZYX4b7vAYLW6lndV
 eaRQtlkAwZytwYrR43uZAHrGGoS2CAIw8/hYYbh8xa9IGAgDYfG+cAQHeGCN1Yml
 QqwGclHyUmT7XUCtIpSldREngOAJPfIdmSo777SkP9z5IPIAFbfAnfHFz4SFQFTv
 deCNjA6gNKVIIchS1e5VQA+m4z5iAjHAMdZ1
 =vjgL
 -----END PGP SIGNATURE-----

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.
2024-04-14 15:55:14 -06:00
Arseniy Krasnov
248fc16055 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>
2024-04-14 08:49:40 +02:00
Bruce Suen
cd6d71a2e9 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>
2024-04-14 08:49:40 +02:00
Alexander Dahl
8f9a445c15 mtd: nand: raw: atmel: Fix comment in timings preparation
Introduced with commit 6a8dfd5722 ("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>
2024-04-14 08:49:40 +02:00
Alexander Dahl
e3b7545eb1 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>
2024-04-14 08:49:40 +02:00
Alexander Dahl
29b7efae50 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
6a8dfd5722 ("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>
2024-04-14 08:49:40 +02:00
Alexander Dahl
0106ffdc8b 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: 9d1806fadc ("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>
2024-04-14 08:49:40 +02:00
Arseniy Krasnov
c2e8c4d09a 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>
2024-04-14 08:49:40 +02:00
Weizhao Ouyang
85f3d3de8d 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>
2024-04-14 08:49:39 +02:00
Tom Rini
266603d8c3 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
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEK7wKXt3/btL6/yA+hO4vgnE3U0sFAmYaTz8ACgkQhO4vgnE3
 U0tH+w/8CfC10gOWcBd0zKyJIB/jwnJAKZc3mFVwFF9FjeM7XlVsb3uthHV6hVdu
 BS7MNSwv5LR8ZqEjtdcLFIsMUjwPCO/Gu1xaTfuMYnrQkOQEOAZU8AFY9gMiyhN0
 WndbyO8lszLBV/PV8Nqh4rIV7uzFYqcIxn8XvsjQ1fuhU+3HnepYcdV7P/eVaA4i
 HpuUpmvsnig1xaw+Cm6KbfOhgf9eYmjJn/PTmBnkJwh+7PHzQAC6J+1Sx+Mz2g7S
 9qiuRaim+phdr5DO8bkzrHzK/0b6Civof3hhYdfh8jARaitnhEmJX8LFICe3Er7C
 dqGeoDogwfvCvQV9ykZidE7vr4DK0UFxJ5A8eswHuD8l28rXeQJKvPEx7y75W9Ht
 pj30/+LZ542UHhJZTGO3Oi7dKz3icX7ouaoV4qtXOYG0+UgrygSgNdR7zeNk0XGq
 0x2OWgohPZxeb36e1Uqq4dAm9ARPpRia33ZN8JN8Qs4SQA3y0Lye6/Q5KiNT0n72
 kzI1P6TdZamUWvfr1NzwUZz+LryozbI4bOw0uHP4jefG4chb/TSWftuXTrTvzBl1
 1CLYYYWqC8t5XNz8ypXKtcSuYKKQZkIsJsEF1NBd5L8hWttKAhvbfuykTOVUAttg
 wOmvJX1lsNczMh2/3aS2Pf3fqOSfM30lXu4kyop1dWEDmtWOlhc=
 =PpZf
 -----END PGP SIGNATURE-----

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
2024-04-13 10:18:38 -06:00
Tom Rini
f1f4b0e6f3 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>
2024-04-13 11:16:14 +02:00
Vincent Stehlé
6d9a851e50 Fix references to trace doc
The README.trace has been moved and converted to rst in commit dce26c7d56
("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>
2024-04-13 11:14:29 +02:00
Heinrich Schuchardt
5884481e2a 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>
2024-04-13 11:03:12 +02:00
Weizhao Ouyang
0ec4279ba3 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>
2024-04-13 11:03:12 +02:00
Heinrich Schuchardt
8d7ccea1c3 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>
2024-04-13 11:03:12 +02:00
Heinrich Schuchardt
b34ce3113b 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>
2024-04-13 11:03:12 +02:00
Ilias Apalodimas
df1076af36 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>
2024-04-13 11:03:12 +02:00
Mattijs Korpershoek
286546d33b 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>
2024-04-13 11:03:12 +02:00
Mattijs Korpershoek
4e5013be0e doc: build: update docker image to latest
commit cacc0b2678 ("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>
2024-04-13 11:03:12 +02:00
Tom Rini
977fc15e98 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.
2024-04-12 16:23:19 -06:00
Eugene Uriev
707a6dfb2b mcheck: let mcheck_abortfunc_t print the pointer
Signed-off-by: Eugene Uriev <eugeneuriev@gmail.com>
2024-04-12 16:23:06 -06:00
Eugene Uriev
a0ff152d4f 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>
2024-04-12 16:23:06 -06:00
Eugene Uriev
7bceb16106 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>
2024-04-12 16:23:06 -06:00
Eugene Uriev
18c1bfafe0 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>
2024-04-12 16:23:06 -06:00
Eugene Uriev
ae838768d7 mcheck: support memalign
Signed-off-by: Eugene Uriev <eugeneuriev@gmail.com>
2024-04-12 16:23:06 -06:00
Eugene Uriev
151493a875 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>
2024-04-12 16:23:06 -06:00
Eugene Uriev
7dafc5c925 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>
2024-04-12 16:23:06 -06:00
Eugene Uriev
dfba071ddc 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>
2024-04-12 16:23:06 -06:00
Eugene Uriev
c82ff48115 mcheck: prepare +1 tier for mcheck-wrappers, in dl-*alloc commands
Signed-off-by: Eugene Uriev <eugeneuriev@gmail.com>
2024-04-12 16:23:06 -06:00
Jim Liu
13c1100335 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>
2024-04-12 13:59:12 -06:00
Jim Liu
3d98b8c504 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>
2024-04-12 13:59:12 -06:00
Patrice Chotard
b4e9b524f7 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>
2024-04-12 13:59:12 -06:00
Tom Rini
b566f7d239 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.
2024-04-12 13:59:12 -06:00
MD Danish Anwar
8ace084672 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>
2024-04-12 13:54:43 -06:00
MD Danish Anwar
737a668413 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>
2024-04-12 13:54:43 -06:00
MD Danish Anwar
ff7799907e 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>
2024-04-12 13:54:43 -06:00
MD Danish Anwar
1c05cb469f 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>
2024-04-12 13:54:43 -06:00
MD Danish Anwar
8cb5f079ac 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>
2024-04-12 13:54:43 -06:00
Tom Rini
4914263c9a 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.
2024-04-12 12:57:13 -06:00
Michal Simek
26beded3d0 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>
2024-04-12 12:57:07 -06:00
Michal Simek
340fdf1303 zlib: Port fix for CVE-2016-9841 to U-Boot
The patch corresponds to zlib commit at
9aaec95e82
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 92faa8b109 ("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>
2024-04-12 12:57:07 -06:00
Michal Simek
67b252cb33 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>
2024-04-12 12:57:07 -06:00
Michal Simek
70f37a5def 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>
2024-04-12 12:57:07 -06:00
Tom Rini
ef8ef5f77c Merge branch '2024-04-12-assorted-updates'
- Assorted sandbox fixes, cleanup some of the partition table code and a
  few other fixes
2024-04-12 12:50:57 -06:00
Kunihiko Hayashi
4341fb7332 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>
2024-04-12 08:53:31 -06:00
Heinrich Schuchardt
51b2f4f085 disk: simplify print_part_header()
Using uclass_get_name() reduces the code size.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2024-04-12 08:53:31 -06:00
Heinrich Schuchardt
9b6d415eea test: remove unused import from pkg_resources
load_entry_point is not used.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2024-04-12 08:53:31 -06:00
Sam Protsenko
16b80c93e2 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: 739a01ed8e ("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>
2024-04-12 08:53:31 -06:00
Heinrich Schuchardt
d2e4b2fa04 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>
2024-04-12 08:53:31 -06:00