platform/kernel/u-boot.git
15 months agoefi: Add dhrystone, dcache and scroll lines to app
Simon Glass [Fri, 10 Mar 2023 20:47:22 +0000 (12:47 -0800)]
efi: Add dhrystone, dcache and scroll lines to app

Add these options to provide some performance measurement, see cache
status and slightly speed up the appallingly slow console.

Signed-off-by: Simon Glass <sjg@chromium.org>
15 months agovideo: Clear the vidconsole rather than the video
Simon Glass [Fri, 10 Mar 2023 20:47:21 +0000 (12:47 -0800)]
video: Clear the vidconsole rather than the video

It is better to clear the console device rather than the video device,
since the console has the text display. We also need to reset the cursor
position with the console, but not with the video device.

Add a new function to handle this and update the 'cls' command to use it.

Signed-off-by: Simon Glass <sjg@chromium.org>
15 months agovideo: Remove duplicate cursor-positioning function
Simon Glass [Fri, 10 Mar 2023 20:47:20 +0000 (12:47 -0800)]
video: Remove duplicate cursor-positioning function

There are two functions for positioning the cursor on the console. Remove
one of them.

Signed-off-by: Simon Glass <sjg@chromium.org>
15 months agoefi: Adjust script to show pre-relocation output on terminal
Simon Glass [Fri, 10 Mar 2023 20:47:19 +0000 (12:47 -0800)]
efi: Adjust script to show pre-relocation output on terminal

When running with video enabled, the pre-relocation output of U-Boot is
currently lost. Add a -serial flag to show it on the terminal.

Signed-off-by: Simon Glass <sjg@chromium.org>
15 months agobbinfo: Show the size of the copy framebuffer
Simon Glass [Fri, 10 Mar 2023 20:47:18 +0000 (12:47 -0800)]
bbinfo: Show the size of the copy framebuffer

If the copy framebuffer is enabled, show its size.

Signed-off-by: Simon Glass <sjg@chromium.org>
15 months agovideo: Allow a copy framebuffer with pre-allocated fb
Simon Glass [Fri, 10 Mar 2023 20:47:17 +0000 (12:47 -0800)]
video: Allow a copy framebuffer with pre-allocated fb

At present it is not possible for the video driver to use a pre-allocated
frame buffer (such as is done with EFI) with the copy framebuffer. This
can be useful to speed up the display.

Adjust the implementation so that copy_size can be set to the required
size, with this being allocated if the normal framebuffer size is 0.

Signed-off-by: Simon Glass <sjg@chromium.org>
15 months agoefi: Support copy framebuffer
Simon Glass [Fri, 10 Mar 2023 20:47:16 +0000 (12:47 -0800)]
efi: Support copy framebuffer

Add support for this to EFI in case it becomes useful. At present it just
slows things down. You can enable CONFIG_VIDEO_COPY to turn it on.

Signed-off-by: Simon Glass <sjg@chromium.org>
15 months agoefi: Use a fixed value for the timer clock
Simon Glass [Fri, 10 Mar 2023 20:47:15 +0000 (12:47 -0800)]
efi: Use a fixed value for the timer clock

It is not yet clear how to read the timer via EFI. The current value seems
much too high on a Framework laptop I tried. Adjust it to a lower
hard-coded value for now.

Signed-off-by: Simon Glass <sjg@chromium.org>
15 months agox86: Add a few more items to bdinfo
Simon Glass [Fri, 10 Mar 2023 20:47:14 +0000 (12:47 -0800)]
x86: Add a few more items to bdinfo

Add the timer and vendor/model information.

Signed-off-by: Simon Glass <sjg@chromium.org>
15 months agoefi: Support a 64-bit frame buffer address
Simon Glass [Fri, 10 Mar 2023 20:47:13 +0000 (12:47 -0800)]
efi: Support a 64-bit frame buffer address

The current vesa structure only provides a 32-bit value for the frame
buffer. Many modern machines use an address outside the range.

It is still useful to have this common struct, but add a separate
frame-buffer address as well.

Add a comment for vesa_setup_video_priv() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
15 months agoefi: video: Return mode info for app also
Simon Glass [Fri, 10 Mar 2023 20:47:12 +0000 (12:47 -0800)]
efi: video: Return mode info for app also

The mode info is currently not initialised for the app. Fix this by
returning it from the function.

Signed-off-by: Simon Glass <sjg@chromium.org>
15 months agoefi: video: Move payload code into a function
Simon Glass [Fri, 10 Mar 2023 20:47:11 +0000 (12:47 -0800)]
efi: video: Move payload code into a function

Put this into a function, as we have done for the app implementation.
Comment both functions. FOr now the app still does not access it
correctly.

Signed-off-by: Simon Glass <sjg@chromium.org>
16 months agoMerge tag 'dm-next-9mar23' of https://source.denx.de/u-boot/custodians/u-boot-dm...
Tom Rini [Thu, 9 Mar 2023 16:22:50 +0000 (11:22 -0500)]
Merge tag 'dm-next-9mar23' of https://source.denx.de/u-boot/custodians/u-boot-dm into next

binman x509, separate tools dir and other improvements
patman parallel patch generation
fdt fixes and tests
PyPi support for U-Boot tools
buildman reproducible builds

16 months agobinman: Support generation of x509 certificates
Simon Glass [Fri, 3 Mar 2023 00:02:45 +0000 (17:02 -0700)]
binman: Support generation of x509 certificates

And a new entry type which supports generation of x509 certificates.
This uses a new 'openssl' btool with just one operation so far.

