]> git.dujemihanovic.xyz Git - u-boot.git/log
u-boot.git
11 months agofw_env: autodetect NAND erase size and env sectors
Anthony Loiseau [Thu, 21 Dec 2023 22:44:38 +0000 (23:44 +0100)]
fw_env: autodetect NAND erase size and env sectors

As already done for NOR chips, if device ESIZE and ENVSECTORS static
configurations are both zero, then autodetect them at runtime.

Cc: Joe Hershberger <joe.hershberger@ni.com>
cc: Stefan Agner <stefan@agner.ch>
cc: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Signed-off-by: Anthony Loiseau <anthony.loiseau@allcircuits.com>
11 months agofw_env: keep calling read() until whole flash block is read
Rafał Miłecki [Wed, 13 Dec 2023 12:13:54 +0000 (13:13 +0100)]
fw_env: keep calling read() until whole flash block is read

It's totally valid for read() to provide less bytes than requested
maximum. It may happen if there is no more data available yet or source
pushes data in small chunks.

This actually happens when trying to read env data from NVMEM device.
Kernel may provide NVMEM content in page size parts (like 4096 B).

This fixes warnings like:
Warning on /sys/bus/nvmem/devices/u-boot-env0/nvmem: Attempted to read 16384 bytes but got 4096
Warning on /sys/bus/nvmem/devices/u-boot-env0/nvmem: Attempted to read 12288 bytes but got 4096
Warning on /sys/bus/nvmem/devices/u-boot-env0/nvmem: Attempted to read 8192 bytes but got 4096

Since the main loop in flash_read_buf() is used to read blocks this
patch adds a new nested one.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
11 months agofw_env: rename variables holding env data content
Rafał Miłecki [Wed, 13 Dec 2023 09:23:44 +0000 (10:23 +0100)]
fw_env: rename variables holding env data content

Rename "addr0" and "addr1" to "buf0" and "buf1" accordingly. Name "addr"
suggests that variable contains a numeric value being some kind of
address. Name "buf" is de facto a standard name for pointer to allocated
memory for reading data to.

While at it drop redundant checks for NULL before calling free().

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
11 months agofw_env: fix reading NVMEM device's "compatible" value
Rafał Miłecki [Tue, 12 Dec 2023 17:33:27 +0000 (18:33 +0100)]
fw_env: fix reading NVMEM device's "compatible" value

Call to fread() was changed to check for return value. The problem is it
can't be checked for returning 1 (as it is) to determine success.

We call fread() with buffer size as "size" argument. Reading any
"compatible" value shorter than buffer size will result in returning 0
even on success.

Modify code to use fstat() to determine expected read length.

This fixes regression that broke using fw_env with NVMEM devices.

Fixes: c059a22b7776 ("tools: env: fw_env: Fix unused-result warning")
Cc: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
11 months agoMerge patch series "ATF and OP-TEE Firewalling for K3 devices."
Tom Rini [Thu, 4 Jan 2024 21:53:49 +0000 (16:53 -0500)]
Merge patch series "ATF and OP-TEE Firewalling for K3 devices."

Manorit Chawdhry <m-chawdhry@ti.com> says:

K3 devices have firewalls that are used to prevent illegal accesses to
memory regions that are deemed secure. The series prevents the illegal
accesses to ATF and OP-TEE regions that are present in different K3
devices.

AM62X, AM62AX and AM64X are currently in hold due to some firewall
configurations that our System Controller (TIFS) needs to handle.
The devices that are not configured with the firewalling nodes will not
be affected and can continue to work fine until the firewall nodes are
added so will be a non-blocking merge.

Test Logs: https://gist.github.com/manorit2001/4cead2fb3a19eb5d19005b3f54682627
CICD Run: https://github.com/u-boot/u-boot/pull/442

11 months agodocs: board: ti: k3: Add secure booting documentation
Manorit Chawdhry [Fri, 29 Dec 2023 10:46:33 +0000 (16:16 +0530)]
docs: board: ti: k3: Add secure booting documentation

This commit adds a general flow to explain the usage of firewalls and
the chain of trust in K3 devices.

Signed-off-by: Manorit Chawdhry <m-chawdhry@ti.com>
11 months agodocs: board: ti: k3: Cleanup FIT signature documentation
Manorit Chawdhry [Fri, 29 Dec 2023 10:46:32 +0000 (16:16 +0530)]
docs: board: ti: k3: Cleanup FIT signature documentation

The previous documentation had been very crude so refactor it to make it
cleaner and concise.

Signed-off-by: Manorit Chawdhry <m-chawdhry@ti.com>
11 months agoarm: dts: k3-j7200-binman: Add firewall configurations
Manorit Chawdhry [Fri, 29 Dec 2023 10:46:31 +0000 (16:16 +0530)]
arm: dts: k3-j7200-binman: Add firewall configurations

The following commits adds the configuration of firewalls required to
protect ATF and OP-TEE memory region from non-secure reads and
writes using master and slave firewalls present in our K3 SOCs.

Signed-off-by: Manorit Chawdhry <m-chawdhry@ti.com>
Tested-by: Thomas Richard <thomas.richard@bootlin.com>
11 months agoarm: dts: k3-j721s2-binman: Add firewall configurations
Manorit Chawdhry [Fri, 29 Dec 2023 10:46:30 +0000 (16:16 +0530)]
arm: dts: k3-j721s2-binman: Add firewall configurations

The following commits adds the configuration of firewalls required to
protect ATF and OP-TEE memory region from non-secure reads and
writes using master and slave firewalls present in our K3 SOCs.

Signed-off-by: Manorit Chawdhry <m-chawdhry@ti.com>
11 months agoarm: dts: k3-j721e-binman: Add firewall configurations
Manorit Chawdhry [Fri, 29 Dec 2023 10:46:29 +0000 (16:16 +0530)]
arm: dts: k3-j721e-binman: Add firewall configurations

The following commits adds the configuration of firewalls required to
protect ATF and OP-TEE memory region from non-secure reads and
writes using master and slave firewalls present in our K3 SOCs.

Signed-off-by: Manorit Chawdhry <m-chawdhry@ti.com>
11 months agoarm: dts: k3-binman: Add k3-security.h and include it in k3-binman.dtsi
Manorit Chawdhry [Fri, 29 Dec 2023 10:46:28 +0000 (16:16 +0530)]
arm: dts: k3-binman: Add k3-security.h and include it in k3-binman.dtsi

For readability during configuring firewalls, adding k3-security.h file
and including it in k3-binman.dtsi to be accessible across K3 SoCs

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Manorit Chawdhry <m-chawdhry@ti.com>
Reviewed-by: Andrew Davis <afd@ti.com>
11 months agobinman: ftest: Add test for ti-secure firewall node
Manorit Chawdhry [Fri, 29 Dec 2023 10:46:27 +0000 (16:16 +0530)]
binman: ftest: Add test for ti-secure firewall node

