Commit Graph

92396 Commits

Author SHA1 Message Date
Igor Opaniuk
b905599b36 tee: remove common.h inclusion
The usage of the common.h include file is deprecated [1], and has already
been removed from several files.
Get rid of all inclusions in the "drivers/tee" directory, and replace it
with required include files directly where needed.

[1] doc/develop/codingstyle.rst

Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Igor Opaniuk <igor.opaniuk@gmail.com>
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2024-04-18 16:04:48 +03:00
Igor Opaniuk
f5d14bea8f test: py: add optee_rpmb tests
Add read/write tests for optee_rpmb cmd.

Signed-off-by: Igor Opaniuk <igor.opaniuk@gmail.com>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2024-04-18 16:04:48 +03:00
Igor Opaniuk
dfac18e944 cmd: optee_rpmb: build cmd for sandbox
Support CMD_OPTEE_RPMB for SANDBOX configurations.
Test:

$ ./u-boot -d arch/sandbox/dts/test.dtb
...
=> optee_rpmb write_pvalue test_variable test_value
Wrote 11 bytes
=> optee_rpmb read_pvalue test_variable 11
Read 11 bytes, value = test_value

Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Tested-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Signed-off-by: Igor Opaniuk <igor.opaniuk@gmail.com>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2024-04-18 16:04:48 +03:00
Igor Opaniuk
fbdaafbb80 cmd: optee_rpmb: close tee session
Close tee session after each optee_rpmb invocation, as there is no
reason to keep it open, considering the absence of any available mechanism
to clean up all open sessions automatically before handing over control
to the Linux kernel. Without proper clean-up we might end up with orphaned
sessions registered in OP-TEE OS core (obvious resource leak).

Signed-off-by: Igor Opaniuk <igor.opaniuk@gmail.com>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2024-04-18 16:04:48 +03:00
Igor Opaniuk
6e8bb1fb0a tee: optee: fix description in Kconfig
Fix OPTEE_TA_AVB symbol description in Kconfig:
s/"write"rb"/"write_rb"/g

Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Igor Opaniuk <igor.opaniuk@gmail.com>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2024-04-18 16:04:48 +03:00
Heinrich Schuchardt
2c3fa4b8ad sandbox: don't call os_close with invalid file descriptor
If open() fails it returns -1. Calling close() with this value
makes no sense. Return -EIO instead.

Addresses-Coverity-ID: 185828 Improper use of negative value
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Fixes: 566bf3a869 ("sandbox: Add a function to read a host file")
Reviewed-by: Sean Anderson <seanga2@gmail.com>
2024-04-17 17:06:16 -06:00
Andrew Davis
adf418d8c1 arm: mach-k3: security: Lower verbosity of cert message for GP
When we find a certificate on an image to be booted on a GP device we
print out a message explaining that the certificate is being skipped.
This message is rather long and is printed for every image. Shorten
the message and make the long version into a debug message.

Signed-off-by: Andrew Davis <afd@ti.com>
Tested-by: Jonathan Humphreys <j-humphreys@ti.com>
2024-04-17 17:06:13 -06:00
Judith Mendez
312d4e23e6 configs: am64x_evm_*_defconfig: Increase offsets for eMMC raw boot
EMMC boot can fail due to the size of R5 SPL image growing beyond the
500KB of memory allocated in eMMC. Update offsets for eMMMC raw boot
to load each binary from the correct address in eMMC according to the
following eMMC layout:

            boot0/1 partition
    0x0+----------------------------------+
       |     tiboot3.bin (1 MB)           |
  0x800+----------------------------------+
       |       tispl.bin (2 MB)           |
0x1800+-----------------------------------+
       |       u-boot.img (4 MB)          |
0x3800+-----------------------------------+
       |      environment (128 KB)        |
0x3900+-----------------------------------+

Signed-off-by: Judith Mendez <jm@ti.com>
2024-04-17 17:06:11 -06:00
Jim Liu
11987d3baf configs: arbel: Use generic timer and npcm reset driver
Modify defconfig to use generic timer and npcm reset driver

Signed-off-by: Jim Liu <JJLIU0@nuvoton.com>
2024-04-17 17:06:09 -06:00
Heinrich Schuchardt
ba23c378c5 fs: fat: fill creation and change date
The FAT specification requires that the change date is set.

If a DM RTC device exists, set the creation and change date to the current
date when updating the directory entry. Otherwise use the date 2020-01-01.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2024-04-17 17:06:06 -06:00
Heinrich Schuchardt
3c1bc9f15c fs: fat: convert change month correctly
The month is stored in 5 - 8. We need to shift it by 5 bits.