Signed-off-by: Simon Glass <sjg@chromium.org>
16 months agobinman: Support updating section contents
Simon Glass [Fri, 3 Mar 2023 00:02:44 +0000 (17:02 -0700)]
binman: Support updating section contents

Implement this feature since it is useful for updating FITs within an
image.

Signed-off-by: Simon Glass <sjg@chromium.org>
16 months agobinman: Handle missing bintools correctly in fit
Simon Glass [Fri, 3 Mar 2023 00:02:43 +0000 (17:02 -0700)]
binman: Handle missing bintools correctly in fit

At present these are handled as if they are allowed to be missing, but
this is only true if the -M flag is provided. Fix this and add a test.

Signed-off-by: Simon Glass <sjg@chromium.org>
16 months agobinman: Allow preserving the output dir when replacing
Simon Glass [Fri, 3 Mar 2023 00:02:42 +0000 (17:02 -0700)]
binman: Allow preserving the output dir when replacing

Add these flags for the 'replace' subcommand too, to aid debugging.

Signed-off-by: Simon Glass <sjg@chromium.org>
44 2023 -0700

16 months agobuildman: Correct CROSS_COMPILE output for sandbox
Simon Glass [Thu, 2 Mar 2023 13:11:44 +0000 (06:11 -0700)]
buildman: Correct CROSS_COMPILE output for sandbox

At present, 'buildman -A sandbox' adds the path containing the
toolchain at present. We can assume that this is in the path and
we don't want to set CROSS_COMPILE=/bin/ so change this to align
with what MakeEnvironment() does.

Signed-off-by: Simon Glass <sjg@chromium.org>
16 months agopatman: Check patches in parallel
Simon Glass [Wed, 8 Mar 2023 18:52:55 +0000 (10:52 -0800)]
patman: Check patches in parallel

For large series this can take a while. Run checkpatch in parallel to
try to reduce the time. The checkpatch information is still reported in
sequential order, so a very slow patch at the start can still slow
things down. But overall this gives good results.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
16 months agopatman: Run get_maintainer.pl in parallel
Simon Glass [Wed, 8 Mar 2023 18:52:54 +0000 (10:52 -0800)]
patman: Run get_maintainer.pl in parallel

This script can take ages on some series. Try to limit the time by
using threads. If a few stubborn patches remain, show progress so the
user has some idea what is going on.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
16 months agopatman: Refactor MakeCcFile() into two functions
Simon Glass [Wed, 8 Mar 2023 18:52:53 +0000 (10:52 -0800)]
patman: Refactor MakeCcFile() into two functions

This function is quite long. Moving the handling of a commit into a
separate function. This will make it easier to do the work in parallel.

Update function comments while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
16 months agopatman: Drop an incorrect comment about git am
Simon Glass [Wed, 8 Mar 2023 18:52:52 +0000 (10:52 -0800)]
patman: Drop an incorrect comment about git am

Patman does not do this anymore, as of this commit:

   7428dc14b0f ("patman: Remove the -a option")

Drop the comment.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
16 months agotest: cmd: fdt: Add list of remaining missing tests
Marek Vasut [Thu, 2 Mar 2023 03:08:45 +0000 (04:08 +0100)]
test: cmd: fdt: Add list of remaining missing tests

Add list of missing tests for the 'fdt' command, currently
the missing sandbox tests are only 'fdt boardsetup' and
'fdt checksign' .

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
16 months agotest: cmd: fdt: Test fdt bootcpu
Marek Vasut [Thu, 2 Mar 2023 03:08:40 +0000 (04:08 +0100)]
test: cmd: fdt: Test fdt bootcpu

Add 'fdt bootcpu' test which works as follows:
- Create basic FDT, map it to sysmem
- Print the FDT bootcpu
- Set the FDT bootcpu and read the value back using 'fdt header get'
- Perform the previous step twice to validate bootcpu overwrite

The test case can be triggered using:
"
./u-boot -Dc 'ut fdt'
"
To dump the full output from commands used during test, add '-v' flag.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
16 months agotest: cmd: fdt: Test fdt rm
Marek Vasut [Thu, 2 Mar 2023 03:08:38 +0000 (04:08 +0100)]
test: cmd: fdt: Test fdt rm

Add 'fdt rm' test which works as follows:
- Create fuller FDT, map it to sysmem
- Selectively delete nodes or properties by both path and aliases
- Verify created nodes or properties using fdt print command

The test case can be triggered using:
"
./u-boot -Dc 'ut fdt'
"
To dump the full output from commands used during test, add '-v' flag.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
16 months agotest: cmd: fdt: Test fdt mknode
Marek Vasut [Thu, 2 Mar 2023 03:08:37 +0000 (04:08 +0100)]
test: cmd: fdt: Test fdt mknode

Add 'fdt mknode' test which works as follows:
- Create fuller FDT, map it to sysmem
- Create node either in / or subnode
- Attempt to create node over existing node, which fails
- Attempt to create subnodes in non-existing nodes or aliases
- Verify created nodes using fdt list command

The test case can be triggered using:
"
./u-boot -Dc 'ut fdt'
"
To dump the full output from commands used during test, add '-v' flag.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
16 months agotest: cmd: fdt: Test fdt set
Marek Vasut [Thu, 2 Mar 2023 03:08:36 +0000 (04:08 +0100)]
test: cmd: fdt: Test fdt set

Add 'fdt set' test which works as follows:
- Create fuller FDT, map it to sysmem
- Set either existing property to overwrite it, or new property
- Test setting both single properties as well as string and integer arrays
- Test setting to non-existent nodes and aliases
- Verify set values using 'fdt get value'

