Commit Graph

726 Commits

Author SHA1 Message Date
Miquel Raynal
1922df2010 tpm: add TPM2_Startup command support
Add support for the TPM2_Startup command.

Change the command file and the help accordingly.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2018-05-25 20:12:57 -04:00
Miquel Raynal
ff32245bb3 tpm: prepare support for TPMv2.x commands
Choice between v1 and v2 compliant functions is done with the
configuration.

Create the various files that will receive TPMv2-only code on the same
scheme as for the TPMv1 code.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2018-05-25 20:12:55 -04:00
Miquel Raynal
d677bfe2f7 tpm: disociate TPMv1.x specific and generic code
There are no changes in this commit but a new organization of the code
as follow.

* cmd/ directory:
        > move existing code from cmd/tpm.c in cmd/tpm-common.c
	> move specific code in cmd/tpm-v1.c
	> create a specific header file with generic definitions for
	  commands only called cmd/tpm-user-utils.h

* lib/ directory:
        > move existing code from lib/tpm.c in lib/tpm-common.c
	> move specific code in lib/tpm-v1.c
	> create a specific header file with generic definitions for
	  the library itself called lib/tpm-utils.h

* include/ directory:
        > move existing code from include/tpm.h in include/tpm-common.h
	> move specific code in include/tpm-v1.h

Code designated as 'common' is compiled if TPM are used. Code designated
as 'specific' is compiled only if the right specification has been
selected.

All files include tpm-common.h.
Files in cmd/ include tpm-user-utils.h.
Files in lib/ include tpm-utils.h.
Depending on the specification, files may include either (not both)
tpm-v1.h or tpm-v2.h.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
[trini: Fix a few more cases of tpm.h -> tpm-v1.h, some Kconfig logic]
Signed-off-by: Tom Rini <trini@konsulko.com>
2018-05-25 20:12:55 -04:00
Miquel Raynal
9f9ce3c369 tpm: prepare introduction of TPMv2.x support in Kconfig
Because both major revisions are not compatible at all, let's make them
mutually exclusive in Kconfig. This way we will be sure, when using a
command or a library function that it is supported by the right
revision.

Current drivers are currently prefixed by "tpm_", we will prefix TPMv2.x
files by "tpm2_" to make the distinction without moving everything.

The Kconfig menu about TPM drivers is now divided into two sections, one
for each specification. Compliant drivers with one specification will
only show up if this specification _only_ has been selected, otherwise a
comment is displayed.

Once a driver is selected by the user, it selects automatically a
boolean value, that is needed in order to activate the TPM commands.
Selecting the TPM commands will automatically select the right
command/library files.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
[trini: Rework deps as TPM_V1 and TPM_V2 depend on TPM,
        drop TPM_DRIVER_SELECTED]
Signed-off-by: Tom Rini <trini@konsulko.com>
2018-05-25 20:12:33 -04:00
Miquel Raynal
c617918764 tpm: align arguments with open parenthesis
Fix following checkpatch.pl issue in TPM-related code:

    CHECK: Alignment should match open parenthesis

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2018-05-25 08:12:40 -04:00
Miquel Raynal
b9804e5bf3 tpm: substitute deprecated uint<x>_t types with their u<x> equivalent
Fix following checkpatch.pl issues in TPM-related code:

    CHECK: Prefer kernel type 'u8' over 'uint8_t'
    CHECK: Prefer kernel type 'u16' over 'uint16_t'
    CHECK: Prefer kernel type 'u32' over 'uint32_t'

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2018-05-25 08:12:40 -04:00
Alex Kiernan
b11ed7d602 bootcount: Add bootcount command
Add a command to manipulate the bootcounter. This is useful if you can
run device recovery from inside U-Boot and need to reset the bootcounter
after executing that process as part of altbootcmd.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
2018-05-23 17:30:05 -04:00
Alex Kiernan
5a7b11e65a Convert CONFIG_SUPPORT_EMMC_RPMB to Kconfig
Convert CONFIG_SUPPORT_EMMC_RPMB to Kconfig. Split the command handling
from the underlying support and expose this through CMD_MMC_RPMB.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
2018-05-23 17:30:02 -04:00
Lukasz Majewski
d4505c8e0d pmic: Rewrite the pmic command to not only work with single byte transmission
Up till now it was only possible to use 'pmic' command with a single byte
transmission.
The pmic_read|write functions has been replaced with ones, which don't need
the transmission length as a parameter.

Due to that it is possible now to read data from PMICs transmitting more
data than 1 byte at once (e.g. mc34708)

Signed-off-by: Lukasz Majewski <lukma@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
2018-05-18 08:27:26 +02:00
Chris Packham
9b23c73d5e net: Add Kconfig option for BOOTP_NTPSERVER
Add a Kconfig option for BOOTP_NTPSERVER to enable the DHCP/BOOTP option
to configure the sntp server address.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
2018-05-14 21:28:38 -04:00
Tom Rini
f739fcd831 SPDX: Convert a few files that were missed before
As part of the main conversion a few files were missed.  These files had
additional whitespace after the '*' and before the SPDX tag and my
previous regex was too strict.  This time I did a grep for all SPDX tags
and then filtered out anything that matched the correct styles.

Fixes: 83d290c56f ("SPDX: Convert all of our single license tags to Linux Kernel style")
Reported-by: Heinrich Schuchardt <xypron.debian@gmx.de>
Signed-off-by: Tom Rini <trini@konsulko.com>
2018-05-10 20:38:35 -04:00
Neil Armstrong
051ebe3228 cmd: add ADC cli commands
Add an 'adc' cli command to get information from adc devices and to read
"single shot" data.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
2018-05-08 18:50:23 -04:00
Michalis Pappas
666028fc7c arm64: Add SMC and HVC commands
This patch adds smc and hvc commands, that allow issuing Secure Monitor
Calls and Hypervisor Calls conforming to the ARM SMC Calling Convention.

Add Kconfig items to allow each command can be individually enabled.

Signed-off-by: Michalis Pappas <mpappas@fastmail.fm>
Reviewed-by: Simon Glass <sjg@chromium.org>
2018-05-08 09:07:35 -04:00
Jassi Brar
732bc7ce3f mmc: support writing sparse images
Provide an alternate path for sparse-images to be
written to MMC. For example, via tftp on platforms
that don't support fastboot protocol. Or when an
image is to written at some offset, rather than the
start of a partition.

Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
[trini: Guard with CONFIG_FASTBOOT_FLASH tests, use LBAF for lbaint_t
        printing]
Signed-off-by: Tom Rini <trini@konsulko.com>
2018-05-08 09:06:33 -04:00
Michal Simek
4bbd6b1d94 arm: v7R: Add initial support
The Cortex-R* processors are a mid-range CPUs for use in deeply-embedded,
real-time systems. It implements the ARMv7-R architecture, and includes
Thumb-2 technology for optimum code density and processing throughput.

Except for MPU(Memory Protection Unit) and few CP15 registers, most of the
features are compatible with v7 architecture. So,reuse the same armv7
folder and introduce a new config CPU_V7R in order to differentiate
from v7 based platforms.

Tested-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
2018-05-07 15:53:28 -04:00
Lokesh Vutla
acf1500138 arm: v7: Kconfig: Rename CPU_V7 as CPU_V7A
Currently CPU_V7 kconfig symbol supports only ARMv7A architectures under
armv7 folder. This led to a misconception of creating separate folders
for armv7m and armv7r. There is no reason to create separate folder for
other armv7 based architectures when it can co-exist with few Kconfig
symbols.

As a first step towards a common folder, rename CPU_V7 as CPUV7A. Later
separate Kconfig symbols can be added for CPU_V7R and CPU_V7M and
can co exist in the same folder.

Reviewed-by: Tom Rini <trini@konsulko.com>
Tested-by: Michal Simek <michal.simek@xilinx.com>
Suggested-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
2018-05-07 15:53:24 -04:00
Tom Rini
83d290c56f SPDX: Convert all of our single license tags to Linux Kernel style
When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from.  So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry.  Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents.  There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>
2018-05-07 09:34:12 -04:00
Heinrich Schuchardt
83a1f933d1 cmd: CONFIG_CMD_LOG select CONFIG_LOG
CONFIG_CMD_LOG without CONFIG_LOG leads to a build error:
‘gd_t {aka volatile struct global_data}’ has no member named
‘default_log_level’

So CMD_LOG should select LOG.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
2018-04-28 10:42:35 -04:00
Tom Rini
d024236e5a Remove unnecessary instances of DECLARE_GLOBAL_DATA_PTR
We have a large number of places where while we historically referenced
gd in the code we no longer do, as well as cases where the code added
that line "just in case" during development and never dropped it.

Signed-off-by: Tom Rini <trini@konsulko.com>
2018-04-27 14:54:48 -04:00
Adam Ford
f1b1f77060 Convert CONFIG_SPI to Kconfig
This converts the following to Kconfig:
   CONFIG_SPI

This partly involves updating code that assumes that CONFIG_SPI implies
things that are specific to the MPC8xx SPI driver.  For now, just update
the CONFIG tests.  This also involves reworking the default for
CONFIG_SYS_DEF_EEPROM_ADDR so that we don't set it when we cannot make a
reasonable default, as it does not cause any compile failures.

