]> git.dujemihanovic.xyz Git - u-boot.git/log
u-boot.git
4 years agopatman: Update errors and warnings to use stderr
Simon Glass [Fri, 10 Jul 2020 00:39:39 +0000 (18:39 -0600)]
patman: Update errors and warnings to use stderr

When warnings and errors are produced by tools they should be written to
stderr. Update the tout implementation to handle this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agobinman: Allow external binaries to be missing
Simon Glass [Fri, 10 Jul 2020 00:39:38 +0000 (18:39 -0600)]
binman: Allow external binaries to be missing

Sometimes it is useful to build an image even though external binaries are
not present. This allows the build system to continue to function without
these files, albeit not producing valid images.

U-Boot does with with ATF (ARM Trusted Firmware) today.

Add a new flag to binman to request this behaviour.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agobinman: Convert existing binary blobs to blob_ext
Simon Glass [Fri, 10 Jul 2020 00:39:37 +0000 (18:39 -0600)]
binman: Convert existing binary blobs to blob_ext

Many of the existing blobs rely on external binaries which may not be
available. Move them over to use blob_ext to indicate this.

Unfortunately cros-ec-rw cannot use this class because it inherits
another. So set the 'external' value for that class.

While we are here, drop the import of Entry since it is not used (and
pylint3 complains).

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agobinman: Add an etype for external binary blobs
Simon Glass [Fri, 10 Jul 2020 00:39:36 +0000 (18:39 -0600)]
binman: Add an etype for external binary blobs

It is useful to be able to distinguish between ordinary blobs such as
u-boot.bin and external blobs that cannot be build by the U-Boot build
system. If the external blobs are not available for some reason, then we
know that a value image cannot be built.

Introduce a new 'blob-ext' entry type for that.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agobinman: Use super() instead of specifying parent type
Simon Glass [Fri, 10 Jul 2020 00:39:35 +0000 (18:39 -0600)]
binman: Use super() instead of specifying parent type

It is easier and less error-prone to use super() when the parent type is
needed. Update binman to remove the type names.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agobinman: Re-enable concurrent tests
Simon Glass [Fri, 10 Jul 2020 00:39:34 +0000 (18:39 -0600)]
binman: Re-enable concurrent tests

With the change to absolute imports the concurrent tests feature
unfortunately broke. Fix it.

We cannot easy add a warning, since the output messes up tests which check
the output.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agobinman: Adjust pylibfdt for incremental build
Simon Glass [Fri, 10 Jul 2020 00:39:33 +0000 (18:39 -0600)]
binman: Adjust pylibfdt for incremental build

If the pylibfdt shared-object file is detected, then Python assumes that
the libfdt.py file exists also.

Sometimes when an incremental build aborts, the shared-object file is
built but the libfdt.py is not. The only way out at this point is to use
'make mkproper', or similar.

Fix this by removing the .so file before it is built. This seems to make
Python rebuild everything.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agobinman: Fix a few typos in the entry docs
Simon Glass [Fri, 10 Jul 2020 00:39:32 +0000 (18:39 -0600)]
binman: Fix a few typos in the entry docs

Some typos have been fixed in the generated entry docs but the code was
not updated. Fix this.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agobinman: Add support for calling mkimage
Simon Glass [Fri, 10 Jul 2020 00:39:31 +0000 (18:39 -0600)]
binman: Add support for calling mkimage

As a first step to integrating mkimage into binman, add a new entry type
that feeds data into mkimage for processing and incorporates that output
into the image.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agobinman: Set a default toolpath
Simon Glass [Fri, 10 Jul 2020 00:39:30 +0000 (18:39 -0600)]
binman: Set a default toolpath

When binman is run from 'make check' it is given a toolpath so that the
latest tools (e.g. mkimage) are used. When run manually with no toolpath,
it relies on the system mkimage. But this may be missing or old.

Make some effort to find the built-from-soruce version by looking in the
current directory and in the builds created by 'make check'.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agobinman: Specify the toolpath when running test coverage
Simon Glass [Fri, 10 Jul 2020 00:39:29 +0000 (18:39 -0600)]
binman: Specify the toolpath when running test coverage

At present binman's test coverage runs without a toolpath set. This means
that the system tools will be used. That may not be correct if they are
out of date or missing and this can result in a reduction in test coverage
below 100%.

Provide the toolpath to binman in this case.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agobinman: Correct the search patch for pylibfdt
Simon Glass [Fri, 10 Jul 2020 00:39:28 +0000 (18:39 -0600)]
binman: Correct the search patch for pylibfdt

Now that binman uses tools/ as its base directory for importing modules,
the path to the pylibfdt build by U-Boot is incorrect. Fix it with a new
path.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agobinman: cbfs: Fix IFWI typo
Simon Glass [Fri, 10 Jul 2020 00:39:27 +0000 (18:39 -0600)]
binman: cbfs: Fix IFWI typo

This comment references the wrong thing. Fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agobinman: Output errors to stderr
Simon Glass [Fri, 10 Jul 2020 00:39:26 +0000 (18:39 -0600)]
binman: Output errors to stderr

At present binman outputs errors to stdout which means that fails are
effectively silent when printed by buildman, for example. Fix this by
outputing errors to stderr.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years ago.gitignore: Ignore Python 3 cache directories
Simon Glass [Fri, 10 Jul 2020 00:39:25 +0000 (18:39 -0600)]
.gitignore: Ignore Python 3 cache directories

These can appear when moving between branches that have different tools
in the tree. Ignore them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agodm: core Fix long line in device_bind_common()
Simon Glass [Fri, 10 Jul 2020 00:39:24 +0000 (18:39 -0600)]
dm: core Fix long line in device_bind_common()

Fix an over-length line in this function.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agopatman: Add a -D option to enable debugging
Simon Glass [Mon, 6 Jul 2020 03:41:59 +0000 (21:41 -0600)]
patman: Add a -D option to enable debugging

