]> git.dujemihanovic.xyz Git - u-boot.git/log
u-boot.git
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>
11 months agoandes: cpu: Enable cache and TLB ECC support
Leo Yu-Chi Liang [Tue, 26 Dec 2023 06:17:35 +0000 (14:17 +0800)]
andes: cpu: Enable cache and TLB ECC support

Andes CPU supports cache and TLB ECC.
Enable them by default.

Signed-off-by: Leo Yu-Chi Liang <ycliang@andestech.com>
Reviewed-by: Yu Chien Peter Lin <peterlin@andestech.com>
11 months agoandes: cpu: Enable memboost feature
Leo Yu-Chi Liang [Tue, 26 Dec 2023 06:17:34 +0000 (14:17 +0800)]
andes: cpu: Enable memboost feature

Andes CPU has memboost feature including prefetch,
write-around and non-blocking load. Enable them by default.

Signed-off-by: Leo Yu-Chi Liang <ycliang@andestech.com>
Reviewed-by: Yu Chien Peter Lin <peterlin@andestech.com>
11 months agoandes: ae350: Implement cache switch via Kconfig
Leo Yu-Chi Liang [Tue, 26 Dec 2023 06:17:33 +0000 (14:17 +0800)]
andes: ae350: Implement cache switch via Kconfig

Kconfig provides SYS_[I|D]CACHE_OFF config options to switch off caches.
Provide the corresponding implementation to the options.

Signed-off-by: Leo Yu-Chi Liang <ycliang@andestech.com>
Reviewed-by: Yu Chien Peter Lin <peterlin@andestech.com>
11 months agoandes: csr.h: Clean up CSR definition
Leo Yu-Chi Liang [Tue, 26 Dec 2023 06:17:32 +0000 (14:17 +0800)]
andes: csr.h: Clean up CSR definition

Signed-off-by: Leo Yu-Chi Liang <ycliang@andestech.com>
Reviewed-by: Yu Chien Peter Lin <peterlin@andestech.com>
11 months agoriscv: Extend board compatible string with "qemu,mbv"
Michal Simek [Wed, 20 Dec 2023 14:53:28 +0000 (15:53 +0100)]
riscv: Extend board compatible string with "qemu,mbv"

Extend compatible string to match the latest change in dt binding.

Fixes: 7576ab2facae ("riscv: Add support for AMD/Xilinx MicroBlaze V")
Signed-off-by: Michal Simek <michal.simek@amd.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
11 months agoriscv: cache: support cache enable in SPL stage
Zong Li [Thu, 14 Dec 2023 14:09:37 +0000 (14:09 +0000)]
riscv: cache: support cache enable in SPL stage

The power gating feature of pl2 should be enabled as early as possible,
it would be better to put it in SPL stage.

Signed-off-by: Zong Li <zong.li@sifive.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
11 months agocache: add sifive private L2 cache driver
Zong Li [Thu, 14 Dec 2023 14:09:36 +0000 (14:09 +0000)]
cache: add sifive private L2 cache driver

This driver is currently responsible for enabling the clock gating
feature of SiFive pre core's private L2 cache.

Signed-off-by: Zong Li <zong.li@sifive.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
12 months agobootmeth: pass size to efi_binary_run()
Heinrich Schuchardt [Fri, 22 Dec 2023 15:01:56 +0000 (16:01 +0100)]
bootmeth: pass size to efi_binary_run()

If we call efi_binary_run() with size parameter set to zero, we get an error

     Not a PE-COFF file

Fill the missing value.

Fixes: 1373ffde52e1 ("Merge tag 'v2024.01-rc5' into next")
Fixes: 7017fc54a5bc ("bootmeth: use efi_loader interfaces instead of bootefi command")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
12 months agoMerge patch series "Complete decoupling of bootm logic from commands"
Tom Rini [Thu, 21 Dec 2023 21:10:00 +0000 (16:10 -0500)]
Merge patch series "Complete decoupling of bootm logic from commands"

