oweals/u-boot.git
5 years agoefi_loader: do not miss last relocation block
Heinrich Schuchardt [Sat, 16 Feb 2019 14:36:33 +0000 (15:36 +0100)]
efi_loader: do not miss last relocation block

If the last block in the relocation table contains only a single
relocation, the current coding ignores it.

Fix the determination of the end of the relocation table.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agoefi_loader: documentation of image loader
Heinrich Schuchardt [Sat, 16 Feb 2019 14:22:13 +0000 (15:22 +0100)]
efi_loader: documentation of image loader

- Add missing function descriptions.
- Update existing function descriptions to match Sphinx style.
- Add lib/efi_loader/efi_image_loader.c to the input files for Sphinx
  generated documentation.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agoefi_loader: clean up bootefi_test_prepare()
Heinrich Schuchardt [Sat, 12 Jan 2019 13:42:40 +0000 (14:42 +0100)]
efi_loader: clean up bootefi_test_prepare()

Free resources upon failure.

Correct the function description.

As there is no need for any special address in the dummy memory device
path passed via the EFI_LOADED_IMAGE_PROTOCOL simply use 0 as address.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agoefi_loader: fix EFI entry counting
Heinrich Schuchardt [Sat, 9 Feb 2019 13:10:39 +0000 (14:10 +0100)]
efi_loader: fix EFI entry counting

`bootefi selftest` fails on qemu-x86_defconfig if efi_selftest() is not
invoked using EFI_CALL().

Likewise we call the entry point of EFI payloads with
EFI_CALL(efi_start_image()).

entry_count indicates if we are in U-Boot (1) or in EFI payload code (0).
As we start in U-Boot code the initial value has to be 1.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agoefi_loader: use efi_start_image() for bootefi
Heinrich Schuchardt [Wed, 26 Dec 2018 12:28:09 +0000 (13:28 +0100)]
efi_loader: use efi_start_image() for bootefi

Remove the duplicate code in efi_do_enter() and use efi_start_image() to
start the image invoked by the bootefi command.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agoefi_loader: set entry point in efi_load_pe()
Heinrich Schuchardt [Wed, 26 Dec 2018 11:49:09 +0000 (12:49 +0100)]
efi_loader: set entry point in efi_load_pe()

Up to now efi_load_pe() returns the entry point or NULL in case of an
error. This does not allow to return correct error codes from LoadImage().

Let efi_load_pe() return a status code and fill in the entry point in the
corresponding field of the image object.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agoefi_loader: LoadImage: always allocate new pages
Heinrich Schuchardt [Mon, 24 Dec 2018 08:19:07 +0000 (09:19 +0100)]
efi_loader: LoadImage: always allocate new pages

If we want to properly unload images in Exit() the memory should always be
allocated in the same way. As we allocate memory when reading from file we
should do the same when the original image is in memory.

A further patch will be needed to free the memory when Exit() is called.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agoefi_loader: error handling in efi_setup_loaded_image()
Heinrich Schuchardt [Wed, 6 Feb 2019 18:41:29 +0000 (19:41 +0100)]
efi_loader: error handling in efi_setup_loaded_image()

In case of an error we should set the returned pointers to NULL. This
ensures that an illegal free does not occur even if the caller calls
free() for the handles.

If protocols cannot be installed, release all resources.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agotest: adjust names of Unicode test functions
Heinrich Schuchardt [Fri, 15 Feb 2019 22:12:50 +0000 (23:12 +0100)]
test: adjust names of Unicode test functions

In test/py/conftest.py the assumption is made that for if a test is called
with `ut unicode` the test function name starts with 'unicode_test_'. As
the Unicode tests did not follow this naming scheme they were not executed
by `make tests`.

Rename the Unicode test functions.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agolib/vsprintf: print '?' for illegal Unicode sequence
Heinrich Schuchardt [Fri, 15 Feb 2019 21:20:53 +0000 (22:20 +0100)]
lib/vsprintf: print '?' for illegal Unicode sequence