Most users don't want to see traceback errors. Add an option to enable
them for debugging. Disable them by default.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agopatman: Support collecting response tags in Patchstream
Simon Glass [Mon, 6 Jul 2020 03:41:57 +0000 (21:41 -0600)]
patman: Support collecting response tags in Patchstream

Collect response tags such as 'Reviewed-by' while parsing the stream.
This allows us to see what tags are present.

Add a new 'Fixes' tag also, since this is now quite common.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agopatman: Allow disabling 'bright' mode with Print output
Simon Glass [Mon, 6 Jul 2020 03:41:56 +0000 (21:41 -0600)]
patman: Allow disabling 'bright' mode with Print output

At present all text is marked bright, which makes it stand out on the
terminal. Add a way to disable that, as is done with the Color class.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agopatman: Add a 'test' subcommand
Simon Glass [Mon, 6 Jul 2020 03:41:55 +0000 (21:41 -0600)]
patman: Add a 'test' subcommand

At present we use --test to indicate that tests should be run. It is
better to use a subcommand for list, like binman. Change it and adjust
the existing code to fit under a 'send' subcommand, the default.

Give this subcommand the same default arguments as the others.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agopatman: Allow different commands
Simon Glass [Mon, 6 Jul 2020 03:41:54 +0000 (21:41 -0600)]
patman: Allow different commands

At present patman only does one thing so does not have any comments. We
want to add a few more command, so create a sub-parser for the default
command ('send').

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agopatman: Convert to ArgumentParser
Simon Glass [Mon, 6 Jul 2020 03:41:53 +0000 (21:41 -0600)]
patman: Convert to ArgumentParser

Convert from OptionParser to ArgumentParser to match binman. With this we
can easily add sub-commands.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agopatman: Allow skipping patches at the end
Simon Glass [Mon, 6 Jul 2020 03:41:52 +0000 (21:41 -0600)]
patman: Allow skipping patches at the end

The -s option allows skipping patches at the top of the branch. Sometimes
there are commits at the bottom that need to be skipped. At present it is
necessary to count the number of commits and then use -c to tell patman
how many to process.

Add a -e option to easily skip a number of commits at the bottom of the
branch.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agopatman: Allow creating patches for another branch
Simon Glass [Mon, 6 Jul 2020 03:41:51 +0000 (21:41 -0600)]
patman: Allow creating patches for another branch

Add a -b option to allow patches to be created from a branch other than
the current one.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agopatman: Add a test that uses gitpython
Simon Glass [Mon, 6 Jul 2020 03:41:50 +0000 (21:41 -0600)]
patman: Add a test that uses gitpython

It is convenient to use gitpython to create a real git repo for testing
patman's operation. Add a test for this. So far it just checks that patman
produces the right number of patches for a branch.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agopatman: Move main code out to a control module
Simon Glass [Mon, 6 Jul 2020 03:41:49 +0000 (21:41 -0600)]
patman: Move main code out to a control module

To make testing easier, move the code out from main into a separate
'control' module and split it into four parts: setup, preparing patches,
checking patches and emailing patches.

Add comments and fix a few code-style issues while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agopatman: Use test_util to show test results
Simon Glass [Mon, 6 Jul 2020 03:41:48 +0000 (21:41 -0600)]
patman: Use test_util to show test results

This handles skipped tests correctly, so use it instead of the existing
code.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agoMerge https://gitlab.denx.de/u-boot/custodians/u-boot-x86
Tom Rini [Mon, 20 Jul 2020 13:25:32 +0000 (09:25 -0400)]
Merge https://gitlab.denx.de/u-boot/custodians/u-boot-x86

- dm: core: Don't show an ACPI warning if there is no ordering
- x86: Enhance MTRR functionality to support multiple CPUs

4 years agox86: mtrr: Enhance 'mtrr' command to list MTRRs on any CPU
Simon Glass [Fri, 17 Jul 2020 14:48:31 +0000 (08:48 -0600)]
x86: mtrr: Enhance 'mtrr' command to list MTRRs on any CPU

Update this command so it can list the MTRRs on a selected CPU. If
'-c all' is used, then all CPUs are listed.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Wolfgang Wallner <wolfgang.wallner@br-automation.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
4 years agox86: mp: Add more comments to the module
Simon Glass [Fri, 17 Jul 2020 14:48:30 +0000 (08:48 -0600)]
x86: mp: Add more comments to the module

Add a description of how this module works and also some missing function
comments.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Wolfgang Wallner <wolfgang.wallner@br-automation.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agox86: mtrr: Update 'mtrr' to allow setting MTRRs on any CPU
Simon Glass [Fri, 17 Jul 2020 14:48:29 +0000 (08:48 -0600)]
x86: mtrr: Update 'mtrr' to allow setting MTRRs on any CPU

Add a -c option to mtrr to allow any CPU to be updated with this command.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Wolfgang Wallner <wolfgang.wallner@br-automation.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agox86: mtrr: Restructure so command execution is in one place
Simon Glass [Fri, 17 Jul 2020 14:48:28 +0000 (08:48 -0600)]
x86: mtrr: Restructure so command execution is in one place

At present do_mtrr() does the 'list' subcommand at the top and the rest
below. Update it to do them all in the same place so we can (in a later
patch) add parsing of the CPU number for all subcommands.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Wolfgang Wallner <wolfgang.wallner@br-automation.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agox86: mtrr: Update the command to use the new mtrr calls
Simon Glass [Fri, 17 Jul 2020 14:48:27 +0000 (08:48 -0600)]
x86: mtrr: Update the command to use the new mtrr calls

Use the multi-CPU calls to set the MTRR values. This still supports only
the boot CPU for now.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Wolfgang Wallner <wolfgang.wallner@br-automation.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agox86: mtrr: Add support for writing to MTRRs on any CPU
Simon Glass [Fri, 17 Jul 2020 14:48:26 +0000 (08:48 -0600)]
x86: mtrr: Add support for writing to MTRRs on any CPU