Signed-off-by: Adam Ford <aford173@gmail.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
2018-04-27 14:54:11 -04:00
Michal Simek
ebc675b98d cmd: clk: Check return value from soc_clk_dump
In case of error in soc_clk_dump function are returned different values
then CMD return values (-1, 0, 1).

For example:
ZynqMP> clk dump
exit not allowed from main input shel

The patch is checking all negative return values and return
CMD_RET_FAILURE which is proper reaction for these cases.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
2018-04-23 13:15:32 +02:00
Bin Meng
79c584e559 bootvx: x86: Assign bootaddr based on kernel memory base
On VxWorks x86 its bootline address is at a pre-defined offset @
0x1200. If 'bootaddr' is not passed via environment variable, we
assign its value based on the kernel memory base address.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
2018-04-16 22:38:53 +08:00
Bin Meng
ced71a2f72 bootvx: Exit if bootline address is not specified
Exit the 'bootvx' command if bootline address is not specified.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
2018-04-16 22:38:53 +08:00
Bin Meng
7824ad6ad4 bootvx: Refactor the bootline copy codes a little bit
There is a small duplication in do_bootvx() that does the bootline
copy. Refactor this a little bit to make it simpler.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2018-04-16 22:38:52 +08:00
Bin Meng
447ae4f7ad bootvx: x86: Make VxWorks EFI console driver happy
When booting from EFI BIOS, VxWorks bootloader stores the EFI GOP
framebuffer info at a pre-defined offset @ 0x6100. When VxWorks
kernel boots up, its EFI console driver tries to find such a block
and if the signature matches, the framebuffer information will be
used to initialize the driver.

However it is not necessary to prepare an EFI environment for
VxWorks's EFI console driver to function (eg: EFI loader in
U-Boot). If U-Boot has already initialized the graphics card and
set it to a VESA mode that is compatible with EFI GOP, we can
simply prepare such a block for VxWorks.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2018-04-16 22:38:52 +08:00
Bin Meng
839c4e9c5b elf: Add a very simple ELF64 loader
This adds a very simple ELF64 loader via program headers, similar
to load_elf_image_phdr() that we already have.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2018-04-16 16:54:51 +08:00
Bin Meng
45519924a0 x86: Rename e820entry to e820_entry
This changes 'struct e820entry' to 'struct e820_entry' to conform
with the coding style.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
2018-04-16 16:54:51 +08:00
Bin Meng
fa5e91f778 vxworks: x86: Rename e820info to e820_info
This changes 'struct e820info' to 'struct e820_info' to conform
with the coding style.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
2018-04-16 16:54:51 +08:00
Bin Meng
1351700cf2 bootvx: x86: Explicitly clear the bootloader image size
VxWorks bootloader stores its size at a pre-defined offset @ 0x5004.
Later when VxWorks kernel boots up and system memory information is
retrieved from the E820 table, the bootloader size will be subtracted
from the total system memory size to calculate the size of available
memory for the OS.

Explicitly clear the bootloader image size otherwise if memory
at this offset happens to contain some garbage data, the final
available memory size for the kernel is insane.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2018-04-16 16:54:51 +08:00
Bin Meng
2902be86c1 bootvx: x86: Prepare e820 related stuff from the given kernel memory base address
At present two environment variables 'e820data'/'e820info' are required
to boot a VxWorks x86 kernel, but this is superfluous. The offset of
these two tables are actually at a fixed offset from the kernel memory
base address and we can provide the kernel memory base address to U-Boot
via only one variable 'vx_phys_mem_base'.

Note as it name indicates, the physical address should be provided.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
2018-04-16 16:54:51 +08:00
Tom Rini
df13a44377 Merge git://git.denx.de/u-boot-net 2018-04-15 08:42:37 -04:00
Vasyl Vavrychuk
3194daa10b vxworks: fixed cpu enable using PSCI on armv8
Without armv8_setup_psci register VBAR_EL3 is not set up property which
makes SMC calls jump to invalid location.

smp_kick_all_cpus is required to make slave cpus leave gic_wait_for_interrupt.
Without this they will never pursue booting process.

Fix was applied to the two ways of booting VxWorks: bootvx and bootm commands.

This implementation is very similar to what is done in boot_jump_linux
in arch/arm/lib/bootm.c file.

Tested on VxWorks 7 release SR0520 2017-12-08 Intel Stratix 10 SX SoC
Development Kit board.

Signed-off-by: Vasyl Vavrychuk <vasyl.vavrychuk@globallogic.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2018-04-13 17:06:05 -04:00
Joe Hershberger
092f2f35b5 Revert "Kconfig: cmd: Make networking command dependent on NET"
This reverts the parts of commit 3b3ea2c56e
where it changed the EFI dependency on NET.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

Reviewed-by: Duncan Hare <dh@synoia.com>
2018-04-13 15:48:34 -05:00
Joe Hershberger
3dfbc53bd6 net: Make the BOOTP options default
The BOOTP options used to be and should still be default for all boards
with CMD_NET enabled. One should not be forced to use DISTRO_DEFAULTS to
get them.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

Reviewed-by: Duncan Hare <dh@synoia.com>
2018-04-13 15:48:25 -05:00
Joe Hershberger
2b9f486bf5 net: Improve BOOTP PXE config option
Improve the documentation and correct the listed dependencies.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

Reviewed-by: Duncan Hare <dh@synoia.com>
2018-04-13 15:48:21 -05:00
Joe Hershberger
80449c032c net: Add the BOOTP_DNS2 option to Kconfig
Commit 3b3ea2c56e ("Kconfig: cmd: Make networking command dependent on NET")
removed the help documentation from the README but didn't add it back to Kconfig.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Duncan Hare <dh@synoia.com>
2018-04-13 15:48:17 -05:00
Joe Hershberger
8df69d9063 net: Improve menu options and help for BOOTP options
The options were pretty unhelpful, so improve them some.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Chris Packham <judge.packham@gmail.com>
2018-04-13 15:48:13 -05:00
Joe Hershberger
e88b2563dd net: Move the DHCP command below the BOOTP command
Move DHCP to directly follow BOOTP so that Kconfig can show the
dependency as a hierarchy.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

Reviewed-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Duncan Hare <dh@synoia.com>
2018-04-13 15:48:09 -05:00
Joe Hershberger
92fa44d58f net: Move net command options to the cmd menu
Options that controlled the tftp and bootp commands depended on their
commands, but lived in the net menu.

Move them so they are in a consistent location.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Chris Packham <judge.packham@gmail.com>
2018-04-13 15:48:05 -05:00
Joe Hershberger
d7a45eafda net: Make CMD_NET a menuconfig
Previously, CMD_NET was an alias for 2 commands (bootp and tftpboot) and
they we not able to be disabled. Separate out those 2 commands and move
CMD_NET up to the menu level, which more accurately represents the code.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>

Reviewed-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Duncan Hare <dh@synoia.com>
2018-04-13 15:47:57 -05:00
Tom Rini
844fb498cc Patch queue for efi - 2018-04-09
Highlights this time around:
 
   - Lots of minor spec compliance fixes
   - Support full range of GOP BLT commands
   - More fine grained error checking
   - Network fixes (init, DP)
   - Lots of other bug fixes...
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQIcBAABAgAGBQJay2U6AAoJECszeR4D/txgE8UP/A5xHq707fv4CcQez/cZj/KE
 Twv4HoSY28by71VWS+SjXXTKkx+XGM/2tLzl6dQCB9V1aFUwtB12zu4mXpplfT8R
 K+dJU9PgkPKJzWRvn08JgeuXs1RQnfSgXz5J2pvSnJ4mySMlZKuVRGwHxw7DLFPf
 EZOqkd2+NI90fogGFoZ2l/aAzbDssBI45jDmH0KcPO49/+7XRVYJqpg0s7TQYmhY
 BeoJ0mAp12Ybpb4E7XDIGKKgCTjOGnftoRmzZyPZPfHPrmVWo2srmtycDbz0f/N0
 tEiXIOAo72DzmhL6aPPNJtt1mjXTGU2iavkV74JVqXODCd3bRJxz7TF6R30Nmvfz
 WMaKM+69Ahior9YJnGv2GUe8ebThxivWUUCB6HmfRh07sGCes6eV3HfklY5Fnglu
 Gw5pRl9+YBOywuUuyMg/yBPpPyA7b1HaTjwhsYWAB+q7htB6JkPhQruMxdiMaQnC
 gvOEoguW1XZo4MSudfC/SUOdayGp+KsQiEivi8gUh11uBPA2nj1Bh028Pj7tTET3
 J4C527uF/ivKwhx2hUHq2YkkgxHWz0Z98LFG3Xkj3q3fZFRwSEzugik1TswT8z3l
 qPxWgwX7Q9dxNYLW4ogvnlXU/09APRg9fVeaXxOfqJTHCCn9PHehbKKpkJ9g3cOt
 lPr1Q/4C5daK8dnxDzYo
 =fzbe
 -----END PGP SIGNATURE-----

Merge tag 'signed-efi-next' of git://github.com/agraf/u-boot