The test case can be triggered using:
"
./u-boot -Dc 'ut fdt'
"
To dump the full output from commands used during test, add '-v' flag.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
16 months agotest: cmd: fdt: Test fdt get size
Marek Vasut [Thu, 2 Mar 2023 03:08:35 +0000 (04:08 +0100)]
test: cmd: fdt: Test fdt get size

Add 'fdt get size' test which works as follows:
- Create fuller FDT, map it to sysmem
- Get size of various properties
- Get node count of available nodes
- Test non-existent nodes and properties

The test case can be triggered using:
"
./u-boot -Dc 'ut fdt'
"
To dump the full output from commands used during test, add '-v' flag.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
16 months agotest: cmd: fdt: Test fdt get addr
Marek Vasut [Thu, 2 Mar 2023 03:08:34 +0000 (04:08 +0100)]
test: cmd: fdt: Test fdt get addr

Add 'fdt get addr' test which works as follows:
- Create fuller FDT, map it to sysmem
- Get address of various properties
- Compare addresses calculated by UT and fdt command

This test is special in that it has to go through gruesome remapping scheme
where the test calculates:
- pointer offsets of the generated FDT root and the property being tested
- map_sysmem() result of environment variable "fdtaddr" and the one set
  by the test matching address of property being tested
- difference between the later and the former, to obtain offset of the
  DT property from start of DT
The offsets must match in both the UT and the tested U-Boot, if they do
not, the test fails.

The test case can be triggered using:
"
./u-boot -Dc 'ut fdt'
"
To dump the full output from commands used during test, add '-v' flag.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
16 months agotest: cmd: fdt: Test fdt get name
Marek Vasut [Thu, 2 Mar 2023 03:08:33 +0000 (04:08 +0100)]
test: cmd: fdt: Test fdt get name

Add 'fdt get name' test which works as follows:
- Create fuller FDT, map it to sysmem
- Get name of / node 0, 1 and /clk-test node 0
- Compare output and validate the node name
- Get name of / node 2 and /clk-test node 1
- Compare output and validate the node is not present
- Get name of / node -1 and /clk-test node -1
- Compare output and validate the node name equals node 0 name
- Check nonexistent node, verify the command errors out

The test case can be triggered using:
"
./u-boot -Dc 'ut fdt'
"
To dump the full output from commands used during test, add '-v' flag.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
16 months agotest: cmd: fdt: Test fdt resize
Marek Vasut [Thu, 2 Mar 2023 03:08:31 +0000 (04:08 +0100)]
test: cmd: fdt: Test fdt resize

Add 'fdt resize' test which works as follows:
- Create simple FDT with extra size 0, map it to sysmem
- 'resize' the FDT by 0x2000 bytes
- Verify the new space has been added to the FDT

The test case can be triggered using:
"
./u-boot -Dc 'ut fdt'
"
To dump the full output from commands used during test, add '-v' flag.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
16 months agotest: cmd: fdt: Test fdt move
Marek Vasut [Thu, 2 Mar 2023 03:08:30 +0000 (04:08 +0100)]
test: cmd: fdt: Test fdt move

Add 'fdt move' test which works as follows:
- Create simple FDT, map it to sysmem
- 'move' the FDT into new zeroed out sysmem location
- Verify newly active FDT is in the new location
- Compare both locations

The test case can be triggered using:
"
./u-boot -Dc 'ut fdt'
"
To dump the full output from commands used during test, add '-v' flag.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
16 months agotest: cmd: fdt: Test both string and integer arrays in 'fdt get value'
Marek Vasut [Thu, 2 Mar 2023 03:08:29 +0000 (04:08 +0100)]
test: cmd: fdt: Test both string and integer arrays in 'fdt get value'

The 'fdt get value' subcommand now supports extraction of integer value
from integer arrays, add test for it, including a test for special case
unindexed integer array read, which is handled as hash and treated as a
long string instead of integer.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
16 months agotest: cmd: fdt: Test alias resolution in 'fdt get value'
Marek Vasut [Thu, 2 Mar 2023 03:08:28 +0000 (04:08 +0100)]
test: cmd: fdt: Test alias resolution in 'fdt get value'

The 'fdt' command help contains the following note:
"
Dereference aliases by omitting the leading '/', e.g. fdt print ethernet0.
"
Add test for it.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
16 months agotest: cmd: fdt: Generate fuller DT internally and switch fdt get value to it
Marek Vasut [Thu, 2 Mar 2023 03:08:27 +0000 (04:08 +0100)]
test: cmd: fdt: Generate fuller DT internally and switch fdt get value to it

Implement function to generate internal test DT fragment and switch
the 'fdt get value' test to this instead of depending on the sandbox
DT. Rename clk-test node to test-node node. This FDT fragment will be
reused by other tests. No functional change.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
16 months agotest: cmd: fdt: Rename fdt_test_get() to fdt_test_get_value()
Marek Vasut [Thu, 2 Mar 2023 03:08:26 +0000 (04:08 +0100)]
test: cmd: fdt: Rename fdt_test_get() to fdt_test_get_value()

The 'fdt get' command has a 'get value' subcommand, rename the fdt_test_get()
to fdt_test_get_value() to avoid confusion about what it is testing. There is
currently no get 'get name', 'get addr', 'get size' subcommand test.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
16 months agotest: cmd: fdt: Rename fdt_test_resize() to fdt_test_addr_resize()
Marek Vasut [Thu, 2 Mar 2023 03:08:25 +0000 (04:08 +0100)]
test: cmd: fdt: Rename fdt_test_resize() to fdt_test_addr_resize()