Add test for TI firewalling node in ti-secure.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Manorit Chawdhry <m-chawdhry@ti.com>
11 months agobinman: ti-secure: Add support for firewalling entities
Manorit Chawdhry [Fri, 29 Dec 2023 10:46:26 +0000 (16:16 +0530)]
binman: ti-secure: Add support for firewalling entities

We can now firewall entities while loading them through our secure
entity TIFS, the required information should be present in the
certificate that is being parsed by TIFS.

The following commit adds the support to enable the certificates to be
generated if the firewall configurations are present in the binman dtsi
nodes.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Manorit Chawdhry <m-chawdhry@ti.com>
11 months agodtoc: Change dst to self in debug message
Manorit Chawdhry [Fri, 29 Dec 2023 10:46:25 +0000 (16:16 +0530)]
dtoc: Change dst to self in debug message

Fix the error message to not use dst and use self as it is copying the
properties to self.

While using templating if there are no subnodes defined, we end up in
this situation where "dst" isn't defined and it tries to print the error
message and fails.

'UnboundLocalError: local variable 'dst' referenced before assignment'

Fixes: 55e1278d5eca ("dtoc: Allow inserting a list of nodes into another")
Signed-off-by: Manorit Chawdhry <m-chawdhry@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
11 months agoconfigs: Resync with savedefconfig
Tom Rini [Wed, 3 Jan 2024 14:26:16 +0000 (09:26 -0500)]
configs: Resync with savedefconfig

Rsync all defconfig files using moveconfig.py

Signed-off-by: Tom Rini <trini@konsulko.com>
11 months agoMerge tag 'v2024.01-rc6' into next
Tom Rini [Wed, 3 Jan 2024 14:22:47 +0000 (09:22 -0500)]
Merge tag 'v2024.01-rc6' into next

Prepare v2024.01-rc6

11 months agoPrepare v2024.01-rc6
Tom Rini [Wed, 3 Jan 2024 14:11:33 +0000 (09:11 -0500)]
Prepare v2024.01-rc6

Signed-off-by: Tom Rini <trini@konsulko.com>
11 months agoconfigs: Resync with savedefconfig
Tom Rini [Wed, 3 Jan 2024 14:09:56 +0000 (09:09 -0500)]
configs: Resync with savedefconfig

Rsync all defconfig files using moveconfig.py

Signed-off-by: Tom Rini <trini@konsulko.com>
11 months agoarm: dts: k3-am62a*: Sync with kernel v6.7-rc1
Nishanth Menon [Mon, 13 Nov 2023 14:51:43 +0000 (08:51 -0600)]
arm: dts: k3-am62a*: Sync with kernel v6.7-rc1

Sync with kernel v6.7-rc1 and sync up the u-boot dts files accordingly.

Signed-off-by: Nishanth Menon <nm@ti.com>
11 months agoarm: mach-k3: am62a: Add main_timer0 id to the dev list
Nishanth Menon [Mon, 13 Nov 2023 14:51:42 +0000 (08:51 -0600)]
arm: mach-k3: am62a: Add main_timer0 id to the dev list

main_timer0 is used by u-boot as the tick-timer. Add it to the soc
devices list so it an be enabled via the k3 power controller.

Signed-off-by: Nishanth Menon <nm@ti.com>
Reviewed-by: Neha Malcom Francis <n-francis@ti.com>
11 months agoMerge patch series "sync am65x device tree with Linux v6.7-rc1"
Tom Rini [Wed, 3 Jan 2024 13:38:40 +0000 (08:38 -0500)]
Merge patch series "sync am65x device tree with Linux v6.7-rc1"

Bryan Brattlof <bb@ti.com> says:

Hello Again Everyone!

This series gets the am65x booting again along with syncing the device
tree files with v6.7-rc1 Linux.

The bulk of these patches unify the WKUP SPL board file with the arm64
files to make future syncs from Linux much easier. In the end the DTBs
should look a lot like what the DTBs look like for the am64x which
is fairly similar to the am65x.

For those interested in what UART boot looks like:
   https://paste.sr.ht/~bryanb/7df8a645dc548912cd806abd5ecab967ef3287bc

11 months agoarm: dts: k3-am654: convert bootph-pre-ram to bootph-all
Bryan Brattlof [Fri, 29 Dec 2023 17:47:23 +0000 (11:47 -0600)]
arm: dts: k3-am654: convert bootph-pre-ram to bootph-all

Many nodes are reused between WKUP SPL, MAIN SPL, and U-Boot. Using
bootph-pre-ram is causing these nodes to be present in SPL builds but
pruned away during the U-Boot build. Convert these nodes to bootph-all
so they will remain no matter which dtb build is happening.

Tested-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Bryan Brattlof <bb@ti.com>
Reviewed-by: Nishanth Menon <nm@ti.com>
11 months agoarm: dts: k3-am654: remove duplicate mcu secure proxy node
Bryan Brattlof [Fri, 29 Dec 2023 17:47:22 +0000 (11:47 -0600)]
arm: dts: k3-am654: remove duplicate mcu secure proxy node

With the Linux and U-Boot board dtb files unified, we now have a
duplicate mcu secure proxy node. Remove it

Tested-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Bryan Brattlof <bb@ti.com>
Reviewed-by: Nishanth Menon <nm@ti.com>
11 months agoarm: dts: k3-am654: move dummy_clock to root node
Bryan Brattlof [Fri, 29 Dec 2023 17:47:21 +0000 (11:47 -0600)]
arm: dts: k3-am654: move dummy_clock to root node

The dummy_clock node is used to help the drivers probe the IO needed to
setup consoles and boot media to load firmware into the SoC.

This dummy_clock isn't a device that exists nor does it exist in the
mcu domain. So move it from cbass_mcu to the root node to avoid any
confusion.

Tested-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Bryan Brattlof <bb@ti.com>
Reviewed-by: Nishanth Menon <nm@ti.com>
11 months agoarm: dts: k3-am654: remove un-needed aliases
Bryan Brattlof [Fri, 29 Dec 2023 17:47:20 +0000 (11:47 -0600)]
arm: dts: k3-am654: remove un-needed aliases

These aliases are not needed in U-Boot. Remove them

Tested-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Bryan Brattlof <bb@ti.com>
Reviewed-by: Nishanth Menon <nm@ti.com>
11 months agoarm: dts: k3-am654: remove duplicate root properties
Bryan Brattlof [Fri, 29 Dec 2023 17:47:19 +0000 (11:47 -0600)]
arm: dts: k3-am654: remove duplicate root properties

With the Linux and U-Boot board dtb files unified, we have duplicate
properties in the root node. Remove them

