platform/kernel/u-boot.git
6 years agopowerpc: mpc85xx: Drop u-boot-with-spl.bin on selected boards
York Sun [Thu, 14 Jun 2018 21:25:52 +0000 (14:25 -0700)]
powerpc: mpc85xx: Drop u-boot-with-spl.bin on selected boards

For SoCs with PBL, u-boot-with-spl-pbl.bin is the final image for
SPL boot. Drop unused u-boot-with-spl.bin.

Signed-off-by: York Sun <york.sun@nxp.com>
CC: Ashish Kumar <ashish.kumar@nxp.com>
CC: Ruchika Gupta <ruchika.gupta@nxp.com>
CC: Priyanka Jain <priyanka.jain@nxp.com>
CC: Shengzhou Liu <Shengzhou.Liu@nxp.com>
6 years agoarmv8: layerscape: Drop u-boot-with-spl.bin for selected boards
York Sun [Thu, 14 Jun 2018 21:25:51 +0000 (14:25 -0700)]
armv8: layerscape: Drop u-boot-with-spl.bin for selected boards

For SPL boot with PBL, u-boot-with-spl-pbl.bin is the final image.
Drop unused u-boot-with-spl.bin.

Signed-off-by: York Sun <york.sun@nxp.com>
CC: Mingkai Hu <mingkai.hu@nxp.com>
CC: Ruchika Gupta <ruchika.gupta@nxp.com>
CC: Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com>
CC: Udit Agarwal <udit.agarwal@nxp.com>
CC: Sumit Garg <sumit.garg@nxp.com>
CC: Priyanka Jain <priyanka.jain@nxp.com>
6 years agoarmv8: ls1046ardb: Enable IFC for SPL build
York Sun [Fri, 8 Jun 2018 23:37:27 +0000 (16:37 -0700)]
armv8: ls1046ardb: Enable IFC for SPL build

Commit a52ff334c5b1 ("armv8: ls1046ardb: SPL size reduction") reduced
image size for SPL. IFC was disabled. If PPA is loaded in SPL, MMU is
enabled as a result. Removing IFC skips IFC region in the MMU table,
causing later failure in RAM version U-boot when accessing CPLD
through IFC. Only disable IFC if PPA is not enabled for SPL.

Signed-off-by: York Sun <york.sun@nxp.com>
6 years agoarm64: ls1012a: enable DM support for sata
Yuantian Tang [Fri, 13 Jul 2018 09:25:31 +0000 (17:25 +0800)]
arm64: ls1012a: enable DM support for sata

Enable related configs to support sata DM feature.

Signed-off-by: Tang Yuantian <andy.tang@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>
6 years agoscsi: ceva: add ls1012a soc support
Yuantian Tang [Fri, 13 Jul 2018 09:25:30 +0000 (17:25 +0800)]
scsi: ceva: add ls1012a soc support

Make the code structure more general so that more socs can be
added easily and also remove speed limitation restriction.
Add the ls1012a sata support as well.

Signed-off-by: Tang Yuantian <andy.tang@nxp.com>
Reviewed-by: Michal Simek <michal.simek@xilinx.com>
Tested-by: Michal Simek <michal.simek@xilinx.com>
(with and without CONFIG_OF_LIVE on zynqmp zcu102)
Reviewed-by: York Sun <york.sun@nxp.com>
6 years agoarmv8: dts: fsl-ls1012a: add sata node support
Yuantian Tang [Fri, 13 Jul 2018 09:25:29 +0000 (17:25 +0800)]
armv8: dts: fsl-ls1012a: add sata node support

One ls1012a, there is one SATA 3.0 advanced host controller interface
which is a high-performance SATA solution that delivers comprehensive
and fully-compliant generation 3 (1.5 Gb/s - 6.0 Gb/s) serial ATA
capabilities, in accordance with the serial ATA revision 3.0 of Serial
ATA International Organization.
Add sata node to support this feature.

Signed-off-by: Tang Yuantian <andy.tang@nxp.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
6 years agoarmv8: fsl: remove sata support
Yuantian Tang [Fri, 13 Jul 2018 09:25:28 +0000 (17:25 +0800)]
armv8: fsl: remove sata support

Remove the old implementation in order to enable DM for sata.

Signed-off-by: Tang Yuantian <andy.tang@nxp.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: York Sun <york.sun@nxp.com>
6 years agoarmv8: layerscape: Enabled I-cache for SPL boot
York Sun [Tue, 26 Jun 2018 21:26:02 +0000 (14:26 -0700)]
armv8: layerscape: Enabled I-cache for SPL boot

Enable I-cache for SPL boot to boost performance. Earlier MMU was
enabled only for LS2080A and has since been dropped by commit
f539c8a4a7a5 ("armv8: ls2080a: Drop early MMU for SPL build").

Signed-off-by: York Sun <york.sun@nxp.com>
6 years agoarmv8: ls1046ardb: ls1046aqds: Move SPL macros to defconfig
York Sun [Tue, 26 Jun 2018 16:41:24 +0000 (09:41 -0700)]
armv8: ls1046ardb: ls1046aqds: Move SPL macros to defconfig

Instead of defining Kconfig macros in header file, move them to
defconfig files.

Signed-off-by: York Sun <york.sun@nxp.com>
6 years agoarmv8: ls2088ardb: Move CONFIG_SPI_FLASH, CONFIG_SPI_FLASH_SPANSION to defconfig
Ashish Kumar [Tue, 26 Jun 2018 11:20:57 +0000 (16:50 +0530)]
armv8: ls2088ardb: Move CONFIG_SPI_FLASH, CONFIG_SPI_FLASH_SPANSION to defconfig

Move CONFIG_SPI_FLASH_SPANSION, CONFIG_SPI_FLASH, to defconfig.
Also disable disable 4K erase size option.

Signed-off-by: Ashish Kumar <Ashish.Kumar@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>
6 years agoconfigs: Disable 4k erase sector size for spansion "s25fs512s" flash
Ashish Kumar [Tue, 26 Jun 2018 09:18:30 +0000 (14:48 +0530)]
configs: Disable 4k erase sector size for spansion "s25fs512s" flash