The 'fdt' command has a 'resize' subcommand, rename the fdt_test_resize()
to fdt_test_addr_resize() to avoid confusion about what it is testing.
There is currently no resize test.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
16 months agotest: Add ut_assert_nextline_empty() empty line helper
Marek Vasut [Thu, 2 Mar 2023 03:08:24 +0000 (04:08 +0100)]
test: Add ut_assert_nextline_empty() empty line helper

Add helper macro to test for empty lines, which is an inobvious
wrapper around ut_assert_nextline("%s", "") .

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
16 months agocmd: fdt: Add support for integer arrays in fdt get value with index
Marek Vasut [Thu, 2 Mar 2023 03:08:23 +0000 (04:08 +0100)]
cmd: fdt: Add support for integer arrays in fdt get value with index

Currently any integer array value is set as long up-to-40 character
hexadecimal string into environment variable when extracted from an
FDT using 'fdt get value path prop index', because the support for
handling integer arrays is not implemented, and fdt_value_env_set()
code falls back into the hash handling behavior instead.

Implement this support simply by checking whether user supplied any
index. If index is set and the property length is multiple of four,
then this is an integer array, and the code would extract value at
specified index.

There is a subtle change where default index is set to -1 instead of 0.
This is OK, since the only place which checks for index to be less or
equal zero is the string array handling code in fdt_value_env_set() and
that code would work perfectly well with index -1 too.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
16 months agocmd: fdt: Map address returned from fdt get addr to sysmem
Marek Vasut [Thu, 2 Mar 2023 03:08:22 +0000 (04:08 +0100)]
cmd: fdt: Map address returned from fdt get addr to sysmem

The address returned from 'fdt get addr' command must be mapped
into sysmem, as this is a working FDT. Access to this address
without mapping it would lead to crash e.g. in sandbox.

The following command triggers the crash:
"
./u-boot -Dc 'fdt addr $fdtcontroladdr ; fdt get addr var / compatible ; md $var'
"

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
16 months agocmd: fdt: Handle 64bit pointers in fdt get addr
Marek Vasut [Thu, 2 Mar 2023 03:08:21 +0000 (04:08 +0100)]
cmd: fdt: Handle 64bit pointers in fdt get addr

The command assumed 32bit pointers so far, with 64bit pointer the
command would overwrite a piece of stack. Fix it by extending the
array size to cater for 64bit pointer, and use snprintf() to avoid
writing past the end of the array ever again.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
16 months agocmd: fdt: Align checksign parameter names in help text
Marek Vasut [Thu, 2 Mar 2023 03:08:20 +0000 (04:08 +0100)]
cmd: fdt: Align checksign parameter names in help text

The help text references 'addr' as an optional key start address,
but the explanation references the same as 'start', make sure they
both read as 'addr'. Also update the abbreviated 'addr' in the
explanation to 'address'.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
16 months agocmd: fdt: Check argc before accessing argv in fdt memory
Marek Vasut [Thu, 2 Mar 2023 03:08:19 +0000 (04:08 +0100)]
cmd: fdt: Check argc before accessing argv in fdt memory

On case 'fdt memory' is invoked without parameters, argv[2]/argv[3]
is not valid and this command would SEGFAULT in sandbox environment.
Add missing argc test to avoid the crash and rather print usage help
message.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
16 months agocmd: fdt: Check argc before accessing argv in fdt bootcpu
Marek Vasut [Thu, 2 Mar 2023 03:08:18 +0000 (04:08 +0100)]
cmd: fdt: Check argc before accessing argv in fdt bootcpu

On case 'fdt bootcpu' is invoked without parameters, argv[2] is not
valid and this command would SEGFAULT in sandbox environment. Add
missing argc test to avoid the crash and rather print usage help
message.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
16 months agocmd: fdt: Fix fdt rsvmem behavior on non-existent index and error message space
Marek Vasut [Thu, 2 Mar 2023 03:08:17 +0000 (04:08 +0100)]
cmd: fdt: Fix fdt rsvmem behavior on non-existent index and error message space

In case 'fdt rsvmem delete index' is passed a non-existent index, one
which does not exist in 'fdt rsvmem print', then the following command
triggers a print of help message for 'fdt' command instead of erroring
out:
=> fdt rsvmem delete 1234
This is because the subcommand errornously returns 'err' instead of
CMD_RET_FAILURE, fix it. Furthermore, align the number of spaces past
fdt_del_mem_rsv() and fdt_add_mem_rsv() in error message with the rest
of the code.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
16 months agocmd: fdt: Fix fdt rm behavior on non-existent property and error message space
Marek Vasut [Thu, 2 Mar 2023 03:08:16 +0000 (04:08 +0100)]
cmd: fdt: Fix fdt rm behavior on non-existent property and error message space

In case an FDT contains a node '/test-node@1234' , with no property
called 'noprop' in that node, the following command triggers a print
of help message for 'fdt' command instead of erroring out:
=> fdt rm /test-node@1234 noprop
This is because the subcommand errornously returns 'err' instead of
CMD_RET_FAILURE, fix it. Furthermore, align the number of spaces past
fdt_delprop() in error message with the rest of the code.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
16 months agocmd: fdt: Fix handling of empty properties for fdt get addr and fdt get size
Marek Vasut [Thu, 2 Mar 2023 03:08:15 +0000 (04:08 +0100)]
cmd: fdt: Fix handling of empty properties for fdt get addr and fdt get size

It is perfectly valid to request an address or size of FDT property
without value, the only special case if requesting of the value of
FDT property without value. Invert the test such, that properties
without value still set the variable from 'fdt get addr/size' to
address of the property or size of the property, where the later
is 0.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
16 months agocmd: fdt: Import is_printable_string() from DTC to fix u32 misprint
Marek Vasut [Thu, 2 Mar 2023 03:08:14 +0000 (04:08 +0100)]
cmd: fdt: Import is_printable_string() from DTC to fix u32 misprint