Tested-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Bryan Brattlof <bb@ti.com>
Reviewed-by: Nishanth Menon <nm@ti.com>
11 months agoarm: dts: k3-am654: remove duplicate vtt pinmux
Bryan Brattlof [Fri, 29 Dec 2023 17:47:18 +0000 (11:47 -0600)]
arm: dts: k3-am654: remove duplicate vtt pinmux

With the Linux and U-Boot board dtb files unified, we now have a
duplicate vtt_pinmux node. Remove it

Tested-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Bryan Brattlof <bb@ti.com>
Reviewed-by: Nishanth Menon <nm@ti.com>
11 months agoarm: dts: k3-am654: remove duplicate mdio
Bryan Brattlof [Fri, 29 Dec 2023 17:47:17 +0000 (11:47 -0600)]
arm: dts: k3-am654: remove duplicate mdio

With the Linux and U-Boot board dtb files unified, we now have a
duplicate mdio node. Remove it

Tested-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Bryan Brattlof <bb@ti.com>
Reviewed-by: Nishanth Menon <nm@ti.com>
11 months agoarm: dts: k3-am654: remove usb0
Bryan Brattlof [Fri, 29 Dec 2023 17:47:16 +0000 (11:47 -0600)]
arm: dts: k3-am654: remove usb0

The pinmux for usb0 is missing from the Linux board dtb file. Remove it
until we can introduce it in Linux

Tested-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Bryan Brattlof <bb@ti.com>
Reviewed-by: Nishanth Menon <nm@ti.com>
11 months agoarm: dts: k3-am654: remove duplicate ospi0 node
Bryan Brattlof [Fri, 29 Dec 2023 17:47:15 +0000 (11:47 -0600)]
arm: dts: k3-am654: remove duplicate ospi0 node

With the Linux and U-Boot board dtb files unified, we now have a
duplicate ospi0 node. Remove it

Tested-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Bryan Brattlof <bb@ti.com>
Reviewed-by: Nishanth Menon <nm@ti.com>
11 months agoarm: dts: k3-am654: remove duplicate wkup_i2c0
Bryan Brattlof [Fri, 29 Dec 2023 17:47:14 +0000 (11:47 -0600)]
arm: dts: k3-am654: remove duplicate wkup_i2c0

With the Linux and U-Boot board dtb files unified, we now have a
duplicate wkup_i2c0 node. Remove it

Tested-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Bryan Brattlof <bb@ti.com>
Reviewed-by: Nishanth Menon <nm@ti.com>
11 months agoarm: dts: k3-am654: remove duplicate sdhci1 pinmux node
Bryan Brattlof [Fri, 29 Dec 2023 17:47:13 +0000 (11:47 -0600)]
arm: dts: k3-am654: remove duplicate sdhci1 pinmux node

With the Linux and U-Boot board dtb files unified, we now have a
duplicate sdhci1 pinmux node. Remove it

Tested-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Bryan Brattlof <bb@ti.com>
Reviewed-by: Nishanth Menon <nm@ti.com>
11 months agoarm: dts: k3-am654: remove duplicate sdhci0 pinmux node
Bryan Brattlof [Fri, 29 Dec 2023 17:47:12 +0000 (11:47 -0600)]
arm: dts: k3-am654: remove duplicate sdhci0 pinmux node

With the Linux and U-Boot board dtb files unified, we now have
a duplicate sdhci0 pinmux node. Remove it

Tested-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Bryan Brattlof <bb@ti.com>
Reviewed-by: Nishanth Menon <nm@ti.com>
11 months agoarm: dts: k3-am654: remove duplicate main_uart0
Bryan Brattlof [Fri, 29 Dec 2023 17:47:11 +0000 (11:47 -0600)]
arm: dts: k3-am654: remove duplicate main_uart0

With the Linux and U-Boot board dtb files unified, we now have a
duplicate main_uart0 node. Remove it

Tested-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Bryan Brattlof <bb@ti.com>
Reviewed-by: Nishanth Menon <nm@ti.com>
11 months agoarm: dts: k3-am654: remove duplicate mcu_uart0 node
Bryan Brattlof [Fri, 29 Dec 2023 17:47:10 +0000 (11:47 -0600)]
arm: dts: k3-am654: remove duplicate mcu_uart0 node

With the Linux and U-Boot board dtb files unified we now have a
duplicate mcu_uart0 node. Remove it

Tested-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Bryan Brattlof <bb@ti.com>
Reviewed-by: Nishanth Menon <nm@ti.com>
11 months agoarm: dts: k3-am654: add needed regs to udmap nodes
Bryan Brattlof [Fri, 29 Dec 2023 17:47:09 +0000 (11:47 -0600)]
arm: dts: k3-am654: add needed regs to udmap nodes

Ethernet is one of a few IPs in U-Boot that depend on DMA to operate.
However there are a few missing registers ranges in the udmap nodes
need to properly setup DMA for the am65x.

A fix has been added to the Linux kernel[0] to add these ranges however
they have not made it to a Linux tag. To keep DMA operational until the
next DT sync from Linux, add these ranges to the *-u-boot.dtsi with a
note for our future selves.

[0] https://lore.kernel.org/r/20231213135138.929517-2-vigneshr@ti.com

Tested-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Bryan Brattlof <bb@ti.com>
Reviewed-by: Nishanth Menon <nm@ti.com>
11 months agoarm: dts: k3-am654: remove duplicate mcu_udmap
Bryan Brattlof [Fri, 29 Dec 2023 17:47:08 +0000 (11:47 -0600)]
arm: dts: k3-am654: remove duplicate mcu_udmap

With the Linux and U-Boot board dtb files unified, we now have a
duplicate mcu_udmap node. Remove it

Tested-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Bryan Brattlof <bb@ti.com>
Reviewed-by: Nishanth Menon <nm@ti.com>
11 months agoarm: dts: k3-am654: remove duplicate mcu_ringacc
Bryan Brattlof [Fri, 29 Dec 2023 17:47:07 +0000 (11:47 -0600)]
arm: dts: k3-am654: remove duplicate mcu_ringacc

With the Linux and U-Boot board dtb files unified, we now have a
duplicate mcu_ringacc node. Remove it

Tested-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Bryan Brattlof <bb@ti.com>
Reviewed-by: Nishanth Menon <nm@ti.com>
11 months agoarm: dts: k3-am654: remove duplicate timer
Bryan Brattlof [Fri, 29 Dec 2023 17:47:06 +0000 (11:47 -0600)]
arm: dts: k3-am654: remove duplicate timer

timer1 is really just the mcu_timer0 node redefined for the WKUP SPL.
Remove the timer1 and replace it with the mcu_timer0 from the Linux
device tree we imported into U-Boot.

Tested-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Bryan Brattlof <bb@ti.com>
Reviewed-by: Nishanth Menon <nm@ti.com>
11 months agoarm: dts: k3-am654: remove duplicate wkup_uart0
Bryan Brattlof [Fri, 29 Dec 2023 17:47:05 +0000 (11:47 -0600)]
arm: dts: k3-am654: remove duplicate wkup_uart0