Cf. Microsoft FAT Specification, 2005-08-30

Fixes: 13c11c6653 ("fs: fat: add file attributes to struct fs_dirent")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Alexander Dahl <ada@thorsis.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2024-04-17 17:06:04 -06:00
Ahelenia Ziemiańska
7c665e1512 tools: copyfile: use 64k instead of 512 buffer
This is a trivial but significant optimization:
mkimage took >200ms (and 49489 writes (of which 49456 512)),
now it takes  110ms (and   419 writes (of which   386 64k)).

sendfile is much more appropriate for this and is done in one syscall,
but doesn't bring any significant speedups over 64k r/w
at the 13M size ranges, so there's no need to introduce
	#if __linux__
	while((size = sendfile(fd_dst, fd_src, NULL, 128 * 1024 * 1024)) > 0)
		;
	if(size != -1) {
		ret = 0;
		goto out;
	}
	#endif

Also extract the buffer size to a macro.

Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Reviewed-by: Dragan Simic <dsimic@manjaro.org>
2024-04-17 17:06:01 -06:00
Heinrich Schuchardt
28a766ebf1 test: typo curren
Fix typos in test_eficonfig.py: %s/curren/current/

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@gmail.com>
2024-04-17 17:05:57 -06:00
Jonathan Humphreys
d31ff219a8 Makefile.lib: find capsule ESL dtsi file with CONFIG_OF_UPSTREAM
When CONFIG_OF_UPSTREAM is enabled, DTS files are in SOC subdirectories (vs the
top level dts directory), but when CONFIG_EFI_CAPSULE_AUTHENTICATE is enabled,
the dynamically created dtsi file containing the capsule ESL DT node is in the
parent directory. This results in a build failure because the #include inserted
in the DTS file is local to the current directory.  Update Makefile to have the
DT preprocessing of #includes search in the parent (dts top level) directory
too.

Signed-off-by: Jonathan Humphreys <j-humphreys@ti.com>
2024-04-17 17:05:54 -06:00
Tom Rini
a712a54dc4 Merge patch series "configs: ti: Enable basic settings for SystemReady ACS"
Jonathan Humphreys <j-humphreys@ti.com> says:

Set basic settings needed for System Ready IR ACS testing, for several TI SoC
based platforms: AM64, AM62, AM62p, BeaglePlay, J7, and BeagleboneAI.

For AM64, AM62, and AM62p, also includes some config cleanup.  Should be no
functional change.
2024-04-17 13:16:12 -06:00
Jonathan Humphreys
fc75cf1c84 configs: beagleboneai64: Enable RTC emulation
Signed-off-by: Jonathan Humphreys <j-humphreys@ti.com>
2024-04-17 13:15:23 -06:00
Jonathan Humphreys
4524c433bf configs: beagleboneai64: Enable basic EFI CMD support
Signed-off-by: Jonathan Humphreys <j-humphreys@ti.com>
2024-04-17 13:15:23 -06:00
Jonathan Humphreys
634d7a3b1c configs: am62x: Enable RTC emulation
This is required to pass SystemReadyIR tests.

Signed-off-by: Jonathan Humphreys <j-humphreys@ti.com>
2024-04-17 13:15:23 -06:00
Jonathan Humphreys
b9462edf17 configs: am62x: Enable basic EFI CMD support
This is required to pass SystemReadyIR tests.

Signed-off-by: Jonathan Humphreys <j-humphreys@ti.com>
2024-04-17 13:15:23 -06:00
Jonathan Humphreys
c2b69cdb7b configs: am62x: cosmetic config cleanup
Signed-off-by: Jonathan Humphreys <j-humphreys@ti.com>
2024-04-17 13:15:23 -06:00
Jonathan Humphreys
2b6584adae configs: am62px: Enable RTC emulation
This is required to pass SystemReadyIR tests.

Signed-off-by: Jonathan Humphreys <j-humphreys@ti.com>
2024-04-17 13:15:23 -06:00
Jonathan Humphreys
06a79af9aa configs: am62px: Enable basic EFI CMD support
This is required to pass SystemReadyIR tests.