Simon Glass <sjg@chromium.org> says:

This series continues refactoring the bootm code to allow it to be used
with CONFIG_COMMAND disabled. The OS-handling code is refactored and
a new bootm_run() function is created to run through the bootm stages.
This completes the work.

A booti_go() function is created also, in case it proves useful, but at
last for now standard boot does not use this.

This is cmdd (part d of CMDLINE refactoring)
It depends on dm/bootstda-working
which depends on dm/cmdc-working

12 months agobootm: Create a new boot_run() function to handle booting
Simon Glass [Sat, 16 Dec 2023 03:14:26 +0000 (20:14 -0700)]
bootm: Create a new boot_run() function to handle booting

Create a common function used by the three existing bootz/i/m_run()
functions, to reduce duplicated code.

Signed-off-by: Simon Glass <sjg@chromium.org>
Suggested-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
12 months agobootm: Create a function to run through the booti states
Simon Glass [Sat, 16 Dec 2023 03:14:25 +0000 (20:14 -0700)]
bootm: Create a function to run through the booti states

In a few places, the booti command is used to handle a boot. We want
these to be done without needing CONFIG_CMDLINE, so add a new
booti_run() function to handle this.

So far this is not used.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
12 months agostm32: Use bootm_run() and bootz_run()
Simon Glass [Sat, 16 Dec 2023 03:14:24 +0000 (20:14 -0700)]
stm32: Use bootm_run() and bootz_run()

Use the new bootm/z_run() functions to avoid having to create an
argument list for the stm32prog code.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
12 months agobootm: Create a function to run through the bootz states
Simon Glass [Sat, 16 Dec 2023 03:14:23 +0000 (20:14 -0700)]
bootm: Create a function to run through the bootz states

In a few places, the bootz command is used to handle a boot. We want
these to be done without needing CONFIG_CMDLINE, so add a new
bootz_run() function to handle this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
12 months agostm32: Use local vars in stm32prog for initrd and fdt
Simon Glass [Sat, 16 Dec 2023 03:14:22 +0000 (20:14 -0700)]
stm32: Use local vars in stm32prog for initrd and fdt

Rather than assigning to the bootm_argv[] array multiple times, use
local variables for the two things that can change and assign them at
the end.

This makes it easier to drop the array eventually.

Tidu up an overly short line while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
12 months agobootm: Create a function to run through the bootm states
Simon Glass [Sat, 16 Dec 2023 03:14:21 +0000 (20:14 -0700)]
bootm: Create a function to run through the bootm states

In quite a few places, the bootm command is used to handle a boot. We
want these to be done without needing CONFIG_CMDLINE, so add a new
bootm_run() function to handle this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
12 months agobootm: Tidy up boot_selected_os()
Simon Glass [Sat, 16 Dec 2023 03:14:20 +0000 (20:14 -0700)]
bootm: Tidy up boot_selected_os()

Use struct bootm_info with this function, to avoiding needing to
create a new one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
12 months agobootm: Rename do_bootm_states() to bootm_run_states()
Simon Glass [Sat, 16 Dec 2023 03:14:19 +0000 (20:14 -0700)]
bootm: Rename do_bootm_states() to bootm_run_states()

Rename the function to bootm_run_states() to better indicate ts
purpose. The 'do_' prefix is used to indicate a command processor,
which this is now not.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
12 months agobootm: Drop arguments from do_bootm_states()
Simon Glass [Sat, 16 Dec 2023 03:14:18 +0000 (20:14 -0700)]
bootm: Drop arguments from do_bootm_states()

Use the bootm_info struct to hold the information required by bootm.

Now that none of the functions called from do_bootm_states() needs an
argv[] list, change the arguments of do_bootm_states() as well. Take
care to use the same value for boot_progress even though it is a little
inconsistent.

For booti make sure it only uses argv[] and argc at the top of the
function, so we can eventually refactor to remove these parameters.

