oweals/u-boot.git
6 years agobootm: Handle kernel_noload on arm64
Marek Vasut [Wed, 13 Jun 2018 04:13:33 +0000 (06:13 +0200)]
bootm: Handle kernel_noload on arm64

The ARM64 has 2 MiB alignment requirement for the kernel. When using
fitImage, this requirement may by violated, the kernel will thus be
executed from unaligned address and fail to boot. Do what booti does
and run booti_setup() for kernel_noload images on arm64 to obtain a
suitable aligned address to which the image shall be relocated.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Chen <bin.chen@linaro.org>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Tom Rini <trini@konsulko.com>
6 years agoARM: image: Add option for ignoring ep bit 3
Marek Vasut [Wed, 13 Jun 2018 04:13:32 +0000 (06:13 +0200)]
ARM: image: Add option for ignoring ep bit 3

Add option to the booti_setup() which indicates to it that the caller
requires the image to be relocated to the beginning of the RAM and
that the information whether the image can be located anywhere in RAM
at 2 MiB aligned boundary or not is to be ignored. This is useful ie.
in case the Image is wrapped in another envelope, ie. fitImage and not
relocating it but moving it would corrupt the envelope.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Bin Chen <bin.chen@linaro.org>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-By: Bin Chen <bin.chen@linaro.org>
6 years agosandbox: swap_case: Increase number of base address regs
Simon Glass [Tue, 12 Jun 2018 06:05:02 +0000 (00:05 -0600)]
sandbox: swap_case: Increase number of base address regs

At present the code overruns the bar[] array. Fix this.

At the same time, drop the leading / from the "/spl" path so that we can
run U-Boot SPL with:

   spl/u-boot-spl

rather than requiring:

   /path/to/spl/u-boot-spl

Reported-by: Coverity (CID: 131199)
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
6 years agospi: sandbox: Fix memory leak in sandbox_sf_bind_emul()
Simon Glass [Tue, 12 Jun 2018 06:05:01 +0000 (00:05 -0600)]
spi: sandbox: Fix memory leak in sandbox_sf_bind_emul()

Move the strdup() call so that it is only done when we know we will bind
the device.

Reported-by: Coverity (CID: 131216)
Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agorsa: Fix missing memory leak on error in fdt_add_bignum()
Simon Glass [Tue, 12 Jun 2018 06:05:00 +0000 (00:05 -0600)]
rsa: Fix missing memory leak on error in fdt_add_bignum()

Thsi function can fail without freeing all its memory. Fix it.

Reported-by: Coverity (CID: 131217)
Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agofdtgrep: Separate out checking of two allocations
Simon Glass [Tue, 12 Jun 2018 06:04:59 +0000 (00:04 -0600)]
fdtgrep: Separate out checking of two allocations

The current code might succeed on the first allocation and fail on the
second. Separate the checks to avoid this problem.

Of course, free() will never fail and the chances that (when allocating
two small areas) one will succeed and one will fail are just as remote.
But this keeps coverity happy.

Reported-by: Coverity (CID: 131226)
Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agofdtgrep: Fix logic of free() in do_fdtgrep()
Simon Glass [Tue, 12 Jun 2018 06:04:58 +0000 (00:04 -0600)]
fdtgrep: Fix logic of free() in do_fdtgrep()

This loop never actually exits, but the way the code is written this is
not obvious. Add an explicit error check.

Reported-by: Coverity (CID: 131280)
Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Add explicit init of region to NULL per LLVM warning]
Signed-off-by: Tom Rini <trini@konsulko.com>
6 years agoconsole: Fix handling of NULL global_data
Simon Glass [Tue, 12 Jun 2018 06:04:56 +0000 (00:04 -0600)]
console: Fix handling of NULL global_data

Both putc() and puts() can be called before global_data is set up. Some of
the code paths don't handle this correctly. Add an explicit test before
any member is accessed.

Reported-by: Coverity (CID: 169030)
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
6 years agolog: Fix incorect range check in log_get_cat_name()
Simon Glass [Tue, 12 Jun 2018 06:04:55 +0000 (00:04 -0600)]
log: Fix incorect range check in log_get_cat_name()

This allows access to an element after the end of the array. Fix it.

Reported-by: Coverity (CID: 173279)
Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agogpio: omap_gpio: Name GPIO's by bank and index with DM_GPIO
Adam Ford [Tue, 12 Jun 2018 01:05:38 +0000 (20:05 -0500)]
gpio: omap_gpio: Name GPIO's by bank and index with DM_GPIO

There are multiple GPIO banks with up to 32 pins / bank. When
using 'gpio status -a' to read the pins, this patch displays
both GPIO<bank>_<index> similar to how the device trees
display in addition to displaying  gpio_#

Signed-off-by: Adam Ford <aford173@gmail.com>
6 years agoarm: mach-omap2/omap3/clock.c: Enable all GPIO with CMD_GPIO
Adam Ford [Tue, 12 Jun 2018 00:56:49 +0000 (19:56 -0500)]
arm: mach-omap2/omap3/clock.c: Enable all GPIO with CMD_GPIO

When CMD_GPIO is enabled the command 'gpio status -a' can cause
a hang or reboot if GPIO banks are not enabled, because it scans
all banks.  This patch enables all GPIO banks so 'gpio status -a'
can fully execute.

Signed-off-by: Adam Ford <aford173@gmail.com>
6 years agoblock: Add SPL_BLOCK_CACHE and default n
Adam Ford [Mon, 11 Jun 2018 22:17:48 +0000 (17:17 -0500)]
block: Add SPL_BLOCK_CACHE and default n

When enabling BLOCK_CACHE on devices with limited RAM during SPL,
some devices may not boot.  This creates an option to enable
block caching in SPL by defaults off.  It is dependent on SPL_BLK