With the Linux and U-Boot board files unified, we now have a duplicate
wkup_uart0 node. Remove it

Tested-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Bryan Brattlof <bb@ti.com>
Reviewed-by: Nishanth Menon <nm@ti.com>
11 months agoarm: dts: k3-am654: remove duplicate vtt_supply
Bryan Brattlof [Fri, 29 Dec 2023 17:47:04 +0000 (11:47 -0600)]
arm: dts: k3-am654: remove duplicate vtt_supply

With the Linux and U-Boot board dtb files unified we now have a
duplicate vtt_supply node. Remove it

Tested-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Bryan Brattlof <bb@ti.com>
Reviewed-by: Nishanth Menon <nm@ti.com>
11 months agoarm: dts: k3-am654: include a53 board dtb for r5 build
Bryan Brattlof [Fri, 29 Dec 2023 17:47:03 +0000 (11:47 -0600)]
arm: dts: k3-am654: include a53 board dtb for r5 build

To make things as organized as possible, start from the Linux board dtbs
and apply all properties needed for U-Boot in our *-u-boot.dtsi file for
the MAIN SPL and U-Boot builds.

We can then include these files for the WKUP SPL build making further
edits to the needed properties and nodes for the WKUP SPL bootloader's
view of the am65x.

Tested-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Bryan Brattlof <bb@ti.com>
Reviewed-by: Nishanth Menon <nm@ti.com>
11 months agoarm: dts: k3-am654: copy bootph properties to a53 dts
Bryan Brattlof [Fri, 29 Dec 2023 17:47:02 +0000 (11:47 -0600)]
arm: dts: k3-am654: copy bootph properties to a53 dts

In order to unify the R5 board dtb file with the Linux board dtb file,
we will need to copy all bootph-pre-ram properties to the *-u-boot.dtsi
overlay.

Tested-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Bryan Brattlof <bb@ti.com>
Reviewed-by: Nishanth Menon <nm@ti.com>
11 months agoarm: dts: k3-am654: pull in dtb update from Linux
Bryan Brattlof [Fri, 29 Dec 2023 17:47:01 +0000 (11:47 -0600)]
arm: dts: k3-am654: pull in dtb update from Linux

Pull in dtb updates for the am654 base board from v6.7-rc1 of Linux

Tested-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Bryan Brattlof <bb@ti.com>
Reviewed-by: Nishanth Menon <nm@ti.com>
11 months agoarm: dts: k3-am654-r5: Merge board file and U-Boot overlay
Bryan Brattlof [Fri, 29 Dec 2023 17:47:00 +0000 (11:47 -0600)]
arm: dts: k3-am654-r5: Merge board file and U-Boot overlay

The R5 board file for U-Boot should be the same as the board file copied
from Linux with a few alterations to work with the R5's view of the SoC.

First we need to unify the R5 board file and it's U-Boot overlay before
we can unify the Linux board file with this one.

Tested-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Bryan Brattlof <bb@ti.com>
Reviewed-by: Nishanth Menon <nm@ti.com>
11 months agoconfigs: am65x_evm_a53: disable CONSOLE_MUX
Bryan Brattlof [Fri, 29 Dec 2023 17:46:59 +0000 (11:46 -0600)]
configs: am65x_evm_a53: disable CONSOLE_MUX

We do not have a need to share a single console with the evaluation
board and disabling this option reduces the complexity of configuring
the consoles. Disable CONSOLE_MUX

Tested-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Bryan Brattlof <bb@ti.com>
Reviewed-by: Nishanth Menon <nm@ti.com>
11 months agoconfigs: am65x_evm_r5: enable driver for fixed regulators
Bryan Brattlof [Fri, 29 Dec 2023 17:46:58 +0000 (11:46 -0600)]
configs: am65x_evm_r5: enable driver for fixed regulators

Some of the regulators we need to successfully boot are fixed
regulators. Enable the driver to properly probe them.

Tested-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Bryan Brattlof <bb@ti.com>
Reviewed-by: Nishanth Menon <nm@ti.com>
11 months agoMerge tag 'dm-next-1124' of https://source.denx.de/u-boot/custodians/u-boot-dm into...
Tom Rini [Mon, 1 Jan 2024 17:38:15 +0000 (12:38 -0500)]
Merge tag 'dm-next-1124' of https://source.denx.de/u-boot/custodians/u-boot-dm into next

support propagating supernode properties with bootph schema
align bloblist with v0.9 of Firmware Handoff spec

11 months agobloblist: Update documentation and header comment
Simon Glass [Wed, 27 Dec 2023 21:07:10 +0000 (13:07 -0800)]
bloblist: Update documentation and header comment

Align the documentation with the v0.9 spec.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Raymond Mao <raymond.mao@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
11 months agobloblist: Add alignment to bloblist_new()
Simon Glass [Wed, 27 Dec 2023 21:07:09 +0000 (13:07 -0800)]
bloblist: Add alignment to bloblist_new()

Allow the alignment to be specified when creating a bloblist.

Signed-off-by: Simon Glass <sjg@chromium.org>
Co-developed-by: Raymond Mao <raymond.mao@linaro.org>
Signed-off-by: Raymond Mao <raymond.mao@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
11 months agobloblist: Adjust the bloblist header
Simon Glass [Wed, 27 Dec 2023 21:07:08 +0000 (13:07 -0800)]
bloblist: Adjust the bloblist header

The v0.9 spec provides for a 24-byte header. Update the implementation
to match this.
Rename the fields of the bloblist header to align to the spec.
Adds an alignment field into the bloblist header.
Update the related bloblist APIs and UT testcases.

Signed-off-by: Simon Glass <sjg@chromium.org>
Co-developed-by: Raymond Mao <raymond.mao@linaro.org>
Signed-off-by: Raymond Mao <raymond.mao@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
11 months agobloblist: Reduce blob-header size
Simon Glass [Wed, 27 Dec 2023 21:07:07 +0000 (13:07 -0800)]
bloblist: Reduce blob-header size

The v0.9 spec provides for an 8-byte header for each blob, with fewer
fields.
The blob data start address should be aligned to the alignment specified
by the bloblist header.
Update the implementation to match this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Co-developed-by: Raymond Mao <raymond.mao@linaro.org>
Signed-off-by: Raymond Mao <raymond.mao@linaro.org>
11 months agobloblist: Handle alignment with a void entry
Simon Glass [Wed, 27 Dec 2023 21:07:06 +0000 (13:07 -0800)]
bloblist: Handle alignment with a void entry

Rather than setting the alignment using the header size, add an entirely
new entry to cover the gap left by the alignment.