With bootm, some OSes need access to the arguments provided to the
command, so set these up in the bootm_info struct, for bootm only.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
12 months agobootz: Avoid use of #ifdef
Simon Glass [Sat, 16 Dec 2023 03:14:17 +0000 (20:14 -0700)]
bootz: Avoid use of #ifdef

Use the compiler to get the set of states, instead of the preprocessor.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
12 months agobooti: Avoid use of #ifdef
Simon Glass [Sat, 16 Dec 2023 03:14:16 +0000 (20:14 -0700)]
booti: Avoid use of #ifdef

Use the compiler to get the set of states, instead of the preprocessor.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
12 months agobootm: Move do_bootm_states() comment to header file
Simon Glass [Sat, 16 Dec 2023 03:14:15 +0000 (20:14 -0700)]
bootm: Move do_bootm_states() comment to header file

This is an exported function, so move the function comment to the
bootm.h header file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
12 months agobootm: Add more fields to bootm_info
Simon Glass [Sat, 16 Dec 2023 03:14:14 +0000 (20:14 -0700)]
bootm: Add more fields to bootm_info

Add fields for the three bootm parameters and other things needed for
booting. Also add a helper to set up the struct correctly.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
12 months agobootm: Adjust arguments of boot_os_fn
Simon Glass [Sat, 16 Dec 2023 03:14:13 +0000 (20:14 -0700)]
bootm: Adjust arguments of boot_os_fn

Adjust boot_os_fn to use struct bootm_info instead of the separate
argc, argv and image parameters. Update the handlers accordingly. Few
of the functions make use of the arguments, so this improves code size
slightly.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
12 months agobootm: Create a struct for argument information
Simon Glass [Sat, 16 Dec 2023 03:14:12 +0000 (20:14 -0700)]
bootm: Create a struct for argument information

Some OS functions require the arguments to the 'bootm' command. This is
inconvenient for two reasons.

Firstly, there may not be any actual command, if CMDLINE is not enabled
and programmatic boot is being used.

Secondly, most functions don't require the arguments, so it is
inefficient to pass them when not needed. For example it increases code
size.

Create a new struct which holds the arguments, which can be used if
needed.

Add the images pointer as well, since this is commonly needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
12 months agosandbox: bootm: Enable more bootm OS methods
Simon Glass [Sat, 16 Dec 2023 03:14:11 +0000 (20:14 -0700)]
sandbox: bootm: Enable more bootm OS methods

It is useful for sandbox to build as much code as possible. Enable
support for booting various other operating systems. Add the missing
cache functions.

These operating systems do not actually boot on sandbox, of course.

Signed-off-by: Simon Glass <sjg@chromium.org>
12 months agobootm: Adjust how the board is reset
Simon Glass [Sat, 16 Dec 2023 03:14:10 +0000 (20:14 -0700)]
bootm: Adjust how the board is reset

Use reset_cpu() to reset the board, copying the logic from the 'reset'
command. This makes more sense than directly calling the do_reset()
function with the arguments passsed to the bootm command.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
12 months agoriscv: Add a reset_cpu() function
Simon Glass [Sat, 16 Dec 2023 03:14:09 +0000 (20:14 -0700)]
riscv: Add a reset_cpu() function

The current do_reset() is called from a command context. Add a function
which can be used from anywhere, as is done on ARM. Adjust do_reset()
to call it.

Note that reset_cpu() is normally provided by SYSRESET so make this
declaration conditional on that being disabled.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Chanho Park <chanho61.park@samsung.com>
Tested-by: Chanho Park <chanho61.park@samsung.com>
12 months agonios2: Add a reset_cpu() function
Simon Glass [Sat, 16 Dec 2023 03:14:08 +0000 (20:14 -0700)]
nios2: Add a reset_cpu() function

The current do_reset() is called from a command context. Add a function
which can be used from anywhere, as is done on ARM.