4K erase size is used only in case of hydrid mode which is not
supported on any NXP platform with flash "s25fs512s".
Supported mode is uniform sector, with erase size 256kiB.

Signed-off-by: Ashish Kumar <Ashish.Kumar@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>
6 years agoLS1088ARDB: Secure Boot:Change load address of dpl header in SD
Vinitha V Pillai [Wed, 20 Jun 2018 13:29:12 +0000 (18:59 +0530)]
LS1088ARDB: Secure Boot:Change load address of dpl header in SD

Change address of DPL header in SD.

Signed-off-by: Vinitha V Pillai <vinitha.pillai@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>
6 years agoarmv8: ls2080ardb: update copyright claim
Alison Wang [Mon, 18 Jun 2018 12:25:05 +0000 (20:25 +0800)]
armv8: ls2080ardb: update copyright claim

This patch updates the copyright claim for the issues reported by
legal review.

Signed-off-by: Alison Wang <alison.wang@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>
6 years agoLS1043ARBD: Fix SD Boot issue with PPA
Vinitha V Pillai [Thu, 7 Jun 2018 04:35:14 +0000 (10:05 +0530)]
LS1043ARBD: Fix SD Boot issue with PPA

CONFIG_SPL_FSL_LS_PPA is needed only in case of falcon boot
Support for this is not present in PPA currently, so
removing the default option from defconfig

Signed-off-by: Vinitha V Pillai <vinitha.pillai@nxp.com>
Signed-off-by: Ruchika Gupta <ruchika.gupta@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>
6 years agoarmv8: ls1088a: change dpl load command from apply to lazyapply
Jagdish Gediya [Tue, 5 Jun 2018 03:34:05 +0000 (09:04 +0530)]
armv8: ls1088a: change dpl load command from apply to lazyapply

use "fsl_mc lazyapply dpl addr" instead of "fsl_mc apply dpl addr"

change dpl load addr to 0x80001000 from 0x80200000 because dpl gets
corrupted at 0x80200000 during bootm command excecution.

Signed-off-by: Jagdish Gediya <jagdish.gediya@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>
6 years agocmd/ubi.c: Fix format warning
Tom Rini [Thu, 26 Jul 2018 15:17:24 +0000 (11:17 -0400)]
cmd/ubi.c: Fix format warning

On 64bit platforms we would otherwise see:
../cmd/ubi.c: In function 'ubi_volume_read':
../cmd/ubi.c:359:16: warning: format '%u' expects argument of type 'unsigned int', but argument 2 has type 'size_t {aka long unsigned int}' [-Wformat=]

Fixes: 68c7025d99db ("cmd: ubi: print load size after establishing volume size")
Signed-off-by: Tom Rini <trini@konsulko.com>
6 years agoMerge branch 'master' of git://git.denx.de/u-boot-socfpga
Tom Rini [Thu, 26 Jul 2018 15:43:26 +0000 (11:43 -0400)]
Merge branch 'master' of git://git.denx.de/u-boot-socfpga

6 years agoMerge branch 'master' of git://git.denx.de/u-boot-sh
Tom Rini [Thu, 26 Jul 2018 15:43:23 +0000 (11:43 -0400)]
Merge branch 'master' of git://git.denx.de/u-boot-sh

6 years agoMakefile: Fix 'clean' target
Tom Rini [Wed, 25 Jul 2018 15:38:17 +0000 (11:38 -0400)]
Makefile: Fix 'clean' target

Now that we have removed the DocBook files we need to not try and clean
that directory.

Reported-by: ericywl <midnight2903@gmail.com>
Reported-by: Jagan Teki <jagan@amarulasolutions.com>
Fixes: 78a88f7930be ("doc: Replace DocBook with sphinx-based docs")
Signed-off-by: Tom Rini <trini@konsulko.com>
6 years agoMAINTAINERS: assign lib/charset.c
Heinrich Schuchardt [Thu, 5 Jul 2018 17:43:50 +0000 (19:43 +0200)]
MAINTAINERS: assign lib/charset.c

lib/charset.c is only used by the EFI subsystem.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_selftest: unit test for GetTime()
Heinrich Schuchardt [Sat, 7 Jul 2018 21:39:16 +0000 (23:39 +0200)]
efi_selftest: unit test for GetTime()

Provide a unit test for the GetTime() runtime service.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_selftest: support printing leading zeroes
Heinrich Schuchardt [Sat, 7 Jul 2018 21:39:15 +0000 (23:39 +0200)]
efi_selftest: support printing leading zeroes

Allow specifying the precision when printing integers, e.g.

efi_st_printf("%.4u-%.2u-%.2u\n", year, month, day);

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: complete implementation of GetTime()
Heinrich Schuchardt [Sat, 7 Jul 2018 21:39:14 +0000 (23:39 +0200)]
efi_loader: complete implementation of GetTime()

Implement the missing parts of the GetTime() runtime service.

Fill seconds.
Fill daylight saving time flag correctly.
Provide dummy values for capabilities.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: remove unused efi_get_time_init()
Heinrich Schuchardt [Sat, 7 Jul 2018 21:39:13 +0000 (23:39 +0200)]
efi_loader: remove unused efi_get_time_init()

Remove unused function efi_get_time_init().

Initialization of the RTC has to be done in board bring up not in the EFI
subsystem.

There is no RTC device in the UEFI spec. The RTC is only accessed through
the runtime services.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agortc: remove CONFIG_CMD_DATE dependency
Heinrich Schuchardt [Sat, 7 Jul 2018 21:39:12 +0000 (23:39 +0200)]
rtc: remove CONFIG_CMD_DATE dependency

The EFI subsystem accesses the real time clock and is enabled by default.
So we should drop any CONFIG_CMD_DATE dependency from the real time clock
drivers.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_selftest: unit test for CalculateCrc32()
Heinrich Schuchardt [Sat, 7 Jul 2018 13:36:07 +0000 (15:36 +0200)]
efi_selftest: unit test for CalculateCrc32()