Signed-off-by: Jonathan Humphreys <j-humphreys@ti.com>
2024-04-17 13:15:23 -06:00
Jonathan Humphreys
ced082af1c configs: am62px: cosmetic config cleanup
Signed-off-by: Jonathan Humphreys <j-humphreys@ti.com>
2024-04-17 13:15:23 -06:00
Jonathan Humphreys
dd34f6e322 configs: beagleplay: Enable RTC emulation
Signed-off-by: Jonathan Humphreys <j-humphreys@ti.com>
2024-04-17 13:15:23 -06:00
Jonathan Humphreys
d8bc1174e3 configs: beagleplay: Enable basic EFI CMD support
Signed-off-by: Jonathan Humphreys <j-humphreys@ti.com>
2024-04-17 13:15:23 -06:00
Jonathan Humphreys
c1ddf814d4 configs: j721e: Enable RTC emulation
Signed-off-by: Jonathan Humphreys <j-humphreys@ti.com>
2024-04-17 13:15:23 -06:00
Jonathan Humphreys
280fd7ef11 configs: j721e: Enable basic EFI CMD support
Signed-off-by: Jonathan Humphreys <j-humphreys@ti.com>
2024-04-17 13:15:23 -06:00
Jonathan Humphreys
dcb2282738 configs: am64x: Enable RTC emulation
This is required to pass SystemReadyIR tests.

Signed-off-by: Jonathan Humphreys <j-humphreys@ti.com>
2024-04-17 13:15:23 -06:00
Jonathan Humphreys
a0b0e6b379 configs: am64x: Enable basic EFI CMD support
This is required to pass SystemReadyIR tests.

Signed-off-by: Jonathan Humphreys <j-humphreys@ti.com>
2024-04-17 13:15:23 -06:00
Jonathan Humphreys
bba9456a56 configs: am64x: cosmetic config cleanup
Signed-off-by: Jonathan Humphreys <j-humphreys@ti.com>
2024-04-17 13:15:23 -06:00
Tom Rini
198f33a2eb Merge patch series "zfs: Fix zfs support on aarch64"
mwleeds@mailtundra.com <mwleeds@mailtundra.com> says:

This patch series is needed to get U-Boot to boot from a ZFS filesystem
on an aarch64 computer. Some of the patches are not architecture specific
and would be needed to boot ZFS on other platforms as well. The ZFS
support in U-Boot hasn't been substantively touched in several years and
to me it seems like it must have been broken for a long time on all
platforms, but I have only tested on aarch64.

Since there doesn't seem to be a mantainer for this area who I can cc,
I'm hoping these patches get seen and pulled in by a general U-Boot
maintainer.

[trini: Per Igor's comment and Phaedrus agreement, dropped his Tested-by
 on the patches themselves]
2024-04-17 10:08:59 -06:00
mwleeds@mailtundra.com
730c69f133 zfs: Fix zfs_read() to actually work
Without this patch, the while loop being modified goes on infinitely,
but with the patch I am able to boot linux on zfs on a jetson tx2 nx.

It seems like this code was never tested because the logic is clearly
wrong. The function do_div(a,b) does a division that modifies the first
parameter to have a = a / b, and returns the remainder of the division.
So clearly in the usual case when file->offset = 0, the line
"blkid = do_div(blkid, blksz);" just results in blkid being set to zero
on every iteration of the loop, rather than being incremented as blocks
are read. Hence the zeroth block is read over and over and this becomes
an infinite loop.

So instead capture the remainder of the division in a "blkoff" variable,
and use that to properly calculate the memory address to move from in
memmove() below.

For example, if file->offset were 1337, on the first iteration of the
loop blkid would be 0 and blkoff would be 1337. If the blksz is 131072
(as it was for me), that amount of data would be copied into
data->file_buf. movesize would be 131072 - 1337 = 129735 so 129735 bytes
would be moved into buf. On the second iteration of the loop (assuming
there is one), red would be 129735, blkid would be 1, blkoff would be 0,
and 131072 bytes would be copied into buf. And so on...

Signed-off-by: Phaedrus Leeds <mwleeds@mailtundra.com>
2024-04-17 10:08:58 -06:00
mwleeds@mailtundra.com
1e85ddb784 zfs: Fix return value of fs_devread()
As evidenced by how other filesystems handle it, a return value of 0
from fs_devread() means failure; nonzero means success. The opposite
assumption was being made in zfs.c for the use of zfs_devread() so fix
the confusion by making zfs_devread() return 0 on success.

It probably doesn't make sense to change the handling of zfs_devread()
in zfs.c instead, because as it is it matches the semantics of the other
functions there.

Signed-off-by: Phaedrus Leeds <mwleeds@mailtundra.com>
2024-04-17 10:08:56 -06:00
mwleeds@mailtundra.com
1fe745b4b9 zfs: Fix unaligned read of uint64
Without this patch, when trying to boot zfs using U-Boot on a Jetson TX2
NX (which is aarch64), I get a CPU reset error like so:

"Synchronous Abort" handler, esr 0x96000021
elr: 00000000800c9000 lr : 00000000800c8ffc (reloc)
elr: 00000000fff77000 lr : 00000000fff76ffc
x0 : 00000000ffb40f04 x1 : 0000000000000000
x2 : 000000000000000a x3 : 0000000003100000
x4 : 0000000003100000 x5 : 0000000000000034
x6 : 00000000fff9cc6e x7 : 000000000000000f
x8 : 00000000ff7f84a0 x9 : 0000000000000008
x10: 00000000ffb40f04 x11: 0000000000000006
x12: 000000000001869f x13: 0000000000000001
x14: 00000000ff7f84bc x15: 0000000000000010
x16: 0000000000002080 x17: 00000000001fffff
x18: 00000000ff7fbdd8 x19: 00000000ffb405f8
x20: 00000000ffb40dd0 x21: 00000000fffabe5e
x22: 000000ea77940000 x23: 00000000ffb42090
x24: 0000000000000000 x25: 0000000000000000
x26: 0000000000000000 x27: 0000000000000000
x28: 0000000000bab10c x29: 00000000ff7f85f0

Code: d00001a0 9103a000 94006ac6 f9401ba0 (f9400000)
Resetting CPU ...

This happens when be64_to_cpu() is called on a value that exists at a
memory address that's 4 byte aligned but not 8 byte aligned (e.g. an
address ending in 04). The call stack where that happens is:
check_pool_label() ->
zfs_nvlist_lookup_uint64(vdevnvlist, ZPOOL_CONFIG_ASHIFT,...) ->
be64_to_cpu()

Signed-off-by: Phaedrus Leeds <mwleeds@mailtundra.com>
Fixes: 4d3c95f5ea ("zfs: Add ZFS filesystem support")
2024-04-17 10:08:53 -06:00
mwleeds@mailtundra.com
6bbd7e820d zfs: Add a comment to clarify nvlist memory layout
Signed-off-by: Phaedrus Leeds <mwleeds@mailtundra.com>
2024-04-17 10:08:51 -06:00
mwleeds@mailtundra.com
0c17f85710 zfs: Fix malloc() success check
This code was hitting the error code path whenever malloc() succeeded
rather than when it failed, so presumably this part of the code hasn't
been tested. I had to apply this fix (and others) to get U-Boot to boot
from ZFS on an Nvidia Jetson TX2 NX SoM (an aarch64 computer).

Signed-off-by: Phaedrus Leeds <mwleeds@mailtundra.com>
2024-04-17 10:08:48 -06:00
Yasuharu Shibata
beac958153 net: wget: fix TCP sequence number wrap around issue
If tcp_seq_num is wrap around, tcp_seq_num >= initial_data_seq_num
isn't satisfied and store_block() isn't called.
The condition has a wrap around issue, so it is fixed in this patch.

Signed-off-by: Yasuharu Shibata <yasuharu.shibata@gmail.com>
Reviewed-by: Michael Trimarchi <michael@amarulasolutions.com>
Suggested-by: Michael Trimarchi <michael@amarulasolutions.com>
Reported-by: Tim Harvey <tharvey@gateworks.com>
Tested-by: Fabio Estevam <festevam@denx.de>
2024-04-16 17:19:35 -06:00
Yasuharu Shibata
cab7867cff net: wget: Support retransmission a dropped packet
The server sends multiple packets without waiting for an ACK
by window control and if some packets are dropped,
wget will return an ACK including the dropped packets.

Following log indicates this issue.

  wget_handler() wget: Transferring, seq=97bbdd4a, ack=30,len=580
  wget_handler() wget: Transferring, seq=97bbedca, ack=30,len=580

First packet of TCP sequence number is 0x97bbdd4a.
Second packet of TCP sequence number should be 0x97bbe2ca,
however it is 0x97bbedca and returns its ACK, so the server
suppose that 0x97bbe2ca and 0x97bbedca are received appropriately.
In this case, 0x97bbe2ca was lost and the data of wget was broken.

In this patch, next_data_seq_num holds the next expected
TCP sequence number.
If the TCP sequence number different from next_data_seq_num,
trying to retransmit the packet.