Signed-off-by: Simon Glass <sjg@chromium.org>
Co-developed-by: Raymond Mao <raymond.mao@linaro.org>
Signed-off-by: Raymond Mao <raymond.mao@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
11 months agobloblist: Checksum the entire bloblist
Simon Glass [Wed, 27 Dec 2023 21:07:05 +0000 (13:07 -0800)]
bloblist: Checksum the entire bloblist

Use a sinple 8-bit checksum for bloblist, as specified by the spec
version 0.9.
Spec v0.9 specifies that the entire bloblist area is checksummed,
including unused portions. Update the code to follow this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Co-developed-by: Raymond Mao <raymond.mao@linaro.org>
Signed-off-by: Raymond Mao <raymond.mao@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
11 months agobloblist: Drop spare value from bloblist record
Simon Glass [Wed, 27 Dec 2023 21:07:04 +0000 (13:07 -0800)]
bloblist: Drop spare value from bloblist record

Drop spare value from bloblist record header.

For now it is still present in the header, with an underscore, so that
tests continue to pass.

Signed-off-by: Simon Glass <sjg@chromium.org>
Co-developed-by: Raymond Mao <raymond.mao@linaro.org>
Signed-off-by: Raymond Mao <raymond.mao@linaro.org>
11 months agobloblist: Access record hdr_size and tag via a function
Simon Glass [Wed, 27 Dec 2023 21:07:03 +0000 (13:07 -0800)]
bloblist: Access record hdr_size and tag via a function

Convert accesses to tag and hdr_size via function for grouping tag and
hdr_size together later.

Signed-off-by: Simon Glass <sjg@chromium.org>
Co-developed-by: Raymond Mao <raymond.mao@linaro.org>
Signed-off-by: Raymond Mao <raymond.mao@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
11 months agobloblist: Set version to 1
Simon Glass [Wed, 27 Dec 2023 21:07:02 +0000 (13:07 -0800)]
bloblist: Set version to 1

The new bloblist for v0.9 has version 1 so update this value.

Signed-off-by: Simon Glass <sjg@chromium.org>
Co-developed-by: Raymond Mao <raymond.mao@linaro.org>
Signed-off-by: Raymond Mao <raymond.mao@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
11 months agobloblist: Change the magic value
Simon Glass [Wed, 27 Dec 2023 21:07:01 +0000 (13:07 -0800)]
bloblist: Change the magic value

This uses a new value with spec v0.9 so change it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Co-developed-by: Raymond Mao <raymond.mao@linaro.org>
Signed-off-by: Raymond Mao <raymond.mao@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
11 months agobloblist: Adjust API to align in powers of 2
Simon Glass [Wed, 27 Dec 2023 21:07:00 +0000 (13:07 -0800)]
bloblist: Adjust API to align in powers of 2

The updated bloblist structure stores the alignment as a power-of-two
value in its structures. Adjust the API to use this, to avoid needing to
calling ilog2().
Update the bloblist alignment from 16 bytes to 8 bytes.
Drop a stale comment while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
Co-developed-by: Raymond Mao <raymond.mao@linaro.org>
Signed-off-by: Raymond Mao <raymond.mao@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
11 months agobloblist: Update the tag numbering
Simon Glass [Wed, 27 Dec 2023 21:06:59 +0000 (13:06 -0800)]
bloblist: Update the tag numbering

Align bloblist tags with the FW handoff spec v0.9.
The most common ones are from 0.
TF related ones are from 0x100.
All non-standard ones from 0xfff000.

Added new defined tags:
BLOBLISTT_OPTEE_PAGABLE_PART for TF.
BLOBLISTT_TPM_EVLOG and BLOBLISTT_TPM_CRB_BASE for TPM.

Signed-off-by: Simon Glass <sjg@chromium.org>
Co-developed-by: Raymond Mao <raymond.mao@linaro.org>
Signed-off-by: Raymond Mao <raymond.mao@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
11 months agoMakefile: Use the fdtgrep -u flag
Simon Glass [Tue, 19 Dec 2023 14:21:25 +0000 (07:21 -0700)]
Makefile: Use the fdtgrep -u flag

Use this flag so that the bootph binding is obeyed correctly.

Add a comment about what is going on.

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: https://source.denx.de/u-boot/custodians/u-boot-dm/-/issues/12
Reviewed-by: Tom Rini <trini@konsulko.com>
11 months agofdtgrep: Allow propagating properties up to supernodes
Simon Glass [Sun, 17 Dec 2023 16:36:22 +0000 (09:36 -0700)]
fdtgrep: Allow propagating properties up to supernodes