This unit test checks the CalculateCrc32 bootservice and checks the
headers of the system table, the boot services tablle, and the runtime
services table before and after ExitBootServices().

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_selftest: check crc32 for InstallConfigurationTable
Heinrich Schuchardt [Sat, 7 Jul 2018 13:36:06 +0000 (15:36 +0200)]
efi_selftest: check crc32 for InstallConfigurationTable

InstallConfigurationTable() may change the number of installed
configuration tables.

Check the crc32 of the system table.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: update crc32 in InstallConfigurationTable
Heinrich Schuchardt [Sat, 7 Jul 2018 13:36:05 +0000 (15:36 +0200)]
efi_loader: update crc32 in InstallConfigurationTable

If the number of installed tables is changed in
InstallConfigurationTable() update the crc32 of the system table.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: correct signature of CalculateCrc32()
Heinrich Schuchardt [Sat, 7 Jul 2018 13:36:04 +0000 (15:36 +0200)]
efi_loader: correct signature of CalculateCrc32()

Use const for the buffer. We are not changing the buffer.
Use efi_uintn_t where prescribed by the UEFI spec.
Prefer u32 over uint32_t.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_selftest: test InstallConfigurationTable()
Heinrich Schuchardt [Thu, 28 Jun 2018 10:45:33 +0000 (12:45 +0200)]
efi_selftest: test InstallConfigurationTable()

Provide a unit test for InstallConfigurationTable().

A table is installed, updated, removed. The table entry and the
triggering of events is checked.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: allocate configuration table array
Heinrich Schuchardt [Thu, 28 Jun 2018 10:45:32 +0000 (12:45 +0200)]
efi_loader: allocate configuration table array

The system table contains a link to the list of configurations tables.
These include the device tree, SMBIOS table, and the ACPI table.

This array is currently statically linked. With the patch it is allocated
as EFI_RUNTIME_SERVICES_DATA. Due to the structure of the system table we
cannot work with a linked list here.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: calculate crc32 for EFI tables
Heinrich Schuchardt [Thu, 28 Jun 2018 10:45:31 +0000 (12:45 +0200)]
efi_loader: calculate crc32 for EFI tables

For the boot and runtime services tables and for the system table the
crc32 has to be set in the header.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: provide firmware revision
Heinrich Schuchardt [Thu, 28 Jun 2018 10:45:30 +0000 (12:45 +0200)]
efi_loader: provide firmware revision

Provide a firmware revision in the system table using the Makefile
variables VERSION and PATCHLEVEL, e.g. 0x20180700 for v2018.07.

Correct the type of the firmware vendor. It is a u16* pointer.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: correct headersize EFI tables
Heinrich Schuchardt [Thu, 28 Jun 2018 10:45:29 +0000 (12:45 +0200)]
efi_loader: correct headersize EFI tables

The headersize field has to be set to the size of the whole table
including the header.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: correct EFI_RUNTIME_SERVICES_SIGNATURE
Heinrich Schuchardt [Thu, 28 Jun 2018 10:45:28 +0000 (12:45 +0200)]
efi_loader: correct EFI_RUNTIME_SERVICES_SIGNATURE

The value for EFI_RUNTIME_SERVICES_SIGNATURE does not match the
UEFI spec 2.7.

Reported-by: Takahiro Akashi <takahiro.akashi@linaro.org>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: specify UEFI spec revision
Heinrich Schuchardt [Thu, 28 Jun 2018 10:45:27 +0000 (12:45 +0200)]
efi_loader: specify UEFI spec revision

Both in the boot and the runtime services tables we have to specify the
UEFI spec revision. The same value is already used for the system
table. So let's use a common constant.

In the boot services table we have to provide the header signature.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: clear screen has to reset cursor position
Heinrich Schuchardt [Thu, 5 Jul 2018 06:18:00 +0000 (08:18 +0200)]
efi_loader: clear screen has to reset cursor position

After clearing the screen the cursor position is row 0, column 0.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: EFI_SIMPLE_TEXT_INPUT_PROTOCOL.Reset()
Heinrich Schuchardt [Thu, 5 Jul 2018 06:17:59 +0000 (08:17 +0200)]
efi_loader: EFI_SIMPLE_TEXT_INPUT_PROTOCOL.Reset()

Implement the reset service of the EFI_SIMPLE_TEXT_INPUT_PROTOCOL.

This should resolve the error reported by the SCT in
Protocol/SimpleTextIn/BlackBoxTest/SimpleTextInBBTestFunction.c:193

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: set revision in loaded image protocol
Heinrich Schuchardt [Thu, 5 Jul 2018 06:17:58 +0000 (08:17 +0200)]
efi_loader: set revision in loaded image protocol

The revision number has to be set in the loaded image protocol.

The problem was detected by running the SCT in
Protocol/LoadedImage/BlackBoxTest/LoadedImageBBTestMain.c:890

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_driver: set DM_FLAG_NAME_ALLOCED flag
Heinrich Schuchardt [Sat, 30 Jun 2018 05:11:32 +0000 (07:11 +0200)]
efi_driver: set DM_FLAG_NAME_ALLOCED flag

Set the DM_FLAG_NAME_ALLOCED flag to avoid a memory leak when the block
device is removed.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_selftest: test writing to file
Heinrich Schuchardt [Mon, 2 Jul 2018 00:41:24 +0000 (02:41 +0200)]
efi_selftest: test writing to file

Provide a unit test for writing to a FAT file system.
Add some additional comments in block device unit test.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agofs: fat: cannot write to subdirectories
Heinrich Schuchardt [Mon, 2 Jul 2018 00:41:23 +0000 (02:41 +0200)]
fs: fat: cannot write to subdirectories

fs_fat_write() is not able to write to subdirectories.

Currently if a filepath with a leading slash is passed, the slash is
treated as part of the filename to be created in the root directory.

Strip leading (back-)slashes.