Commit 0e66c10a7d80 ("lib: vsprintf: avoid overflow printing UTF16
strings") broke the Unicode unit tests: an illegal UTF16 code point
should be printed as '?'.

Fixes: 0e66c10a7d80 ("lib: vsprintf: avoid overflow printing UTF16 strings")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agoefi_selftest: LoadImage from file device path
Heinrich Schuchardt [Wed, 9 Jan 2019 18:04:14 +0000 (19:04 +0100)]
efi_selftest: LoadImage from file device path

Provide a unit test that calls LoadImage() with a file device path and
executes the application via StartImage().

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agoefi_loader: comments for efi_file_from_path()
Heinrich Schuchardt [Mon, 4 Feb 2019 20:24:35 +0000 (21:24 +0100)]
efi_loader: comments for efi_file_from_path()

Add more comments for efi_file_from_path().

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agoefi_loader: efi_dp_split_file_path() error handling
Heinrich Schuchardt [Mon, 4 Feb 2019 11:49:43 +0000 (12:49 +0100)]
efi_loader: efi_dp_split_file_path() error handling

If the path passed to efi_dp_split_file_path() does not contain a
reference to a file it returns EFI_OUT_OF_RESOURCES. This does not properly
indicate the kind of the problem that occurred. Return
EFI_INVALID_PARAMETER instead.

Update function description.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agoefi_selftest: fix memory allocation in HII tests
Heinrich Schuchardt [Tue, 12 Feb 2019 20:38:02 +0000 (21:38 +0100)]
efi_selftest: fix memory allocation in HII tests

In efi_selftest we are in EFI land. We cannot call U-Boot library
functions malloc() and free() but should use the boot time services
instead.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Alexander Graf <agraf@suse.de>
5 years agoefi_selftest: do not use efi_free_pool()
Heinrich Schuchardt [Tue, 12 Feb 2019 20:50:45 +0000 (21:50 +0100)]
efi_selftest: do not use efi_free_pool()

In efi_selftest we are in EFI land. We should not use U-Boot library
functions but boot time services for memory management.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Alexander Graf <agraf@suse.de>
5 years agoMerge tag 'xilinx-for-v2019.04-rc2' of git://git.denx.de/u-boot-microblaze
Tom Rini [Sat, 16 Feb 2019 02:21:28 +0000 (21:21 -0500)]
Merge tag 'xilinx-for-v2019.04-rc2' of git://git.denx.de/u-boot-microblaze

Xilinx changes for v2019.04-rc2

xilinx:
- Start to use distro boot commands first
- Setup fdtfile on ZynqMP
- Move mac addr eeprom read to common location
- Convert to OF_SEPARATE
- Switch all board to DM_I2C
- Some DT syncs

i2c:
- Remove !DM_I2C zynq driver

versal:
- Enable some more features
- Add mini configurations

5 years agoMerge tag '2019.01-next' of https://github.com/mbgg/u-boot
Tom Rini [Sat, 16 Feb 2019 01:10:15 +0000 (20:10 -0500)]
Merge tag '2019.01-next' of https://github.com/mbgg/u-boot

- add compute module 3+
- fix 64 bit warning in bmp command

5 years agoarm64: zynqmp: Create fdtfile from compatible string
Michal Simek [Thu, 14 Feb 2019 12:14:30 +0000 (13:14 +0100)]
arm64: zynqmp: Create fdtfile from compatible string

distro boot expects that fdtfile name is setup for alternative DTB.
Create this file based on the first platform compatible string.
This should ensure that one rootfs can store multiple DTBs for different
boards.
Reflect structure which is used in Linux kernel. It means dtbs are
strored in xilinx folder.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Alexander Graf <agraf@suse.de>
5 years agoarm64: zynqmp: Change the spi-rx-bus-width property to x1
Venkatesh Yadav Abbarapu [Wed, 14 Nov 2018 11:50:18 +0000 (17:20 +0530)]
arm64: zynqmp: Change the spi-rx-bus-width property to x1

As per the zc1275 design x1 mode is enabled so changing the
spi-rx-bus-width property to x1.

Signed-off-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agoarm64: zynqmp: Fix i2c boot warning
Shubhrajyoti Datta [Mon, 3 Sep 2018 10:16:46 +0000 (15:46 +0530)]
arm64: zynqmp: Fix i2c boot warning

Fix the below warning as the core looks for the compatible
string.

[    5.198919] i2c i2c-18: of_i2c: modalias failure on
/amba/i2c@ff030000/i2c-mux@75/i2c@3/dev@19
[    5.207454] i2c i2c-18: Failed to create I2C device for
/amba/i2c@ff030000/i2c-mux@75/i2c@3/dev@19
[    5.216394] i2c i2c-18: of_i2c: modalias failure on
/amba/i2c@ff030000/i2c-mux@75/i2c@3/dev@30
[    5.224986] i2c i2c-18: Failed to create I2C device for
/amba/i2c@ff030000/i2c-mux@75/i2c@3/dev@30
[    5.233927] i2c i2c-18: of_i2c: modalias failure on
/amba/i2c@ff030000/i2c-mux@75/i2c@3/dev@35
[    5.242527] i2c i2c-18: Failed to create I2C device for
/amba/i2c@ff030000/i2c-mux@75/i2c@3/dev@35
[    5.263880] i2c i2c-18: of_i2c: modalias failure on
/amba/i2c@ff030000/i2c-mux@75/i2c@3/dev@36
[    5.272477] i2c i2c-18: Failed to create I2C device for
/amba/i2c@ff030000/i2c-mux@75/i2c@3/dev@36
[    5.281415] i2c i2c-18: of_i2c: modalias failure on
/amba/i2c@ff030000/i2c-mux@75/i2c@3/dev@51
[    5.290008] i2c i2c-18: Failed to create I2C device for
/amba/i2c@ff030000/i2c-mux@75/i2c@3/dev@51

Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agoarm64: zynqmp: Remove autodetected devices without description
Michal Simek [Wed, 13 Feb 2019 14:39:04 +0000 (15:39 +0100)]
arm64: zynqmp: Remove autodetected devices without description

It will never reach mainline that's why remove it.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agoarm64: dts: Fix various entry-method properties to reflect documentation
Amit Kucheria [Thu, 23 Aug 2018 08:53:29 +0000 (14:23 +0530)]
arm64: dts: Fix various entry-method properties to reflect documentation

The idle-states binding documentation[1] mentions that the
'entry-method' property is required on 64-bit platforms and must be
set to "psci".

Linux commit a13f18f59d26 ("Documentation: arm: Fix typo in the idle-states
bindings examples") attempted to fix this earlier but clearly more is
needed.

Linux docs:
Documentation/devicetree/bindings/arm/idle-states.txt (see
idle-states node)

Signed-off-by: Amit Kucheria <amit.kucheria@linaro.org>
Acked-by: Sudeep Holla <sudeep.holla@arm.com>
Acked-by: Li Yang <leoyang.li@nxp.com>
Signed-off-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agoxilinx: dts: Remove additional empty lines
Michal Simek [Wed, 13 Feb 2019 15:39:51 +0000 (16:39 +0100)]
xilinx: dts: Remove additional empty lines

Trivial fix.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agoarm64: zynqmp: Add reset-on-timeout for all boards and modify default timeout value
Mounika Grace Akula [Tue, 9 Oct 2018 15:22:50 +0000 (20:52 +0530)]
arm64: zynqmp: Add reset-on-timeout for all boards and modify default timeout value

This patch adds reset-on-timeout to FPD WDT which will trigger an
interrupt to PMU when watchdog expiry happens and PMU takes the
necessary action. If this property is not enabled, reason will not be
known when watchdog expiry happens.
This patch also modifies the default timeout to 60 seconds. Reason is
that if u-boot enables WDT, it will set the timeout to 10 seconds and
this is not enough to boot till Linux and start the WDT application in
Linux. 60 seconds is the maximum safest value to boot till Linux and
start the WDT application.

Users need to change this timeout value to fit their needs.

Signed-off-by: Mounika Grace Akula <mounika.grace.akula@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agoARM: dts: zynq: correct and improve the model property of dt files
Luis Araneda [Thu, 12 Jul 2018 04:10:20 +0000 (00:10 -0400)]
ARM: dts: zynq: correct and improve the model property of dt files

Replace the current value of the model property by a more accurate
description of each board (which includes the manufacturer), as some
of the boards had the same value ("Xilinx Zynq")

Signed-off-by: Luis Araneda <luaraneda@gmail.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agoARM: dts: zynq: Set correct manufacturer for ZedBoard and MicroZed boards
Luis Araneda [Thu, 12 Jul 2018 04:10:19 +0000 (00:10 -0400)]
ARM: dts: zynq: Set correct manufacturer for ZedBoard and MicroZed boards

Both boards are made by Avnet, Inc. So add an additional
value to the compatible property

Signed-off-by: Luis Araneda <luaraneda@gmail.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agoARM: dts: Use mmc@ instead sdhci@
Michal Simek [Wed, 26 Sep 2018 11:36:16 +0000 (13:36 +0200)]
ARM: dts: Use mmc@ instead sdhci@

mmc name is recommended based on devicetree specification.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agorpi: add Compute Module 3+
Jonathan Gray [Wed, 30 Jan 2019 22:24:44 +0000 (09:24 +1100)]
rpi: add Compute Module 3+

Add Raspberry Pi Compute Module 3+ to list of models, the revision code
is 0x10 according to the list on raspberrypi.org.

v2: Use the same dtb name as CM3 as CM3+ is a drop in replacement
    for CM3.

Signed-off-by: Jonathan Gray <jsg@jsg.id.au>
Reviewed-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Matthias Brugger <mbrugger@suse.com>
5 years agocmd: bmp: Make integer-to-pointer cast platform, independent
Adam Heinrich [Mon, 31 Dec 2018 11:11:08 +0000 (12:11 +0100)]
cmd: bmp: Make integer-to-pointer cast platform, independent

This patch fixes the int-to-pointer-cast warning on aarch64.

Signed-off-by: Adam Heinrich <adam@adamh.cz>
Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Matthias Brugger <mbrugger@suse.com>
5 years agoMerge branch 'master' of git://git.denx.de/u-boot-sunxi
Tom Rini [Fri, 15 Feb 2019 01:14:51 +0000 (20:14 -0500)]
Merge branch 'master' of git://git.denx.de/u-boot-sunxi

- MMC CD pin fix on Orangepi Zero plus
- SPI boot for  Olinuxino Lime2-eMMC boards
- Change in dram frequnecy for tbs_a711

5 years agoarm64: zynqmp: Remove board config files
Michal Simek [Wed, 13 Feb 2019 12:33:32 +0000 (13:33 +0100)]
arm64: zynqmp: Remove board config files

All options have been moved to Kconfig and there is no need to have
board header files. Mini configurations require them that's why they are
still there.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agoarm64: zynqmp: Remove SPD related configurations
Michal Simek [Wed, 13 Feb 2019 13:00:06 +0000 (14:00 +0100)]
arm64: zynqmp: Remove SPD related configurations

SPD autodetection hasn't been enabled that's why there is zero size
difference if that options are enabled/disabled.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agoarm64: zynqmp: Fix logic around CONFIG_ZYNQ_SDHCI
Michal Simek [Wed, 13 Feb 2019 12:46:41 +0000 (13:46 +0100)]
arm64: zynqmp: Fix logic around CONFIG_ZYNQ_SDHCI

Replace SDHCI controller listing by Kconfig symbol to let SPL know that
this board is using multiple SDHCIs controllers.
Kconfig help message should explain why this is needed.
Origin symbols were used in full u-boot but with moving to distro boot
this was fixed already.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agoxilinx: common: Remove !DM_i2C code for reading mac from eeprom
Michal Simek [Tue, 22 Jan 2019 14:55:46 +0000 (15:55 +0100)]
xilinx: common: Remove !DM_i2C code for reading mac from eeprom

All platforms are converted to DM_I2C that's why there is no reason to
keep this code here.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
5 years agoi2c: Remove ancient zynq_i2c driver
Michal Simek [Tue, 22 Jan 2019 11:50:12 +0000 (12:50 +0100)]
i2c: Remove ancient zynq_i2c driver

This driver is replaced by drivers/i2c/i2c-cdns.c DM based driver.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Heiko Schocher <hs@denx.de>
5 years agoarm64: zynqmp: Remove addresses for i2c controllers
Michal Simek [Fri, 18 Jan 2019 08:09:40 +0000 (09:09 +0100)]
arm64: zynqmp: Remove addresses for i2c controllers

All platforms have been converted to DM that's why there is no reason to
keep addresses in headers. They are all read from DT now.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
5 years agoarm64: zynqmp: Switch all platforms to DM_I2C
Michal Simek [Fri, 18 Jan 2019 08:10:39 +0000 (09:10 +0100)]
arm64: zynqmp: Switch all platforms to DM_I2C

CONFIG_PCA953X is not needed because of PCA953X is integrated in gpio
subsystem already. That's why also remove CMD_PCA953X which is only for
this driver.

zcu102/zcu104-revC/zcu106/zcu111 contain links to eeprom which stores MAC address.

DM_I2C is not enabled for the whole SoC because it increase size for
mini configurations and there is no I2C symbol present to setup
dependencies.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
5 years agoARM: zynq: Remove addresses for i2c controllers
Michal Simek [Tue, 22 Jan 2019 11:48:47 +0000 (12:48 +0100)]
ARM: zynq: Remove addresses for i2c controllers

All platforms have been converted to DM that's why there is no reason to
keep addresses in headers. They are all read from DT now.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
5 years agoARM: zynq: Convert dlc20 and zc70x board to DM_I2C
Michal Simek [Tue, 22 Jan 2019 13:43:04 +0000 (14:43 +0100)]
ARM: zynq: Convert dlc20 and zc70x board to DM_I2C

All these board have also eeprom enabled that's why it is also enabled
via defconfig.
There is also no need to have zc70x specific config file that's why also
remove it.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
5 years agoARM: zynq: Convert Syzygy to DM_I2C
Michal Simek [Tue, 22 Jan 2019 13:12:54 +0000 (14:12 +0100)]
ARM: zynq: Convert Syzygy to DM_I2C

Boards have only one controller enabled that's why move to DM_I2C is
easy.
Add also i2c alias for not to be shown as i2c bus -1 because alias
doesn't exist.
Config file points to MAC stored in eeprom but it is not listed that's
why I have added 24c08 part.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
5 years agoarm64: versal: Add mini configuration for Versal
Siva Durga Prasad Paladugu [Mon, 4 Feb 2019 10:48:29 +0000 (16:18 +0530)]
arm64: versal: Add mini configuration for Versal

This patch adds new mini target for versal.
This configuration is very minimal in size which runs
from OCM. It contains support for mtest which can be
used for running DDR memory tests.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agoarm64: versal: Move IOU_SWITCH_DIVISOR0 to Kconfig
Michal Simek [Mon, 28 Jan 2019 10:12:41 +0000 (11:12 +0100)]
arm64: versal: Move IOU_SWITCH_DIVISOR0 to Kconfig

Move hardcoded IOU_SWITCH_DIVISOR0 to Kconfig to be able to set it up
for different platforms.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agoarm64: versal: Remove one level of indentation in board_early_init_r()
Michal Simek [Mon, 28 Jan 2019 10:08:00 +0000 (11:08 +0100)]
arm64: versal: Remove one level of indentation in board_early_init_r()

Simplify code indentation.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agoarm64: versal: Define distro boot commnads for qspi ospi and mmc
Siva Durga Prasad Paladugu [Thu, 31 Jan 2019 11:58:13 +0000 (17:28 +0530)]
arm64: versal: Define distro boot commnads for qspi ospi and mmc

This patch adds distro boot commands for qspi, ospi and mmc.
The distro boot commands now reads the script from flash offset
of 63.5MB  for qspi and ospi and executes it. For mmc its same
as generic distro boot command. As either one of the qspi or ospi can
exist on hardware, defined a single distroboot command as xspi
that works for both.

Setup default location via script_offset_f to 63.5MB to match the most
xilinx reference boards for qspi, ospi for now.
512kB allocated space for script size (script_size_f) should be more
than enough to cover custom boot logic.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agoarm64: versal: Disable showing information about console
Michal Simek [Mon, 28 Jan 2019 09:47:33 +0000 (10:47 +0100)]
arm64: versal: Disable showing information about console

There is no need to see this info. It is just wasting of space/time.
It saves 308Bytes.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agoarm: zynq: Update boot_targets based on bootmode
Siva Durga Prasad Paladugu [Fri, 25 Jan 2019 11:36:06 +0000 (17:06 +0530)]
arm: zynq: Update boot_targets based on bootmode

Update boot_targets based on bootmode to run corresponding
distroboot command first.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agoarm: zynq: Define distro boot commnads for qspi, nand and nor
Siva Durga Prasad Paladugu [Fri, 25 Jan 2019 11:36:05 +0000 (17:06 +0530)]
arm: zynq: Define distro boot commnads for qspi, nand and nor

This patch adds distro boot commands for qspi, nand and nor.
The distro boot commands now reads the script from flash offset
of 15.75MB and executes it.

Setup default location via script_offset_f to 15.75MB to match the most
xilinx reference boards for qspi, nand and set the same using
script_offset_nor to 0xE2EC0000 for nor.
256kB allocated space for script size (script_size_f) should be more
than enough to cover custom boot logic.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agospi: zynqmp_gqspi: Enable versal compatible string
Michal Simek [Thu, 29 Nov 2018 07:48:28 +0000 (08:48 +0100)]
spi: zynqmp_gqspi: Enable versal compatible string

Trivial patch.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agoarm64: versal: Add mini eMMC configuration
Siva Durga Prasad Paladugu [Tue, 8 Jan 2019 16:17:29 +0000 (21:47 +0530)]
arm64: versal: Add mini eMMC configuration

This patch adds mini eMMC configuration which has only
emmc0 and emmc1 functionalities and can run from small
amount of memory. This is required for memory constraint
devices.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agoarm64: versal: Enable different ethernet phy for virt platform
Michal Simek [Thu, 17 Jan 2019 08:22:37 +0000 (09:22 +0100)]
arm64: versal: Enable different ethernet phy for virt platform

This platform is going to become generic that's why it is necessary also
enable different PHY vendors.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agoarm64: versal: Add new Kconfig SYS_MEM_RSVD_FOR_MMU
Siva Durga Prasad Paladugu [Tue, 8 Jan 2019 16:17:26 +0000 (21:47 +0530)]
arm64: versal: Add new Kconfig SYS_MEM_RSVD_FOR_MMU

This patch adds new config option which is used for
reserving a specific memory for MMU Table and in this
case we are using TCM for that purpose.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agoARM: zynq: Convert Antminer to OF_SEPARATE
Michal Simek [Mon, 28 Jan 2019 07:40:50 +0000 (08:40 +0100)]
ARM: zynq: Convert Antminer to OF_SEPARATE

Convert board from OF_EMBED to OF_SEPARATE.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agoxilinx: common: Add support for DM_I2C zynq_board_read_rom_ethaddr()
Michal Simek [Mon, 21 Jan 2019 15:29:07 +0000 (16:29 +0100)]
xilinx: common: Add support for DM_I2C zynq_board_read_rom_ethaddr()

It is much easier to point to eeprom which stores information like MAC
address directly via DT. eeprom which contains this information is
pointed by /chosen/xlnx,eeprom parameter.

For example:
        chosen {
                bootargs = "earlycon";
                stdout-path = "serial0:115200n8";
+               xlnx,eeprom = &eeprom;
        };

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agoxilinx: Move zynq_board_read_rom_ethaddr to shared location
Michal Simek [Mon, 21 Jan 2019 14:25:02 +0000 (15:25 +0100)]
xilinx: Move zynq_board_read_rom_ethaddr to shared location

Zynq and ZynqMP are sharing similar code and there is no reason to do
code duplication. Move zynq_board_read_rom_ethaddr() to common file for
easier conversion to DM.
Use ZynqMP version that's why also add CONFIG_ZYNQ_EEPROM_BUS to Syzygy
which is only one Zynq board which is using this feature.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agoarm64: zynqmp: Define distro boot commnads for qspi and nand
Siva Durga Prasad Paladugu [Thu, 24 Jan 2019 06:02:04 +0000 (11:32 +0530)]
arm64: zynqmp: Define distro boot commnads for qspi and nand

This patch adds distro boot commands for qspi and nand. The
distro boot commands now reads the script from flash offset
of 63.5MB and executes it.

Setup default location via script_offset_f to 63.5MB to match the most
xilinx reference boards. 512kB allocated space for script size
(script_size_f) should be more than enough to cover custom boot logic.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agoARM: zynq: Run distribution boot commands first
Michal Simek [Thu, 3 Jan 2019 12:58:27 +0000 (13:58 +0100)]
ARM: zynq: Run distribution boot commands first

This patch is doing two things.
1. Exchanging order of boot commands. distro_bootcmd is run first
followed by Xilinx boot command.
2. Remove CONFIG_BOOTCOMMAND from configs (and follow mainline) by
creating Xilinx distribution bootcommand and wiring it as the last
bootcommand.

QSPI, NAND distribution boot command will be added later.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agoMerge tag 'signed-efi-next' of git://github.com/agraf/u-boot
Tom Rini [Wed, 13 Feb 2019 12:12:29 +0000 (07:12 -0500)]
Merge tag 'signed-efi-next' of git://github.com/agraf/u-boot

Patch queue for efi - 2019-02-13

Goodness this time around:

  - HII protocol, finally allows us to run the UEFI Shell!
    (experimantal, disabled by default)
  - efi selftest now available on Cortex-M
  - NVMe support for distro boot
  - Lots of code cleanup

5 years agoefi_loader: fix EFI_FILE_PROTOCOL.GetInfo()
Heinrich Schuchardt [Sat, 9 Feb 2019 21:23:48 +0000 (22:23 +0100)]
efi_loader: fix EFI_FILE_PROTOCOL.GetInfo()

We check the existence of files with fs_exist(). This function calls
fs_close(). If we do not set the active block device again fs_opendir()
fails and we do not set the flag EFI_FILE_DIRECTORY. Due to this error the
`cd` command in the EFI shell fails.

So let's add the missing set_blk_dev(fh) call.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
5 years agolib: vsprintf: avoid overflow printing UTF16 strings
Heinrich Schuchardt [Sun, 10 Feb 2019 10:11:26 +0000 (11:11 +0100)]
lib: vsprintf: avoid overflow printing UTF16 strings

We have to ensure while printing UTF16 strings that we do not exceed the
end of the print buffer.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
5 years agoefi_loader: Make HII a config option
Alexander Graf [Mon, 11 Feb 2019 14:24:00 +0000 (15:24 +0100)]
efi_loader: Make HII a config option

Heinrich ran into issues with HII and iPXE which lead to #SErrors on
his Odroid-C2 system. We definitely do not want to regress just yet,
so let's not expose the HII protocols by default.

Instead, let's make it a config option that people can play with
This way, we can stabilize the code in tree without breaking any
users.

Once someone figures out, why this breaks iPXE (probably a NULL
dereference), we can enable it by default.

Reported-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
---

v1 -> v2:

  - Remove HII selftest as well

v2 -> v3:

  - Make config option

5 years agoarm: Leave smccc calls in .text when efi_loader=n
Alexander Graf [Mon, 11 Feb 2019 14:07:17 +0000 (15:07 +0100)]
arm: Leave smccc calls in .text when efi_loader=n

Commit 81ea00838c6 ("efi_loader: PSCI reset and shutdown") put the SMCCC
assembly code into the efi specific code section. This is wrong when we
do not have EFI_LOADER enabled, as that strips efi runtime sections from
the output binary

Reported-by: Michal Simek <monstr@monstr.eu>
Reported-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Tested-by: Michal Simek <monstr@monstr.eu>
Fixes: 81ea00838c6 ("efi_loader: PSCI reset and shutdown")
Signed-off-by: Alexander Graf <agraf@suse.de>
5 years agoefi_loader: debug output for HII protocols
Heinrich Schuchardt [Wed, 23 Jan 2019 21:55:36 +0000 (22:55 +0100)]
efi_loader: debug output for HII protocols

For correct indention use EFI_PRINT() instead of debug().

For printing efi_uintn_t or size_t use the %zu or %zx format code.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
5 years agoefi_selftest: fix HII tests
Heinrich Schuchardt [Wed, 23 Jan 2019 19:36:27 +0000 (20:36 +0100)]
efi_selftest: fix HII tests

efi_st_printf() does not support format code %ld. Anyway the format code
for size_t would be %zu which isn't supported either.

We do not want any divisions to avoid invalid references to integer
arithmetic routines, cf.
https://gcc.gnu.org/onlinedocs/gccint/Integer-library-routines.html.

As a simple remedy remove the noisy messages from the output.
They are not relevant for automated testing.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
5 years agoefi_selftest: add HII database protocols test
AKASHI Takahiro [Mon, 21 Jan 2019 03:13:01 +0000 (12:13 +0900)]
efi_selftest: add HII database protocols test

This efi_selftest tests HII database protocol and HII string protocol.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
5 years agoefi: hii: add HII config routing/access protocols
AKASHI Takahiro [Mon, 21 Jan 2019 03:13:00 +0000 (12:13 +0900)]
efi: hii: add HII config routing/access protocols

This patch is a place holder for HII configuration routing protocol and
HII configuration access protocol.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
5 years agoefi: hii: add keyboard layout package support
AKASHI Takahiro [Mon, 21 Jan 2019 03:12:59 +0000 (12:12 +0900)]
efi: hii: add keyboard layout package support

Allow for handling keyboard layout package in HII database protocol.

A package can be added or deleted in HII database protocol, but
we don't set 'current' keyboard layout as there is no driver that
requests a keyboard layout.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
5 years agoefi: hii: add guid package support
AKASHI Takahiro [Mon, 21 Jan 2019 03:12:58 +0000 (12:12 +0900)]
efi: hii: add guid package support

Allow for handling GUID package in HII database protocol.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
5 years agoefi_loader: Initial HII database protocols
Leif Lindholm [Mon, 21 Jan 2019 03:12:57 +0000 (12:12 +0900)]
efi_loader: Initial HII database protocols

This patch provides enough implementation of the following protocols to
run EDKII's Shell.efi and UEFI SCT:

  * EfiHiiDatabaseProtocol
  * EfiHiiStringProtocol

Not implemented are:
  * ExportPackageLists()
  * RegisterPackageNotify()/UnregisterPackageNotify()
  * SetKeyboardLayout() (i.e. *current* keyboard layout)

HII database protocol in this patch series can handle only:
  * GUID package
  * string package
  * keyboard layout package
  (The other packages, except Device path package, will be necessary
   for interactive and graphical UI.)

Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
5 years agox86: do not use i386 code for x86_64 memory functions
Heinrich Schuchardt [Wed, 23 Jan 2019 01:42:39 +0000 (02:42 +0100)]
x86: do not use i386 code for x86_64 memory functions

arch/x86/lib/string.c contains assembler implementations of memcpy(),
memmove(), and memset() written for i386. Don't use it on x86_64.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
5 years agoefi_loader: GetNextVariableName() relies on REGEX
Heinrich Schuchardt [Tue, 22 Jan 2019 20:35:23 +0000 (21:35 +0100)]
efi_loader: GetNextVariableName() relies on REGEX

Our implementation of GetNextVariableName() relies on
CONFIG_REGEX=y. So EFI_LOADER has to select it.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
5 years agoefi_loader: fix GetNextVariableName
Heinrich Schuchardt [Tue, 22 Jan 2019 19:10:46 +0000 (20:10 +0100)]
efi_loader: fix GetNextVariableName

Our current implementation of GetNextVariableName() first collects all EFI
variables. If none is found at all hexport_r() returns a zero length string
terminated by \0 and the value 1 as number of bytes in the returned buffer.

In this case GetNextVariableName() has to return EFI_NOT_FOUND.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
5 years agoefi_loader: do not use symbolic links
Heinrich Schuchardt [Mon, 21 Jan 2019 18:30:42 +0000 (19:30 +0100)]
efi_loader: do not use symbolic links

Symbolic links are not supported on all file systems, e.g. not on FAT. So
it is not wise to use them in our source tree.

Use a qualified path to refer to lib/efi_loader/efi_freestanding.c in
scripts/Makefile.lib instead.

Reported-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
[agraf: Fix build with O=]
Signed-off-by: Alexander Graf <agraf@suse.de>
5 years agoefi_loader: use library memcpy() in helloworld.efi
Heinrich Schuchardt [Sun, 20 Jan 2019 07:20:32 +0000 (08:20 +0100)]
efi_loader: use library memcpy() in helloworld.efi

Helloworld does not need its own memcpy() implementation anymore. Use the
one provided in efi_freestanding.c.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
5 years agoefi_loader: use freestanding library for efi apps
Heinrich Schuchardt [Sun, 20 Jan 2019 07:20:31 +0000 (08:20 +0100)]
efi_loader: use freestanding library for efi apps

GCC requires that freestanding programs provide memcpy(), memmove(),
memset(), and memcmp().

Add the library functions when building a *.efi files.

The EFI selftests might use other compilation flags. So use a symbolic
link to provide lib/efi_selftest/efi_freestanding.c and compile it
separately.

Reported-by: Alexander Graf <agraf@suse.de>
Fixes: 5be444d14b38 ("efi_loader: consistent build flags for EFI applications")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
5 years agoefi_loader: provide freestanding library
Heinrich Schuchardt [Sun, 20 Jan 2019 07:20:30 +0000 (08:20 +0100)]
efi_loader: provide freestanding library

GCC requires that freestanding programs provide memcpy(), memmove(),
memset(), and memcmp().

Provide the required library functions.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
5 years agoefi_selftest: fix variables test for GetNextVariableName()
AKASHI Takahiro [Mon, 21 Jan 2019 11:43:14 +0000 (12:43 +0100)]
efi_selftest: fix variables test for GetNextVariableName()

There is a bug in efi variables test.
Fix it with some cosmetic improvements.

Please note that efi variables test still fails at QueryVariableInfo()
and GetVariable(), but this is not due to a change in this patch.
  ==8<==
  Testing EFI API implementation

  Selected test: 'variables'

  Setting up 'variables'
  Setting up 'variables' succeeded

  Executing 'variables'
  .../u-boot/lib/efi_selftest/efi_selftest_variables.c(60):
  TODO: QueryVariableInfo failed
  .../u-boot/lib/efi_selftest/efi_selftest_variables.c(131):
  TODO: GetVariable returned wrong length 7
  .../u-boot/lib/efi_selftest/efi_selftest_variables.c(133):
  TODO: GetVariable returned wrong value
  Executing 'variables' succeeded

  Boot services terminated

  Summary: 0 failures
  ==>8==

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
5 years agoefi_loader: implement GetNextVariableName()
AKASHI Takahiro [Mon, 21 Jan 2019 11:43:13 +0000 (12:43 +0100)]
efi_loader: implement GetNextVariableName()

The current GetNextVariableName() is a placeholder.
With this patch, it works well as expected.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
rebased on efi-next
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
5 years agoefi_loader: comments for variable services
Heinrich Schuchardt [Fri, 18 Jan 2019 18:52:05 +0000 (19:52 +0100)]
efi_loader: comments for variable services

Comment the functions implementing the runtime variable services.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
5 years agoefi_loader: remove duplicate function mem2hex()
Heinrich Schuchardt [Fri, 18 Jan 2019 17:54:26 +0000 (18:54 +0100)]
efi_loader: remove duplicate function mem2hex()

Replace duplicate function mem2hex() by inline function bin2hex().

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
5 years agoefi_loader: eliminate duplicate function hex2mem()
Heinrich Schuchardt [Fri, 18 Jan 2019 11:31:54 +0000 (12:31 +0100)]
efi_loader: eliminate duplicate function hex2mem()

Use existing inline function hex2bin() instead of defining a new one.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
5 years agoefi_loader: remove duplicate GUID definition
Heinrich Schuchardt [Tue, 15 Jan 2019 04:44:56 +0000 (05:44 +0100)]
efi_loader: remove duplicate GUID definition

Remove duplicate definition o EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
5 years agoefi_loader: consistent build flags for EFI applications
Heinrich Schuchardt [Sat, 12 Jan 2019 14:32:06 +0000 (15:32 +0100)]
efi_loader: consistent build flags for EFI applications

At the same time adding and removing the -Os flag does not make any sense.
Actually it leads to -Os not being used.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
5 years agoefi_loader: use u16* for file name
Heinrich Schuchardt [Sat, 12 Jan 2019 11:02:33 +0000 (12:02 +0100)]
efi_loader: use u16* for file name

UTF-16 strings in our code should all be u16 *. Fix an inconsistency for
file names which may lead to a warning for printf("%ls", ).

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
5 years agoefi_loader: fix CopyMem()
Heinrich Schuchardt [Wed, 9 Jan 2019 20:41:13 +0000 (21:41 +0100)]
efi_loader: fix CopyMem()

CopyMem() must support overlapping buffers. So replace memcpy() by
memmove().

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
5 years agoefi_loader: refactor switch to non-secure mode
Heinrich Schuchardt [Tue, 8 Jan 2019 17:13:06 +0000 (18:13 +0100)]
efi_loader: refactor switch to non-secure mode

Refactor the switch from supervisor to hypervisor to a new function called
at the beginning of do_bootefi().

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
5 years agoefi_driver: simplify error message
Heinrich Schuchardt [Sun, 6 Jan 2019 16:12:43 +0000 (17:12 +0100)]
efi_driver: simplify error message

Stating the function module is sufficient. We don't need file and line
number. Anyway the format code for the line number was incorrect (should
be %d).

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
5 years agoefi_selftest: tpl unit test, check return values
Heinrich Schuchardt [Sun, 6 Jan 2019 15:44:16 +0000 (16:44 +0100)]
efi_selftest: tpl unit test, check return values

For some API calls checks for the return values are missing.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
5 years agoefi_selftest: events unit test, check return values
Heinrich Schuchardt [Sun, 6 Jan 2019 15:38:57 +0000 (16:38 +0100)]
efi_selftest: events unit test, check return values

For some API calls checks for the return values are missing.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
5 years agoefi_selftest: SNP unit test on sandbox
Heinrich Schuchardt [Sat, 5 Jan 2019 22:50:41 +0000 (23:50 +0100)]
efi_selftest: SNP unit test on sandbox

Running the simple network protocol test on the sandbox requires setting
the environment variable ethact to a network interface connected to a DHCP
server and ethrotate to 'no'. So let's make it an on-request test on the
sandbox (selectable by setting environment variable efi_selftest).

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
5 years agoefi_loader: efi_set_variable use const void *
Heinrich Schuchardt [Sun, 30 Dec 2018 20:03:15 +0000 (21:03 +0100)]
efi_loader: efi_set_variable use const void *

The SetVariable() runtime service does not change the data passed to it.
So mark the parameter as constant.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
5 years agoefi_loader: use const efi_guid_t * for variable services
Heinrich Schuchardt [Sun, 30 Dec 2018 19:53:51 +0000 (20:53 +0100)]
efi_loader: use const efi_guid_t * for variable services

The runtime variable services never change GUIDs. So we should declare
the GUID parameters as constant.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
5 years agoefi_loader: move efi_init_obj_list() to a new efi_setup.c
AKASHI Takahiro [Sun, 30 Dec 2018 14:16:55 +0000 (15:16 +0100)]
efi_loader: move efi_init_obj_list() to a new efi_setup.c

The function, efi_init_obj_list(), can be shared in different pseudo efi
applications, like bootefi/bootmgr as well as my efishell. Moreover, it
will be utilized to extend efi initialization, for example, my "removable
disk support" patch and "capsule-on-disk support" patch in the future.

So with this patch, it will be moved to a new file, efi_setup.c, under
lib/efi_loader and exported, making no changes in functionality.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Remove lines deactivated by #if 1 #else
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
5 years agodoc: README.uefi: fix typos
Heinrich Schuchardt [Sun, 30 Dec 2018 11:54:36 +0000 (12:54 +0100)]
doc: README.uefi: fix typos

%s/specfication/specification/
%s/selftest/self-test/
%s/little endian/little-endian/

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
5 years agoefi_selftest: allow building on ARMv7-M
Heinrich Schuchardt [Sun, 30 Dec 2018 09:52:41 +0000 (10:52 +0100)]
efi_selftest: allow building on ARMv7-M

ARMv7-M only supports the Thumb instruction set. Our current crt0 code does
not support it. With the patch we can build all unit tests of the EFI
subsystem that do not require crt0.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
5 years agoefi_loader: signature of StartImage and Exit
Heinrich Schuchardt [Fri, 28 Dec 2018 11:41:15 +0000 (12:41 +0100)]
efi_loader: signature of StartImage and Exit

We use u16* for Unicode strings and efi_uintn_t for UINTN. Correct the
signature of efi_exit() and efi_start_image().

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
5 years agoefi_loader: avoid unnecessary pointer to long conversion
Heinrich Schuchardt [Fri, 28 Dec 2018 11:41:14 +0000 (12:41 +0100)]
efi_loader: avoid unnecessary pointer to long conversion

debug() support supports %p to print pointers.

The debug message is unique. So there is not need to write a possibly
distracting line number.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
5 years agoefi_loader: fix memory allocation on sandbox
Heinrich Schuchardt [Sat, 5 Jan 2019 22:41:36 +0000 (23:41 +0100)]
efi_loader: fix memory allocation on sandbox

Commit 7b78d6438a2b ("efi_loader: Reserve unaccessible memory") introduced
a comparison between RAM top and RAM start that was not known at the time
when the patch of commit 49759743bf09 ("efi_loader: eliminate sandbox
addresses") was written.

The sandbox uses an address space that is only relevant in the sandbox
context. We have to map ram_top from the sandbox address space to the
physical address space before using it in the EFI subsystem.

Fixes: 49759743bf09 ("efi_loader: eliminate sandbox addresses")
Fixes: 7b78d6438a2b ("efi_loader: Reserve unaccessible memory")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
5 years agoefi_loader: CMD_BOOTEFI_HELLO_COMPILE in configs
Heinrich Schuchardt [Sun, 30 Dec 2018 09:11:14 +0000 (10:11 +0100)]
efi_loader: CMD_BOOTEFI_HELLO_COMPILE in configs

It should not be necessary to adjust CMD_BOOTEFI_HELLO_COMPILE in config
files.

arch/arm/lib/crt0_arm_efi.S cannot be compiled in thumbs mode. We can
disable CMD_BOOTEFI_HELLO_COMPILE for CONFIG_CPU_V7M. So there is no longer
a need to disable it in stm32 configs.

helloworld.efi can be built without problems on x86_64. So there is no need
to disable it in chromebook_link64_defconfig and qemu-x86_64_defconfig.

Same is true for ARM V7A. So do not disable CMD_BOOTEFI_HELLO_COMPILE in
kp_imx6q_tpc_defconfig.

Some architecture checks are already make for EFI_LOADER. There is no need
to repeat them for CMD_BOOTEFI_HELLO_COMPILE

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Patrice.Chotard@st.com
Signed-off-by: Alexander Graf <agraf@suse.de>
5 years agoefi_loader: use named constant for efi_dp_from_mem()
Heinrich Schuchardt [Wed, 26 Dec 2018 21:23:00 +0000 (22:23 +0100)]
efi_loader: use named constant for efi_dp_from_mem()

When calling efi_dp_from_mem() use a named constant for the memory type.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
5 years agodistro: not taint environment variables if possible
AKASHI Takahiro [Tue, 4 Dec 2018 06:46:55 +0000 (15:46 +0900)]
distro: not taint environment variables if possible

The aim of this patch is not to have temporary variables used in
distro_bootcmd left as environment variables after run something.
See the discussion[1].
Without this patch, saveenv command also saves those variables, too.
While they are apparently safe, scsi_need_init can be harmful.

Please note that, in most cases, a variable should be converted to
hush's local variable, while "devplist" cannot because it is created
by "part" command as an environment variable.

[1] https://lists.denx.de/pipermail/u-boot/2018-December/350209.html

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Signed-off-by: Alexander Graf <agraf@suse.de>