Import is_printable_string() implementation from DTC 1.7.0 as of
DTC commit 039a994 ("Bump version to v1.7.0") . This fixes a print
of u32 property which so far used to be printed as string by U-Boot
fdt print command.

We might see the case where the parsed property value, in this case
it is a 32-bit integer, identified as a printable string or a null byte
(concatenated strings) because of its last character happens to be:
  0x00 (null character), 0xB (vertical tab character) or
  0x10 (line feed character)
In this situation, if the string is identified as printable string,
it will be displayed as character instead of hex value

When the isprint() condition is true, there are two possibilities:
  1) The character is ASCII character (except the first 32)
  2) The character is extended ASCII character

For example,
NG property in device tree:
    clock-frequency = <16640000>;
by default, would be displayed as
    clock-frequency = "", "ýè";
and with this patch applied, would be displayed as
    clock-frequency = <0x00fde800>;

Full investigation was done by Nam and Hai, patch reworked by Marek
to use common code from DTC.

Signed-off-by: Hai Pham <hai.pham.ud@renesas.com>
Signed-off-by: Nam Nguyen <nam.nguyen.yh@renesas.com>
Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
16 months agoCI: Add a check for building tools for PyPi
Simon Glass [Fri, 24 Feb 2023 01:18:24 +0000 (18:18 -0700)]
CI: Add a check for building tools for PyPi

Add a simple check that the PyPi packages can be built.

Signed-off-by: Simon Glass <sjg@chromium.org>
16 months agodoc: Add notes on how to install patman and binman
Simon Glass [Fri, 24 Feb 2023 01:18:23 +0000 (18:18 -0700)]
doc: Add notes on how to install patman and binman

These can be installed with 'pip' now. Add the details for those who are
interested.

Signed-off-by: Simon Glass <sjg@chromium.org>
16 months agotest: Add concurrencytest to the requirements
Simon Glass [Fri, 24 Feb 2023 01:18:22 +0000 (18:18 -0700)]
test: Add concurrencytest to the requirements

This allows tests to run in parallel and speeds up some tests markedly,
particularly with binman. Add it to the requirements.

Signed-off-by: Simon Glass <sjg@chromium.org>
16 months agobinman: Add support for building a binmanu PyPi package
Simon Glass [Fri, 24 Feb 2023 01:18:21 +0000 (18:18 -0700)]
binman: Add support for building a binmanu PyPi package

Create the necessary files to build this new package.

It is not actually clear whether this is useful, since buildman has no
purpose outside U-Boot.

Move the main program into a function so that it can easily be called by
the PyPi-created script.

Signed-off-by: Simon Glass <sjg@chromium.org>
16 months agobinman: Use importlib to find the help
Simon Glass [Fri, 24 Feb 2023 01:18:20 +0000 (18:18 -0700)]
binman: Use importlib to find the help

Use this function so that the help can be found even when binman is
running from a package.

Signed-off-by: Simon Glass <sjg@chromium.org>
16 months agobinman: Hide the 'test' command unless test code is available
Simon Glass [Fri, 24 Feb 2023 01:18:19 +0000 (18:18 -0700)]
binman: Hide the 'test' command unless test code is available

It doesn't make much sense to expose tests when dtoc is running
outside of the U-Boot git checkout. Hide the option in this case.

Fix a long line while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
16 months agobinman: Move the main code into a function
Simon Glass [Fri, 24 Feb 2023 01:18:18 +0000 (18:18 -0700)]
binman: Move the main code into a function

Put this code into a function so it is easy for it be run when packaged.

Signed-off-by: Simon Glass <sjg@chromium.org>
16 months agodtoc: Add support for building a dtoc PyPi package
Simon Glass [Fri, 24 Feb 2023 01:18:17 +0000 (18:18 -0700)]
dtoc: Add support for building a dtoc PyPi package

Create the necessary files to build this new package.

This is needed for binman.

Move the main program into a function so that it can easily be called by
the PyPi-created script.

Signed-off-by: Simon Glass <sjg@chromium.org>
16 months agodtoc: Use pathlib to find the test directory
Simon Glass [Fri, 24 Feb 2023 01:18:16 +0000 (18:18 -0700)]
dtoc: Use pathlib to find the test directory

Update this so that the directory being used is declared at the top of
the file. Use pathlib as it seems to be more modern.

Signed-off-by: Simon Glass <sjg@chromium.org>
16 months agodtoc: Move the main code into a function
Simon Glass [Fri, 24 Feb 2023 01:18:15 +0000 (18:18 -0700)]
dtoc: Move the main code into a function

Put this code into a function so it is easy for it be run when packaged.

Signed-off-by: Simon Glass <sjg@chromium.org>
16 months agodtoc: Hide the test options unless test code is available
Simon Glass [Fri, 24 Feb 2023 01:18:14 +0000 (18:18 -0700)]
dtoc: Hide the test options unless test code is available

It doesn't make much sense to expose tests when dtoc is running
outside of the U-Boot git checkout. Hide the option in this case.

Signed-off-by: Simon Glass <sjg@chromium.org>
16 months agobuildman: Add support for building a buildman PyPi package
Simon Glass [Fri, 24 Feb 2023 01:18:13 +0000 (18:18 -0700)]
buildman: Add support for building a buildman PyPi package

Create the necessary files to build this new package.

It is not actually clear whether this is useful, since buildman has no
purpose outside U-Boot. It is included for completeness, since adding
this later would be more trouble.