Fixes: 46960ad6d09b ("block: Have BLOCK_CACHE default to y in some cases")

Signed-off-by: Adam Ford <aford173@gmail.com>
6 years agoarm: Do not clear LR on exception in SPL
Andrew F. Davis [Mon, 11 Jun 2018 19:04:17 +0000 (14:04 -0500)]
arm: Do not clear LR on exception in SPL

When an exception or interrupt occurs the link register (LR) may
contain the source of the exception, although we do not print the
value it may still be extracted with a debugger. When in SPL we
loop on getting and exception, but use a linking branch, which
over-writes the LR value, use a regular branch instruction here.

Signed-off-by: Andrew F. Davis <afd@ti.com>
6 years agommc: Remove hwpartition help text when command is disabled
Alex Kiernan [Mon, 11 Jun 2018 16:20:09 +0000 (16:20 +0000)]
mmc: Remove hwpartition help text when command is disabled

When the `mmc hwpartition` command is disabled, remove the associated help
text.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
6 years agofs: btrfs: Do not fail when all root_backups are empty
Yevgeny Popovych [Mon, 11 Jun 2018 11:14:33 +0000 (14:14 +0300)]
fs: btrfs: Do not fail when all root_backups are empty

This is the case when reading freshly created filesystem.
The error message is like the following:
    btrfs_read_superblock: No valid root_backup found!

Since the data from super_roots/root_backups is not actually used -
decided to rework btrfs_newest_root_backup() into
btrfs_check_super_roots() that will only check if super_roots
array is valid and correctly handle empty scenario.

As a result:
* btrfs_read_superblock() now only checks if super_roots array is valid;
  the case when it is empty is considered OK.
* removed root_backup pointer from btrfs_info,
  which would be NULL in case of empty super_roots.
* btrfs_read_superblock() verifies number of devices from the superblock
  itself, not newest root_backup.

Signed-off-by: Yevgeny Popovych <yevgenyp@pointgrab.com>
Cc: Marek Behun <marek.behun@nic.cz>
Cc: Sergey Struzh <sergeys@pointgrab.com>
6 years ago.gitignore: move *.dtb and *.dtb.S patterns to the top-level .gitignore
Masahiro Yamada [Mon, 11 Jun 2018 07:21:50 +0000 (16:21 +0900)]
.gitignore: move *.dtb and *.dtb.S patterns to the top-level .gitignore