To enable support for the 'mtrr' command, add a way to perform MTRR
operations on selected CPUs.

This works by setting up a little 'operation' structure and sending it
around the CPUs for action.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Wolfgang Wallner <wolfgang.wallner@br-automation.com>
4 years agox86: mtrr: Update MTRRs on all CPUs
Simon Glass [Fri, 17 Jul 2020 14:48:25 +0000 (08:48 -0600)]
x86: mtrr: Update MTRRs on all CPUs

When the boot CPU MTRRs are updated, perform the same update on all other
CPUs so they are kept in sync.

This avoids kernel warnings about mismatched MTRRs.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Wolfgang Wallner <wolfgang.wallner@br-automation.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agox86: coral: Update the memory map
Simon Glass [Fri, 17 Jul 2020 14:48:24 +0000 (08:48 -0600)]
x86: coral: Update the memory map

This currently excludes the temporary memory used to start up the APs.
Add it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Wolfgang Wallner <wolfgang.wallner@br-automation.com>
4 years agox86: Don't enable SMP in SPL
Simon Glass [Fri, 17 Jul 2020 14:48:23 +0000 (08:48 -0600)]
x86: Don't enable SMP in SPL

SMP should be set up in U-Boot where possible, not SPL. Disable it in SPL.
For 64-bit U-Boot we should find a way to allow SMP operations in U-Boot,
but this is somewhat more complicated. For now that is disabled too.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Wolfgang Wallner <wolfgang.wallner@br-automation.com>
4 years agox86: mtrr: Use MP calls to list the MTRRs
Simon Glass [Fri, 17 Jul 2020 14:48:22 +0000 (08:48 -0600)]
x86: mtrr: Use MP calls to list the MTRRs

Update the mtrr command to use mp_run_on_cpus() to obtain its information.
Since the selected CPU is the boot CPU this does not change the result,
but it sets the stage for supporting other CPUs.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Wolfgang Wallner <wolfgang.wallner@br-automation.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agox86: mp: Add iterators for CPUs
Simon Glass [Fri, 17 Jul 2020 14:48:21 +0000 (08:48 -0600)]
x86: mp: Add iterators for CPUs

It is convenient to iterate through the CPUs performing work on each one
and processing the result. Add a few iterator functions which handle this.
These can be used by any client code. It can call mp_run_on_cpus() on
each CPU that is returned, handling them one at a time.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Wolfgang Wallner <wolfgang.wallner@br-automation.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agox86: mp: Park CPUs before running the OS
Simon Glass [Fri, 17 Jul 2020 14:48:20 +0000 (08:48 -0600)]
x86: mp: Park CPUs before running the OS

With the new MP features the CPUs are no-longer parked when the OS is run.
Fix this by calling a special function to park them, just before the OS is
started.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Wolfgang Wallner <wolfgang.wallner@br-automation.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agox86: mp: Allow running functions on multiple CPUs
Simon Glass [Fri, 17 Jul 2020 14:48:19 +0000 (08:48 -0600)]
x86: mp: Allow running functions on multiple CPUs

Add a way to run a function on a selection of CPUs. This supports either
a single CPU, all CPUs, just the main CPU or just the 'APs', in Intel
terminology.

It works by writing into a mailbox and then waiting for the CPUs to notice
it, take action and indicate they are done.

When SMP is not yet enabled, this just calls the function on the main CPU.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Wolfgang Wallner <wolfgang.wallner@br-automation.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agox86: Set the SMP flag when MP init is complete
Simon Glass [Fri, 17 Jul 2020 14:48:18 +0000 (08:48 -0600)]
x86: Set the SMP flag when MP init is complete

Set this flag so we can track when it is safe to use CPUs other than the
main one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Wolfgang Wallner <wolfgang.wallner@br-automation.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agoglobal_data: Add a generic global_data flag for SMP state
Simon Glass [Fri, 17 Jul 2020 14:48:17 +0000 (08:48 -0600)]
global_data: Add a generic global_data flag for SMP state

Allow keeping track of whether all CPUs have been enabled yet. This allows
us to know whether other CPUs need to be considered when updating
CPU-specific settings such as MTRRs on x86.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Wolfgang Wallner <wolfgang.wallner@br-automation.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agox86: mp: Support APs waiting for instructions
Simon Glass [Fri, 17 Jul 2020 14:48:16 +0000 (08:48 -0600)]
x86: mp: Support APs waiting for instructions

At present the APs (non-boot CPUs) are inited once and then parked ready
for the OS to use them. However in some cases we want to send new requests
through, such as to change MTRRs and keep them consistent across CPUs.

Change the last state of the flight plan to go into a wait loop, accepting
instructions from the main CPU.

Drop cpu_map since it is not used.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Wolfgang Wallner <wolfgang.wallner@br-automation.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agox86: cpu: Remove unnecessary #ifdefs
Simon Glass [Fri, 17 Jul 2020 14:48:15 +0000 (08:48 -0600)]
x86: cpu: Remove unnecessary #ifdefs

Drop some #ifdefs that are not needed or can be converted to compile-time
checks.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Wolfgang Wallner <wolfgang.wallner@br-automation.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agox86: mp_init: Adjust bsp_init() to return more information
Simon Glass [Fri, 17 Jul 2020 14:48:14 +0000 (08:48 -0600)]
x86: mp_init: Adjust bsp_init() to return more information

This function is misnamed since it does not actually init the BSP. Also
it is convenient to adjust it to return a little more information.

Rename and update the function, to allow it to return the BSP CPU device
and number, as well as the total number of CPUs.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Wolfgang Wallner <wolfgang.wallner@br-automation.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agox86: mp_init: Set up the CPU numbers at the start
Simon Glass [Fri, 17 Jul 2020 14:48:13 +0000 (08:48 -0600)]
x86: mp_init: Set up the CPU numbers at the start