Signed-off-by: Simon Glass <sjg@chromium.org>
12 months agoppc: Add a reset_cpu() function
Simon Glass [Sat, 16 Dec 2023 03:14:07 +0000 (20:14 -0700)]
ppc: Add a reset_cpu() function

The current do_reset() is called from a command context. Add a function
which can be used from anywhere, as is done on ARM.

This is only needed if CONFIG_SYSRESET is disabled.

Since there are lots of reset functions, this one actually just calls
do_reset(). Future refactoring could correct this.

Signed-off-by: Simon Glass <sjg@chromium.org>
12 months agom68k: Add a reset_cpu() function
Simon Glass [Sat, 16 Dec 2023 03:14:06 +0000 (20:14 -0700)]
m68k: Add a reset_cpu() function

The current do_reset() is called from a command context. Add a function
which can be used from anywhere, as is done on ARM.

Since there are lots of reset functions, this one actually just calls
do_reset(). Future refactoring could correct this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Angelo Dureghello <angelo@kernel-spcece.org>
12 months agomips: Add a reset_cpu() function
Simon Glass [Sat, 16 Dec 2023 03:14:05 +0000 (20:14 -0700)]
mips: Add a reset_cpu() function

The current do_reset() is called from a command context. Add a function
which can be used from anywhere, as is done on ARM.

Signed-off-by: Simon Glass <sjg@chromium.org>
12 months agoMerge branch '2023-12-21-assorted-updates-and-fixes' into next
Tom Rini [Thu, 21 Dec 2023 20:35:03 +0000 (15:35 -0500)]
Merge branch '2023-12-21-assorted-updates-and-fixes' into next

- A few board fixes along with IOMMU enhancements and general fixes

12 months agolib: rsa: Print detailed error info in rsa_engine_init() on engine resolution failure
Csókás Bence [Thu, 14 Dec 2023 16:54:17 +0000 (17:54 +0100)]
lib: rsa: Print detailed error info in rsa_engine_init() on engine resolution failure

Signed-off-by: Csókás Bence <csokas.bence@prolan.hu>
Reviewed-by: Tom Rini <trini@konsulko.com>
12 months agoboard/keymile/kmcent2: fix update-nor indentation
Tomas Alvarez Vanoli [Tue, 12 Dec 2023 14:39:27 +0000 (15:39 +0100)]
board/keymile/kmcent2: fix update-nor indentation

variable was indented as part of the value of the previous variable.

Signed-off-by: Tomas Alvarez Vanoli <tomas.alvarez-vanoli@hitachienergy.com>
Signed-off-by: Holger Brunck <holger.brunck@hitachienergy.com>
12 months agoiommu: add qcom-hyp-smmu
Caleb Connolly [Mon, 11 Dec 2023 18:41:42 +0000 (18:41 +0000)]
iommu: add qcom-hyp-smmu

Add a basic implementation of the ARM SMMU. This driver is intended for
use on Qualcomm platforms where the SMMU has been configured by a previous
bootloader, cannot be turned off, and doesn't support BYPASS streams.
It keeps all existing stream mappings and only creates new ones for stream
ids that aren't already configured.