Follow Linux commit 10b62a2f785a (".gitignore: move *.dtb and *.dtb.S
patterns to the top-level .gitignore").

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
6 years ago.gitignore: sort normal pattern rules alphabetically
Masahiro Yamada [Mon, 11 Jun 2018 07:21:49 +0000 (16:21 +0900)]
.gitignore: sort normal pattern rules alphabetically

Follow Linux commit 1377dd3e2987 (".gitignore: sort normal pattern
rules alphabetically").

This would allow us to easily catch duplicated patterns if any.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
6 years agodm: gpio: Add DM compatibility to GPIO driver for Davinci
Adam Ford [Mon, 11 Jun 2018 03:25:57 +0000 (22:25 -0500)]
dm: gpio: Add DM compatibility to GPIO driver for Davinci

This adds DM_GPIO support for the davinici GPIO driver with
DT support.

Signed-off-by: Adam Ford <aford173@gmail.com>
6 years agoMAINTAINERS: update ARM Snapdragon
Ramon Fried [Sun, 10 Jun 2018 20:51:41 +0000 (23:51 +0300)]
MAINTAINERS: update ARM Snapdragon

Replace Mateusz as Maintainer for ARM Snapdragon arch.

Signed-off-by: Ramon Fried <ramon.fried@gmail.com>
Acked-by: Mateusz Kulikowski <mateusz.kulikowski@gmail.com>
6 years agodb410c: fix alignment of dts file
Ramon Fried [Sat, 9 Jun 2018 08:30:30 +0000 (11:30 +0300)]
db410c: fix alignment of dts file

Alignment was wrong, missing one tab. fix it.

Signed-off-by: Ramon Fried <ramon.fried@gmail.com>
6 years agoiotrace: fix behaviour when buffer is full
Ramon Fried [Fri, 8 Jun 2018 17:53:27 +0000 (20:53 +0300)]
iotrace: fix behaviour when buffer is full

Don't continue updating the offset when buffer is full.
When the buffer size exhausts and there's no space left to write
warn the user and update only the needed size and not both the
offset and needed size.

Add needed buffer size information in the iotrace command.

Signed-off-by: Ramon Fried <ramon.fried@gmail.com>
6 years agocmd: iotrace: add dump trace command
Ramon Fried [Fri, 8 Jun 2018 17:53:26 +0000 (20:53 +0300)]
cmd: iotrace: add dump trace command

Add dump trace command which dump all trace
buffer content in a much more readable fashion
than md.

Signed-off-by: Ramon Fried <ramon.fried@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agoiotrace: move record definitons to header file
Ramon Fried [Fri, 8 Jun 2018 17:53:25 +0000 (20:53 +0300)]
iotrace: move record definitons to header file

The header definitions are needed for reading
record information in cmd/iotrace.c

Signed-off-by: Ramon Fried <ramon.fried@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agoARM: sunxi: remove empty #ifdef/endif block
Chris Packham [Mon, 4 Jun 2018 09:45:23 +0000 (21:45 +1200)]
ARM: sunxi: remove empty #ifdef/endif block

Whatever code this was guarding has been removed so remove the guards
too.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
6 years agom68k: Remove empty #ifdef/#ifndef block
Chris Packham [Mon, 4 Jun 2018 09:45:22 +0000 (21:45 +1200)]
m68k: Remove empty #ifdef/#ifndef block

Whatever code this was guarding has been removed so remove the guards
too.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
6 years agoconfigs: Remove empty #ifdef/#ifndef blocks
Chris Packham [Mon, 4 Jun 2018 09:45:21 +0000 (21:45 +1200)]
configs: Remove empty #ifdef/#ifndef blocks

Remove empty #ifdef/#ifndef..#endif blocks where the configuration they
guarded has been completely removed.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
6 years agodoc: avb2.0: add README about AVB2.0 integration
Igor Opaniuk [Sun, 3 Jun 2018 18:56:43 +0000 (21:56 +0300)]
doc: avb2.0: add README about AVB2.0 integration

Contains:
1. Overview of Android Verified Boot 2.0
2. Description of avb subset of commands
3. Examples of errors when boot/vendor/system/vbmeta partitions
are tampered
4. Examples of enabling AVB2.0 on your setup

Signed-off-by: Igor Opaniuk <igor.opaniuk@linaro.org>
6 years agotest/py: avb2.0: add tests for avb commands
Igor Opaniuk [Sun, 3 Jun 2018 18:56:42 +0000 (21:56 +0300)]
test/py: avb2.0: add tests for avb commands

1. Run AVB 2.0 full verification chain, avb verify
2. Check if 'avb get_uuid' works, compare results with
'part list mmc 1' output
3. Test `avb read` commands, which reads N bytes from a partition
identified by a name

Signed-off-by: Igor Opaniuk <igor.opaniuk@linaro.org>
6 years agoam57xx_hs: avb2.0: add support of AVB 2.0
Igor Opaniuk [Sun, 3 Jun 2018 18:56:41 +0000 (21:56 +0300)]
am57xx_hs: avb2.0: add support of AVB 2.0

1. Add vbmeta partition info to android partition layout for TI
   platforms.
2. Add support of AVB 2.0 (including avb subset of commands) for am57xx HS

Signed-off-by: Igor Opaniuk <igor.opaniuk@linaro.org>
[trini: Move to include/environment/ti/boot.h, reword commit slightly]
Signed-off-by: Tom Rini <trini@konsulko.com>
6 years agoavb2.0: add boot states and dm-verity support
Igor Opaniuk [Sun, 3 Jun 2018 18:56:40 +0000 (21:56 +0300)]
avb2.0: add boot states and dm-verity support

1. Add initial support of boot states mode (red, green, yellow)
2. Add functions for enforcing dm-verity configurations

Signed-off-by: Igor Opaniuk <igor.opaniuk@linaro.org>
6 years agocmd: avb2.0: avb command for performing verification
Igor Opaniuk [Sun, 3 Jun 2018 18:56:39 +0000 (21:56 +0300)]
cmd: avb2.0: avb command for performing verification

Enable a "avb" command to execute Android Verified
Boot 2.0 operations. It includes such subcommands:
  avb init - initialize avb2 subsystem
  avb read_rb - read rollback index
  avb write_rb - write rollback index
  avb is_unlocked - check device lock state
  avb get_uuid - read and print uuid of a partition
  avb read_part - read data from partition
  avb read_part_hex - read data from partition and output to stdout
  avb write_part - write data to partition
  avb verify - run full verification chain

Signed-off-by: Igor Opaniuk <igor.opaniuk@linaro.org>
6 years agoavb2.0: implement AVB ops
Igor Opaniuk [Sun, 3 Jun 2018 18:56:38 +0000 (21:56 +0300)]
avb2.0: implement AVB ops

Implement AVB ops on top of existing mmc subsystem API. Currently there
is a full implementation of such operations, defined by [1]
AVB2.0 specification:

.read_from_partition() - reads N bytes from a partition identified by
a name.
.write_to_partition() - Writes N bytes to a partition identified by a name.
.validate_vbmeta_public_key() - checks if the given public ‘vbmeta’
partition is trusted.
.get_unique_guid_for_partition() - Gets the GUID for a partition identified
by a string name.

As [1] specification recommends to use tamper-evident storage for storing
rollback indexes and device state (LOCKED/UNLOCKED),
currently are only stubs instead of full implementation for these ops:
.read_rollback_index() - Gets the rollback index for a given index location
.write_rollback_index() - Sets the rollback index to a given location
.read_is_device_unlocked() - Gets where the device is unlocked

[1] https://android.googlesource.com/platform/external/avb/+/master/README.md

Signed-off-by: Igor Opaniuk <igor.opaniuk@linaro.org>
6 years agoavb2.0: integrate avb 2.0 into the build system
Igor Opaniuk [Sun, 3 Jun 2018 18:56:37 +0000 (21:56 +0300)]
avb2.0: integrate avb 2.0 into the build system

Integrate libavb into the build system. Introduce CONFIG_LIBAVB
build option.

Signed-off-by: Igor Opaniuk <igor.opaniuk@linaro.org>
6 years agoavb2.0: add Android Verified Boot 2.0 library
Igor Opaniuk [Sun, 3 Jun 2018 18:56:36 +0000 (21:56 +0300)]
avb2.0: add Android Verified Boot 2.0 library

Add libavb lib (3rd party library from AOSP), that implements support of
AVB 2.0. This library is used for integrity checking of Android partitions
on eMMC.

libavb was added as it is and minimal changes were introduced to reduce
maintenance cost, because it will be deviated from AOSP upstream in the future.

Changes:
- license headers changed to conform SPDX-style
- avb_crc32.c dropped
- updates in avb_sysdeps_posix.c/avb_sysdeps.h

For additional details check [1] AVB 2.0 README.

[1] https://android.googlesource.com/platform/external/avb/+/master/README.md

Signed-off-by: Igor Opaniuk <igor.opaniuk@linaro.org>
6 years agoMerge git://git.denx.de/u-boot-x86
Tom Rini [Mon, 18 Jun 2018 16:59:46 +0000 (12:59 -0400)]
Merge git://git.denx.de/u-boot-x86

6 years agox86: efi: app: Display correct CPU info during boot
Bin Meng [Tue, 12 Jun 2018 15:36:25 +0000 (08:36 -0700)]
x86: efi: app: Display correct CPU info during boot

Currently when EFI application boots, it says:

  CPU: x86_64, vendor <invalid cpu vendor>, device 0h

Fix this by calling x86_cpu_init_f() in arch_cpu_init().

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agox86: Rename efi-x86 target to efi-x86_app
Bin Meng [Tue, 12 Jun 2018 15:36:24 +0000 (08:36 -0700)]
x86: Rename efi-x86 target to efi-x86_app

To avoid confusion, let's rename the efi-x86 target to efi-x86_app.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agox86: efi: payload: Add EFI framebuffer driver support
Bin Meng [Tue, 12 Jun 2018 15:36:23 +0000 (08:36 -0700)]
x86: efi: payload: Add EFI framebuffer driver support

This turns on the EFI framebuffer driver support so that a graphics
console can be of additional help.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agodm: video: Add an EFI framebuffer driver
Bin Meng [Tue, 12 Jun 2018 15:36:22 +0000 (08:36 -0700)]
dm: video: Add an EFI framebuffer driver

This adds a DM video driver for U-Boot as the EFI payload. The driver
makes use of all necessary information from the passed EFI GOP info
to create a linear framebuffer device, as if it were initialized by
U-Boot itself.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Anatolij Gustschin <agust@denx.de>
6 years agoefi: stub: Pass EFI GOP information to U-Boot payload
Bin Meng [Tue, 12 Jun 2018 15:36:21 +0000 (08:36 -0700)]
efi: stub: Pass EFI GOP information to U-Boot payload

If UEFI BIOS has the graphics output protocol (GOP), let's pass its
information to U-Boot payload so that U-Boot can utilize it (eg:
an EFI framebuffer driver).

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agox86: baytrail: Drop EFI-specific test logics
Bin Meng [Tue, 12 Jun 2018 15:36:20 +0000 (08:36 -0700)]
x86: baytrail: Drop EFI-specific test logics

Now that we have generic EFI payload support, drop EFI-specific test
logics in BayTrail Kconfig and codes, and all BayTrail boards too.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agox86: Drop QEMU-specific EFI payload support
Bin Meng [Tue, 12 Jun 2018 15:36:19 +0000 (08:36 -0700)]
x86: Drop QEMU-specific EFI payload support

Now that we have generic EFI payload support for all x86 boards,
drop the QEMU-specific one.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agox86: Add generic EFI payload support
Bin Meng [Tue, 12 Jun 2018 15:36:18 +0000 (08:36 -0700)]
x86: Add generic EFI payload support

It is possible to create a generic EFI payload for all x86 boards.
The payload is configured to include as many generic drivers as
possible. All stuff that touches low-level initialization are not
allowed as such is the EFI BIOS's responsibility. Platform specific
drivers (like gpio, spi, etc) are not included.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agox86: efi: payload: Add arch_cpu_init()
Bin Meng [Tue, 12 Jun 2018 15:36:17 +0000 (08:36 -0700)]
x86: efi: payload: Add arch_cpu_init()

This adds arch_cpu_init() to the payload codes, in preparation for
supporting a generic efi payload.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agox86: efi: Refactor the directory of EFI app and payload support
Bin Meng [Tue, 12 Jun 2018 15:36:16 +0000 (08:36 -0700)]
x86: efi: Refactor the directory of EFI app and payload support

At present the EFI application and payload support codes in the x86
directory is distributed in a hybrid way. For example, the Kconfig
options for both app and payload are in arch/x86/lib/efi/Kconfig,
but the source codes in the same directory get built only for
CONFIG_EFI_STUB.

This refactors the codes by consolidating all the EFI support codes
into arch/x86/cpu/efi, just like other x86 targets.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agox86: doc: Fix reference to EFI doc in U-Boot
Bin Meng [Tue, 12 Jun 2018 15:36:13 +0000 (08:36 -0700)]
x86: doc: Fix reference to EFI doc in U-Boot

Since commit f3b5056c4e72 ("efi_loader: split README.efi into two
separate documents"), the original README.efi was renamed to
README.u-boot_on_efi, but x86 doc still refers to the old one.

This updates the x86 doc to reference both README.u-boot_on_efi and
README.uefi.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
6 years agox86: use EFI calling convention for efi_main on x86_64
Ivan Gorinov [Thu, 14 Jun 2018 00:27:39 +0000 (17:27 -0700)]
x86: use EFI calling convention for efi_main on x86_64

UEFI specifies the calling convention used in Microsoft compilers;
first arguments of a function are passed in (%rcx, %rdx, %r8, %r9).

All other compilers use System V ABI by default, passing first integer
arguments of a function in (%rdi, %rsi, %rdx, %rcx, %r8, %r9).

These ABI also specify different sets of registers that must be preserved
across function calls (callee-saved).

GCC allows using the Microsoft calling convention by adding the ms_abi
attribute to a function declaration.

Current EFI implementation in U-Boot specifies EFIAPI for efi_main()
in the test apps but uses default calling convention in lib/efi.

Save efi_main() arguments in the startup code on x86_64;
use EFI calling convention for _relocate() on x86_64;
consistently use EFI calling convention for efi_main() everywhere.

Signed-off-by: Ivan Gorinov <ivan.gorinov@intel.com>
Reviewed-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
6 years agox86: cherryhill: Fix DTC warning
Bin Meng [Wed, 13 Jun 2018 03:01:14 +0000 (20:01 -0700)]
x86: cherryhill: Fix DTC warning

Fix warning when compiling cherryhill.dts with latest DTC:

  "Warning (avoid_unnecessary_addr_size): /pci/pch@1f,0: unnecessary
   #address-cells/#size-cells without "ranges" or child "reg" property"

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agoMerge branch 'master' of git://git.denx.de/u-boot-sh
Tom Rini [Sun, 17 Jun 2018 13:09:40 +0000 (09:09 -0400)]
Merge branch 'master' of git://git.denx.de/u-boot-sh

6 years agoMerge branch 'master' of git://git.denx.de/u-boot-usb
Tom Rini [Sat, 16 Jun 2018 04:07:37 +0000 (00:07 -0400)]
Merge branch 'master' of git://git.denx.de/u-boot-usb

6 years agoARM: rmobile: Disable 4k SF sectors on V3M Eagle
Marek Vasut [Sat, 16 Jun 2018 02:21:45 +0000 (04:21 +0200)]
ARM: rmobile: Disable 4k SF sectors on V3M Eagle

The V3M Eagle uses flash with 128 kiB or 256 kiB sectors,
disable the 4k sector support.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
6 years agoARM: rmobile: Enable cache command on V3M Eagle
Marek Vasut [Fri, 15 Jun 2018 23:41:09 +0000 (01:41 +0200)]
ARM: rmobile: Enable cache command on V3M Eagle

Turning the cache off can help when experimenting with bare metal
applications, enable the cache command on V3M Eagle to make that
easier.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
6 years agoARM: rmobile: Fix CPGW address on V3M Eagle
Marek Vasut [Fri, 15 Jun 2018 23:16:50 +0000 (01:16 +0200)]
ARM: rmobile: Fix CPGW address on V3M Eagle

Fix the CPGWPR/CPGWPCR register address on V3M Eagle to unlock
access to the CPG clock control registers.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
6 years agoARM: dts: rmobile: Add AVB PHY reset on V3M Eagle
Marek Vasut [Sat, 16 Jun 2018 00:15:12 +0000 (02:15 +0200)]
ARM: dts: rmobile: Add AVB PHY reset on V3M Eagle

Add EtherAVB PHY reset on V3M Eagle to let the AVB driver unreset the PHY.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
6 years agoARM: dts: rmobile: Add AVB pinmux on V3M Eagle
Marek Vasut [Fri, 15 Jun 2018 23:16:41 +0000 (01:16 +0200)]
ARM: dts: rmobile: Add AVB pinmux on V3M Eagle

Add EtherAVB pinmux node on V3M Eagle to set the pinmux configuration.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
6 years agoARM: dts: rmobile: Enable SDHI on E3 Ebisu
Marek Vasut [Thu, 31 May 2018 17:56:42 +0000 (19:56 +0200)]
ARM: dts: rmobile: Enable SDHI on E3 Ebisu

Enable SDHI on R8A77990 E3 Ebisu in DT.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
6 years agoARM: dts: rmobile: Add initial SDHI nodes to R8A77990 E3
Marek Vasut [Thu, 31 May 2018 17:56:36 +0000 (19:56 +0200)]
ARM: dts: rmobile: Add initial SDHI nodes to R8A77990 E3

Add SDHI nodes to R8A77990 E3 SoC to allow SDHI operation.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
6 years agoARM: dts: rmobile: Add SCIF2 pinmux to E3 Ebisu
Marek Vasut [Wed, 13 Jun 2018 19:44:50 +0000 (21:44 +0200)]
ARM: dts: rmobile: Add SCIF2 pinmux to E3 Ebisu

Add SCIF2 pinmux nodes to R8A77990 E3 Ebisu.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
6 years agoARM: dts: rmobile: Add Renesas RPC HF/QSPI DT node to R8A77990
Marek Vasut [Wed, 13 Jun 2018 19:15:54 +0000 (21:15 +0200)]
ARM: dts: rmobile: Add Renesas RPC HF/QSPI DT node to R8A77990

Add device tree nodes for the Renesas RPC HF/QSPI controller
to R8A77990 E3.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
6 years agoARM: rmobile: Enable RPCHF on Draak
Marek Vasut [Thu, 14 Jun 2018 03:38:07 +0000 (05:38 +0200)]
ARM: rmobile: Enable RPCHF on Draak

Enable the Renesas RPC HF driver on R8A77995 D3 Draak.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
6 years agoARM: rmobile: Fix environment placement on Draak
Marek Vasut [Sun, 10 Jun 2018 14:19:01 +0000 (16:19 +0200)]
ARM: rmobile: Fix environment placement on Draak

The environment on Draak is in the eMMC, card 0, place it so.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
6 years agoMerge tag 'arc-updates-for-2018.07-rc2' of git://git.denx.de/u-boot-arc
Tom Rini [Fri, 15 Jun 2018 13:38:16 +0000 (09:38 -0400)]
Merge tag 'arc-updates-for-2018.07-rc2' of git://git.denx.de/u-boot-arc

Here we just add a tool for HSDK flashable images preparation
together with extensive documentation for HSDK board.

This will help real-life users to update U-Boot on the board.

6 years agoMerge tag 'xilinx-for-v2018.07-rc2' of git://git.denx.de/u-boot-microblaze
Tom Rini [Fri, 15 Jun 2018 13:38:06 +0000 (09:38 -0400)]
Merge tag 'xilinx-for-v2018.07-rc2' of git://git.denx.de/u-boot-microblaze

Xilinx fixes for v2018.07-rc2

Zynq:
- Fix missing watchdog header
- DT fixes

ZynqMP:
- emmc configuration split
- Enable SPD
- Fix PMUFW_INIT_FILE logic
- Coverity fixes in SoC code

timer
- Add timer_get_boot_us

mmc:
- Fix MMC HS200 tuning command

serial:
- Fix scrabled chars with OF_LIVE

6 years agoARC: HSDK: Add readme
Alexey Brodkin [Thu, 14 Jun 2018 21:38:53 +0000 (00:38 +0300)]
ARC: HSDK: Add readme

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
6 years agoARC: HSDK: Add tool and make target to generate bsp
Eugeniy Paltsev [Mon, 4 Jun 2018 11:52:32 +0000 (14:52 +0300)]
ARC: HSDK: Add tool and make target to generate bsp

HSDK board has preloader that reads SPI flash pages and searches
for a special image header to fetch and load binary.

Add tool, make target (bsp-generate) to generate
update script and u-boot binary image with header for preloader.

Also add script to default environment to apply updates.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
6 years agoserial: zynq: Make zynq_serial_setbrg static
Michal Simek [Thu, 14 Jun 2018 09:19:57 +0000 (11:19 +0200)]
serial: zynq: Make zynq_serial_setbrg static

This function is used only inside this driver that's why should be
static.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agoserial: zynq: Initialize uart only before relocation
Michal Simek [Thu, 14 Jun 2018 08:41:35 +0000 (10:41 +0200)]
serial: zynq: Initialize uart only before relocation

This issue was found when OF_LIVE was enabled that there are scrambled
chars on the console like this:
Chip ID: zu3eg
Watchdog: Started��j�   sdhci@ff160000: 0, sdhci@ff170000: 1
In:    serial@ff010000

I found a solution for this problem exactly the same as I found later in
serial_msm fixed by:
"serial: serial_msm: initialize uart only before relocation"
(sha1: 7e5ad796bcd65772a87da236ae21cd536ae3a4d2)

What it is happening is that output TX fifo still contains chars to be
sent and _uart_zynq_serial_init() resets TX fifo even in the middle of
transfer.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agoserial: zynq: Write chars till output fifo is full
Michal Simek [Thu, 14 Jun 2018 07:43:34 +0000 (09:43 +0200)]
serial: zynq: Write chars till output fifo is full

Change logic and put char to fifo till there is a space in output fifo.
Origin logic was that output fifo needs to be empty. It means only one
char was in output queue.
Also remove unused ZYNQ_UART_SR_TXEMPTY macro.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agoserial: zynq: Use BIT macros instead of shifts and full hex numbers
Michal Simek [Thu, 14 Jun 2018 09:13:41 +0000 (11:13 +0200)]
serial: zynq: Use BIT macros instead of shifts and full hex numbers

Coding style is checking to use BIT macros instead of shifts.
The patch is also fixing the rest of macros which should be BITs instead
of hex numbers.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agogpio: zynq_gpio: bank description should use unsigned type
Michal Simek [Wed, 13 Jun 2018 11:22:08 +0000 (13:22 +0200)]
gpio: zynq_gpio: bank description should use unsigned type

Use u32 instead of int for max_bank, bank_min and bank_max. These values
can't be negative that's why no reason to use signed type.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
6 years agoarm64: zynqmp: Check return value in zynqmp_mmio_rawwrite()
Michal Simek [Wed, 13 Jun 2018 08:38:33 +0000 (10:38 +0200)]
arm64: zynqmp: Check return value in zynqmp_mmio_rawwrite()

There should be return value check from zynqmp_mmio_read() in
zynqmp_mmio_rawwrite() to make sure that errors are propagated properly.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
6 years agoarm64: zynqmp: Check return value from calloc
Michal Simek [Wed, 13 Jun 2018 07:42:41 +0000 (09:42 +0200)]
arm64: zynqmp: Check return value from calloc

calloc() can fail and return NULL. The patch is checking return value
and return in case of error.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
6 years agommc: zynq: Fix tuning_loop_counter type in arasan_sdhci_execute_tuning()
Michal Simek [Wed, 13 Jun 2018 07:12:29 +0000 (09:12 +0200)]
mmc: zynq: Fix tuning_loop_counter type in arasan_sdhci_execute_tuning()

Code around tuning_loop_counter variable expects to go below zero.
That's why this variable can't use unsigned type.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
6 years agogpio: zynq: Do not check unsigned type that is >= 0
Michal Simek [Wed, 13 Jun 2018 07:05:51 +0000 (09:05 +0200)]
gpio: zynq: Do not check unsigned type that is >= 0

There is no reason to check that unsigned type that is >= 0.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
6 years agommc: sdhci: Fix MMC HS200 tuning command failures
Siva Durga Prasad Paladugu [Wed, 13 Jun 2018 06:13:01 +0000 (11:43 +0530)]
mmc: sdhci: Fix MMC HS200 tuning command failures

This patch fixes the mmc tuning command failures
when tuning pattern data needs to read back for
comparision against the expected bit pattern.

Reported-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Tested-by: Masahiro Yamada <yamada.masahiro@socionext.com>
6 years agoarm64: zynqmp: accept an absolute path for PMUFW_INIT_FILE
Luca Ceresoli [Mon, 4 Jun 2018 10:21:01 +0000 (12:21 +0200)]
arm64: zynqmp: accept an absolute path for PMUFW_INIT_FILE

The value of PMUFW_INIT_FILE is prefixed with "$(srctree)/", thus
forcing it to be a relative path inside the U-Boot source tree. Since
the PMUFW is a binary file generated outside of U-Boot, the PMUFW
binary must be copied inside the U-Boot source tree before the
build.

This generates a few problems:

 * if the source tree is shared among different out-of-tree builds,
   they will pollute (and potentially corrupt) each other
 * the source tree cannot be read-only
 * any buildsystem must add a command to copy the PMUFW binary
 * putting an externally-generated binary in the source tree is ugly
   as hell

Avoid these problems by accepting an absolute path for
PMUFW_INIT_FILE. This would be as simple as removing the "$(srctree)/"
prefix, but in order to keep backward compatibility we rather use the
shell and readlink to get the absolute path even when starting from a
relative path.

Since 'readlink -f' produces an empty string if the file does not
exist, we also add a check to ensure the file configured in
PMUFW_INIT_FILE exists. Otherwise the build would exit successfully,
but produce a boot.bin without PMUFW as if PMUFW_INIT_FILE were empty.

Tested in the 12 possible combinations of:
 - PMUFW_INIT_FILE empty, relative, absolute, non-existing
 - building in-tree, in subdir, in other directory

Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net>
Cc: Michal Simek <michal.simek@xilinx.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Emmanuel Vadot <manu@bidouilliste.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
6 years agoarm64: zynqmp: Enable SPD ddr support for zcu102 targets
Michal Simek [Mon, 4 Jun 2018 06:27:50 +0000 (08:27 +0200)]
arm64: zynqmp: Enable SPD ddr support for zcu102 targets

zcu102 contains DIMM with SPD on it at 0x51 address.
For example:
i2c dev 13
i2c sdram 51

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
6 years agotimer: cadence: Implement timer_get_boot_us
Michal Simek [Wed, 18 Apr 2018 12:03:56 +0000 (14:03 +0200)]
timer: cadence: Implement timer_get_boot_us

This function is required for adding bootstage support.
Also enable it directly for ZynqMP R5 configuration.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
6 years agoarm: zynq: Drop #address-cells and #size-cells from gpio-keys
Michal Simek [Fri, 8 Jun 2018 07:36:12 +0000 (09:36 +0200)]
arm: zynq: Drop #address-cells and #size-cells from gpio-keys

dtc is showing some warnings and this change was also done in
the Linux kernel as "Input: gpio-keys - clean up device tree binding
example"
with this fragment in commit message
"Drop #address-cells and #size-cells, which are not required by the
gpio-keys binding documentation, as button sub-nodes are not devices."

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
6 years agoarm64: zynqmp: Split emmc configuration into emmc0 and emmc1
Siva Durga Prasad Paladugu [Tue, 5 Jun 2018 09:48:32 +0000 (15:18 +0530)]
arm64: zynqmp: Split emmc configuration into emmc0 and emmc1

This patch splits the current mini emmc configuration into emmc0
and emmc1 configurations because emmc is probed at boot time and on
systems which have only one interface mini configuration is failing on
unused interface. This patch also adds required clock node in dts and
enables CONFIG_MMC_SDHCI_ZYNQ through defconfig.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
6 years agoarm: zynq: Add missing watchdog header
Michal Simek [Fri, 8 Jun 2018 11:45:14 +0000 (13:45 +0200)]
arm: zynq: Add missing watchdog header

Add missing header detected by sparse.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
6 years agoARM: rmobile: Point load address to more sane area on Gen3
Marek Vasut [Thu, 31 May 2018 13:18:18 +0000 (15:18 +0200)]
ARM: rmobile: Point load address to more sane area on Gen3

Point the $loadaddr variable and default load address to a more sane
area, 384 MiB from the start of RAM. This is to avoid all the reserved
memory at the beginning of RAM. The old behavior could still be easily
retained by "setenv loadaddr 0x48080000" . The new setup allows us to
use for example modern fitImage with kernel_noload, so use this as a
new preferred default.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
6 years agoARM: rmobile: Point load address to more sane area on Gen2
Marek Vasut [Thu, 31 May 2018 13:12:53 +0000 (15:12 +0200)]
ARM: rmobile: Point load address to more sane area on Gen2

Point the $loadaddr variable and default load address to a more sane
area, 256 MiB from the start of RAM. While it is convenient to use
uImage without copying, which is why the previous load address was
set the way it was, uImage is now legacy. This behavior could still
be easily retained by "setenv loadaddr 0x40007fc0" . The new setup
allows us to use for example modern fitImage with kernel_noload, so
use this as a new preferred default.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
6 years agoARM: rmobile: Zap CONFIG_SYS_CLK_FREQ where applicable
Marek Vasut [Tue, 5 Jun 2018 18:21:30 +0000 (20:21 +0200)]
ARM: rmobile: Zap CONFIG_SYS_CLK_FREQ where applicable

The CONFIG_SYS_CLK_FREQ is not used on some of the Gen3 boards,
remove it. Moreover, on Ebisu this actually didn't match the
comment in the config file at all, but since it was not used,
there was no real problem.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
6 years agoARM: rmobile: Sync Gen3 DTS with Linux v4.17
Marek Vasut [Wed, 6 Jun 2018 18:03:30 +0000 (20:03 +0200)]
ARM: rmobile: Sync Gen3 DTS with Linux v4.17

Sync the DTs with Linux v4.17.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
6 years agoARM: rmobile: Sync Gen2 DTS with Linux v4.17
Marek Vasut [Wed, 6 Jun 2018 17:58:17 +0000 (19:58 +0200)]
ARM: rmobile: Sync Gen2 DTS with Linux v4.17

Sync the DTs with Linux v4.17.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
6 years agopinctrl: renesas: Sync Gen3 PFC tables with Linux v4.17
Marek Vasut [Sun, 10 Jun 2018 14:05:48 +0000 (16:05 +0200)]
pinctrl: renesas: Sync Gen3 PFC tables with Linux v4.17

Sync the PFC tables with Linux v4.17.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
6 years agoMerge tag 'signed-efi-next' of git://github.com/agraf/u-boot
Tom Rini [Thu, 14 Jun 2018 17:28:03 +0000 (13:28 -0400)]
Merge tag 'signed-efi-next' of git://github.com/agraf/u-boot

Patch queue for efi - 2018-06-14

A few minor fixes for the release:

  - Compile fixes
  - HI20 relocations for RISC-V
  - Fix bootefi without load path
  - Fix Runtime Services with certain compilers

6 years agopinctrl: renesas: Sync Gen2 PFC tables with Linux v4.17
Marek Vasut [Sun, 10 Jun 2018 14:05:18 +0000 (16:05 +0200)]
pinctrl: renesas: Sync Gen2 PFC tables with Linux v4.17

Sync the PFC tables with Linux v4.17.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
6 years agoclk: rmobile: Add R8A77995 RPC clock
Marek Vasut [Thu, 14 Jun 2018 03:26:31 +0000 (05:26 +0200)]
clk: rmobile: Add R8A77995 RPC clock

Add missing RPC entry into the R8A77995 clock driver tables.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
6 years agoclk: rmobile: Add R8A77990 RPC clock
Marek Vasut [Wed, 13 Jun 2018 19:25:24 +0000 (21:25 +0200)]
clk: rmobile: Add R8A77990 RPC clock

Add missing RPC entry into the R8A77990 clock driver tables.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
6 years agodts: gpio: Sync header with Linux 4.17
Marek Vasut [Thu, 14 Jun 2018 11:32:10 +0000 (13:32 +0200)]
dts: gpio: Sync header with Linux 4.17

Sync the gpio.h header with Linux 4.17, which contains new macros.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Tom Rini <trini@konsulko.com>
6 years agoMerge branch 'master' of git://git.denx.de/u-boot-net
Tom Rini [Thu, 14 Jun 2018 11:20:41 +0000 (07:20 -0400)]
Merge branch 'master' of git://git.denx.de/u-boot-net

6 years agousb: sunxi: access ahb_reset0_cfg in CCM using its offset
Vasily Khoruzhick [Thu, 14 Jun 2018 06:19:34 +0000 (23:19 -0700)]
usb: sunxi: access ahb_reset0_cfg in CCM using its offset

struct sunxi_ccm_reg doesn't have ahb_reset0_cfg on sun4i and sun5i,
thus compilation fails with:

drivers/usb/host/ohci-sunxi.c:96:26: error: 'struct sunxi_ccm_reg' has
no member named 'ahb_reset0_cfg'

Access this reg using its offset to fix this issue.

Fixes commit 1ed9c1118 ("usb: sunxi: ehci: get rid of ifdefs")
and commit 56830cee3 ("usb: sunxi: ohci: get rid of ifdefs")

Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
6 years agoefi_loader: Allocate memory handle for mem dp
Alexander Graf [Tue, 12 Jun 2018 08:21:16 +0000 (10:21 +0200)]
efi_loader: Allocate memory handle for mem dp

When we boot using memdp (bootefi on an address without previous
load that populates the device path) then the memory device path
we pass in is not backed by any handle.

That can result in weird effects. For example grub gets very grumpy
about this inside the efi_net module and just loops endlessly.

So let's expose a simple handle that the memory device path is backed
on. That way any code that looks for the device the dp is on, finds
one.

Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: avoid make race condition
Heinrich Schuchardt [Sat, 2 Jun 2018 17:00:41 +0000 (19:00 +0200)]
efi_loader: avoid make race condition

When U-Boot is built with 'make -j' there is not guarantee that targets in
directory arch/ are built before targets in directory lib/. The current
build instruction for EFI binaries in lib/ rely on dependencies in arch/.
If $(EFI_CRT0) or $(EFI_RELOC) is not yet built before trying to build
%.efi an error
    *** No rule to make target '%.efi'
occurs.

With the patch separate copies of $(EFI_CRT0) and $(EFI_RELOC) named
efi_crt0.o and efi_reloc.o are built in lib/efi_loader and
lib/efi_selftest.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: avoid initializer element is not constant
Heinrich Schuchardt [Sat, 9 Jun 2018 15:50:18 +0000 (17:50 +0200)]
efi_loader: avoid initializer element is not constant

When building with -pedantic the current definition of EFI_GUID() causes
an error 'initializer element is not constant'.

Currently EFI_GUID() is used both as an anonymous constant and as an
intializer. A conversion to efi_guid_t is not allowable when using
EFI_GUID() as an initializer. But it is needed when using it as an
anonymous constant.

We should not use EFI_GUID() for anything but an initializer. So let's
introduce a variable where needed and remove the conversion.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi: Add a comment about duplicated ELF constants
Simon Glass [Tue, 12 Jun 2018 05:26:40 +0000 (23:26 -0600)]
efi: Add a comment about duplicated ELF constants

These constants are defined in arch-specific code but redefined here. Add
a TODO to clean this up.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: Convert runtime reset from switch to if statements
Alexander Graf [Sun, 10 Jun 2018 19:51:02 +0000 (21:51 +0200)]
efi_loader: Convert runtime reset from switch to if statements

We currently handle the UEFI runtime reset / power off case handling via
a switch statement. Compilers (gcc in my case) may opt to handle these via
jump tables which they may conveniently put into .rodata which is not part
of the runtime section, so it will be unreachable when executed.

Fix this by just converting the switch statement into an if/else statement.
It produces smaller code that is faster and also correct because we no
longer refer .rodata from efi runtime code.

Reported-by: Andreas Färber <aferber@suse.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoriscv: Add support for HI20 PE relocations
Alexander Graf [Tue, 5 Jun 2018 17:20:32 +0000 (19:20 +0200)]
riscv: Add support for HI20 PE relocations

The PE standard allows for HI20/LOW12 relocations. Within the efi_loader
target we always know that our relocation target is 4k aligned, so we
don't need to worry about the LOW12 part.

This patch adds support for the respective relocations. With this and a
few grub patches I have cooking in parallel I'm able to run grub on RISC-V.

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