At present each CPU is given a number when it starts itself up. While this
saves a tiny amount of time by doing the device-tree read in parallel, it
is confusing that the numbering happens on the fly.

Move this code into mp_init() and do it at the start.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Wolfgang Wallner <wolfgang.wallner@br-automation.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agox86: mtrr: Fix 'ensable' typo
Simon Glass [Fri, 17 Jul 2020 14:48:12 +0000 (08:48 -0600)]
x86: mtrr: Fix 'ensable' typo

Fix a typo in the command help.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Wolfgang Wallner <wolfgang.wallner@br-automation.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agox86: mp_init: Drop the num_cpus static variable
Simon Glass [Fri, 17 Jul 2020 14:48:11 +0000 (08:48 -0600)]
x86: mp_init: Drop the num_cpus static variable

This does not need to be global across all functions in this file. Pass a
parameter instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Wolfgang Wallner <wolfgang.wallner@br-automation.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agox86: mp_init: Switch parameter names in start_aps()
Simon Glass [Fri, 17 Jul 2020 14:48:10 +0000 (08:48 -0600)]
x86: mp_init: Switch parameter names in start_aps()

These parameters are named differently from elsewhere in this file. Switch
them to avoid confusion.

Also add comments to this function.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Wolfgang Wallner <wolfgang.wallner@br-automation.com>
4 years agox86: mp_init: Avoid declarations in header files
Simon Glass [Fri, 17 Jul 2020 14:48:09 +0000 (08:48 -0600)]
x86: mp_init: Avoid declarations in header files

The functions used by the flight plan are declared in the header file but
are not used in any other file.

Move the flight plan steps down to just above where it is used so that we
can make these function static.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Wolfgang Wallner <wolfgang.wallner@br-automation.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agox86: Move MP code into mp_init
Simon Glass [Fri, 17 Jul 2020 14:48:08 +0000 (08:48 -0600)]
x86: Move MP code into mp_init

At present the 'flight plan' for CPUs is passed into mp_init. But it is
always the same. Move it into the mp_init file so everything is in one
place. Also drop the SMI function since it does nothing. If we implement
SMIs, more refactoring will be needed anyway.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Wolfgang Wallner <wolfgang.wallner@br-automation.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agox86: mp_init: Switch to livetree
Simon Glass [Fri, 17 Jul 2020 14:48:07 +0000 (08:48 -0600)]
x86: mp_init: Switch to livetree

Update this code to use livetree calls instead of flat-tree.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Wolfgang Wallner <wolfgang.wallner@br-automation.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agodm: core: Don't show an ACPI warning if there is no ordering
Simon Glass [Fri, 17 Jul 2020 14:49:25 +0000 (08:49 -0600)]
dm: core: Don't show an ACPI warning if there is no ordering

Some boards don't care about the ordering of ACPI code fragments. Change
the warning to a debug message.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
4 years agoMerge tag 'mips-pull-2020-07-18' of https://gitlab.denx.de/u-boot/custodians/u-boot...
Tom Rini [Sat, 18 Jul 2020 15:34:49 +0000 (11:34 -0400)]
Merge tag 'mips-pull-2020-07-18' of https://gitlab.denx.de/u-boot/custodians/u-boot-mips

- MIPS: refactor cache init and setup in start.S
- MIPS: sync asm header files with Linux 5.7
- MIPS: add initial support for Marvell Octeon MIPS64

4 years agomips: octeon: Add minimal Octeon 3 EBB7304 EVK support
Stefan Roese [Tue, 30 Jun 2020 10:08:58 +0000 (12:08 +0200)]
mips: octeon: Add minimal Octeon 3 EBB7304 EVK support

This patch adds very basic minimal support for the Marvell Octeon 3
CN73xx based EBB7304 EVK. Please note that the basic Octeon port does
not support DDR3/4 initialization yet. To still use U-Boot on with this
port, the L2 cache (4MiB) is used as RAM. This way, U-Boot can boot
to the prompt on this board.

Supported devices:
- UART
- reset
- CFI parallel NOR flash

Signed-off-by: Stefan Roese <sr@denx.de>
4 years agomips: octeon: use mips_mach_early_init() to copy to L2 cache
Stefan Roese [Tue, 30 Jun 2020 10:33:17 +0000 (12:33 +0200)]
mips: octeon: use mips_mach_early_init() to copy to L2 cache

This patch adds the code to copy itself from bootrom location to a
different location (TEXT_BASE) to the Octeon platform. Its used in
this case to copy the complete U-Boot image into L2 cache, which
greatly improves the bootup time - especially in regard to the
very long and complex DDR4 init code.

The Kconfig symbol CONFIG_MIPS_MACH_EARLY_INIT is enabled with this
patch for Octeon.

Signed-off-by: Stefan Roese <sr@denx.de>
4 years agomips: octeon: dts: Add Octeon 3 cn73xx base dtsi file
Stefan Roese [Tue, 30 Jun 2020 10:08:57 +0000 (12:08 +0200)]
mips: octeon: dts: Add Octeon 3 cn73xx base dtsi file

This patch adds the base dtsi file for the Octeon 3 cn73xx SoC.

Signed-off-by: Stefan Roese <sr@denx.de>
4 years agomips: octeon: Initial minimal support for the Marvell Octeon SoC
Aaron Williams [Tue, 30 Jun 2020 10:08:56 +0000 (12:08 +0200)]
mips: octeon: Initial minimal support for the Marvell Octeon SoC

This patch adds very basic support for the Octeon III SoCs. Only
CFI parallel NOR flash and UART is supported for now.

Please note that the basic Octeon port does not include the DDR3/4
initialization yet. This will be added in some follow-up patches
later. To still use U-Boot on with this port, the L2 cache (4MiB on
Octeon III CN73xx) is used as RAM. This way, U-Boot can boot to the
prompt on such boards.