The existing bootph binding is defined such that properties in a
subnode are also implied in the supernode also, as in this example:

   buttons {
      /* bootph,pre-ram is implied by btn1 */
      compatible = "gpio-keys";

      btn1 {
         bootph,pre-ram;
         gpios = <&gpio_a 3 0>;
         label = "button1";
         linux,code = <BTN_1>;
      };

Provide an option to implement this in fdtgrep.

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agosandbox: Correct SPL condition for building devicetree
Simon Glass [Sun, 17 Dec 2023 16:36:21 +0000 (09:36 -0700)]
sandbox: Correct SPL condition for building devicetree

With sandbox, CONFIG_SANDBOX is y so the current rule ends up building
the devicetree for only those SPL builds where it is unwanted.

Correct the condition. This allows sandbox_vpl to produce a
u-boot-vpl.dtb file.

Fixes: e7fb789612e ("sandbox: Remove OF_HOSTFILE")
Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agofdtgrep: Move property checking into a function
Simon Glass [Sun, 17 Dec 2023 16:36:20 +0000 (09:36 -0700)]
fdtgrep: Move property checking into a function

The h_include() function includes a piece which checks if a node
contains a property being searched for. Move this into its own
function to reduce the size of the h_include() function.

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agofdtgrep: Simplify code to inverting the match
Simon Glass [Sun, 17 Dec 2023 16:36:19 +0000 (09:36 -0700)]
fdtgrep: Simplify code to inverting the match

The code to invert the match in h_include() is a bit convoluted.
Simplify it by using disp->invert only once.

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agofdtgrep: Tidy up comment for h_include()
Simon Glass [Sun, 17 Dec 2023 16:36:18 +0000 (09:36 -0700)]
fdtgrep: Tidy up comment for h_include()

Copy the comment from fdt_first_region() so that it is clear what value
this function returns.

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agofdtgrep: Correct references to fdt_find_regions()
Simon Glass [Sun, 17 Dec 2023 16:36:17 +0000 (09:36 -0700)]
fdtgrep: Correct references to fdt_find_regions()

The function name is actually fdtgrep_find_regions() so update the name
in comments accordinging.

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agofdtgrep: Correct ordering of flags
Simon Glass [Sun, 17 Dec 2023 16:36:16 +0000 (09:36 -0700)]
fdtgrep: Correct ordering of flags

Two of the flags are out of order, so fix this.

Also adjust the ordering of one flag in the main switch()

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agofdtgrep: Tidy up a few type warnings and comments
Simon Glass [Sun, 17 Dec 2023 16:36:15 +0000 (09:36 -0700)]
fdtgrep: Tidy up a few type warnings and comments

Align the code with the upstream version at fdt-tools which had a few
tweaks before being applied.

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agox86: coral: Align bootph SPI-flash subnodes with parent
Simon Glass [Sun, 17 Dec 2023 16:36:14 +0000 (09:36 -0700)]
x86: coral: Align bootph SPI-flash subnodes with parent

The subnode has different tags from the parents, which is not correct.
Fix the subnode.

Signed-off-by: Simon Glass <sjg@chromium.org>
11 months agobinman: used-before-assignment in ftest.py
Heinrich Schuchardt [Fri, 15 Dec 2023 23:26:04 +0000 (00:26 +0100)]
binman: used-before-assignment in ftest.py

Pytest 7.4.3 complains if a variable is used in a finally clause without
having been initialized before the try clause.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
11 months agobuildman: type cotaining
Heinrich Schuchardt [Fri, 15 Dec 2023 09:42:30 +0000 (10:42 +0100)]
buildman: type cotaining

%s/cotaining/containing/

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
11 months agoMerge patch series "Modernize U-Boot shell"
Tom Rini [Thu, 28 Dec 2023 17:03:25 +0000 (12:03 -0500)]
Merge patch series "Modernize U-Boot shell"

Francis Laniel <francis.laniel@amarulasolutions.com> says:

During 2021 summer, Sean Anderson wrote a contribution to add a new shell, based
on LIL, to U-Boot [1, 2].
While one of the goals of this contribution was to address the fact actual
U-Boot shell, which is based on Busybox hush, is old there was a discussion
about adding a new shell versus updating the actual one [3, 4].

So, in this series, with Harald Seiler, we updated the actual U-Boot shell to
reflect what is currently in Busybox source code.
Basically, this contribution is about taking a snapshot of Busybox shell/hush.c
file (as it exists in commit 37460f5da) and adapt it to suit U-Boot needs.

This contribution was written to be as backward-compatible as possible to avoid
breaking the existing.
So, the modern hush flavor offers the same as the actual, that is to say:
1. Variable expansion.
2. Instruction lists (;, && and ||).
3. If, then and else.
4. Loops (for, while and until).
No new features offered by Busybox hush were implemented (e.g. functions).

It is possible to change the parser at runtime using the "cli" command:
=> cli print
old
=> cli set modern
=> cli print
modern
=> cli set old
The default parser is the old one.
Note that to use both parser, you would need to set both
CONFIG_HUSH_MODERN_PARSER and CONFIG_HUSH_OLD_PARSER.

In terms of testing, new unit tests were added to ut to ensure the new behavior
is the same as the old one and it does not add regression.
Nonetheless, if old behavior was buggy and fixed upstream, the fix is then added
to U-Boot [5].
In sandbox, all of these tests pass smoothly:
=> printenv board
board=sandbox
=> ut hush
Running 20 hush tests
...
Failures: 0
=> cli set modern
=> ut hush
Running 20 hush tests
...
Failures: 0

Thanks to the effort of Harald Seiler, I was successful booting a board:
=> printenv fdtfile
fdtfile=amlogic/meson-gxl-s905x-libretech-cc.dtb
=> cli get
old
=> boot
...
root@lepotato:~#
root@lepotato:~# reboot
...
=> cli set modern
=> cli get
modern
=> printenv fdtfile
fdtfile=amlogic/meson-gxl-s905x-libretech-cc.dtb
=> boot
...
root@lepotato:~#

This contribution indeed adds a lot of code and there were concern about its
size [6, 7].
With regard to the amount of code added, the cli_hush_upstream.c is 13030 lines
long but it seems a smaller subset is really used:
gcc -D__U_BOOT__ -E common/cli_hush_upstream.c | wc -l
2870
Despite this, it is better to still have the whole upstream code for the sake of
easing maintenance.
With regard to memory size, I conducted some experiments for version 8 of this
series and for a subset of arm64 boards and found the worst case to be 4K [8].
Tom Rini conducted more research on this and also found the increase to be
acceptable [9].

If you want to review it - your review will really be appreciated - here are
some information regarding the commits:
* commits marked as "test:" deal with unit tests.
* commit "cli: Add Busybox upstream hush.c file." copies Busybox shell/hush.c
into U-Boot tree, this explain why this commit contains around 12000 additions.
* commit "cli: Port Busybox 2021 hush to U-Boot." modifies previously added file
to permit us to use this as new shell.
The really good idea of #include'ing Busybox code into a wrapper file to define
some particular functions while minimizing modifications to upstream code comes
from Harald Seiler.
* commit "cmd: Add new parser command" adds a new command which permits
selecting parser at runtime.
I am not really satisfied with the fact it calls cli_init() and cli_loop() each
time the parser is set, so your reviews would be welcomed.
* Other commits focus on enabling features we need (e.g. if).

11 months agoconfigs: Use old hush for several boards
Francis Laniel [Fri, 22 Dec 2023 21:02:44 +0000 (22:02 +0100)]
configs: Use old hush for several boards

The keymile board family is not compatible with modern hush parser.
Indeed, This boards used set_local_var() to store some variables as local shell.
They then used get_local_var() to retrieve the variables values.
Sadly, this two functions do not exist with CONFIG_HUSH_MODERN_PARSER.
A patch was proposed to use environment variables rather than local variables
but it does not tackle the problem, so complementary work is needed to make
this boards use CONFIG_HUSH_MODERN_PARSER.

Also, with CONFIG_HUSH_MODERN_PARSER, kirkwoord sheevaplug and phytec bk4r1 hit
their board limits, so better to stick with old hush.

Cc: Holger Brunck <holger.brunck@hitachienergy.com>
Link: https://marc.info/?l=u-boot&m=165541917618725&w=2
Signed-off-by: Francis Laniel <francis.laniel@amarulasolutions.com>
11 months agocmd: Set modern hush as default shell
Francis Laniel [Fri, 22 Dec 2023 21:02:43 +0000 (22:02 +0100)]
cmd: Set modern hush as default shell

Signed-off-by: Francis Laniel <francis.laniel@amarulasolutions.com>
11 months agocli: modern_hush: Add upstream commits up to 2nd October 2023.
Francis Laniel [Fri, 22 Dec 2023 21:02:42 +0000 (22:02 +0100)]
cli: modern_hush: Add upstream commits up to 2nd October 2023.

This commit adds the following hush busybox upstream commits:
791b222dd55d ("sleep: fix "sleep -- ARGS"")
5353df91cba7 ("Update applet size estimates")
e41e481fd571 ("hush: fix a compile failure")
07a95cfcabb0 ("ash: disable check for "good" function name, bash does not check this")
e5692e2342c6 ("hush: quote values in "readonly" output")
96769486e20f ("shell: move varcmp() to shell_common.h and use it in hush")
bab8828b0dad ("hush: fix expansion of space in "a=${a:+$a }c" construct")
b5be8da350b5 ("hush: make "false" built-in")
6824298ab4d3 ("hush: fix ELIF cmd1;cmd2 THEN ... not executing cmd2, closes 15571")
3a7f00eadcf4 ("hush: add comment about abort on syntax error %{^}")
acae889dd972 ("ash,hush: tab completion of functions and aliases")
90b607d79a13 ("hush: quote variable values printed by "set" (match ash behavior)")
6748e6494c22 ("hush (NOMMU): fix LINENO in execed children")
fd5fb2d2b596 ("hush: speed up "big heredoc" code")
1409432d072e ("hush: add TODO comment")
93ae7464e6e4 ("hush: restore SIGHUP handling, this time explain why we do what we do")
1fdb33bd07e5 ("hush: restore tty pgrp on SIGHUP")
6101b6d3eaa0 ("hush: remove special handling of SIGHUP")
93e0898c663a ("shell: fix SIGWINCH and SIGCHLD (in hush) interrupting line input, closes 15256")
969e00816835 ("hush: code shrink")
27be0e8cfeb6 ("shell: fix compile failures in some configs")
7d1c7d833785 ("ash,hush: use HOME for tab completion and prompts")
21afddefd258 ("hush: fix "error: invalid preprocessing directive ##"")
e53c7dbafc78 ("hush: fix set -n to act immediately, not just after run_list()")
574b9c446da1 ("hush: fix var_LINENO3.tests failure")
49bcf9f40cff ("hush: speed up ${x//\*/|} too")
53b2fdcdba4c ("*: add NOINLINEs where code noticeably shrinks")
7c3e96d4b3d4 ("shell: use more compact SHELL_ASH / HUSH config defines. no code changes")
62f1eed1e191 ("hush: in a comment, document what -i might be doing")
aaf3d5ba74c5 ("shell: tweak --help")
db5546ca1018 ("libbb: code shrink: introduce and use [_]exit_SUCCESS()")
931c55f9e2b4 ("libbb: invert the meaning of SETUP_ENV_NO_CHDIR -> SETUP_ENV_CHDIR")
12566e7f9b5e ("ash,hush: fix handling of SIGINT while waiting for interactive input")
987be932ed3c ("*: slap on a few ALIGN_PTR where appropriate")

Signed-off-by: Francis Laniel <francis.laniel@amarulasolutions.com>
11 months agotest: hush: Fix loop tests for modern hush
Francis Laniel [Fri, 22 Dec 2023 21:02:41 +0000 (22:02 +0100)]
test: hush: Fix loop tests for modern hush

Modifies return code got from while loop as modern hush always returns 0 from
while loop.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Francis Laniel <francis.laniel@amarulasolutions.com>
11 months agocli: hush_modern: Enable loops
Francis Laniel [Fri, 22 Dec 2023 21:02:40 +0000 (22:02 +0100)]
cli: hush_modern: Enable loops

Enables the use of for, while and until loops for command line as
well as with run_command().

Signed-off-by: Francis Laniel <francis.laniel@amarulasolutions.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
11 months agocli: hush_modern: Enable if keyword
Francis Laniel [Fri, 22 Dec 2023 21:02:39 +0000 (22:02 +0100)]
cli: hush_modern: Enable if keyword

Adds support for "if then else" construct both for command line interface and
through run_command().

Signed-off-by: Francis Laniel <francis.laniel@amarulasolutions.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
11 months agocli: hush_modern: Enable using < and > as string compare operators
Francis Laniel [Fri, 22 Dec 2023 21:02:38 +0000 (22:02 +0100)]
cli: hush_modern: Enable using < and > as string compare operators

In Busybox hush, '<' and '>' are used as redirection operators.
For example, cat foo > bar will write content of file foo inside file bar.
In U-Boot, we do not have file system, so we can hardly redirect command output
inside a file.

But, in actual U-Boot hush, these operators ('<' and '>') are used as string
compare operators.
For example, test aaa < bbb returns 0 as aaa is before bbb in the dictionary.
Busybox hush also permits this, but operators need to be escaped ('\<' and
'\>').
Indeed, if escaping is needed it permits the developer to think about its code,
as in a lot of case, we want to compare integers (using '-lt' or '-gt') rather
than strings.

As testing in U-Boot is handled by the test command, we will stick with the
original behaviour and not adapt to Busybox one.

Nonetheless, if one day we decide to implement test with '[[ ]]', we will then
stick to upstream Busybox behavior.

Signed-off-by: Francis Laniel <francis.laniel@amarulasolutions.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
11 months agotest: hush: Fix variable expansion tests for modern hush
Francis Laniel [Fri, 22 Dec 2023 21:02:37 +0000 (22:02 +0100)]
test: hush: Fix variable expansion tests for modern hush

Modifies the expected result for modern hush.
Indeed, there were bugs in actual U-Boot hush which were fixed in upstream
Busybox.
As modern hush is based on upstream Busybox, these bugs no longer exist.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Francis Laniel <francis.laniel@amarulasolutions.com>
11 months agotest: hush: Fix instructions list tests for modern hush
Francis Laniel [Fri, 22 Dec 2023 21:02:36 +0000 (22:02 +0100)]
test: hush: Fix instructions list tests for modern hush

Modifies the expected result for modern hush.
Indeed, there were bugs in actual U-Boot hush which were fixed in upstream
Busybox.
As modern hush is based on upstream Busybox, these bugs no longer exist.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Francis Laniel <francis.laniel@amarulasolutions.com>
11 months agocli: add modern hush as parser for run_command*()
Francis Laniel [Fri, 22 Dec 2023 21:02:35 +0000 (22:02 +0100)]
cli: add modern hush as parser for run_command*()

Enables using, in code, modern hush as parser for run_command function family.
It also enables the command run to be used by CLI user of modern hush.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Francis Laniel <francis.laniel@amarulasolutions.com>
11 months agocli: hush_modern: Add functions to be called from run_command()
Francis Laniel [Fri, 22 Dec 2023 21:02:34 +0000 (22:02 +0100)]
cli: hush_modern: Add functions to be called from run_command()

run_command() is called internally by the command run and it can also be called
directly from U-Boot code, e.g. to do unit tests.
This commit adds this path to go to modern hush.

Signed-off-by: Francis Laniel <francis.laniel@amarulasolutions.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
11 months agocli: hush_modern: Enable variables expansion for modern hush
Francis Laniel [Fri, 22 Dec 2023 21:02:33 +0000 (22:02 +0100)]
cli: hush_modern: Enable variables expansion for modern hush

Enables variables expansion for modern hush, both for local and environment
variables.
So the following commands:
foo=bar
echo $foo
setenv bar foo
echo $bar
leads to "bar" and "foo" being printed on console output.

Signed-off-by: Francis Laniel <francis.laniel@amarulasolutions.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
11 months agocli: Enables using modern hush parser as command line parser
Francis Laniel [Fri, 22 Dec 2023 21:02:32 +0000 (22:02 +0100)]
cli: Enables using modern hush parser as command line parser

If one defines HUSH_MODERN_PARSER, it is then possible to use modern parser with:
=> cli get
old
=> cli set modern
=> cli get
modern

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Francis Laniel <francis.laniel@amarulasolutions.com>
11 months agocmd: Add new cli command
Francis Laniel [Fri, 22 Dec 2023 21:02:31 +0000 (22:02 +0100)]
cmd: Add new cli command

This command can be used to print the current parser with 'cli get'.
It can also be used to set the current parser with 'cli set'.
For the moment, only one value is valid for set: old.

Signed-off-by: Francis Laniel <francis.laniel@amarulasolutions.com>
11 months agoglobal_data.h: add GD_FLG_HUSH_OLD_PARSER flag
Francis Laniel [Fri, 22 Dec 2023 21:02:30 +0000 (22:02 +0100)]
global_data.h: add GD_FLG_HUSH_OLD_PARSER flag

This flag is used to indicate we are using the hush parser.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Francis Laniel <francis.laniel@amarulasolutions.com>
11 months agocli: Add menu for hush parser
Francis Laniel [Fri, 22 Dec 2023 21:02:29 +0000 (22:02 +0100)]
cli: Add menu for hush parser

For the moment, the menu contains only entry: HUSH_OLD_PARSER which is the
default.
The goal is to prepare the field to add a new hush parser which guarantees
actual behavior is still correct.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Francis Laniel <francis.laniel@amarulasolutions.com>
11 months agocli: Port upstream Busybox hush to U-Boot
Francis Laniel [Fri, 22 Dec 2023 21:02:28 +0000 (22:02 +0100)]
cli: Port upstream Busybox hush to U-Boot

Adds new file cli_hush_upstream.c, it is a copy of Busybox hush file as it was of
time to commit 37460f5da.
This commit modifies Busybox hush to not compile some part specific to Busybox
and adds some code needed by U-Boot.
The modifications consists mainly on adding code #if(n)def guards.

For the moment, this refurbished flavor of hush only permits running command
without any keywords (i.e., if and for are not recognized) or variable expansion
(i.e., echo $foo prints foo and not value stored in variable foo).

A new file was also added to define some functions specific to U-Boot.

Signed-off-by: Francis Laniel <francis.laniel@amarulasolutions.com>
Signed-off-by: Harald Seiler <hws@denx.de>
11 months agocli: Add Busybox upstream hush.c file
Francis Laniel [Fri, 22 Dec 2023 21:02:27 +0000 (22:02 +0100)]
cli: Add Busybox upstream hush.c file

This commit adds new file cli_hush_upstream.c, it is a copy of Busybox hush
file it was of time to Busybox commit 37460f5da.

Signed-off-by: Francis Laniel <francis.laniel@amarulasolutions.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
11 months agotest: hush: Test hush loops
Francis Laniel [Fri, 22 Dec 2023 21:02:26 +0000 (22:02 +0100)]
test: hush: Test hush loops

The added tests verifies correct behavior of for, while and until loops.

Signed-off-by: Francis Laniel <francis.laniel@amarulasolutions.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
11 months agotest: hush: Test hush commands list
Francis Laniel [Fri, 22 Dec 2023 21:02:25 +0000 (22:02 +0100)]
test: hush: Test hush commands list

Verifies behavior of commands separated by ';', '&&' and '||'.

Signed-off-by: Francis Laniel <francis.laniel@amarulasolutions.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
11 months agotest: hush: Test hush variable expansion
Francis Laniel [Fri, 22 Dec 2023 21:02:24 +0000 (22:02 +0100)]
test: hush: Test hush variable expansion

Verifies shell variables are replaced by their values.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Francis Laniel <francis.laniel@amarulasolutions.com>
11 months agotest/py: hush_if_test: Remove the test file
Francis Laniel [Fri, 22 Dec 2023 21:02:23 +0000 (22:02 +0100)]
test/py: hush_if_test: Remove the test file

5804ebfeb1ce ("test: hush: Test hush if/else") translated this test to a C test,
so this python file is no more needed.

Signed-off-by: Francis Laniel <francis.laniel@amarulasolutions.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
11 months agotest: hush: Test hush if/else
Francis Laniel [Fri, 22 Dec 2023 21:02:22 +0000 (22:02 +0100)]
test: hush: Test hush if/else

As asked in commit 9c6bf1715f6a ("test/py: hush_if_test: Add tests to cover
octal/hex values"), this commit translates test_hush_if_test.py to a C test.

Signed-off-by: Francis Laniel <francis.laniel@amarulasolutions.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
11 months agotest: Add framework to test hush behavior
Francis Laniel [Fri, 22 Dec 2023 21:02:21 +0000 (22:02 +0100)]
test: Add framework to test hush behavior

Introduce a new subcommand to ut: ut hush.
For the moment, this command does nothing, future commits will add tests which
will be run on command call.

Note that CONFIG_HUSH_PARSER must be defined to compile this new subcommand.

Signed-off-by: Francis Laniel <francis.laniel@amarulasolutions.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
11 months agoMerge branch 'next' of https://source.denx.de/u-boot/custodians/u-boot-riscv into...
Tom Rini [Thu, 28 Dec 2023 12:54:54 +0000 (07:54 -0500)]
Merge branch 'next' of https://source.denx.de/u-boot/custodians/u-boot-riscv into next

- Andes: Enable Andes CPU memboost and ECC feature by default
- Sifive: Add private L2 cache driver

11 months agoandes: ae350: Enable MISC_INIT_R for ae350 platform
Leo Yu-Chi Liang [Tue, 26 Dec 2023 06:54:41 +0000 (14:54 +0800)]
andes: ae350: Enable MISC_INIT_R for ae350 platform

Enable MISC_INIT_R for ae350 to support CPU name detection
and re-sync the configs via make savedefconfig.

Signed-off-by: Leo Yu-Chi Liang <ycliang@andestech.com>
Reviewed-by: Yu Chien Peter Lin <peterlin@andestech.com>
11 months agoandes: ae350: Save cpu name to env
Leo Yu-Chi Liang [Tue, 26 Dec 2023 06:54:27 +0000 (14:54 +0800)]
andes: ae350: Save cpu name to env

Detect CPU name through marchid and then save it to env.

Signed-off-by: Leo Yu-Chi Liang <ycliang@andestech.com>
Reviewed-by: Yu Chien Peter Lin <peterlin@andestech.com>