Signed-off-by: Yasuharu Shibata <yasuharu.shibata@gmail.com>
Tested-by: Fabio Estevam <festevam@gmail.com>
2024-04-16 17:19:29 -06:00
Tom Rini
6e316e3f39 Merge tag 'u-boot-imx-master-20240415' of https://gitlab.denx.de/u-boot/custodians/u-boot-imx
CI:
https://source.denx.de/u-boot/custodians/u-boot-imx/-/pipelines/20348

- Update the imx_rgpio2p to only access one address as per the
  dt-schema.
- Remove unused imx9_cpu.c file.
- Only use the LPUART ipg clk for i.MX7ULP.
- Use the correct anatop base for accessing the PLL clocks on i.MX93.
2024-04-15 07:39:14 -06:00
Tom Rini
db97266579 Merge https://source.denx.de/u-boot/custodians/u-boot-mmc 2024-04-15 07:38:51 -06:00
Tom Rini
d736d9f212 Merge tag 'u-boot-socfpga-next-20240415' of https://source.denx.de/u-boot/custodians/u-boot-socfpga
- Add option to reprogram FPGA every reboot, enable this as default in
  chameleonv3 defconfig.
- Fixes: Rename CONFIG_SPL_SOCFPGA_SEC_REG to CONFIG_SPL_SOCFPGA_DT_REG,
  so the driver can be built when CONFIG_SPL_SOCFPGA_DT_REG is set in
  defconfig.
2024-04-15 07:38:18 -06:00
Peng Fan
8ecb093194 clk: imx93: fix anatop base
The PLL clk needs use anatop base, otherwise wrong PLL address will
be used.

Fixes: 9c153e4666 ("clk: imx: add i.MX93 CCF driver")
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2024-04-15 08:09:41 -03:00
Peng Fan
9422e1c441 cpu: drop imx9_cpu
This was wrongly committed, no user, remove it.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
2024-04-15 08:09:36 -03:00
Peng Fan
1e635a319d serial: lpuart: use ipg clk for i.MX7ULP
To i.MX7ULP compatible lpuart, there is only ipg clk, no per clk.
So add a devtype check for i.MX7ULP.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
2024-04-15 08:09:31 -03:00
Peng Fan
51cfa66f2c gpio: imx_rgpio2p: support one address
The i.MX8ULP/93 gpio dt-schema have been updated to only have one
address entry, update the driver to support it.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
2024-04-15 08:09:26 -03:00
Jaehoon Chung
3657ef738a mmc: cv1800b_sdhci: Remove the unused argument
Remove the unused argument about cmd_error.

Fixes: a3b2786651 ("mmc: Drop unused mmc_send_tuning() cmd_error parameter")

Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
2024-04-15 17:58:59 +09:00
Yang Xiwen
2ea7b7a42a mmc: hi6220_dw_mmc: add fifoth_val to private data and set it in .probe
The value defaults to 0 and is ignored by dw_mmc code, so the other
users are not affected.

Setting this explicitly fixes some weird reading error found on Hi3798MV200.

Fixes: 8a5dc8140e ("mmc: hi6220_dw_mmc: add compatible for HC2910 support")

Signed-off-by: Yang Xiwen <forbidden405@outlook.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
2024-04-15 16:01:48 +09:00
Yang Xiwen
1fa6dc2879 mmc: dw_mmc: Don't return error if data busy timeout
As described in [1], some poor hardware or cards would fail to release
the bus and keep driving data lines low. Ignore it and send the next cmd
directly seems okay for most cases.

[1]: https://patchwork.kernel.org/project/linux-mmc/patch/1424458179-5456-1-git-send-email-dianders@chromium.org/

Signed-off-by: Yang Xiwen <forbidden405@outlook.com>
Tested-by: Jaehoon Chung <jh80.chung@samsung.com>
2024-04-15 16:01:32 +09:00
Yang Xiwen
4685d6fbe4 mmc: hi6220-dwmmc: handle clocks and resets if CONFIG_CLK and CONFIG_DM_RESET enabled
This can avoid hardcoding a clock rate in driver. Also can enable the
clocks and deassert the resets if the pre-bootloader does not do this
for us.

Currently only enabled for Hi3798MV200.

Signed-off-by: Yang Xiwen <forbidden405@outlook.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
2024-04-15 16:01:15 +09:00
Marek Vasut
27ba82cb6c mmc: Unconditionally call mmc_deinit()
Place the SDR104/HS200/HS400 checks into the mmc_deinit() and always
call it. This simplifies the code and removes ifdeffery. No functional
change is expected.

Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Dragan Simic <dsimic@manjaro.org>
2024-04-15 15:19:13 +09:00