Signed-off-by: Aaron Williams <awilliams@marvell.com>
Signed-off-by: Stefan Roese <sr@denx.de>
4 years agosysreset: Add Octeon sysreset driver
Stefan Roese [Tue, 30 Jun 2020 10:08:55 +0000 (12:08 +0200)]
sysreset: Add Octeon sysreset driver

This patch adds a UCLASS_SYSRESET sysreset driver for the Octeon SoC
family.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
4 years agomips: Add CONFIG_MIPS_MACH_EARLY_INIT for very early mach init code
Stefan Roese [Tue, 30 Jun 2020 10:33:16 +0000 (12:33 +0200)]
mips: Add CONFIG_MIPS_MACH_EARLY_INIT for very early mach init code

This patch adds the optional call to mips_mach_early_init() to start.S
at a very early stage. Its disabled per default. It can be used for
very early machine / platform specific init code.  Its called very
early and at this stage the PC is allowed to differ from the linking
address (CONFIG_TEXT_BASE) as no absolute jump has been performed until
this call.

It will be used by thje Octeon platform.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
4 years agomips: sync asm/mipsregs.h with Linux 5.7
Daniel Schwierzeck [Sat, 11 Jul 2020 23:46:18 +0000 (01:46 +0200)]
mips: sync asm/mipsregs.h with Linux 5.7

Sync asm/mipsregs.h with Linux 5.7. Also replace the custom
symbols EBASE_CPUNUM and EBASE_WG with the according symbols
from Linux.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Tested-by: Stefan Roese <sr@denx.de>
4 years agomips: sync asm/addrspace.h with Linux 5.7
Daniel Schwierzeck [Sat, 11 Jul 2020 23:46:17 +0000 (01:46 +0200)]
mips: sync asm/addrspace.h with Linux 5.7

Sync asm/addrspace.h with Linux 5.7

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Tested-by: Stefan Roese <sr@denx.de>
4 years agomips: sync asm/asm.h with Linux 5.7
Daniel Schwierzeck [Sat, 11 Jul 2020 23:46:16 +0000 (01:46 +0200)]
mips: sync asm/asm.h with Linux 5.7

Sync asm/asm.h with Linux 5.7.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Tested-by: Stefan Roese <sr@denx.de>
4 years agomips: remove deprecated UNCACHED_SDRAM() macro
Daniel Schwierzeck [Sat, 11 Jul 2020 23:46:15 +0000 (01:46 +0200)]
mips: remove deprecated UNCACHED_SDRAM() macro

This macro only served as a wrapper for CKSEG1ADDR() with an
exception for CONFIG_TB0229. CONFIG_TB0229 doesn't exist, thus
use CKSEG1ADDR() directly.

This also prepares for an upcoming asm header sync with Linux.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Tested-by: Stefan Roese <sr@denx.de>
4 years agomips: add config options for generic cache setup code
Daniel Schwierzeck [Sat, 11 Jul 2020 22:45:57 +0000 (00:45 +0200)]
mips: add config options for generic cache setup code

Add an own Kconfig symbol for the initial disabling of caches
invoked from generic start code.

Also add an own Kconfig symbols for the initialization of caches
invoked from generic start code.

Until now both code paths could only be disabled with
CONFIG_SKIP_LOWLEVEL_INIT. But this is not flexible enough for
RAM boot scenarios like EJTAG or SPL payload or for machines
which don't require cache initialization or which want to
provide their own cache implementation.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Tested-by: Stefan Roese <sr@denx.de>
4 years agomips: refactor disabling of caches
Daniel Schwierzeck [Sat, 11 Jul 2020 22:45:56 +0000 (00:45 +0200)]
mips: refactor disabling of caches

Logically this code belongs to cache_init.S.

If a complex SoC needs to replace the generic cache init,
mips_cache_disable() can now be called from custom start.S files.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Tested-by: Stefan Roese <sr@denx.de>
4 years agomips: add KSEG1 wrapper for change_k0_cca
Daniel Schwierzeck [Sat, 11 Jul 2020 22:45:55 +0000 (00:45 +0200)]
mips: add KSEG1 wrapper for change_k0_cca

change_k0_cca() is called multiple times. Move the code for
changing to KSEG1 to a macro to avoid code duplication.

Also fix missing change to KSEG1 when changing to CONF_CM_CACHABLE_COW.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Tested-by: Stefan Roese <sr@denx.de>
4 years agomips: start.S: remove dead code
Daniel Schwierzeck [Sat, 11 Jul 2020 22:45:54 +0000 (00:45 +0200)]
mips: start.S: remove dead code

Since commit 703ec9ddf965 ("MIPS: Stop building position independent code")
the relocation code was completely reworked and removed from start.S.
Remove some left-overs of the old code.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Tested-by: Stefan Roese <sr@denx.de>
4 years agomips: cache: Make invalidate_dcache_range() weak to enable overwrite
Stefan Roese [Tue, 30 Jun 2020 10:33:19 +0000 (12:33 +0200)]
mips: cache: Make invalidate_dcache_range() weak to enable overwrite

This patch adds __weak to invalidate_dcache_range() in lib/cache.c. This
makes it possible to overwrite this function by a platforms specific
version, which will be done for Octeon.

Signed-off-by: Stefan Roese <sr@denx.de>
4 years agomips: cache: Make flush_cache() weak to enable overwrite
Stefan Roese [Thu, 14 May 2020 09:59:04 +0000 (11:59 +0200)]
mips: cache: Make flush_cache() weak to enable overwrite

This patch adds __weak to flush_cache() in lib/cache.c. This makes it
possible to overwrite this function by a platforms specific version,
like done with the Octeon base port.

Signed-off-by: Stefan Roese <sr@denx.de>
4 years agomips: cache: Allow using CONFIG_MIPS_L2_CACHE without CONFIG_MIPS_CM
Stefan Roese [Thu, 14 May 2020 09:59:03 +0000 (11:59 +0200)]
mips: cache: Allow using CONFIG_MIPS_L2_CACHE without CONFIG_MIPS_CM