Move the main program into a function so that it can easily be called by
the PyPi-created script.

Signed-off-by: Simon Glass <sjg@chromium.org>
16 months agobuildman: Use importlib to find the help
Simon Glass [Fri, 24 Feb 2023 01:18:12 +0000 (18:18 -0700)]
buildman: Use importlib to find the help

Use this function so that the help can be found even when buildman is
running from a package.

Signed-off-by: Simon Glass <sjg@chromium.org>
16 months agobuildman: Fix use of a type as a variable
Simon Glass [Fri, 24 Feb 2023 01:18:11 +0000 (18:18 -0700)]
buildman: Fix use of a type as a variable

Using 'str' as a variable makes it impossible to use it as a type in the
same function. Fix this by using a different name.

Signed-off-by: Simon Glass <sjg@chromium.org>
16 months agobuildman: Hide the test options unless test code is available
Simon Glass [Fri, 24 Feb 2023 01:18:10 +0000 (18:18 -0700)]
buildman: Hide the test options unless test code is available

It doesn't make much sense to expose tests when buildman is running
outside of the U-Boot git checkout. Hide the option in this case

Signed-off-by: Simon Glass <sjg@chromium.org>
16 months agobuildman: Move the main code into a function
Simon Glass [Fri, 24 Feb 2023 01:18:09 +0000 (18:18 -0700)]
buildman: Move the main code into a function

Put this code into a function so it is easy for it be run when packaged.

Signed-off-by: Simon Glass <sjg@chromium.org>
16 months agopatman: Add support for building a patman PyPi package
Simon Glass [Fri, 24 Feb 2023 01:18:08 +0000 (18:18 -0700)]
patman: Add support for building a patman PyPi package

Create the necessary files to build this new package.

Signed-off-by: Simon Glass <sjg@chromium.org>
16 months agopatman: Avoid importing test_checkpatch before it is needed
Simon Glass [Fri, 24 Feb 2023 01:18:07 +0000 (18:18 -0700)]
patman: Avoid importing test_checkpatch before it is needed

Tests are not packaged with patman so this file will not be accessible
when installing with pip. Move the import later in the file, when we
know the file is present.

Signed-off-by: Simon Glass <sjg@chromium.org>
16 months agopatman: Add support for building a u_boot_tools PyPi package
Simon Glass [Fri, 24 Feb 2023 01:18:06 +0000 (18:18 -0700)]
patman: Add support for building a u_boot_tools PyPi package

Create the necessary files to build this new package.

Signed-off-by: Simon Glass <sjg@chromium.org>
16 months agoscript: Add a script to build a PyPi package
Simon Glass [Fri, 24 Feb 2023 01:18:05 +0000 (18:18 -0700)]
script: Add a script to build a PyPi package

Create a script which can package a tool for use with PyPi and the 'pip'
tool. This involves quite a few steps so is best automated. Future work
will enable use of this for some of the tools in U-Boot.

Signed-off-by: Simon Glass <sjg@chromium.org>
16 months agopatman: Move library functions into a library directory
Simon Glass [Fri, 24 Feb 2023 01:18:04 +0000 (18:18 -0700)]
patman: Move library functions into a library directory

The patman directory has a number of modules which are used by other tools
in U-Boot. This makes it hard to package the tools using pypi since the
common files must be copied along with the tool that uses them.

To address this, move these files into a new u_boot_pylib library. This
can be packaged separately and listed as a dependency of each tool.

Signed-off-by: Simon Glass <sjg@chromium.org>
16 months agoRemove concurrencytest
Simon Glass [Fri, 24 Feb 2023 01:18:03 +0000 (18:18 -0700)]
Remove concurrencytest

While our version is better, it is tricky to use it when we are trying
to package things with pip. Drop it.

Somewhat reduced functionality is provided by the upstream version[1],
along with a rather annoying message each time it is used[2] [3].

[1] pip install concurrencytest
[2] https://github.com/cgoldberg/concurrencytest/issues/12
[3] https://github.com/cgoldberg/concurrencytest/pull/14

Signed-off-by: Simon Glass <sjg@chromium.org>
16 months agoRevert "patman: test_util: Print test stdout/stderr within test summaries"
Simon Glass [Fri, 24 Feb 2023 01:18:02 +0000 (18:18 -0700)]
Revert "patman: test_util: Print test stdout/stderr within test summaries"

Unfortunately this adds a new feature to concurrencytest and it has not
made it upstream to the project[1].

Drop it for now so we can use the upstream module. Once it is applied we
can bring this functionality back.

[1] https://github.com/cgoldberg/concurrencytest

This reverts commit ebcaafcded40da8ae6cb4234c2ba9901c7bee644.

Signed-off-by: Simon Glass <sjg@chromium.org>
16 months agobinman: Avoid unwanted output in testFitFirmwareLoadables()
Simon Glass [Fri, 24 Feb 2023 01:18:01 +0000 (18:18 -0700)]
binman: Avoid unwanted output in testFitFirmwareLoadables()

This prints a message about the missing tee-os generated by the test. This
is confusing, so suppress it.

Signed-off-by: Simon Glass <sjg@chromium.org>
16 months agobootstd: Replicate the dtb-filename quirks of distroboot
Simon Glass [Wed, 22 Feb 2023 19:17:04 +0000 (12:17 -0700)]
bootstd: Replicate the dtb-filename quirks of distroboot

For EFI, the distro boot scripts search in three different directories
for the .dtb file. The SOC-based filename fallback is supported only for
32-bit ARM.

Adjust the code to mirror this behaviour.