Check that the remaining filename does not contain any illegal characters
(<>:"/\|?*). This way we will throw an error when trying to write to a
subdirectory.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: check map_key in ExitBootServices
Heinrich Schuchardt [Mon, 2 Jul 2018 10:53:55 +0000 (12:53 +0200)]
efi_loader: check map_key in ExitBootServices

The UEFI spec requires that the memory map key is checked in
ExitBootServices().

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: check parameters of GetMemoryMap
Heinrich Schuchardt [Mon, 2 Jul 2018 10:53:54 +0000 (12:53 +0200)]
efi_loader: check parameters of GetMemoryMap

Check the parameters of boottime service GetMemoryMap().
Return EFI_INVALID_PARAMETER where required by the UEFI spec.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: check parameters in memory allocation
Heinrich Schuchardt [Mon, 2 Jul 2018 10:53:53 +0000 (12:53 +0200)]
efi_loader: check parameters in memory allocation

If no pointer is provided throw an error.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: check parameters of CreateEvent
Heinrich Schuchardt [Mon, 2 Jul 2018 10:53:52 +0000 (12:53 +0200)]
efi_loader: check parameters of CreateEvent

Rigorously check the TPL level and the event type.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agox86: Add efi_loader bits to x86_64 linker script
Alexander Graf [Tue, 10 Jul 2018 23:39:31 +0000 (01:39 +0200)]
x86: Add efi_loader bits to x86_64 linker script

The x86_64 linker script was missing efi runtime information. Add it.

Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: Rename sections to allow for implicit data
Alexander Graf [Tue, 12 Jun 2018 05:48:37 +0000 (07:48 +0200)]
efi_loader: Rename sections to allow for implicit data

Some times gcc may generate data that is then used within code that may
be part of an efi runtime section. That data could be jump tables,
constants or strings.

In order to make sure we catch these, we need to ensure that gcc emits
them into a section that we can relocate together with all the other
efi runtime bits. This only works if the -ffunction-sections and
-fdata-sections flags are passed and the efi runtime functions are
in a section that starts with ".text".

Up to now we had all efi runtime bits in sections that did not
interfere with the normal section naming scheme, but this forces
us to do so. Hence we need to move the efi_loader text/data/rodata
sections before the global *(.text*) catch-all section.

With this patch in place, we should hopefully have an easier time
to extend the efi runtime functionality in the future.

Signed-off-by: Alexander Graf <agraf@suse.de>
[agraf: Fix x86_64 breakage]

6 years agoefi: Drop error return in efi_carve_out_dt_rsv()
Simon Glass [Mon, 18 Jun 2018 14:08:28 +0000 (08:08 -0600)]
efi: Drop error return in efi_carve_out_dt_rsv()

This function currently returns an error code, but never uses it. There is
no function comment so it is not obvious why. Presuambly the error is not
important.

Update the function to explain its purpose and why it ignores the error.
Drop the useful error return value.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi: Tidy up device-tree-size calculation in copy_fdt()
Simon Glass [Mon, 18 Jun 2018 14:08:25 +0000 (08:08 -0600)]
efi: Tidy up device-tree-size calculation in copy_fdt()

This is a bit confusing at present since it adds 4KB to the pointer, then
rounds it up. It looks like a bug, but is not.

Move the 4KB addition into a separate statement and expand the comment.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_selftest: Clean up a few comments and messages
Simon Glass [Mon, 18 Jun 2018 14:08:21 +0000 (08:08 -0600)]
efi_selftest: Clean up a few comments and messages

Fix the 'amp' typo, expand on what 'steps' is and fix a few other minor
things.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agovsprintf: Handle NULL with %pU
Simon Glass [Mon, 18 Jun 2018 14:08:20 +0000 (08:08 -0600)]
vsprintf: Handle NULL with %pU

At present a NULL pointer passed to printf for a %pU argument will cause
U-Boot to access memory at 0. Fix this by adding a check, and print
"(null)" instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Alexander Graf <agraf@suse.de>
[agraf: s/(null)/<NULL>/]
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: Expose U-Boot addresses in memory map for sandbox
Alexander Graf [Mon, 18 Jun 2018 15:23:15 +0000 (17:23 +0200)]
efi_loader: Expose U-Boot addresses in memory map for sandbox

We currently expose host addresses in the EFI memory map. That can be
bad if we ever want to use sandbox to boot strap a real kernel, because
then the kernel would fetch its memory table from our host virtual address
map. But to make that use case work, we would need to have full control
over the address space the EFI application sees.

So let's expose only U-Boot addresses to the guest until we get to the
point of allocation. EFI's allocation functions are fun - they can take
U-Boot addresses as input values for hints and return host addresses as
allocation results through the same uint64_t * parameter. So we need to
be extra careful on what to pass in when.

With this patch I am successfully able to run the efi selftest suite as
well as grub.efi on aarch64.

Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi: sandbox: Adjust memory usage for sandbox
Simon Glass [Mon, 18 Jun 2018 15:23:12 +0000 (17:23 +0200)]
efi: sandbox: Adjust memory usage for sandbox

With sandbox the U-Boot code is not mapped into the sandbox memory range
so does not need to be excluded when allocating EFI memory. Update the EFI
memory init code to take account of that.

Signed-off-by: Simon Glass <sjg@chromium.org>
[agraf: Remove map_sysmem() call and header reference]
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: Use common elf.h reloc defines
Alexander Graf [Mon, 18 Jun 2018 15:23:11 +0000 (17:23 +0200)]
efi_loader: Use common elf.h reloc defines

Now that elf.h contains relocation defines for all architectures
we care about, let's just include it unconditionally and refer to
the defines.

Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoelf: Move x86 reloc defines to common elf.h
Alexander Graf [Mon, 18 Jun 2018 15:23:10 +0000 (17:23 +0200)]
elf: Move x86 reloc defines to common elf.h

We need to know about x86 relocation definitions even in cases where
we don't officially build against the x86 target, such as with sandbox.

So let's move the x86 definitions into the common elf header, where all
other architectures already have them.

Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: Move to compiler based target architecture determination
Alexander Graf [Mon, 18 Jun 2018 15:23:08 +0000 (17:23 +0200)]
efi_loader: Move to compiler based target architecture determination

Thanks to CONFIG_SANDBOX, we can not rely on config options to tell us
what CPU architecture we're running on.

The compiler however does know that, so let's just move the ifdefs over
to compiler based defines rather than kconfig based options.

Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: Introduce ms abi vararg helpers
Alexander Graf [Mon, 18 Jun 2018 15:23:05 +0000 (17:23 +0200)]
efi_loader: Introduce ms abi vararg helpers

Varargs differ between sysv and ms abi. On x86_64 we have to follow the ms
abi though, so we also need to make sure we use x86_64 varargs helpers.

This patch introduces generic efi vararg helpers that adhere to the
respective EFI ABI. That way we can deal with them properly from efi
loader code and properly interpret variable arguments.

This fixes the InstallMultipleProtocolInterfaces tests in the efi selftests
on x86_64 for me.

Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: Disable miniapps on sandbox
Alexander Graf [Mon, 18 Jun 2018 15:23:03 +0000 (17:23 +0200)]
efi_loader: Disable miniapps on sandbox

In the sandbox environment we can not easily build efi stub binaries
right now, so let's disable the respective test cases for the efi
selftest suite.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: efi_allocate_pages is too restrictive
Heinrich Schuchardt [Mon, 18 Jun 2018 15:23:02 +0000 (17:23 +0200)]
efi_loader: efi_allocate_pages is too restrictive

When running on the sandbox the stack is not necessarily at a higher memory
address than the highest free memory.

There is no reason why the checking of the highest memory address should be
more restrictive for EFI_ALLOCATE_ANY_PAGES than for
EFI_ALLOCATE_MAX_ADDRESS.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
[agraf: use -1ULL instead]
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: Allow SMBIOS tables in highmem
Alexander Graf [Mon, 18 Jun 2018 15:23:00 +0000 (17:23 +0200)]
efi_loader: Allow SMBIOS tables in highmem

We try hard to make sure that SMBIOS tables live in the lower 32bit.
However, when we can not find any space at all there, we should not
error out but instead just fall back to map them in the full address
space instead.

This can for example happen on systems that do not have any RAM mapped
in the lower 32bits of address space. In that case having any SMBIOS
tables at all is better than having none.

Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: Use map_sysmem() in bootefi command
Alexander Graf [Mon, 18 Jun 2018 15:22:58 +0000 (17:22 +0200)]
efi_loader: Use map_sysmem() in bootefi command

The bootefi command gets a few addresses as values passed in. In sandbox,
these values are in U-Boot address space, so we need to make sure we
explicitly call map_sysmem() on them to be able to access them.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: Use compiler constants for image loader
Alexander Graf [Mon, 18 Jun 2018 15:22:57 +0000 (17:22 +0200)]
efi_loader: Use compiler constants for image loader

The EFI image loader tries to determine which target architecture we're
working with to only load PE binaries that match.

So far this has worked based on CONFIG defines, because the target CPU
was always indicated by a config define. With sandbox however, this is
not longer true as all sandbox targets only encompass a single CONFIG
option and so we need to use compiler defines to determine the CPU
architecture.

Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoRevert "efi_loader: no support for ARMV7_NONSEC=y"
Mark Kettenis [Fri, 15 Jun 2018 21:47:15 +0000 (23:47 +0200)]
Revert "efi_loader: no support for ARMV7_NONSEC=y"

This reverts commit c524997acb3d322e1bbd36c06ad02ef589705e7c.

Booting ARMv7 in non-secure mode using bootefi works now.

Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoARM: HYP/non-sec: enable ARMV7_LPAE if HYP mode is supported
Mark Kettenis [Fri, 15 Jun 2018 21:47:14 +0000 (23:47 +0200)]
ARM: HYP/non-sec: enable ARMV7_LPAE if HYP mode is supported

ARMV7_LPAE is required in order to enable the MMU in HYP mode.
And we really want to enable the MMU in HYP mode such that we can
enable the the caches.  Otherwise U-Boot code (such as the EFI
implementation) that runs in HYP mode will run at a snils pace.

Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: ARM: don't attempt to enter non-secure mode twice
Mark Kettenis [Fri, 15 Jun 2018 21:47:13 +0000 (23:47 +0200)]
efi_loader: ARM: don't attempt to enter non-secure mode twice

Multiple EFI binaries may be executed in sequence.  So if we already
are in non-secure mode after running the first one we should skip
the switching code since it no longer works once we're non-secure.

Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: ARM: run EFI payloads non-secure
Mark Kettenis [Fri, 15 Jun 2018 21:47:12 +0000 (23:47 +0200)]
efi_loader: ARM: run EFI payloads non-secure

If desired (and possible) switch into HYP mode or non-secure SVC mode
before calling the entry point of an EFI application.  This allows
U-Boot to provide a usable PSCI implementation and makes it possible
to boot kernels into hypervisor mode using an EFI bootloader.

Based on diffs from Heinrich Schuchardt and Alexander Graf.

Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
[agraf: Fix indentation]
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoARM: HYP/non-sec: migrate stack
Mark Kettenis [Fri, 15 Jun 2018 21:47:11 +0000 (23:47 +0200)]
ARM: HYP/non-sec: migrate stack

The current code that switches into HYP mode doesn't bother to set
up a stack for HYP mode.  This doesn't work for EFI applications
as they expect a usable stack.  Fix this by migrating the stack
pointer from SP_svc to SP_hyp while in Monitor mode.
This restores the stack pointer when we drop into HYP mode.

Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_selftest: update .gitignore
Heinrich Schuchardt [Fri, 15 Jun 2018 04:02:18 +0000 (06:02 +0200)]
efi_selftest: update .gitignore

The following generated files should be ignored by git:
efi_miniapp_file_image_exit.h
efi_miniapp_file_image_return.h

*.so files are normally deleted during the build but should be
ignored too.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoMerge branch 'master' of git://git.denx.de/u-boot-uniphier
Tom Rini [Wed, 25 Jul 2018 02:46:50 +0000 (22:46 -0400)]
Merge branch 'master' of git://git.denx.de/u-boot-uniphier

6 years agoARM: uniphier: enable distro boot
Masahiro Yamada [Fri, 20 Jul 2018 12:47:18 +0000 (21:47 +0900)]
ARM: uniphier: enable distro boot

Switch to the distro boot for UniPhier platform.

 - Remove the environment vairalbes used to load images from raw
   block devices.

 - Keep the command to download images via tftp.  This will be
   useful to boot the kernel when no valid kernel image is ready
   yet in the file system.

 - Use root.cpio.gz instead of root.cpio.uboot because we always know
   the file size of the init ramdisk; it is loaded via either a file
   system or network.

 - Rename fit_addr_r to kernel_addr_r, which the distro command
   checks to get the load address of FIT image.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
6 years agoARM: uniphier: enable MTD partition and UBI
Masahiro Yamada [Thu, 19 Jul 2018 07:28:27 +0000 (16:28 +0900)]
ARM: uniphier: enable MTD partition and UBI

Enable "mtdparts" and "ubi" commands for uniphier_v8_defconfig to
use UBI on NAND devices.

Enable only "mtdparts" for uniphier_{v7,ld4_sld8}_defconfig because
enabling UBI would increase 170KB, which would be memory footprint
problem.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
6 years agoARM: uniphier: support fdt_fixup_mtdparts
Masahiro Yamada [Thu, 19 Jul 2018 07:28:26 +0000 (16:28 +0900)]
ARM: uniphier: support fdt_fixup_mtdparts

Propagate the "mtdparts" environment variable to the DT passed
in to OS.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
6 years agoARM: uniphier: split ft_board_setup() out to a separate file
Masahiro Yamada [Thu, 19 Jul 2018 07:28:25 +0000 (16:28 +0900)]
ARM: uniphier: split ft_board_setup() out to a separate file

Prepare to add more fdt fixup code.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
6 years agoARM: uniphier: clean-up ft_board_setup()
Masahiro Yamada [Thu, 19 Jul 2018 07:28:24 +0000 (16:28 +0900)]
ARM: uniphier: clean-up ft_board_setup()

The 'bd' is passed in ft_board_setup() as the second argument.
Replace 'gd->bd' with 'bd'.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
6 years agoboard: constify struct node_info array
Masahiro Yamada [Thu, 19 Jul 2018 07:28:23 +0000 (16:28 +0900)]
board: constify struct node_info array

Add 'const' (also 'static' in some places) to struct node_info
arrays to save memory footprint.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
6 years agofdt_support: make fdt_fixup_mtdparts() prototype more specific
Masahiro Yamada [Thu, 19 Jul 2018 07:28:22 +0000 (16:28 +0900)]
fdt_support: make fdt_fixup_mtdparts() prototype more specific

The second argument of fdt_fixup_mtdparts() is an opaque pointer,
'void *node_info', hence callers can pass any pointer.

Obviously, fdt_fixup_mtdparts() expects 'struct node_info *'
otherwise, it crashes run-time.

Change the prototype so that it is compile-time checked.

Also, add 'const' qualifier to it so that callers can constify
the struct node_info arrays.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agomtd: nand: denali: correct buffer alignment for DMA transfer
Masahiro Yamada [Thu, 19 Jul 2018 01:13:23 +0000 (10:13 +0900)]
mtd: nand: denali: correct buffer alignment for DMA transfer

The NAND framework makes sure to pass in the buffer with at least
chip->buf_align alignment.  Currently, the Denali NAND driver only
requests 16 byte alignment.  This causes unaligned cache operations
for the DMA transfer.

[Error Example]

=> nand read 81000010 0 1000

NAND read: device 0 offset 0x0, size 0x1000
CACHE: Misaligned operation at range [8100001081001010]
CACHE: Misaligned operation at range [8100001081001010]
CACHE: Misaligned operation at range [8100001081001010]
CACHE: Misaligned operation at range [8100001081001010]
 4096 bytes read: OK

Reported-by: Marek Vasut <marex@denx.de>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
6 years agokconfig: Avoid format overflow warning from GCC 8.1
Luis Araneda [Thu, 5 Jul 2018 20:55:31 +0000 (16:55 -0400)]
kconfig: Avoid format overflow warning from GCC 8.1

cherry-pick kernel commit 2ae89c7 (2018-06-05)
to avoid warnings when compiling with GCC 8.1

In file included from scripts/kconfig/zconf.tab.c:2486:
scripts/kconfig/confdata.c: In function ‘conf_write’:
scripts/kconfig/confdata.c:771:22: warning: ‘%s’ directive writing likely 7 or more bytes into a region of size between 1 and 4097 [-Wformat-overflow=]
  sprintf(newname, "%s%s", dirname, basename);
                      ^~
scripts/kconfig/confdata.c:771:19: note: assuming directive output of 7 bytes
  sprintf(newname, "%s%s", dirname, basename);
                   ^~~~~~
scripts/kconfig/confdata.c:771:2: note: ‘sprintf’ output 1 or more bytes (assuming 4104) into a destination of size 4097
  sprintf(newname, "%s%s", dirname, basename);
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
scripts/kconfig/confdata.c:774:23: warning: ‘.tmpconfig.’ directive writing 11 bytes into a region of size between 1 and 4097 [-Wformat-overflow=]
   sprintf(tmpname, "%s.tmpconfig.%d", dirname, (int)getpid());
                       ^~~~~~~~~~~
scripts/kconfig/confdata.c:774:3: note: ‘sprintf’ output between 13 and 4119 bytes into a destination of size 4097
   sprintf(tmpname, "%s.tmpconfig.%d", dirname, (int)getpid());
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Luis Araneda <luaraneda@gmail.com>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
6 years agoARM: rmobile: gen2: Enable ACTLR[0] (Enable invalidates of BTB) to facilitate CVE_201...
Marek Vasut [Sat, 30 Jun 2018 06:07:41 +0000 (08:07 +0200)]
ARM: rmobile: gen2: Enable ACTLR[0] (Enable invalidates of BTB) to facilitate CVE_2017-5715 WA in OS

Enable CVE_2017_5715 mitigation on CPU0 on R-Car H2, M2W, M2N, V2H,
which all contain Cortex-A15 cores. R-Car E2 contains only Cortex-A7
cores and is not affected. Without this enabled, Linux kernel reports:

  CPU0: Spectre v2: firmware did not set auxiliary control register IBE bit, system vulnerable

With this enabled, Linux kernel reports:

  CPU0: Spectre v2: using ICIALLU workaround

NOTE: This by itself does not enable the workaround for other CPUs
      than CPU0 and may require additional kernel patches for the
      other CPUs in SMP configurations.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nishanth Menon <nm@ti.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
6 years agoARM: dts: socfpga: Adjust NAND register layout on Arria10
Marek Vasut [Mon, 7 May 2018 20:22:26 +0000 (22:22 +0200)]
ARM: dts: socfpga: Adjust NAND register layout on Arria10

Adjust the NAND register size on Arria10 to reflect reality.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Chin Liang See <chin.liang.see@intel.com>
Cc: Dinh Nguyen <dinguyen@kernel.org>
6 years agoARM: socfpga: Init missing security policies on A10
Marek Vasut [Thu, 12 Jul 2018 13:34:23 +0000 (15:34 +0200)]
ARM: socfpga: Init missing security policies on A10

The Arria10 requires proper configuration of the NOC firewall, otherwise
the access to certain areas of the LWHPS bridge fails in Linux. Add the
missing setup.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Chin Liang See <chin.liang.see@intel.com>
Cc: Dinh Nguyen <dinguyen@kernel.org>
6 years agoARM: socfpga: Assure correct CPACR configuration
Marek Vasut [Thu, 12 Jul 2018 13:07:46 +0000 (15:07 +0200)]
ARM: socfpga: Assure correct CPACR configuration

Make sure the ARM CPACR register is zeroed out, this is mandatory
on Arria10.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Chin Liang See <chin.liang.see@intel.com>
Cc: Dinh Nguyen <dinguyen@kernel.org>
6 years agoarm: socfpga: Fixes: Rename CONFIG_SPL_RESET_SUPPORT to CONFIG_SPL_DM_RESET
Ley Foon Tan [Fri, 13 Jul 2018 05:40:23 +0000 (13:40 +0800)]
arm: socfpga: Fixes: Rename CONFIG_SPL_RESET_SUPPORT to CONFIG_SPL_DM_RESET

Commit bfc6bae8fa1f2d8a9c51548767b02f1a1e0ffe52

This commit rename CONFIG_SPL_RESET_SUPPORT to CONFIG_SPL_DM_RESET. Update
with new CONFIG name and enable CONFIG_SPL_DM_RESET when CONFIG_DM_RESET is enabled.

Signed-off-by: Ley Foon Tan <ley.foon.tan@intel.com>
Acked-by: Marek Vasut <marex@denx.de>
6 years agomailmap: Fix broken email from fit_image.c
Michal Simek [Tue, 24 Jul 2018 10:51:37 +0000 (12:51 +0200)]
mailmap: Fix broken email from fit_image.c

The patch
"tools/mkimage: Fix DTC run command to handle file names with space"
(sha1: a6e9810495bc929b6beafb88f557cdaadf87fc83) contains comma in name
which is confusing patman. Fix it by defining Mirza's email in mailmap.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
6 years agoconfigs: am3517-evm: Setup NAND booting
Adam Ford [Sat, 21 Jul 2018 23:12:12 +0000 (18:12 -0500)]
configs: am3517-evm: Setup NAND booting

The NAND offsets for the kernel and U-Boot were missing.
This patch sets up the offsets so the AM3517-EVM can boot from NAND
when DIP switches S7:1 and S7:4 are to the OFF position

Signed-off-by: Adam Ford <aford173@gmail.com>
6 years agoARM: AM3517-EVM: Update Maintainer
Adam Ford [Sat, 21 Jul 2018 23:18:10 +0000 (18:18 -0500)]
ARM: AM3517-EVM: Update Maintainer

The previous e-mail pointing to Vaibhav Hiremath <hvaibhav@ti.com>
is bouncing and has for some time.  This updates it to myself and I
work for Logic PD the manufacturer of the AM3517-SOM and EVM

Signed-off-by: Adam Ford <aford173@gmail.com>
6 years agoconfig: remove unused CONFIG_SPL_RELOC_STACK_SIZE
Heinrich Schuchardt [Sat, 21 Jul 2018 15:08:13 +0000 (17:08 +0200)]
config: remove unused CONFIG_SPL_RELOC_STACK_SIZE

Symbol CONFIG_SPL_RELOC_STACK_SIZE is not used anywhere. So remove it.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
6 years agodoc: Move device tree bindings documentation to doc/device-tree-bindings
Breno Lima [Sat, 21 Jul 2018 00:48:10 +0000 (21:48 -0300)]
doc: Move device tree bindings documentation to doc/device-tree-bindings

Currently the U-Boot project contains 2 documentation directories:

- doc/
- Documentation/

The Documentation directory only contains device tree bindings related
content, so move the 3 files to doc/device-tree-bindings/.

Signed-off-by: Breno Lima <breno.lima@nxp.com>
6 years agomkimage: fit_image: Use macros from image.h
Michal Simek [Fri, 20 Jul 2018 10:31:02 +0000 (12:31 +0200)]
mkimage: fit_image: Use macros from image.h

There is no reason not to use macros which are already defined.
It is also much easier for grepping.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agoomap3: beagle: re-enable EFI support after the following commit removed it by mistake:
Guillaume GARDET [Wed, 18 Jul 2018 19:38:44 +0000 (21:38 +0200)]
omap3: beagle: re-enable EFI support after the following commit removed it by mistake:

commit d233ccb1d84b901f7e23e6d9b4f2c6a57198b23b
  ARM: omap3: beagle: Enable DM_SERIAL, update distro usage and NAND layout

Signed-off-by: Guillaume GARDET <guillaume.gardet@free.fr>
Cc: Derald D. Woods <woods.technical@gmail.com>
Cc: Tom Rini <trini@konsulko.com>
6 years agospl: remove dependency to "asm/utils.h"
Paulo Zaneti [Tue, 17 Jul 2018 19:15:46 +0000 (16:15 -0300)]
spl: remove dependency to "asm/utils.h"

Header file "asm/utils.h" is not required to compile "spl_ymodem.c".
So, removing this dependency allows other architectures to use this
booting device as "asm/utils.h" is only present in "arm" architecture.

Signed-off-by: Paulo Zaneti <paulo.zaneti@datacom.ind.br>
6 years agohashtable: Fix length calculation in hexport_r
Zubair Lutfullah Kakakhel [Tue, 17 Jul 2018 18:25:38 +0000 (19:25 +0100)]
hashtable: Fix length calculation in hexport_r

The length returned by hexport_r has a few redundant characters.
This appears as NULL characters at the end so seems harmless.

Remove the surplus counts in two places

totlen += strlen(ep->key) + 2;
I'm guessing the +2 here is for = and sep char. But there is another
totlen += 2; line that does that.

size = totletn + 1;
Doesn't make sense and isn't justified with any comment.

Signed-off-by: Zubair Lutfullah Kakakhel <zubair@resin.io>
6 years agoavb2.0: use block API in AVB ops
Igor Opaniuk [Tue, 17 Jul 2018 11:33:26 +0000 (14:33 +0300)]
avb2.0: use block API in AVB ops

Use blk_dread()/blk_dwrite() in mmc_read()/mmc_write() AVB operation
implementations. This fixes compilation issues when CONFIG_BLK is
enabled.

Signed-off-by: Igor Opaniuk <igor.opaniuk@linaro.org>
Tested-by: Eugeniu Rosca <rosca.eugeniu@gmail.com>
6 years agoavb2.0: add proper dependencies
Igor Opaniuk [Tue, 17 Jul 2018 11:33:25 +0000 (14:33 +0300)]
avb2.0: add proper dependencies

1. Since libavb library alone is highly portable, introduce dedicated
Kconfig symbol for AVB bootloader-dependent operations, so it's possible
to build libavb separately. AVB bootloader-dependent operations include:
  * Helpers to process strings in order to build OS bootargs.
  * Helpers to access MMC, similar to drivers/fastboot/fb_mmc.c.
  * Helpers to alloc/init/free avb ops.
2. Add CONFIG_FASTBOOT dependency, as fastboot buffer is
re-used in partition verification operations.

Reported-by: Eugeniu Rosca <rosca.eugeniu@gmail.com>
Signed-off-by: Igor Opaniuk <igor.opaniuk@linaro.org>
Reviewed-by: Eugeniu Rosca <rosca.eugeniu@gmail.com>
Tested-by: Eugeniu Rosca <rosca.eugeniu@gmail.com>
6 years agomtdparts: fixed buffer overflow bug
Kay Potthoff [Tue, 17 Jul 2018 06:19:39 +0000 (08:19 +0200)]
mtdparts: fixed buffer overflow bug

In the case that there was no name defined for a partition the
code assumes that name_len is 22 and therefore allocates exactly
that space for a dummy name. But the function sprintf() first
resolves "0x%08llx@0x%08llx" to a string that is longer than 22
bytes. This leads to a buffer overflow. The replacement function
snprintf() limits the copied bytes to name_len and therefore
avoids the buffer overflow.

Signed-off-by: Kay Potthoff <Kay.Potthoff@microsys.de>
6 years agoboard: STiH410-B2260: Set SYS_BOOTM_LEN to 16M
Patrice Chotard [Mon, 16 Jul 2018 08:04:19 +0000 (10:04 +0200)]
board: STiH410-B2260: Set SYS_BOOTM_LEN to 16M

With recent kernel v4.18-rcx, uImage becomes bigger than 8MB.
Set SYS_BOOTM_LEN to 16MB, this fix the following error message:
"Fix Loading Kernel Image ... Image too large: increase
CONFIG_SYS_BOOTM_LEN"

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
6 years agomtd: remove stale comment in mtd_oob_ops structure
Miquel Raynal [Sat, 14 Jul 2018 12:37:19 +0000 (14:37 +0200)]
mtd: remove stale comment in mtd_oob_ops structure

A comment in the kernel doc of the mtd_oob_ops structure tells that it
is not possible to write more than one page with OOB. This was
probably true at some time in the past but today it is entirely wrong.

As one can see for instance in the nand_do_write_ops() helper available
in the NAND core, this implementation called by mtd->_write_oob()
simply loops over the pages until everything has been written.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
6 years agortc: compile date.c if DM_RTC
AKASHI Takahiro [Wed, 11 Jul 2018 09:06:06 +0000 (18:06 +0900)]
rtc: compile date.c if DM_RTC

rtc_to_tm() and rtc_mktime() are required for some RTC drivers, at least
PL031. Without this patch, we also need to enable CONFIG_CMD_DATE even if
we don't want or need this command.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
6 years agomtd: nand: add new enum for storing ECC algorithm
Rafał Miłecki [Tue, 10 Jul 2018 09:48:08 +0000 (11:48 +0200)]
mtd: nand: add new enum for storing ECC algorithm

Our nand_ecc_modes_t is already a bit abused by value NAND_ECC_SOFT_BCH.
This enum should store ECC mode only and putting algorithm details there
is a bad idea. It would result in too many values impossible to support
in a sane way.

To solve this problem let's add a new enum. We'll have to modify all
drivers to set it properly but once it's done it'll be possible to drop
NAND_ECC_SOFT_BCH. That will result in a cleaner design and more
possibilities like setting ECC algorithm for hardware ECC mode.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
[Linux commit: b0fcd8ab7b3c89b5da7fff5224d06ed73e7a33cc]
[Philippe Reynes: adapt code to u-boot]
Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>