This patch enables the usage of CONFIG_MIPS_L2_CACHE without
CONFIG_MIPS_CM, which is what is needed for the newly added Octeon
platform.

Signed-off-by: Stefan Roese <sr@denx.de>
4 years agomips: reloc: Change R_MIPS_NONE to catch pre-reloc BSS usage
Stefan Roese [Fri, 5 Jun 2020 08:29:25 +0000 (10:29 +0200)]
mips: reloc: Change R_MIPS_NONE to catch pre-reloc BSS usage

This patch changes the R_MIPS_NONE define from 0 to a magic value. This
makes it possible to better detect any forbidden pre-relocation usage
of BSS variables, as they are often zero'ed and then relocation is
stopped too early.

Additionally the error message is improved to also print the faulting
address. This helps finding the root-cause for this breakage by
comparing this address with the values in System.map.

This patch helps a lot when working on pre-relocation code, like the
Octeon DDR init code, where such variables have hit me multiple times
now.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: Aaron Williams <awilliams@marvell.com>
Cc: Chandrakala Chavva <cchavva@marvell.com>
4 years agomips: traps: Set WG bit in EBase register on Octeon
Stefan Roese [Thu, 14 May 2020 09:59:06 +0000 (11:59 +0200)]
mips: traps: Set WG bit in EBase register on Octeon

WG (bit 11) needs to be set on Octeon to enable writing bits 63:30 of
the exception base register.

Signed-off-by: Stefan Roese <sr@denx.de>
4 years agomips: time: Only compile the weak get_tbclk() when needed
Stefan Roese [Thu, 14 May 2020 09:59:05 +0000 (11:59 +0200)]
mips: time: Only compile the weak get_tbclk() when needed

This patch opts-out the compilation of get_tbclk() if
CONFIG_SYS_MIPS_TIMER_FREQ is not defined. This is used on the Octeon
platform, where the weak get_tbclk() function is overwritten by its
platform specific one.

Signed-off-by: Stefan Roese <sr@denx.de>
4 years agoMerge branch '2020-07-17-misc-fixes'
Tom Rini [Fri, 17 Jul 2020 20:08:54 +0000 (16:08 -0400)]
Merge branch '2020-07-17-misc-fixes'

A large number of assorted fixes, including but not limited to:
- Correct fixdep and CONFIG_IS_ENABLED(...)
- lz4 on big endian
- Assorted LMB hardening
- Remove bd_t typedef

4 years agoinclude: pci_ids: Add Cavium devices
Suneel Garapati [Fri, 17 Jul 2020 06:06:22 +0000 (08:06 +0200)]
include: pci_ids: Add Cavium devices

Add VendorID and DeviceID for supported devices on OcteonTX/TX2
platforms.

Signed-off-by: Suneel Garapati <sgarapati@marvell.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
4 years agodoc: fit: Write hex address as hex instead of int
Michal Simek [Wed, 15 Jul 2020 13:10:17 +0000 (15:10 +0200)]
doc: fit: Write hex address as hex instead of int

When update_uboot.its is used directly there is syntax error for no reason.

Error report:
mkimage -f update_uboot.its boot
Error: update_uboot.its:18.12-13 syntax error
FATAL ERROR: Unable to parse input tree
mkimage: Can't read boot.tmp: Invalid argument

Fixes: 4bae90904b69 ("Automatic software update from TFTP server")
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
4 years agomtd: mtdpart: use uint64_t instead of int for cur_off
Martin Kaistra [Mon, 13 Jul 2020 12:40:02 +0000 (14:40 +0200)]
mtd: mtdpart: use uint64_t instead of int for cur_off

The types of "offset" and "size" of "struct mtd_partition" are uint64_t,
while mtd_parse_partitions() uses int to work with these values. When
the offset reaches 2GB, it is interpreted as a negative value, which
leads to error messages like

mtd: partition "<partition name>" is out of reach -- disabled

eg. when using the "ubi part" command.

Fix this by using uint64_t for cur_off and cur_sz.

Signed-off-by: Martin Kaistra <martin.kaistra@linutronix.de>
Reviewed-by: Kurt Kanzenbach <kurt@linutronix.de>
Reviewed-by: Heiko Schocher <hs@denx.de>
4 years agoboard/km: update MAINTAINERS email
Holger Brunck [Thu, 9 Jul 2020 15:31:23 +0000 (17:31 +0200)]
board/km: update MAINTAINERS email

Signed-off-by: Holger Brunck <holger.brunck@hitachi-powergrids.com>
CC: Valentin Longchamp <valentin.longchamp@hitachi-powergrids.com>
4 years agodoc: correct description of crash dumps
Heinrich Schuchardt [Thu, 9 Jul 2020 06:12:06 +0000 (08:12 +0200)]
doc: correct description of crash dumps

Correct the description of the ESR register.

Fix a typo.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agofixdep: fix CONFIG_IS_ENABLED etc. handling
Stephen Warren [Wed, 8 Jul 2020 21:45:56 +0000 (15:45 -0600)]
fixdep: fix CONFIG_IS_ENABLED etc. handling

When fixdep detects CONFIG_IS_ENABLED and other similar macros, it must
parse the macro parameter to determine which actual CONFIG_ option is
being referenced. This involves moving a pointer forward through the
entire CONFIG_ option "word". Currently, the code uses variable q to walk
through the word, but doesn't actually initialize it to point at the
parameter before doing so. Consequently, the walking process immediately
fails since it sees the macro invocatoins's ( rather than the expected
alpha-numeric characters in the macro parameter. Fix this by adding the
missing initialization.

Fixes: 67f2ee86ccbe ("kbuild: fixdep: Resync this with v4.17")
Fixes: 7012865e961c ("gpio: fix test.py for gpio label lookup")
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agomkimage: Fix error message if write less data then expected
Mylène Josserand [Wed, 8 Jul 2020 09:52:50 +0000 (11:52 +0200)]
mkimage: Fix error message if write less data then expected