Also some boards can use a prior-stage FDT if one is not found in the
normal way. Support this and show a message in that case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Suggested-by: Mark Kettenis <kettenis@openbsd.org>
16 months agobootflow: Rename bootflow_flags_t
Simon Glass [Wed, 22 Feb 2023 19:17:03 +0000 (12:17 -0700)]
bootflow: Rename bootflow_flags_t

These flags actually relate to the iterator, not the bootflow struct
itself. Rename them.

Signed-off-by: Simon Glass <sjg@chromium.org>
16 months agobinman: Make the tooldir configurable
Simon Glass [Wed, 22 Feb 2023 19:14:49 +0000 (12:14 -0700)]
binman: Make the tooldir configurable

Add a command-line argument for setting the tooldir, so that the default
can be overridden. Add this directory to the toolpath automatically.
Create the directory if it does not already exist.

Put the default in the argument parser instead of the class, so that it
is more obvious.

Update a few tests that expect the utility name to be provided without
any path (e.g. 'futility'), so they can accept a path, e.g.
/path/to/futility

Update the documentation and add a few tests.

Improve the help for --toolpath while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
16 months agobinman: Use a private directory for bintools
Simon Glass [Wed, 22 Feb 2023 19:14:48 +0000 (12:14 -0700)]
binman: Use a private directory for bintools

At present binman writes tools into the ~/bin directory. This is
convenient but some may be concerned about downloading unverified
binaries and running them. Place then in a special ~/.binman-tools
directory instead.

Mention this in the documentation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
16 months agobinman: Move the tools directory into the Bintool class
Simon Glass [Wed, 22 Feb 2023 19:14:47 +0000 (12:14 -0700)]
binman: Move the tools directory into the Bintool class

We want to be able to change this directory. Use a class member to hold
the value, since changing a constant is not good.

Signed-off-by: Simon Glass <sjg@chromium.org>
16 months agobinman: Update bintools documentation
Simon Glass [Wed, 22 Feb 2023 19:14:46 +0000 (12:14 -0700)]
binman: Update bintools documentation

This was not regenerated with recent changes. Update it.

Signed-off-by: Simon Glass <sjg@chromium.org>
16 months agobinman: Correct an 'aot' typo
Simon Glass [Wed, 22 Feb 2023 19:14:45 +0000 (12:14 -0700)]
binman: Correct an 'aot' typo

Fix this typo.

Signed-off-by: Simon Glass <sjg@chromium.org>
16 months agobuildman: Add a flag for reproducible builds
Simon Glass [Tue, 21 Feb 2023 19:40:29 +0000 (12:40 -0700)]
buildman: Add a flag for reproducible builds

This is quite a useful thing to use when building since it avoids small
size changes between commits. Add a -r flag for it.

Also undefine CONFIG_LOCALVERSION_AUTO since this appends the git hash
to the version string, causing every build to be slightly different.

Signed-off-by: Simon Glass <sjg@chromium.org>
16 months agobuildman: Support disabling LTO
Simon Glass [Tue, 21 Feb 2023 19:40:28 +0000 (12:40 -0700)]
buildman: Support disabling LTO

This cuts down build performance considerably and is not always needed,
when checking for build errors, etc.

Add a flag to disable it.

Signed-off-by: Simon Glass <sjg@chromium.org>
16 months agobuildman: Write out the build command used
Simon Glass [Tue, 21 Feb 2023 19:40:27 +0000 (12:40 -0700)]
buildman: Write out the build command used

It is sometimes useful to see the exact 'make' command used by buildman
for a commit. Add an output file for this.

Signed-off-by: Simon Glass <sjg@chromium.org>
16 months agobuildman: Add a note about the out-env file
Simon Glass [Tue, 21 Feb 2023 19:40:26 +0000 (12:40 -0700)]
buildman: Add a note about the out-env file

This file holds the environment used when doing a build. Add a note
about it.

Signed-off-by: Simon Glass <sjg@chromium.org>
16 months agobinman: Use correct argument name in docstrings
Jonas Karlman [Sun, 19 Feb 2023 22:02:04 +0000 (22:02 +0000)]
binman: Use correct argument name in docstrings

Use correct argument name in docstrings.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Simon Glass <sjg@chromium.org>
16 months agobinman: Fix spelling of nodes in code comments
Jonas Karlman [Sun, 19 Feb 2023 22:02:03 +0000 (22:02 +0000)]
binman: Fix spelling of nodes in code comments

Replace notes with nodes in code comments and docstrings.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Simon Glass <sjg@chromium.org>
16 months agobinman: Remove redundant SetAllowFakeBlob from blob-ext entry
Jonas Karlman [Sun, 19 Feb 2023 22:02:03 +0000 (22:02 +0000)]
binman: Remove redundant SetAllowFakeBlob from blob-ext entry

Entry_blob_ext contains an implementation of SetAllowFakeBlob that is
identical to the one in the base Entry class, remove it.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Simon Glass <sjg@chromium.org>
16 months agobinman: Support marking FMAP areas as preserved
Simon Glass [Mon, 13 Feb 2023 00:11:15 +0000 (17:11 -0700)]
binman: Support marking FMAP areas as preserved

Add an entry flag called 'preserve' to indicate that an entry should be
preserved by firmware updates. Propagate this to FMAP too.

Signed-off-by: Simon Glass <sjg@chromium.org>
16 months agobinman: Avoid requiring a home directory on startup
Simon Glass [Fri, 10 Feb 2023 20:59:46 +0000 (13:59 -0700)]
binman: Avoid requiring a home directory on startup

This is needed to download tools, but we may not need to do this. At
present binman fails to start if HOME is not set.