Patch queue for efi - 2018-04-09

Highlights this time around:

  - Lots of minor spec compliance fixes
  - Support full range of GOP BLT commands
  - More fine grained error checking
  - Network fixes (init, DP)
  - Lots of other bug fixes...
2018-04-09 11:05:44 -04:00
Alex Kiernan
9925f1dbc3 net: Move enetaddr env access code to env config instead of net config
In order that we can use eth_env_* even when CONFIG_NET isn't set, move
these functions to environment code from net code.

This fixes failures such as:

  board/ti/am335x/built-in.o: In function `board_late_init':
  board/ti/am335x/board.c:752: undefined reference to `eth_env_set_enetaddr'
  u-boot/board/ti/am335x/board.c:766: undefined reference to `eth_env_set_enetaddr'

which caters for use cases such as:

commit f411b5cca4 ("board: am335x: Always set eth/eth1addr environment
variable")

when Ethernet is required in Linux, but not U-Boot.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
2018-04-08 23:00:58 -04:00
Mario Six
e89f8aae3d treewide: Migrate CONFIG_SYS_ALT_MEMTEST to Kconfig
Migrate the CONFIG_SYS_ALT_MEMTEST option to Kconfig.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
[trini: Re-run migration after also including CMD_MEMTEST]
Signed-off-by: Tom Rini <trini@konsulko.com>
2018-04-08 14:52:45 -04:00
Mario Six
55b2556115 cmd: Add command for calculating binary operations
This patch adds a command that enables the calculation of bit operations
(AND, OR, XOR) on binary data from the command line. Memory locations as
well as the contents of environment variables are eligible as sources
and destination of the binary data used in the operations.

The possible applications are manifold: Setting specific bits in
registers using the regular read-OR-write pattern, masking out bits in
bit values, implementation of simple OTP encryption using the XOR
operation, etc.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
2018-04-06 20:45:44 -04:00
Mario Six
8354aa2781 cmd: ximg: Respect cache line size for flushing
Make sure that the cache line size if respected when flushing the cache.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
2018-04-06 20:45:44 -04:00
Christian Gmeiner
476c2fcd28 bootvx: use program header for loading
The section header address is a VMA whereas the address found in
the program header is a physical one. With this change it is
possible to load and start a vx7 intel generic based image.

$ readelf -l /tmp/vx7

Elf file type is EXEC (Executable file)
Entry point 0x408000
There are 2 program headers, starting at offset 52

Program Headers:
  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
  LOAD           0x001000 0x00408000 0x00408000 0x04000 0x04000 RWE 0x1000
  LOAD           0x005000 0xe040c000 0x0040c000 0x583a84 0x5ccc70 RWE 0x1000

 Section to Segment mapping:
  Segment Sections...
   00     .text.locore .data.locore
   01     .text .eh_frame .wrs_build_vars .data .tls_data .tls_vars .bss

$ readelf -S /tmp/vx7
There are 13 section headers, starting at offset 0x588af8:

Section Headers:
  [Nr] Name              Type            Addr     Off    Size   ES Flg Lk Inf Al
  [ 0]                   NULL            00000000 000000 000000 00      0   0  0
  [ 1] .text.locore      PROGBITS        00408000 001000 00011e 00  AX  0   0 16
  [ 2] .data.locore      PROGBITS        00409000 002000 003000 00  WA  0   0 4096
  [ 3] .text             PROGBITS        e040c000 005000 4802a0 00 WAX  0   0 32
  [ 4] .eh_frame         PROGBITS        e088c2a0 4852a0 0a1ed0 00   A  0   0  4
  [ 5] .wrs_build_vars   PROGBITS        e092e170 527170 000190 00  Ax  0   0  1
  [ 6] .data             PROGBITS        e092f000 528000 060a70 00  WA  0   0 4096
  [ 7] .tls_data         PROGBITS        e098fa70 588a70 000004 00   A  0   0  4
  [ 8] .tls_vars         PROGBITS        e098fa78 588a78 00000c 00  WA  0   0  4
  [ 9] .bss              NOBITS          e098faa0 588a84 0491d0 00  WA  0   0 32
  [10] .shstrtab         STRTAB          00000000 588a84 000074 00      0   0  1
  [11] .symtab           SYMTAB          00000000 588d00 056ee0 10     12 9758  4
  [12] .strtab           STRTAB          00000000 5dfbe0 05f48a 00      0   0  1
Key to Flags:
  W (write), A (alloc), X (execute), M (merge), S (strings)
  I (info), L (link order), G (group), T (TLS), E (exclude), x (unknown)
  O (extra OS processing required) o (OS specific), p (processor specific)

For completeness here are the same information for an old vx5 based image. After
this change it is possible to boot vx5 and vx7 (intel generic) images.

$ readelf -l /tmp/vx5

Elf file type is EXEC (Executable file)
Entry point 0x308000
There are 1 program headers, starting at offset 52

Program Headers:
 Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
 LOAD           0x000060 0x00308000 0x00308000 0x3513a0 0x757860 RWE 0x20

Section to Segment mapping:
 Segment Sections...
  00     .text .data .bss
[christian@chgm-pc ~]$ readelf -S /tmp/vx5
There are 12 section headers, starting at offset 0x356580:

Section Headers:
 [Nr] Name              Type            Addr     Off    Size   ES Flg Lk Inf Al
 [ 0]                   NULL            00000000 000000 000000 00      0   0  0
 [ 1] .text             PROGBITS        00308000 000060 319b10 00 WAX  0   0 32
 [ 2] .data             PROGBITS        00621b20 319b80 037880 00  WA  0   0 32
 [ 3] .bss              NOBITS          006593a0 351400 4064c0 00  WA  0   0 16
 [ 4] .debug_aranges    PROGBITS        00000000 351400 000060 00      0   0  1
 [ 5] .debug_pubnames   PROGBITS        00000000 351460 00018b 00      0   0  1
 [ 6] .debug_info       PROGBITS        00000000 3515eb 003429 00      0   0  1
 [ 7] .debug_abbrev     PROGBITS        00000000 354a14 000454 00      0   0  1
 [ 8] .debug_line       PROGBITS        00000000 354e68 0016a4 00      0   0  1
 [ 9] .shstrtab         STRTAB          00000000 35650c 000071 00      0   0  1
 [10] .symtab           SYMTAB          00000000 356760 0440e0 10     11 8574  4
 [11] .strtab           STRTAB          00000000 39a840 03e66c 00      0   0  1
Key to Flags:
 W (write), A (alloc), X (execute), M (merge), S (strings)
 I (info), L (link order), G (group), T (TLS), E (exclude), x (unknown)
 O (extra OS processing required) o (OS specific), p (processor specific)

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
2018-04-06 20:45:44 -04:00
Christophe Leroy
ee1e600c13 powerpc: mpc8xx: Change CONFIG_8xx to CONFIG_MPC8xx
CONFIG_8xx doesn't mean much outside of arch/powerpc/
This patch renames it CONFIG_MPC8xx just like CONFIG_MPC85xx etc ...
It also renames 8xx_immap.h to immap_8xx.h to be consistent with
other file names.

Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
2018-04-06 16:30:37 -04:00
Alexander Graf
806d2fa8e3 efi_loader: Respect DT reserved regions
With legacy boot (booti, bootz), people can declare memory regions as
reserved using device tree memory reservations. This feature is some
times used to indicate memory regions that should not be touched.

Since in a UEFI world, the DT memory reservations do not get honored,
let's copy them into the UEFI memory map so everyone has a coherent
view of the world and we give people the chance to add reservations
on demand.

Signed-off-by: Alexander Graf <agraf@suse.de>
2018-04-06 09:40:53 +02:00
Tom Rini
e294ba0678 Merge git://git.denx.de/u-boot-sunxi
Signed-off-by: Tom Rini <trini@konsulko.com>
2018-04-04 14:10:39 -04:00
Heinrich Schuchardt
2db1eba1c3 efi_loader: correctly determine the boot partition
The device path of the loaded image should be set to the partition
from which the image was loaded. This requires using the same logic as
the load command.

Without the patch the device path pointed to the whole disk after executing

	load mmc 0: 0x43000000 FILE

and not to the boot partition from which the file was actually loaded.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
2018-04-04 13:14:33 +02:00
Heinrich Schuchardt
bc4f9133ed efi_loader: support device tree for bootefi selftest
The second argument of the bootefi command should always be usable to
specify a device tree. This was missing for bootefi selftest and
bootefi hello.

Proper error handling is added.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
2018-04-04 11:00:06 +02:00
Heinrich Schuchardt
fc225e6082 efi_loader: check initialization of EFI subsystem is successful
Up to now errors in the initialization of the EFI subsystems was not
checked.

If any initialization fails, leave the bootefi command.

We do not retry initialization because this would require to undo all prior
initalization steps.

Suggested-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
2018-04-04 11:00:06 +02:00
Heinrich Schuchardt
45204b1025 efi_loader: do_bootefi_exec should always return an EFI status code
The return type of do_bootefi_exec() is efi_status_t. So in case
of an error we should always return an EFI status code.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
2018-04-04 11:00:06 +02:00
Heinrich Schuchardt
098a6cdd1c efi_loader: simplify calling efi_init_obj_list
efi_init_obj_list() should be executed only once.

Rather than having the caller check this variable and the callee set it,
move all access to the variable inside the function. This reduces the
logic needed to call efi_init_obj_list().

Suggested-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
2018-04-04 11:00:06 +02:00
Andre Przywara
d14db11d76 sunxi: revert disabling of features
In January some commits were introduced to mitigate the U-Boot image
size issues we encountered on sunxi builds.
Now with the MMC environment removed we can bring them back, as we
practically don't have a size limit anymore.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>
2018-04-04 14:15:40 +05:30
Andre Heider
33222c8a2c cmd: cbfs: fix reading the end_of_rom pointer for 64bit archs
The cast breaks the pointer on 64bit archs, so lets get rid of it.

Signed-off-by: Andre Heider <a.heider@gmail.com>
Reviewed-by: Alexander Graf <agraf@suse.de>
2018-03-31 16:00:03 +08:00
Liam Beguin
10f087f73f cmd: sf: fix map_physmem check
Make sure 0x00 is a valid address to read to. If `addr` is 0x00 then
map_physmem() will return 0 which should be a valid address.

Signed-off-by: Liam Beguin <liambeguin@gmail.com>
Reviewed-by: Stephen Warren <swarren@nvidia.com>
2018-03-22 13:25:20 -04:00
Sam Protsenko
64e6a49a11 cmd: part: Extract common code to separate function
Refactor the code for "part start" and "part size" commands to avoid
code duplication.

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
2018-03-13 21:59:27 -04:00
Sam Protsenko
36df616a2d cmd: part: Allow passing partition name to start and size
Allow passing the partition name to "part start" and "part size"
commands, so we can avoid magic numbers in the environment.

Consider one real use-case: in include/environment/ti/boot.h we have
commands like these:

    setenv boot_part 9
    part start mmc ${mmcdev} ${boot_part} boot_start
    part size mmc ${mmcdev} ${boot_part} boot_size
    mmc read ${loadaddr} ${boot_start} ${boot_size}

Now suppose that we have changed the partition table and boot_part now
is 10. We will need to fix commands above. And anyone who relies on
these boot commands, will need to change them accordingly, too (this was
an actual case in our lab while testing Linux boot on Android
environment).

By providing the option to pass partition name instead, we fix mentioned
issue, by eliminating the necessity to use magic numbers.

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
2018-03-13 21:59:26 -04:00
Masahiro Yamada
b08c8c4870 libfdt: move headers to <linux/libfdt.h> and <linux/libfdt_env.h>
Thomas reported U-Boot failed to build host tools if libfdt-devel
package is installed because tools include libfdt headers from
/usr/include/ instead of using internal ones.

This commit moves the header code:
  include/libfdt.h         -> include/linux/libfdt.h
  include/libfdt_env.h     -> include/linux/libfdt_env.h

and replaces include directives:
  #include <libfdt.h>      -> #include <linux/libfdt.h>
  #include <libfdt_env.h>  -> #include <linux/libfdt_env.h>

Reported-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-03-05 10:16:28 -05:00
Tom Rini
d231182441 Merge git://git.denx.de/u-boot-net 2018-02-27 20:10:28 -05:00
Michal Simek
3b3ea2c56e Kconfig: cmd: Make networking command dependent on NET
Enable networking command only when NET is enabled.
And remove selecting NET for CMD_NET

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
2018-02-27 16:25:30 -05:00
Mario Six
c550389881 cmd: mdio: Fix style violations
Fix some style violations in the MDIO command.

Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Signed-off-by: Mario Six <mario.six@gdsys.cc>
2018-02-26 15:47:43 -06:00
Adam Ford
d021e94210 Convert CONFIG_BOOTP_BOOTPATH et al to Kconfig
This converts the following to Kconfig:
   CONFIG_BOOTP_BOOTPATH
   CONFIG_BOOTP_DNS
   CONFIG_BOOTP_GATEWAY
   CONFIG_BOOTP_HOSTNAME
   CONFIG_BOOTP_PXE
   CONFIG_BOOTP_SUBNETMASK
   CONFIG_CMDLINE_EDITING
   CONFIG_AUTO_COMPLETE
   CONFIG_SYS_LONGHELP
   CONFIG_SUPPORT_RAW_INITRD
   CONFIG_ENV_VARS_UBOOT_CONFIG

Signed-off-by: Adam Ford <aford173@gmail.com>
[trini: Re-run the migration]
Signed-off-by: Tom Rini <trini@konsulko.com>
2018-02-23 21:41:49 -05:00
Patrick Delaunay
b0cce3f90f cmd: fastboot: Kconfig: solve config issue
When FASTBOOT is activated, only one the supported device is supported in
code at the same time
- CONFIG_FASTBOOT_FLASH_MMC_DEV
- CONFIG_FASTBOOT_FLASH_NAND_DEV

But Today the choice is not exclusive in Kconfig
and that cause Kconfig issue when :
- CONFIG_FASTBOOT, CONFIG_MMC, CONFIG_NAND are activated
- CONFIG_FASTBOOT_FLASH_MMC_DEV = 0
- CONFIG_FASTBOOT_FLASH_NAND_DEV is not activated

The patch add a choice in Kconfig to select the FLASH provider
- CONFIG_FASTBOOT_FLASH_MMC
- CONFIG_FASTBOOT_FLASH_NAND

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
2018-02-21 20:28:15 +01:00
Marek Vasut
bb4059a53b dfu: Rename _FUNCTION_DFU to DFU_OVER_
Do the following to make the symbol names less confusing.

sed -i "s/\([TU][^_]\+\)_FUNCTION_DFU/DFU_OVER_\1/g" \
	`git grep _FUNCTION_DFU | cut -d ":" -f 1 | sort -u`

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
2018-02-21 20:28:15 +01:00
Marek Vasut
0f44d33536 dfu: Fix up the Kconfig mess
Clean up the screaming mess of configuration options that DFU is.
It was impossible to configure DFU such that TFTP is enabled and
USB is not, this patch fixes that and assures that DFU TFTP and
DFU USB can be enabled separatelly and that the correct pieces
of code are compiled in.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
2018-02-21 20:28:15 +01:00
Andre Heider
24ccd0c8fd usb: gadget: sdp: add missing line breaks
Cosmetic change.

Signed-off-by: Andre Heider <a.heider@gmail.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Acked-by: Stefan Agner <stefan.agner@toradex.com>
2018-02-21 20:28:15 +01:00
Mario Six
c6b89f3180 sandbox: Add 64-bit sandbox
To debug device tree issues involving 32- and 64-bit platforms, it is useful to
have a generic 64-bit platform available.

Add a version of the sandbox that uses 64-bit integers for its physical
addresses as well as a modified device tree.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Added CONFIG_SYS_TEXT_BASE to configs/sandbox64_defconfig
Signed-off-by: Simon Glass <sjg@chromium.org>
2018-02-18 15:53:48 -07:00
Heinrich Schuchardt
0c3fecd0bf cmd: scsi: move CMD_SCSI to device access commands
Configuration option CMD_SCSI should be placed in the same submenu as
CMD_SATA and CMD_MMC.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2018-02-14 12:14:16 -05:00
Masahiro Yamada
bf14d9a7e1 cmd: booti: fix invalid image address in debug message
With commit 6808ef9ac2 ("move booti_setup to arch/arm/lig/image.c"),
images->ep has not been set at this point.

Fixes: 6808ef9ac2 ("move booti_setup to arch/arm/lig/image.c")
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Bin Chen <bin.chen@linaro.org>
2018-02-13 23:24:22 -05:00
Marek Vasut
ac08432a4c cmd: fitupd: Convert CONFIG_CMD_FITUPD
Convert the CONFIG_CMD_FITUPD symbol to Kconfig.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Tom Rini <trini@konsulko.com>
2018-02-13 20:34:07 -05:00
Heinrich Schuchardt
f623e07f0c efi_loader: fix the online help for bootefi bootmgr
The bootefi command is missing in the online help for
bootefi bootmgr.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
2018-02-10 00:24:00 +01:00
Adam Ford
1811a928c6 Move most CONFIG_HAVE_BLOCK_DEVICE to Kconfig
config_fallbacks.h has some logic that sets HAVE_BLOCK_DEVICE
based on a list of enabled options.  Moving HAVE_BLOCK_DEVICE to
Kconfig allows us to drastically shrink the logic in
config_fallbacks.h

Signed-off-by: Adam Ford <aford173@gmail.com>
[trini: Rename HAVE_BLOCK_DEVICE to CONFIG_BLOCK_DEVICE]
Signed-off-by: Tom Rini <trini@konsulko.com>
2018-02-08 19:09:03 -05:00
Adam Ford
a451bc27c9 Convert LIB_UUID to Kconfig
config_fallback.h has some logic that checks a variety of options
and selects LIB_UUID if it hasn't already been selected.  This
will all LIB_UUID in Kconfig and select this option for the list
of options to allow us to remove the logic from fallbacks

Signed-off-by: Adam Ford <aford173@gmail.com>
2018-02-08 19:08:39 -05:00
Bin Chen
6808ef9ac2 move booti_setup to arch/arm/lig/image.c
Follow bootz's pattern by moving the booti_setup to arch/arm/lib.
This allows to use booti_setup in other paths, e.g booting
an Android image containing Image format.

Note that kernel relocation is move out of booti_setup and it is the
caller's responsibility to do it and allows them do it differently. say,
cmd/booti.c just do a manually, while in the bootm path, we can use
bootm_load_os(with some changes).

Signed-off-by: Bin Chen <bin.chen@linaro.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2018-02-07 22:06:11 -05:00
Tuomas Tynkkynen
a4fa811463 cmd: Make CONFIG_CMD_FPGA depend on CONFIG_FPGA
cmd/Makefile has:

ifdef CONFIG_FPGA
obj-$(CONFIG_CMD_FPGA) += fpga.o
endif

which means that if CONFIG_FPGA is not set, CONFIG_CMD_FPGA silently
does nothing. Let's remove that Makefile conditional and instead express
this equivalent dependency in Kconfig, so a lot of redundant

 # CONFIG_CMD_FPGA is not set

can be removed from board defconfigs that don't actually have an FPGA.

Signed-off-by: Tuomas Tynkkynen <tuomas@tuxera.com>
2018-02-05 20:58:11 -05:00
Simon Glass
3fd24fa9ed log: Add a command to output a log record
Add a 'log rec' command which allows a log record to be manually output.
This is useful for scripts which want full control over what is logged. It
also permits easy testing of the log system.

Signed-off-by: Simon Glass <sjg@chromium.org>
2018-02-03 10:09:27 -07:00
Simon Glass
ad0e503991 log: Add a command to control the log output format
Add a 'log format' command which can display or change the log output
format. This is useful for changing how much information is displayed. The
ordering of the fields is fixed.

Signed-off-by: Simon Glass <sjg@chromium.org>
2018-02-03 10:09:27 -07:00
Lukasz Majewski
e4d4604a7b usb: ums: Kconfig: Select USB_FUNCTION_MASS_STORAGE when enabling 'ums' command
The CONFIG_USB_FUNCTION_MASS_STORAGE must be selected when one enables
support for ums command.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
2018-02-02 07:13:48 -05:00
Simon Goldschmidt
87c7fb396a cmd: nvedit: env_get_f must check for env_get_char error codes
env_get_f calls env_get_char to load single characters from the
environment. However, the return value of env_get_char was not
checked for errors. Now if the env driver does not support the
.get_char call, env_get_f did not notice this and looped over the
whole size of the environment, calling env_get_char over 8000
times with the default settings, just to return an error in the
end.

Fix this by checking if env_get_char returns < 0.

Signed-off-by: Simon Goldschmidt <sgoldschmidt@de.pepperl-fuchs.com>
Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
2018-01-31 18:45:10 -05:00
Heinrich Schuchardt
ca92ad4f68 cmd/bdinfo: print relocation info on X86
For debugging U-Boot in qemu-x86 the relocation address is needed.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
2018-01-30 22:34:38 +08:00
Андрей Мозжухин
af09eba64f aes: Allow non-zero initialization vector
AES encryption in CBC mode, in most cases, must be used with random
initialization vector. Using the same key and initialization vector several
times is weak and must be avoided.

Added iv parameter to the aes_cbc_encrypt_blocks and aes_cbc_decrypt_blocks
functions for passing initialization vector.

Command 'aes' now also require the initialization vector parameter.

Signed-off-by: Andrey Mozzhuhin <amozzhuhin@yandex.ru>
2018-01-29 12:50:13 -05:00
Heinrich Schuchardt
49db1cb8c3 efi_loader: catch misspelled bootefi subcommand
If 'bootefi hello' or 'bootefi selftest' can be executed depends on the
configuration.

If an invalid non-numeric 1st argument is passed to bootefi, e.g.
'bootefi hola', this string is converted to 0 and U-Boot jumps to
this typically invalid address.

With the patch the online help is shown instead.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
2018-01-28 21:37:13 +01:00
Alexander Graf
c6fa5df6aa efi_loader: Always use EFIAPI instead of asmlinkage
EFI calls are usually defined as asmlinkage. That means we pass all parameters
to functions via the stack x86_32.

On x86_64 however, we need to also stick to the MS ABI calling conventions,
which the EFIAPI define conveniently handles for us. Most EFI functions were
also marked with EFIAPI, except for the entry call.

So this patch adjusts all entry calls to use EFIAPI instead of the manual
asmlinkage attribute.

While at it, we also change the prototype of the entry point to return
efi_status_t instead of ulong, as this is the correct prototype definition.

Signed-off-by: Alexander Graf <agraf@suse.de>

---

v1 -> v2:

  - Use efi_status_t in all occurences
2018-01-28 21:37:13 +01:00
Tuomas Tynkkynen
8996975ff8 powerpc: Drop CONFIG_WALNUT and other related dead code
CONFIG_WALNUT was dropped in June 2017 in:
commit 98f705c9ce ("powerpc: remove 4xx support")

While at it, the related CONFIG_MACH_SPECIFIC and the have_of
and _machine variables are unused as well, so drop them too.

Signed-off-by: Tuomas Tynkkynen <tuomas@tuxera.com>
2018-01-28 12:27:32 -05:00
Maxime Ripard
9c24dfb2b8 cmd: nvedit: Get rid of the env lookup
The nvedit command is the only user of env_driver_lookup_default outside of
the environment code itself, and it uses it only to print the environment
it's about to save to during env save.

As we're about to rework the environment to be able to handle multiple
environment sources, we might not have an idea of what environment backend
is going to be used before trying (and possibly failing for some).

Therefore, it makes sense to remove that message and move it to the
env_save function itself. As a side effect, we also can get rid of the call
to env_driver_lookup_default that is also about to get refactored.

Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
2018-01-27 09:19:11 -05:00
Tom Rini
748277c415 Merge git://git.denx.de/u-boot-sunxi 2018-01-26 13:22:40 -05:00
Maxime Ripard
07dc22dd85 cmd: misc: Disable by default on sunXi
The sunXi arm64 build has overflown, leading to the main U-boot binary
overwriting the environment when flashing the new image, or even worse,
overwriting itself when we're calling saveenv.

Disable this command that is not critical until we can adress the issue
properly.

Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>
2018-01-26 20:02:33 +05:30
Maxime Ripard
e302ede73c cmd: loads: Disable by default on sunXi
The sunXi arm64 build has overflown, leading to the main U-boot binary
overwriting the environment when flashing the new image, or even worse,
overwriting itself when we're calling saveenv.

Disable this command that is not critical until we can adress the issue
properly.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>
2018-01-26 20:02:33 +05:30
Maxime Ripard
197e0be744 cmd: loadb: Disable by default on sunXi
The sunXi arm64 build has overflown, leading to the main U-boot binary
overwriting the environment when flashing the new image, or even worse,
overwriting itself when we're calling saveenv.

Disable this command that is not critical until we can adress the issue
properly.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>
2018-01-26 20:02:33 +05:30
Maxime Ripard
3b50382ab5 cmd: unzip: Disable by default on sunXi
The sunXi arm64 build has overflown, leading to the main U-boot binary
overwriting the environment when flashing the new image, or even worse,
overwriting itself when we're calling saveenv.

Disable this command that is not critical until we can adress the issue
properly.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>
2018-01-26 20:02:33 +05:30
Maxime Ripard
b02436089a cmd: crc32: Disable by default on sunXi
The sunXi arm64 build has overflown, leading to the main U-boot binary
overwriting the environment when flashing the new image, or even worse,
overwriting itself when we're calling saveenv.

Disable this command that is not critical until we can adress the issue
properly.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>
2018-01-26 20:02:33 +05:30
Tom Rini
a516416d75 Patch queue for efi - 2018-01-23
This time around we have a lot of EFI patches from Heinrich.
 Highlights are:
 
   - Allow EFI applications to register as drivers
   - Allow exposure of U-Boot block devices from an EFI payload
   - Compatibility improvements
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQIcBAABAgAGBQJaZwoHAAoJECszeR4D/txgKU0QAMRg5zm95ClGRBjxVbAW7M73
 T7pHQBbsoaddfK0zOAltLo5wOLhLNJPb93L0gxjChx6o5PDV6iFISAYRnJiQsVyj
 XI5Ve2XV8DRBMdaKVxeq1Z7syjYllhdkzBeQbitw6TfIDy+qeA/x/Z1Jz6gYnTDh
 ZmbP0HrTk59Vg80ZLa4XcBumqesfBnUAEDFx9sYX9T8/7bx3QWQfwAJ3XHYKkDmM
 aaXFq/02/z0ZgDPinkG00AIkKme+QRAFCd+leACkDGPR9pAC4mf6df/006a0Sl/s
 qw5j5J06yOZ0ykTxwmREsGg62IqCTPA51mSiBvWS37vZeUUO0WhyysuUvQ5YVv+U
 UII5YN/0PGVGVZ4hM1s3yEijEf48n1YncASRyYVfCtJjC/WJ2IUlthH85MEBrrn4
 IqVHeoLJg5/a3T2Tdo83q/AD9saFshaVsT42C04JB07/29SKjNjZ9sUMMBatOlAP
 HleCy3jgodwB4kF1Tld6oeakvuc0xOhCOckD3rWUhsi9eN9liZiv7AlXFiXxPUgz
 tWcJtluaZ/vhXXJWdCqwf2KIq0fmawgBUsSwLByPrZKTp9OojGsA52Ro6jAuu2Mq
 vKqZhRpSF7DtAhALcex5V2uwCc5npehTTXIHYG/bmzBQWrEWfBlYA7dSjMiuQbuD
 0+1EicqsGp8Chr1H37bC
 =XZ4q
 -----END PGP SIGNATURE-----

Merge tag 'signed-efi-next' of git://github.com/agraf/u-boot

Patch queue for efi - 2018-01-23

This time around we have a lot of EFI patches from Heinrich.
Highlights are:

  - Allow EFI applications to register as drivers
  - Allow exposure of U-Boot block devices from an EFI payload
  - Compatibility improvements
2018-01-23 07:59:43 -05:00
Heinrich Schuchardt
05ef48a248 efi_driver: EFI block driver
This patch provides
* a uclass for EFI drivers
* a EFI driver for block devices

For each EFI driver the uclass
* creates a handle
* adds the driver binding protocol

The uclass provides the bind, start, and stop entry points for the driver
binding protocol.

In bind() and stop() it checks if the controller implements the protocol
supported by the EFI driver. In the start() function it calls the bind()
function of the EFI driver. In the stop() function it destroys the child
controllers.

The EFI block driver binds to controllers implementing the block io
protocol.

When the bind function of the EFI block driver is called it creates a
new U-Boot block device. It installs child handles for all partitions and
installs the simple file protocol on these.

The read and write functions of the EFI block driver delegate calls to the
controller that it is bound to.

A usage example is as following:

U-Boot loads the iPXE snp.efi executable. iPXE connects an iSCSI drive and
exposes a handle with the block IO protocol. It calls ConnectController.

Now the EFI block driver installs the partitions with the simple file
protocol.

iPXE uses the simple file protocol to load Grub or the Linux Kernel.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
[agraf: add comment on calloc len]
Signed-off-by: Alexander Graf <agraf@suse.de>
2018-01-22 23:09:14 +01:00
Heinrich Schuchardt
17ff6f02f5 efi_loader: store DT in EFI_RUNTIME_SERVICES_DATA memory
The device tree is needed at runtime. So we have to store it in
EFI_RUNTIME_SERVICES_DATA memory.

The UEFI spec recommends to store all configuration tables in
EFI_RUNTIME_SERVICES_DATA memory.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
2018-01-22 23:09:14 +01:00
Heinrich Schuchardt
2074f70064 efi_loader: consistently use efi_handle_t for handles
We should consistently use the efi_handle_t typedef when
referring to handles.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
2018-01-22 23:09:13 +01:00
Tuomas Tynkkynen
3d22bae57f fs: Migrate ext4 to Kconfig
Migrate the following symbols to Kconfig:

CONFIG_FS_EXT4
CONFIG_EXT4_WRITE

The definitions in config_fallbacks.h can now be expressed in Kconfig.

Signed-off-by: Tuomas Tynkkynen <tuomas@tuxera.com>
2018-01-22 16:43:30 -05:00
Klaus Goger
7e37a88465 cmd: pmic: update help description
Change help description to match the style of the other U-Boot commands
and get rid of the leading whitespace.

Signed-off-by: Klaus Goger <klaus.goger@theobroma-systems.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
2018-01-19 15:49:29 -05:00
Lokesh Vutla
8a8af8a2fd cmd: ti: Generalize cmd_ddr3 command
Keystone and DRA7 based TI platforms uses same
EMIF memory controller. cmd_ddr3 command is customized
for keystone platforms, make it generic so that it can
be re used for DRA7  platforms.

Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
2018-01-19 15:49:26 -05:00
Lokesh Vutla
5cd9661dc6 arm: keystone: Move cmd_ddr3 to a common place
Move cmd_ddr3 to cmd/ti in order to make
it build for non-keystone TI platforms.

Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
[trini: Rename to ddr3.c not cmd_ddr3.c]
Signed-off-by: Tom Rini <trini@konsulko.com>
2018-01-19 15:49:26 -05:00
Tom Rini
3dde8f2037 Merge git://git.denx.de/u-boot-mmc 2018-01-14 22:26:38 -05:00
Rick Chen
068feb9b86 riscv: Modify generic codes to support RISC-V
Support common commands bdinfo and image format,
also modify common generic flow for RISC-V.

Signed-off-by: Rick Chen <rick@andestech.com>
Signed-off-by: Rick Chen <rickchen36@gmail.com>
Signed-off-by: Greentime Hu <green.hu@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
2018-01-12 08:05:12 -05:00
Jean-Jacques Hiblot
b7a6e2c9c3 mmc: remove hc_wp_grp_size from struct mmc if not needed
hc_wp_grp_size is needed only if hardware partitionning is used.
On ARM removing it saves about 30 bytes of code space.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
2018-01-12 18:11:24 +09:00
Jean-Jacques Hiblot
e6fa5a5461 mmc: compile out erase and write mmc commands if write operations are not enabled
Also remove erase_grp_size and write_bl_len from struct mmc as they are
not used anymore. On ARM, removing them saves about 100 bytes of code
space in SPL.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
2018-01-12 18:11:24 +09:00
Jean-Jacques Hiblot
d6400c3f85 mmc: add a Kconfig option to enable the support for MMC write operations
This allows using CONFIG_IS_ENABLED(MMC_WRITE) to compile out code
needed only if write support is required.
The option is added for u-boot and for SPL

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
2018-01-12 18:11:24 +09:00
Jean-Jacques Hiblot
cf17789e07 mmc: make optional the support for eMMC hardware partitioning
Not all boards have an eMMC and not all users have a need for this.
Allow to compile it out. By default it is still included.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
2018-01-12 18:11:04 +09:00
Jean-Jacques Hiblot
52d241dfba mmc: dump card and host capabilities if debug is enabled
This is a useful information while debugging the initialization process or
performance issues.
Also dump this information with the other mmc info if the verbose option
is selected

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
2018-01-12 18:11:04 +09:00
Jean-Jacques Hiblot
7a96ec7459 cmd: mmc: display the mode name and current bus speed in the mmc info
Display the mode name when the user execute 'mmc info'. Also instead of
displaying tran_speed, display the actual bus speed.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2018-01-12 18:11:04 +09:00
Eddie Cai
453c95e01a usb: rockchip: add rockusb command
this patch add rockusb command. the usage is
rockusb <USB_controller> <devtype> <dev[:part]>
e.g. rockusb 0 mmc 0

Signed-off-by: Eddie Cai <eddie.cai.linux@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2018-01-10 11:11:06 +01:00
Tom Rini
8e18f34c28 x86: Move commands from under arch/x86 to cmd/x86/
We only need to compile and link these files when building for full
U-Boot.  Move them to under cmd/x86/ to make sure they aren't linked in
and undiscarded due to u_boot_list_2_cmd_* being included).

Cc: Bin Meng <bmeng.cn@gmail.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2018-01-08 16:52:22 +08:00
Tom Rini
76cc372879 Merge git://git.denx.de/u-boot-sunxi 2017-12-19 07:57:33 -05:00
Simon Glass
ef11ed8239 log: Add a test command
Add a command which exercises the logging system.

Signed-off-by: Simon Glass <sjg@chromium.org>
2017-12-07 15:17:00 -05:00
Simon Glass
d5f61f272d log: Add a 'log level' command
Add a command for adjusting the log level.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2017-12-07 15:17:00 -05:00
Simon Glass
c5404b64fb Drop the log buffer
This does not appear to be used by any boards. Before introducing a new
log system, remove this old one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2017-12-07 15:17:00 -05:00
Simon Glass
95b41b80d7 mtdparts: Correct use of debug()
The debug() macro now evaluates its expression so does not need #ifdef
protection. In fact the current code causes a warning with the new log
implementation. Adjust the code to fix this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2017-12-07 15:17:00 -05:00
Maxime Ripard
7c750fac22 fastboot: Enable flashing by default on sunxi
Now that more and more devices are built using eMMC, providing a way to
easily flash the system without too much hassle seems like a right thing to
do.

Since fastboot is the most deployed tool to do that these days, we can just
rely on it to provide a way to flash the various components in the system
(SPL, U-Boot and the system itself) easily, especially since you can upload
the U-Boot hosting the fastboot "server" through FEL.

Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
2017-12-07 16:24:32 +01:00
Nobuhiro Iwamatsu
28df8ed07f cmd: i2c: Fix use sdram sub command with CONFIG_DM_I2C
sdram sub command of i2c command does not support Drivers Model.
This adds Drivers Model support to sdram sub command.

Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>
2017-12-07 09:29:35 +01:00
Tom Rini
9188c4315c Patch queue for efi - 2017-12-05
Highlights for this release:
 
   - Dynamic EFI object creation (lists instead of static arrays)
   - EFI selftest improvements
   - Minor fixes
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQIcBAABAgAGBQJaJxZhAAoJECszeR4D/txgtX4P/iTp602iM+2m4WP0P2K/L72b
 EsPAL4W/QXMBZBnq9MowQl7Ia3JU6bS1g2EDlbAvoQgbhmbTBfA6VxJmQj/AuOn0
 waxjyfBw/YL4010YAfmExdVy8Qj0k/SEXcxOiHYZJzmW1o3PXvLuLnetUNJ0Uip9
 GJQPcGjSaXY1VM7oAwpOVMWkbpaIIfgw9yrAc2Cw6KN8iHmaf6rPFBdWARGB7w9m
 znFtq0FpNQSLEEoyJVYAlqyRRsj+1wS3ExGnsL2no74njAgzKSWmdN7qFjkO7WC1
 w+CnZLiUv5MaboYK2uORW2qBQzRylyEXWCkqIaZL+EWElVqPRz7/VSDLUJxnZLbl
 vhDTRUB/kVwdrmB8lP21Rruk1EjCIyYDcGQ+nwhlDes/NJztfNlyOEm47N8LNyt6
 obRxOVC8nIjf4YptHB4CRgccGQAE7VqS/DqstV1plC1Ms+puG6SQvuPwlCkKX9XP
 qkZnirgzrUfGjmFMM3owoelA40jXWV4vv90HjQvwmaOftjPY3IJ+X0rgqUGbuOmn
 /R8OCW6PV0FIOx1k5/waZlqDnfFkChm56Rhxqf9LqEro37YTUjapXEgBn7a+132x
 /icaOySkFx0hy+cvPNQ5aXyNLQPDPS++Af9e/hcMewh4Zn5FrJqkJrmtLDZzGJIG
 LC5DWr8o9vwT41UftPb0
 =uyBA
 -----END PGP SIGNATURE-----

Merge tag 'signed-efi-next' of git://github.com/agraf/u-boot

Patch queue for efi - 2017-12-05

Highlights for this release:

  - Dynamic EFI object creation (lists instead of static arrays)
  - EFI selftest improvements
  - Minor fixes
2017-12-05 17:52:16 -05:00
Masahiro Yamada
6ae3900a86 mtd: nand: Rename nand.h into rawnand.h
This header was renamed to rawnand.h in Linux.

The following is the corresponding commit in Linux.

  commit d4092d76a4a4e57b65910899948a83cc8646c5a5
  Author: Boris Brezillon <boris.brezillon@free-electrons.com>
  Date:   Fri Aug 4 17:29:10 2017 +0200

      mtd: nand: Rename nand.h into rawnand.h

      We are planning to share more code between different NAND based
      devices (SPI NAND, OneNAND and raw NANDs), but before doing that
      we need to move the existing include/linux/mtd/nand.h file into
      include/linux/mtd/rawnand.h so we can later create a nand.h header
      containing all common structure and function prototypes.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2017-12-04 22:00:00 +09:00
Heinrich Schuchardt
ea54ad5928 efi_loader: pass handle of loaded image
The handle of a loaded image is the value of the handle
member of the loaded image info object and not the
address of the loaded image info.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
2017-12-01 13:40:07 +01:00
Stefan Roese
8300be612c efi_loader: Exit in efi_set_bootdev() upon invalid "desc"
When trying to load an image from a non-existent USB key, U-Boot v2017.11
crashes on my x86 platform:

=> load usb 0:1 03000000 abc
General Protection
EIP: 0010:[<7b59030d>] EFLAGS: 00010286
Original EIP :[<fff4330d>]
...

This used to work in v2017.09. Testing has shown, that this bug was
introduced with patch 95c5553e [efi_loader: refactor boot device and
loaded_image handling].

This patch now checks if a valid "desc" is returned from blk_get_dev()
and only continues when "desc" is available. Resulting in this cmd
output (again):

=> load usb 0:1 03000000 abc
** Bad device usb 0 **

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
2017-12-01 13:26:10 +01:00
Heinrich Schuchardt
b57f48a87c efi_loader: use bootargs as load options
Use environment variable bootargs used as load options
for bootefi payloads.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
2017-12-01 13:22:55 +01:00
Heinrich Schuchardt
c2b53902ca efi_selftest: correctly cleanup after selftest
After executing bootefi selftest
* restore GD
* unlink the load image handle
* return 0 or 1 and not a truncated efi_status_t.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
2017-12-01 13:22:55 +01:00
Heinrich Schuchardt
d78e40d651 efi_selftest: allow to select a single test for execution
Environment variable efi_selftest is passed as load options
to the selftest application. It is used to select a single
test to be executed.

The load options are an UTF8 string. Yet I decided to keep
the name propertiy of the tests as char[] to reduce code
size.

Special value 'list' displays a list of all available tests.

Tests get an on_request property. If this property is set
the tests are only executed if explicitly requested.

The invocation of efi_selftest is changed to reflect that
bootefi selftest with efi_selftest = 'list' will call the
Exit bootservice.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
2017-12-01 13:22:55 +01:00
Heinrich Schuchardt
f972dc1401 efi_selftest: provide a dummy device path
Currently we pass bootefi_device_path and bootefi_image_path as
device and image path without initializing them. They may carry
values from previous calls to bootefi.

With the patch the variables are initialized valid dummy values.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
2017-12-01 13:22:55 +01:00
Heinrich Schuchardt
3eb0841be7 efi_loader: consistently use efi_status_t in bootefi
Where ulong or unsigned long are used to hold an EFI status
code we should consistenly use efi_status_t.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
2017-12-01 13:22:55 +01:00
Heinrich Schuchardt
b3d6090042 efi_loader: implement SetWatchdogTimer
The watchdog is initialized with a 5 minute timeout period.
It can be reset by SetWatchdogTimer.
It is stopped by ExitBoottimeServices.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
2017-12-01 13:22:55 +01:00
Heinrich Schuchardt
254eedee7f cmd: blk: remove unreachable code
Remove an unreachable return statement.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2017-11-29 22:30:50 -05:00
Suneel Garapati
abd7cedb19 cmd: usb: ignore blk, emulation devices in usb tree/info display
Usb tree/info commands iterate over all usb uclass devices recursively.
Blk uclass devices based on struct blk_desc are created for mass storage
device, treating them as usb uclass devices based on struct usb_device
and referencing usb config interface descriptors cause crash.
To fix, ignore blk and usb_emul uclass devices in usb_show_info
and usb_tree_graph. Also avoid addition of preamble for blk uclass
child devices, otherwise tree dump gets messed up.

Signed-off-by: Suneel Garapati <suneelglinux@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2017-11-26 02:22:36 +01:00
Tom Rini
29c4992256 Merge git://git.denx.de/u-boot-dm 2017-11-19 20:35:45 -05:00
Bernhard Messerklinger
6dfd65f81f cmd/fdt.c align data buffer to avoid unaligned word access
Since the compiler is free to place a char array to any address in
memory (in this case the stack), also to a non word aligned address the
function "fdt_prop_parse" runs into troubles upon it wants to write some
(fdt32_t *) to such a variable (if it has been placed to a none word
aligned address).

To avoid this we tell the compiler to always align this scratchpad to a
word aligned address.

Signed-off-by: Bernhard Messerklinger <bernhard.messerklinger@br-automation.com>
Reviewed-by: Hannes Schmelzer <oe5hpm@oevsv.at>
Tested-by: Hannes Schmelzer <oe5hpm@oevsv.at>
Reviewed-by: Simon Glass <sjg@chromium.org>
2017-11-16 18:45:05 -07:00
Prabhakar Kushwaha
3e27e1678b cmd: mac: Update description of help
Update help message for "mac" command to reflect correct descriptions
and parameters.

Signed-off-by: Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>
2017-11-15 10:54:06 -08:00
Tom Rini
43ede0bca7 Kconfig: Migrate MTDIDS_DEFAULT / MTDPARTS_DEFAULT
We move all instances of CONFIG_MTDIDS_DEFAULT and
CONFIG_MTDPARTS_DEFAULT from the header files to the defconfig files.
There's a few cases here where we need to expand upon what was in the
header file.

Tested-by: Adam Ford <aford173@gmail.com>  #omap3_logic
Signed-off-by: Tom Rini <trini@konsulko.com>
2017-11-05 11:21:35 -05:00
Benjamin Young
7dec673ea9 cmd: fastboot: Enable FASTBOOT_FLASH_NAND for SUNXI_NAND devices
Encountered an issue where fastboot can't write to NAND on a CHIP_pro,
the symbol was neither present in the board's config header, nor the
Kconfig, this patch puts it in the Kconfig and defaults on when
SUNXI_NAND is selected.

Signed-off-by: Ben Young <computermouth@crunchbangplusplus.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
2017-10-25 10:05:06 +02:00
Patrick Delaunay
3a2605fa87 cmd: gpt: solve issue for swap and rename command
don't use prettyprint_part_size() in create_gpt_partitions_list()
that avoid to align offset and size to 1 MiB and increase precision for
start and size.
This patch avoid the risk to change partition size and lost data during
rename or swap.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Acked-by: Stephen Warren <swarren@nvidia.com>
Tested-by: Stephen Warren <swarren@nvidia.com>
2017-10-23 17:28:11 -04:00
Tom Rini
59ee8f83b6 cmd/pxe.c: Rework bootargs construction to clarify string checks
As the code currently stands, we first check that the length of the
given command line, along with ip_str/mac_str along with an additional 1
for the NULL termination will fit within the buffer we have, and if not,
we return an error.  The way this code was originally written however
left Coverity "unhappy" due to using strcat rather than strncat.
Switching this to strncat however causes clang to be unhappy that we
aren't enforcing the "1" portion within strncat.  Rather than further
re-work the code to include a "- 1" in this case as well, make the
strcat code only be done within the else side of the length test.  This
keeps both clang and Coverity happy.

Fixes: 48ee0a87bc ("cmd/pxe.c: Rework initrd and bootargs handling slightly")
Signed-off-by: Tom Rini <trini@konsulko.com>
2017-10-16 09:42:51 -04:00
Tuomas Tynkkynen
c68c03f52b Drop CONFIG_HAS_DATAFLASH
Last user of this option went away in commit:

fdc7718999 ("board: usb_a9263: Update to support DT and DM")

Signed-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
2017-10-16 09:42:51 -04:00
Tuomas Tynkkynen
7b7341d7f3 env: Drop CONFIG_ENV_IS_IN_DATAFLASH
Last user of this option went away in commit:

fdc7718999 ("board: usb_a9263: Update to support DT and DM")

Signed-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
2017-10-16 09:42:51 -04:00
Tom Rini
f855a7bc12 Patch queue for efi - 2017-10-13
This is the second batch of amazing improvements for efi_loader in 2017.11:
 
   - New self tests to verify our own code
   - A few bug fixes
   - colored text support
   - event and SNP improvements, should get us close to iPXE working
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQIcBAABAgAGBQJZ4HqlAAoJECszeR4D/txgZ0YQAIwd158lVczf/cMnzf3UcIsH
 e4YUFvQJaGxJw5hccaewaEQJqtPhEEJuHnzc683XDoYISTgvzCyhNEs8o0f7LcX3
 41c50x2bQPz7oFO5N60m58RknHqKiGd5VAC6+r4vBM8C0zFHeNTULo4fzn1qRgb3
 YUHDiRMlToVZXCOkbCeFm+dEJvjkXWmDDDdJpFIgDs6Oj+jOuV+H1GRMF2d56V6r
 Dd4/QPAFl4sRprBAMlvsmuI7obwnGV7/aA4CHIlUqKOVcbddBq2KigX8ZpIYEpaf
 FhRfxRLuWqvDRKpn+ixKfgl4KiBE/CH7sg7F6Un0mIjQVvo8k22Jbetqi9m1j/+x
 YzIFnwzb9ZhQEFOmfHnH8M9+bMmHyW46wkS4gdO4OAd/W0SeyIZ0a0gB1prgb2LK
 RfYQ37WsZM5TRARlcvmJt4H5+EtRYLT8lLf+yPSuyX8/8ubVnYHWtVE1IMLCiCAG
 eVmTwfjLzo3c703RJd9rwDtE13lTQmIHczM4cWybQzooXA6ePLJpSZSWx7EJxdQq
 GC7jNIKyKpu2NjhM9fUssbU+SiYLaIvtUBSOlGrcP1TCVR/j8OQ0Y1eIc9xOprIi
 +VEZVB/Z59D8j2TMTn1Xr+hB9i5h9ZxcO88gdEwfs65uihfvJGVhV1AxTyiaxvNv
 novPhik2UyHG5buRHb2Y
 =PiNi
 -----END PGP SIGNATURE-----

Merge tag 'signed-efi-next' of git://github.com/agraf/u-boot

Patch queue for efi - 2017-10-13

This is the second batch of amazing improvements for efi_loader in 2017.11:

  - New self tests to verify our own code
  - A few bug fixes
  - colored text support
  - event and SNP improvements, should get us close to iPXE working
2017-10-13 09:53:58 -04:00
Tom Rini
26f9184e09 Merge git://git.denx.de/u-boot-fsl-qoriq 2017-10-12 13:36:58 -04:00
Rob Clark
bf19273e81 efi_loader: Add mem-mapped for fallback
When we don't have a real device/image path, such as 'bootefi hello',
construct a mem-mapped device-path.

This fixes 'bootefi hello' after devicepath refactoring.

Fixes: 95c5553ea2 ("efi_loader: refactor boot device and loaded_image handling")
Signed-off-by: Rob Clark <robdclark@gmail.com>
Acked-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
2017-10-12 17:22:58 +02:00
Tuomas Tynkkynen
ad12dc1844 cmd: Toggle the default value of CONFIG_CMD_IMLS
Having this as a 'default y' is rather annoying because it doesn't
actually compile unless other options are defined in the board header:

../cmd/bootm.c: In function 'do_imls_nor':
../cmd/bootm.c:330:7: error: 'CONFIG_SYS_MAX_FLASH_BANKS' undeclared (first use in this function); did you mean 'CONFIG_SYS_MAX_FLASH_SECT'?
   i < CONFIG_SYS_MAX_FLASH_BANKS; ++i, ++info) {

Make it 'default n' so people who develop new boards that start from a
blank defconfig have one less compilation failure to debug.

Signed-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
2017-10-10 17:51:04 -04:00
York Sun
b65ac633f5 cmd: spl: fix compiling error when CONFIG_CMD_SPL_WRITE_SIZE not defined
CONFIG_CMD_SPL_WRITE_SIZE is used for writing parameters to non-volatile
storage. So far it is only used for NAND. Fix compiling error when this
macro is not used for SD.

Signed-off-by: York Sun <york.sun@nxp.com>
CC: Anatolij Gustschin <agust@denx.de>
2017-10-09 08:48:44 -07:00
Tom Rini
99e46dfc6a cmd: Make CMD_LZMA / CMD_UNZIP default y if CMD_BOOTI
In the Linux Kernel on ARM64, the Image.COMPRESSION file is not
self-extracting in the way that x86 and ARM images are.  So when
CMD_BOOTI is enabled we should also default to enabling CMD_UNZIP and
CONFIG_LZMA in order for the user to be able to decompress many of the
common compressions that will be done to an Image file.

Signed-off-by: Tom Rini <trini@konsulko.com>
2017-10-08 16:19:56 -04:00
Sam Protsenko
610eec7f05 scripts: Move Kconfig contents to cmd/Kconfig
On case-insensitive file systems we have collision between
scripts/kconfig/ directory and scripts/Kconfig file. This patch moves
scripts/Kcofnig contents to cmd/Kconfig to fix that.

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Acked-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2017-10-08 16:19:56 -04:00
Tom Rini
bf52fcdef4 cmd/gpt.c, cmd/nvedit.c, tools/fit_image.c: Rework recent fixes for Coverity
The recent changes to these files did not completely fix the previous
issues, or introduced different (minor) issues.  In cmd/gpt.c we need to
dereference str_disk_guid to be sure that malloc worked.  In
cmd/nvedit.c we need to be careful that we can also fit in that leading
space when adding to the string.  And in tools/fit_image.c we need to
re-work the error handling slightly in fit_import_data() so that we only
call munmap() once.  We have two error paths here, one where we have an
fd to close and one where we do not.  Adjust labels to match this.

Reported-by: Coverity (CID: 167366, 167367, 167370)
Signed-off-by: Tom Rini <trini@konsulko.com>
2017-10-07 11:27:59 -04:00
Tom Rini
146dda3911 cmd/time.c: Initialize 'repeatable' variable
We cannot leave this uninitialized, set it to 0.

Reported-by: Coverity (CID: 144426)
Signed-off-by: Tom Rini <trini@konsulko.com>
2017-10-06 11:28:21 -04:00
Tom Rini
48ee0a87bc cmd/pxe.c: Rework initrd and bootargs handling slightly
For the initrd portion of handling our bootm arguments we do not have a
sufficiently long enough buffer for some improbable 64bit cases.  Expand
this buffer to allow for a 64bit address and almost 256MB initrd to be
used.  Make use of strncpy/strncat when constructing the values here
since we know what the worst case valid values are, length wise.

Similarly for bootargs themselves, we need to make use of strlen/sizeof
and strncpy/strncat to ensure that we don't overflow bootargs itself.

Cc: Simon Glass <sjg@chromium.org>
Cc: Alexander Graf <agraf@suse.de>
Reported-by: Coverity (CID: 131256)
Signed-off-by: Tom Rini <trini@konsulko.com>
2017-10-06 11:28:21 -04:00
Tom Rini
c667723ffb cmd/nvedit.c: Update input handling to cover overflow cases
When we have multiple messages provided, we need to be sure that we do
not exceed the length of our 'message' buffer.  In the for loop, make
sure that pos is not larger than message.  Only copy in at most however
much of the message buffer remains.  Finally, if we have not reached the
end of the message buffer, put in a space and NULL, and if we have,
ensure the buffer is now NULL termined.

Reported-by: Coverity (CID: 165116)
Signed-off-by: Tom Rini <trini@konsulko.com>
2017-10-06 11:28:21 -04:00