Add a new error message in case the size of data written
are shorter than the one expected.

Currently, it will lead to the following error message:

"mkimage: Write error on uImage: Success"

This is not explicit when the error is because the device
doesn't have enough space. Let's use a more understandable message:

"mkimage: Write only 4202432/4682240 bytes, probably no space left on the device"

Signed-off-by: Mylène Josserand <mylene.josserand@collabora.com>
Reviewed-by: Walter Lozano <walter.lozano@collabora.com>
4 years agoremove include/config_defaults.h
Rasmus Villemoes [Tue, 7 Jul 2020 08:40:26 +0000 (10:40 +0200)]
remove include/config_defaults.h

Since commit 4b0bcfa7c4ec (Kconfig: Migrate CONFIG_BOOTM_* options),
the config_defaults.h file has been void of any actual content - and
these days, "sane defaults for everyone" is achieved by appropriate
default values in Kconfig. Remove it, and thus make every translation
unit process one less header file.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
4 years agodoc: multi-dtb-fit: Remove double underscores
Fabio Estevam [Sun, 5 Jul 2020 22:04:50 +0000 (19:04 -0300)]
doc: multi-dtb-fit: Remove double underscores

Remove the incorrect usage of double underscores for the
CONFIG_OF_LIST and CONFIG_SPL_OF_LIST symbols.

Signed-off-by: Fabio Estevam <festevam@gmail.com>
4 years agofs: error handling in do_load()
Heinrich Schuchardt [Mon, 29 Jun 2020 18:08:49 +0000 (20:08 +0200)]
fs: error handling in do_load()

If a file cannot be loaded, show an error message.
Set the EFI boot device only after successfully loading a file.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agoasm/u-boot.h: remove bd_t definitions
Masahiro Yamada [Fri, 26 Jun 2020 06:13:35 +0000 (15:13 +0900)]
asm/u-boot.h: remove bd_t definitions

All the users of bd_t were converted to struct bd_info.

Remove the definitions.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
4 years agotreewide: convert bd_t to struct bd_info manually
Masahiro Yamada [Fri, 26 Jun 2020 06:13:34 +0000 (15:13 +0900)]
treewide: convert bd_t to struct bd_info manually

Some code was not converted by coccinelle, somehow.

I manually fixed up the remaining, and comments, README docs.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
[trini: Add arch/arm/mach-davinci/include/mach/sdmmc_defs.h and
        include/fdt_support.h]
Signed-off-by: Tom Rini <trini@konsulko.com>
4 years agotreewide: convert bd_t to struct bd_info by coccinelle
Masahiro Yamada [Fri, 26 Jun 2020 06:13:33 +0000 (15:13 +0900)]
treewide: convert bd_t to struct bd_info by coccinelle

The Linux coding style guide (Documentation/process/coding-style.rst)
clearly says:

  It's a **mistake** to use typedef for structures and pointers.

Besides, using typedef for structures is annoying when you try to make
headers self-contained.

Let's say you have the following function declaration in a header:

  void foo(bd_t *bd);

This is not self-contained since bd_t is not defined.

To tell the compiler what 'bd_t' is, you need to include <asm/u-boot.h>

  #include <asm/u-boot.h>
  void foo(bd_t *bd);

Then, the include direcective pulls in more bloat needlessly.

If you use 'struct bd_info' instead, it is enough to put a forward
declaration as follows:

  struct bd_info;
  void foo(struct bd_info *bd);

Right, typedef'ing bd_t is a mistake.

I used coccinelle to generate this commit.

The semantic patch that makes this change is as follows:

  <smpl>
  @@
  typedef bd_t;
  @@
  -bd_t
  +struct bd_info
  </smpl>

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
4 years agoarm64: Remove CONFIG_SYS_FULL_VA macro
Michal Simek [Thu, 25 Jun 2020 07:26:57 +0000 (09:26 +0200)]
arm64: Remove CONFIG_SYS_FULL_VA macro

All configurations have been removed in 2016 by commit 7985cdf74b28
("arm64: Remove non-full-va map code").

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
4 years agoMakefile: Silence relocate-rela call
Jan Kiszka [Thu, 25 Jun 2020 06:39:45 +0000 (08:39 +0200)]
Makefile: Silence relocate-rela call

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
4 years agolib: zlib: Remove offset pointer optimization in inftrees.c
Chin Liang See [Wed, 24 Jun 2020 08:31:08 +0000 (16:31 +0800)]
lib: zlib: Remove offset pointer optimization in inftrees.c

This fixes the CVE-2016-9840. Commit imported from [1].

inftrees.c was subtracting an offset from a pointer to an array,
in order to provide a pointer that allowed indexing starting at
the offset. This is not compliant with the C standard, for which
the behavior of a pointer decremented before its allocated memory
is undefined. Per the recommendation of a security audit of the
zlib code by Trail of Bits and TrustInSoft, in support of the
Mozilla Foundation, this tiny optimization was removed, in order
to avoid the possibility of undefined behavior.

[1]: https://github.com/madler/zlib/commit/6a043145ca6e9c55184013841a67b2fef87e44c0

Signed-off-by: Mark Adler <madler@alumni.caltech.edu>
Signed-off-by: Chin Liang See <chin.liang.see@intel.com>
Signed-off-by: Ley Foon Tan <ley.foon.tan@intel.com>
4 years agoConvert CONFIG_ARMV7_PSCI_1_0 and CONFIG_ARMV7_PSCI_0_2 to Kconfig
Patrick Delaunay [Wed, 17 Jun 2020 16:19:18 +0000 (18:19 +0200)]
Convert CONFIG_ARMV7_PSCI_1_0 and CONFIG_ARMV7_PSCI_0_2 to Kconfig

This converts the following to Kconfig:
CONFIG_ARMV7_PSCI_1_0
CONFIG_ARMV7_PSCI_0_2

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agospl: fix ext4fs_mount return code handling
Thomas Schaefer [Tue, 16 Jun 2020 20:03:52 +0000 (22:03 +0200)]
spl: fix ext4fs_mount return code handling