Use the current directory as a default to avoid this.

Signed-off-by: Simon Glass <sjg@chromium.org>
16 months agoMerge tag 'next-20230307' of https://source.denx.de/u-boot/custodians/u-boot-video...
Tom Rini [Tue, 7 Mar 2023 17:54:01 +0000 (12:54 -0500)]
Merge tag 'next-20230307' of https://source.denx.de/u-boot/custodians/u-boot-video into next

 - video console refactoring and optimization
 - support for fonts wider than 1 byte
 - use named header for 8x16 font data
 - support multiple fonts configuration
 - move get_font_size() to truetype driver ops
 - support font size configuration at runtime
 - add 16x32 Terminus font from linux
 - add 12x22 Sun font from linux
 - add 12x22 console simple font test

16 months agoMerge branch '2023-03-06-assorted-platform-updates' into next
Tom Rini [Tue, 7 Mar 2023 15:42:22 +0000 (10:42 -0500)]
Merge branch '2023-03-06-assorted-platform-updates' into next

- semihosting updates for arm and riscv, assorted arm64 core updates,
  assorted ast2600 updates, remove some more unused code, some TI K3
  defconfig and DTS updates, uniphier DTS updates, mpc83xx Kconfig
  cleanup, re-add fttmr010 driver with an update to use DM.

16 months agovideo console: add 12x22 console simple font test
Dzmitry Sankouski [Tue, 7 Mar 2023 10:21:20 +0000 (13:21 +0300)]
video console: add 12x22 console simple font test

Tests fonts wider than a byte.

Signed-off-by: Dzmitry Sankouski <dsankouski@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
16 months agovideo console: sandbox: add 12x22 font defconfigs
Dzmitry Sankouski [Tue, 7 Mar 2023 10:21:19 +0000 (13:21 +0300)]
video console: sandbox: add 12x22 font defconfigs

Add 12x22 font in order to write a test for it.

Signed-off-by: Dzmitry Sankouski <dsankouski@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
16 months agovideo console: add 16x32 Terminus font from linux
Dzmitry Sankouski [Mon, 27 Feb 2023 17:37:08 +0000 (20:37 +0300)]
video console: add 16x32 Terminus font from linux

Modern mobile phones typically have high pixel density.
Bootmenu is hardly readable on those with 8x16 font.

Signed-off-by: Dzmitry Sankouski <dsankouski@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
16 months agovideo console: add 12x22 Sun font from linux
Dzmitry Sankouski [Mon, 27 Feb 2023 17:37:07 +0000 (20:37 +0300)]
video console: add 12x22 Sun font from linux

Modern mobile phones typically have high pixel density.
Bootmenu is hardly readable on those with 8x16 font.

Signed-off-by: Dzmitry Sankouski <dsankouski@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
16 months agovideo console: allow font size configuration at runtime
Dzmitry Sankouski [Tue, 7 Mar 2023 10:21:16 +0000 (13:21 +0300)]
video console: allow font size configuration at runtime

Allow font size configuration at runtime for console_simple.c
driver. This needed for unit testing different fonts.

Configuring is done by `font` command, also used for font
selection in true type console.

Signed-off-by: Dzmitry Sankouski <dsankouski@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
16 months agovideo console: move vidconsole_get_font_size() logic to driver ops
Dzmitry Sankouski [Tue, 7 Mar 2023 10:21:15 +0000 (13:21 +0300)]
video console: move vidconsole_get_font_size() logic to driver ops

Since multiple vidconsole drivers exists, vidconsole_get_font_size()
implementation cannot longer live in vidconsole_uclass.c file.

Move current vidconsole_get_font_size logic to truetype driver ops.

Signed-off-by: Dzmitry Sankouski <dsankouski@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
16 months agovideo console: implement multiple fonts configuration
Dzmitry Sankouski [Tue, 7 Mar 2023 10:21:14 +0000 (13:21 +0300)]
video console: implement multiple fonts configuration

This needed for unit testing different fonts.

Configured fonts are placed in an array of fonts.
First font is selected by default upon console probe.

Signed-off-by: Dzmitry Sankouski <dsankouski@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
[agust: fixed build error when bmp logo disabled]
Signed-off-by: Anatolij Gustschin <agust@denx.de>
16 months agovideo console: move 8x16 font data in named header
Dzmitry Sankouski [Tue, 7 Mar 2023 10:21:13 +0000 (13:21 +0300)]
video console: move 8x16 font data in named header

Consistent font data header names needed to add new
fonts.

Signed-off-by: Dzmitry Sankouski <dsankouski@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
16 months agovideo console: add support for fonts wider than 1 byte
Dzmitry Sankouski [Tue, 7 Mar 2023 10:21:12 +0000 (13:21 +0300)]
video console: add support for fonts wider than 1 byte

Devices with high ppi may benefit from wider fonts.

Current width implementation is limited by 1 byte, i.e. 8 bits.
New version iterates VIDEO_FONT_BYTE_WIDTH times, to process all
width bytes, thus allowing fonts wider than 1 byte.

Signed-off-by: Dzmitry Sankouski <dsankouski@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
16 months agovideo console: refactoring and optimization
Dzmitry Sankouski [Tue, 7 Mar 2023 10:21:11 +0000 (13:21 +0300)]
video console: refactoring and optimization

- move common code to vidconsole_internal.h and console_core.c
- unite probe functions
- get rid of code duplications in switch across bpp values
- extract common pixel fill logic in two functions one per
horizontal and vertical filling
- rearrange statements in put_xy* methods in unified way
- replace types - uint*_t to u*

Signed-off-by: Dzmitry Sankouski <dsankouski@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>