This driver is necessary to support peripherals that perform DMA which
weren't configured by the previous stage bootloader (for example USB).
It works by allocating a context bank using identity mapping (as U-Boot
doesn't use virtual addresses).

Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
12 months agoiommu: add a connect op
Caleb Connolly [Mon, 11 Dec 2023 18:41:41 +0000 (18:41 +0000)]
iommu: add a connect op

Add an optional iommu callback to be invoked before a device probes.
This can be used to configure the IOMMU in preparation for the device
(e.g. by allocating a context bank)

Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
12 months agoiommu: fix compilation when CONFIG_PCI disabled
Caleb Connolly [Mon, 11 Dec 2023 18:41:40 +0000 (18:41 +0000)]
iommu: fix compilation when CONFIG_PCI disabled

The dev_pci_iommu_enable() function is only available when CONFIG_PCI is
enabled, replace the runtime check with a preprocessor one to fix
compilation with pci disabled.

Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
12 months agoconfigs: verdin-am62: Disable SPL FIT Overlay
Francesco Dolcini [Mon, 11 Dec 2023 13:45:20 +0000 (14:45 +0100)]
configs: verdin-am62: Disable SPL FIT Overlay

Disable CONFIG_SPL_LOAD_FIT_APPLY_OVERLAY, this is not required nor used
on verdin am62, disable it to save precious binary size.

Update defconfig using savedefconfig, this adds CONFIG_OF_LIBFDT_OVERLAY
explicitly.

Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
12 months agoboot: add support for fdt_fixup command in environment
Matthias Schiffer [Mon, 11 Dec 2023 11:03:17 +0000 (12:03 +0100)]
boot: add support for fdt_fixup command in environment

The "fdt" command is convenient for making small changes to the OS FDT,
especially during development. This is easy when the kernel and FDT are
loaded separately, but can be cumbersome for FIT images, requiring to
unpack the image, manually apply overlays, etc.

Add an option to execute a command "fdt_fixup" from the environment at
the beginning of image_setup_libfdt() (after overlays are applied, and
before the other fixups).

Signed-off-by: Matthias Schiffer <matthias.schiffer@ew.tq-group.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
12 months agoinclude: env: ti: ti_common: Run main_cpsw0_qsgmii_phyinit conditionally
Manorit Chawdhry [Mon, 11 Dec 2023 10:42:09 +0000 (16:12 +0530)]
include: env: ti: ti_common: Run main_cpsw0_qsgmii_phyinit conditionally

The main_cpsw0_qsgmii_phyinit command is defined only for certain TI
SoCs which have the do_main_cpsw0_qsgmii_phyinit variable set.

Add a check to ensure that the main_cpsw0_qsgmii_phyinit command is run
only for such SoCs.

Signed-off-by: Manorit Chawdhry <m-chawdhry@ti.com>
Signed-off-by: Siddharth Vadapalli <s-vadapalli@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
12 months agofs: Fix SPL build if FS_LOADER is enabled
Mayuresh Chitale [Thu, 16 Nov 2023 17:16:12 +0000 (22:46 +0530)]
fs: Fix SPL build if FS_LOADER is enabled

If FS_LOADER is enabled for the SPL then the build fails with the error:

fs/fs.o:(.data.rel.fstypes+0x128):
undefined reference to `smh_fs_set_blk_dev'
fs/fs.o:(.data.rel.fstypes+0x140):
undefined reference to `smh_fs_size'
fs/fs.o:(.data.rel.fstypes+0x148):
undefined reference to `smh_fs_read'
fs/fs.o:(.data.rel.fstypes+0x150):
undefined reference to `smh_fs_write'

Fix the error by populating the semihosting entry in the fs_types array
only for non-SPL builds.

Signed-off-by: Mayuresh Chitale <mchitale@ventanamicro.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Sean Anderson <seanga2@gmail.com>
12 months agoMerge branch '2023-12-21-header-inclusion-cleanup' into next
Tom Rini [Thu, 21 Dec 2023 16:51:58 +0000 (11:51 -0500)]
Merge branch '2023-12-21-header-inclusion-cleanup' into next

- Merge in changes to clean up various places that used <common.h> or
  <linux/kconfig.h>

12 months agolib: Remove <common.h> inclusion from these files
Tom Rini [Thu, 14 Dec 2023 18:16:58 +0000 (13:16 -0500)]
lib: Remove <common.h> inclusion from these files

After some header file cleanups to add missing include files, remove
common.h from all files in the lib directory. This primarily means just
dropping the line but in a few cases we need to add in other header
files now.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Rini <trini@konsulko.com>
12 months agoinclude: Further cleanup includes
Tom Rini [Thu, 14 Dec 2023 18:16:57 +0000 (13:16 -0500)]
include: Further cleanup includes

Add some missing headers such as <linux/errno.h> or <linux/types.h> or
<linux/kernel.h> to header files that make direct usage of things
provided by these headers.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Rini <trini@konsulko.com>
12 months agodisplay_options: Clean up headers
Tom Rini [Thu, 14 Dec 2023 18:16:56 +0000 (13:16 -0500)]
display_options: Clean up headers

In include/display_options.h we cannot include ourself, but do need
<linux/types.h> directly. Then in lib/display_options.c we further clean
the list to remove common.h.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Rini <trini@konsulko.com>
12 months agoefi_loader: Remove <common.h>
Tom Rini [Thu, 14 Dec 2023 18:16:55 +0000 (13:16 -0500)]
efi_loader: Remove <common.h>

We largely do not need <common.h> in these files, so drop it. The only
exception here is that efi_freestanding.c needs <linux/types.h> and had
been getting that via <common.h>.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Rini <trini@konsulko.com>
12 months agormobile: Add <mach/rmobile.h> to cpu_info-rzg2l.c
Tom Rini [Thu, 14 Dec 2023 18:16:54 +0000 (13:16 -0500)]
rmobile: Add <mach/rmobile.h> to cpu_info-rzg2l.c

In order for RMOBILE_CPU_TYPE_R9A07G044L to be defined we need to
include <mach/rmobile.h> here.

Reviewed-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Signed-off-by: Tom Rini <trini@konsulko.com>
12 months agolib/sha*.c: Update header list
Tom Rini [Thu, 14 Dec 2023 18:16:53 +0000 (13:16 -0500)]
lib/sha*.c: Update header list

Cleanup the list of headers we include here. For the tools build we only
need to exclude <cyclic.h> as that's used by the target build for the
prototype for schedule(), and we don't need to get that via
<watchdog.h>. We can also make use of our <string.h> intentionally
existing as a redirection to <linux/string.h> to reduce ifdef'd lines.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Rini <trini@konsulko.com>
12 months agoglobal: Rework architecture global_data.h to include <linux/types.h>
Tom Rini [Thu, 14 Dec 2023 18:16:52 +0000 (13:16 -0500)]
global: Rework architecture global_data.h to include <linux/types.h>

In most cases, the architecture global data currently makes use of
assorted linux types, but does not include <linux/types.h> to provide
them. Add <linux/types.h> instead of relying on indirect inclusion.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Rini <trini@konsulko.com>
12 months agom68k: Rework asm/global_data.h slightly
Tom Rini [Thu, 14 Dec 2023 18:16:51 +0000 (13:16 -0500)]
m68k: Rework asm/global_data.h slightly

In the architecture global data, replace the one case of u32 with
unsigned long. Now, we can drop config.h here but then do need to add it
in two m68k-centric spaces.

Acked-by: Angelo Dureghello <angelo@kernel-space.org>
Signed-off-by: Tom Rini <trini@konsulko.com>
12 months agosandbox: Add <linux/types.h> to asm/global_data.h and asm/io.h
Tom Rini [Thu, 14 Dec 2023 18:16:50 +0000 (13:16 -0500)]
sandbox: Add <linux/types.h> to asm/global_data.h and asm/io.h

We need <linux/types.h> in these files as we reference Linux types.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Rini <trini@konsulko.com>
12 months agoarm: Remove <asm/types.h> from asm/global_data.h
Tom Rini [Thu, 14 Dec 2023 18:16:49 +0000 (13:16 -0500)]
arm: Remove <asm/types.h> from asm/global_data.h

We need and include <linux/types.h> and this in turn already includes
<asm/types.h>, so drop it here.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Rini <trini@konsulko.com>
12 months agoglobal: Remove duplicate common.h inclusions
Tom Rini [Thu, 14 Dec 2023 18:16:48 +0000 (13:16 -0500)]
global: Remove duplicate common.h inclusions

These files include <common.h> twice. Start by removing the second
inclusion of the file.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Rini <trini@konsulko.com>
12 months agoglobal: Drop common.h inclusion
Tom Rini [Thu, 14 Dec 2023 18:16:47 +0000 (13:16 -0500)]
global: Drop common.h inclusion

In order to make it easier to move on to dropping common.h from code
directly, remove common.h inclusion from the rest of the header file
which had been including it.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Rini <trini@konsulko.com>
12 months agosandbox: Audit config.h and common.h usage
Tom Rini [Thu, 14 Dec 2023 18:16:46 +0000 (13:16 -0500)]
sandbox: Audit config.h and common.h usage

Remove and replace common.h and config.h in sandbox when it's not needed
and add some explicit includes where needed.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Rini <trini@konsulko.com>
12 months agoarm: Partial cleanup and audit usage of <config.h>
Tom Rini [Thu, 14 Dec 2023 18:16:45 +0000 (13:16 -0500)]
arm: Partial cleanup and audit usage of <config.h>

We need to include <config.h> directly when a file needs to have
something such as CFG_SYS_SDRAM_SIZE referenced as this file is not
automatically globally included and is most commonly indirectly included
via common.h.  Remove most cases of arm including config.h directly, but
add it where needed. This includes a few board-specific fixes.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Rini <trini@konsulko.com>
12 months agoarc: Cleanup and audit usage of <config.h>
Tom Rini [Thu, 14 Dec 2023 18:16:44 +0000 (13:16 -0500)]
arc: Cleanup and audit usage of <config.h>

We need to include <config.h> directly when a file needs to have
something such as CFG_SYS_SDRAM_SIZE referenced as this file is not
automatically globally included and is most commonly indirectly included
via common.h.  Remove most cases of arc including config.h directly, but
add it where needed. Further clean up the tb100 board config.h file so
that we don't rely on config.h being included there for a value used in
a single place.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Rini <trini@konsulko.com>
12 months agoqe: Add <config.h> to linux/immap_qe.h
Tom Rini [Thu, 14 Dec 2023 18:16:43 +0000 (13:16 -0500)]
qe: Add <config.h> to linux/immap_qe.h

Given how we define QE_MURAM_SIZE today, this header needs to have
<config.h> added to it.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Rini <trini@konsulko.com>
12 months agoglobal: Restrict use of '#include <linux/kconfig.h>'
Tom Rini [Thu, 14 Dec 2023 12:16:54 +0000 (07:16 -0500)]
global: Restrict use of '#include <linux/kconfig.h>'

In general terms, we -include include/linux/kconfig.h and so normal
U-Boot code does not need to also #include it. However, for code which
is shared with userspace we may need to add it so that either our full
config is available or so that macros such as CONFIG_IS_ENABLED() can be
evaluated. In this case make sure that we guard these includes with a
test for USE_HOSTCC so that it clear as to why we're doing this.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Rini <trini@konsulko.com>
12 months agoMerge branch '2023-12-20-assorted-general-updates' into next
Tom Rini [Wed, 20 Dec 2023 21:00:22 +0000 (16:00 -0500)]
Merge branch '2023-12-20-assorted-general-updates' into next

- Assorted fixes around the tree

12 months agoMerge tag 'u-boot-imx-next-20231220' of https://gitlab.denx.de/u-boot/custodians...
Tom Rini [Wed, 20 Dec 2023 19:14:46 +0000 (14:14 -0500)]
Merge tag 'u-boot-imx-next-20231220' of https://gitlab.denx.de/u-boot/custodians/u-boot-imx into next

- Put the USB hub out of reset on colibri-imx8x
- Fix VDDx brownout interrupt register of i.MX23/i.MX28
- Fix Phytec imx8m SoM detection
- Add TPM support for gw72xx boards

12 months agocmd: part: Cover both part type entries with GUID ifdef
Marek Vasut [Sun, 10 Dec 2023 21:25:07 +0000 (22:25 +0100)]
cmd: part: Cover both part type entries with GUID ifdef

The 'part type' subcommand depends on GUID partition table support.
The help text exposes one of two 'part type' subcommand entries,
hide both in case GUID partition table support is not enabled to
avoid confusing users.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
12 months agosmbios: Fallback to the default DT if sysinfo nodes are missing
Ilias Apalodimas [Thu, 7 Dec 2023 09:18:50 +0000 (11:18 +0200)]
smbios: Fallback to the default DT if sysinfo nodes are missing

In order to fill in the SMBIOS tables U-Boot currently relies on a
"u-boot,sysinfo-smbios" compatible node.  This is fine for the boards
that already include such nodes.  However with some recent EFI changes,
the majority of boards can boot up distros, which usually rely on
things like dmidecode etc for their reporting.  For boards that
lack this special node the SMBIOS output looks like:

System Information
        Manufacturer: Unknown
        Product Name: Unknown
        Version: Unknown
        Serial Number: Unknown
        UUID: Not Settable
        Wake-up Type: Reserved
        SKU Number: Unknown
        Family: Unknown

This looks problematic since most of the info are "Unknown".  The DT spec
specifies standard properties containing relevant information like
'model' and 'compatible' for which the suggested format is
<manufacturer,model>. Unfortunately the 'model' string found in DTs is
usually lacking the manufacturer so we can't use it for both
'Manufacturer' and 'Product Name' SMBIOS entries reliably.

So let's add a last resort to our current smbios parsing.  If none of
the sysinfo properties are found, scan for those information in the
root node of the device tree. Use the 'model' to fill the 'Product
Name' and the first value of 'compatible' for the 'Manufacturer', since
that always contains one.

pre-patch:
Handle 0x0001, DMI type 1, 27 bytes
System Information
        Manufacturer: Unknown
        Product Name: Unknown
        Version: Unknown
        Serial Number: 100000000bb24ceb
        UUID: 30303031-3030-3030-3061-613234636435
        Wake-up Type: Reserved
        SKU Number: Unknown
        Family: Unknown
[...]

and post patch:
Handle 0x0001, DMI type 1, 27 bytes
System Information
        Manufacturer: raspberrypi
        Product Name: Raspberry Pi 4 Model B Rev 1.1
        Version: Unknown
        Serial Number: 100000000bb24ceb
        UUID: 30303031-3030-3030-3061-613234636435
        Wake-up Type: Reserved
        SKU Number: Unknown
        Family: Unknown
[...]

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Peter Robinson <pbrobinson@gmail.com>
Tested-by: Peter Robinson <pbrobinson@gmail.com>
12 months agosmbios: Simplify reporting of unknown values
Ilias Apalodimas [Thu, 7 Dec 2023 09:18:49 +0000 (11:18 +0200)]
smbios: Simplify reporting of unknown values

If a value is not valid during the DT or SYSINFO parsing,  we explicitly
set that to "Unknown Product" and "Unknown" for the product and
manufacturer respectively.  It's cleaner if we move the checks insisde
smbios_add_prop_si() and provide an alternative string in case the
primary is NULL or empty

pre-patch dmidecode
<snip>
Handle 0x0001, DMI type 1, 27 bytes
System Information
        Manufacturer: Unknown
        Product Name: Unknown Product
        Version: Not Specified
        Serial Number: Not Specified
        UUID: Not Settable
        Wake-up Type: Reserved
        SKU Number: Not Specified
        Family: Not Specified

[...]

post-patch dmidecode:

Handle 0x0001, DMI type 1, 27 bytes
System Information
        Manufacturer: Unknown
        Product Name: Unknown
        Version: Unknown
        Serial Number: Unknown
        UUID: Not Settable
        Wake-up Type: Reserved
        SKU Number: Unknown
        Family: Unknown
[...]

While at it make smbios_add_prop_si() add a string directly if the prop
node is NULL and replace smbios_add_string() calls with
smbios_add_prop_si(ctx, NULL, ....)

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Peter Robinson <pbrobinson@gmail.com>
Tested-by: Peter Robinson <pbrobinson@gmail.com>