- Despite other ext4 filesystem functions, ext4fs_mount returns
  0 in case of error.
- This leads to u-boot crash in case that an SD card
  with valid partition table but without ext4 filesystem created
  in a partition is found on SD card.
- Fix this by returning a proper error code of '-1' from spl_load_image_ext
  function in case of ext4fs_mount error.

Signed-off-by: Thomas Schaefer <thomas.schaefer@kontron.com>
[hthiery: slightly reword the commit message]
Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
4 years agocmd: booti: convert the debug print about image move to printf
Tero Kristo [Fri, 12 Jun 2020 12:41:21 +0000 (15:41 +0300)]
cmd: booti: convert the debug print about image move to printf

Moving of the OS image may have some nasty side effects like corrupting
DTB. Convert the current debug print to printf so that the relocation of
the OS is always obvious to the user.

Signed-off-by: Tero Kristo <t-kristo@ti.com>
4 years agocommon: bootm: add checks to verify if ramdisk / fdtimage overlaps OS image
Tero Kristo [Fri, 12 Jun 2020 12:41:20 +0000 (15:41 +0300)]
common: bootm: add checks to verify if ramdisk / fdtimage overlaps OS image

These cases are typically fatal and are difficult to debug for random
users. Add checks for detecting overlapping images and abort if overlap
is detected.

Signed-off-by: Tero Kristo <t-kristo@ti.com>
4 years agoimage: fdt: bail out with error if no boot time FDT image found
Tero Kristo [Fri, 12 Jun 2020 12:41:19 +0000 (15:41 +0300)]
image: fdt: bail out with error if no boot time FDT image found

Currently the boot continues if the FDT image is clearly corrupted,
which just causes the loaded OS to hang. Abort boot properly if the FDT
is corrupted.

Signed-off-by: Tero Kristo <t-kristo@ti.com>
4 years agoConvert CONFIG_MXC_UART to Kconfig
Tom Rini [Tue, 9 Jun 2020 14:46:46 +0000 (10:46 -0400)]
Convert CONFIG_MXC_UART to Kconfig

This converts the following to Kconfig:
   CONFIG_MXC_UART

Signed-off-by: Tom Rini <trini@konsulko.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
4 years agolz4: fix decompressor on big-endian powerpc
Rasmus Villemoes [Sun, 7 Jun 2020 12:29:18 +0000 (14:29 +0200)]
lz4: fix decompressor on big-endian powerpc

Booting an lz4-compressed kernel image fails on our powerpc board with
-EPROTONOSUPPORT. Adding a bit of debug prints, we get

  magic: 0x184d2204
  flags: 0x64
  reserved0: 1
  has_content_checksum: 1
  has_content_size: 0
  has_block_checksum: 0
  independent_blocks: 1
  version: 0
  block_descriptor: 70
  reserved1: 7
  max_block_size: 0
  reserved2: 0

So the magic is ok, but the version check fails, also some reserved
bits are apparently set. But that's because the code interprets the
"flags" and "block_descriptor" bytes wrongly:

Using bit-fields to access individual bits of an "on the wire" format
is not portable, not even when restricted to the C flavour implemented
by gcc. Quoting the gcc manual:

   * 'The order of allocation of bit-fields within a unit (C90 6.5.2.1,
     C99 and C11 6.7.2.1).'

     Determined by ABI.

and indeed, the PPC Processor ABI supplement says

   * Bit-fields are allocated from right to left (least to most
     significant) on Little-Endian implementations and from left to
     right (most to least significant) on Big-Endian implementations.

The upstream code (github.com/lz4/lz4) uses explicit shifts and masks
for encoding/decoding:

    /* FLG Byte */
    *dstPtr++ = (BYTE)(((1 & _2BITS) << 6)    /* Version('01') */
        + ((cctxPtr->prefs.frameInfo.blockMode & _1BIT ) << 5)
        + ((cctxPtr->prefs.frameInfo.blockChecksumFlag & _1BIT ) << 4)
        + ((unsigned)(cctxPtr->prefs.frameInfo.contentSize > 0) << 3)
        + ((cctxPtr->prefs.frameInfo.contentChecksumFlag & _1BIT ) << 2)
        +  (cctxPtr->prefs.frameInfo.dictID > 0) );

    /* Flags */
    {   U32 const FLG = srcPtr[4];
        U32 const version = (FLG>>6) & _2BITS;
        blockChecksumFlag = (FLG>>4) & _1BIT;
        blockMode = (FLG>>5) & _1BIT;
        contentSizeFlag = (FLG>>3) & _1BIT;
        contentChecksumFlag = (FLG>>2) & _1BIT;
        dictIDFlag = FLG & _1BIT;
        /* validate */
        if (((FLG>>1)&_1BIT) != 0) return err0r(LZ4F_ERROR_reservedFlag_set); /* Reserved bit */
        if (version != 1) return err0r(LZ4F_ERROR_headerVersion_wrong);        /* Version Number, only supported value */
    }

Do the same here, and while at it, be more careful to use unaligned
accessors to what is most likely unaligned. Also update the comment to
make it clear that it only refers to the lz4.c file, not the following
code of lz4_wrapper.c.

This has been tested partly, of course, by seeing that my
lz4-compressed kernel now boots, partly by running the (de)compression
test-suite in the (x86_64) sandbox - i.e., it should still work just
fine on little-endian hosts.

Reviewed-by: Julius Werner <jwerner@chromium.org>
Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
4 years agodoc: Coccinelle: move to HTML doc
Heinrich Schuchardt [Fri, 5 Jun 2020 03:13:44 +0000 (05:13 +0200)]
doc: Coccinelle: move to HTML doc

Move doc/README.coccinelle to doc/develop/coccinelle.rst using the current
linux-next version of the text.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>