platform/kernel/u-boot.git
6 years agodrivers: net: zynq_gem: fix phy dt node setting
Grygorii Strashko [Thu, 5 Jul 2018 17:02:52 +0000 (12:02 -0500)]
drivers: net: zynq_gem: fix phy dt node setting

Now zynq_gem driver will overwrite UCLASS_ETH node when PHY is
connected and configured which is not correct.
Use struct phydev->node instead.

Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Tested-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
6 years agodrivers: net: cpsw: fix phy dt node setting
Grygorii Strashko [Thu, 5 Jul 2018 17:02:51 +0000 (12:02 -0500)]
drivers: net: cpsw: fix phy dt node setting

Now CPSW driver will overwrite UCLASS_ETH node when PHY is
connected and configured which is not correct.
Use struct phydev->node instead.

Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
6 years agonet: phy: xilinx: switch to use phy_get_ofnode()
Grygorii Strashko [Thu, 5 Jul 2018 17:02:50 +0000 (12:02 -0500)]
net: phy: xilinx: switch to use phy_get_ofnode()

Use PHY API phy_get_ofnode() helper to get PHY DT node.

Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
6 years agonet: phy: dp83867: switch to use phy_get_ofnode()
Grygorii Strashko [Thu, 5 Jul 2018 17:02:49 +0000 (12:02 -0500)]
net: phy: dp83867: switch to use phy_get_ofnode()

Use PHY API phy_get_ofnode() helper to get PHY DT node.

Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Tested-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
6 years agonet: phy: add ofnode node to struct phy_device
Grygorii Strashko [Thu, 5 Jul 2018 17:02:48 +0000 (12:02 -0500)]
net: phy: add ofnode node to struct phy_device

Now the UCLASS_ETH device "node" field is owerwritten by some network drivers in
case of Ethernet PHYs which are linked to UCLASS_ETH device using
"phy-handle" DT property and when Ethernet PHY driver needs to read some
additional information from DT. In such cases following happens (in
general):

- network drivers
priv->phydev = phy_connect(priv->bus, priv->phyaddr, dev,
   priv->interface);
<-- phydev is connected to dev which is UCLASS_ETH device

if (priv->phy_of_handle > 0)
dev_set_of_offset(priv->phydev->dev, priv->phy_of_handle);
<-- phydev->dev->node is overwritten by phy-handle DT node

- PHY driver in .config() callback
int node = dev_of_offset(dev);
<-- PHY driver uses overwritten dev->node
        const void *fdt = gd->fdt_blob;

 if (fdtdec_get_bool(fdt, node, "property"))
...

As result, UCLASS_ETH device can't be used any more for DT accessing.

This patch adds additional ofnode node field to struct phy_device which can
be set explicitly by network drivers and used by PHY drivers, so
overwriting can be avoided. Also add helper function phy_get_ofnode()
which will check and return phy_device->node or dev_ofnode(phydev->dev) for
backward compatibility with existing drivers.

Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
6 years agonet: phy: Clean up includes of common.h
Joe Hershberger [Wed, 25 Jul 2018 17:59:22 +0000 (12:59 -0500)]
net: phy: Clean up includes of common.h

We want to be able to include some other system headers in phy.h but
that requires us to have included common.h in the top-level first.

Also, common.h includes config.h as the first thing it does, so don't
include it directly.

Series-to: u-boot
Series-cc: Grygorii Strashko <grygorii.strashko@ti.com>
Seried-cc: ti
Series-process-log: sort, uniq
Cover-letter:
Prepare for net: phy: prevent uclass_eth device "node" field overwriting
Prepare for [1] so that it doesn't break the build for a bunch of
boards. There are a number of reasons this series broke the build
but none of them depend on changes in the series, so fix up those
situations ahead of applying that series.

[1] https://patchwork.ozlabs.org/cover/940104/
END
Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
6 years agophy: Break include cycle
Joe Hershberger [Tue, 17 Jul 2018 20:02:30 +0000 (15:02 -0500)]
phy: Break include cycle

Because some phy wants to export some functions [1], export.h was
including the whole phy subsystem which pulls in lots of stuff that
causes some ordering and redefinition issues. Split out the only part
that is actually needed in export.h and include it there and in phy.h.

[1] commit 95279315076c ("board/ls2085rdb: Export functions for
  standalone AQ FW load apps")

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
6 years agoarm: Prevent redefinition error in fsl-layerscape
Joe Hershberger [Mon, 16 Jul 2018 20:33:51 +0000 (15:33 -0500)]
arm: Prevent redefinition error in fsl-layerscape

The include/phy.h will start including dm.h, which pulls in
linux/compat.h after the attempted redefinition in
arch/arm/include/asm/armv8/mmu.h, so move this include to allow
redefinition.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
6 years agonet: phy: dp83867: switch to use ofnode api
Grygorii Strashko [Thu, 28 Jun 2018 19:26:35 +0000 (14:26 -0500)]
net: phy: dp83867: switch to use ofnode api

Switch to use more generic ofnode API instead of FDT API.

Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Tested-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
6 years agonet: phy: dp83867: add workaround for incorrect RX_CTRL pin strap
Murali Karicheri [Thu, 28 Jun 2018 19:26:34 +0000 (14:26 -0500)]
net: phy: dp83867: add workaround for incorrect RX_CTRL pin strap

The data manual for DP83867IR/CR, SNLS484E[1], revised march 2017,
advises that strapping RX_DV/RX_CTRL pin in mode 1 and 2 is not
supported (see note below Table 5 (4-Level Strap Pins)).

It further advises that if a board has this pin strapped in mode 1 and
mode 2, then bit[7] of Configuration Register 4 (address 0x0031) must
be cleared to 0. This is to ensure proper operation of PHY.

Since it is not possible to detect in software if RX_DV/RX_CTRL pin is
incorrectly strapped, add a device-tree property to advertise this and
allow corrective action in software.
[1] http://www.ti.com/lit/ds/snls484e/snls484e.pdf

Signed-off-by: Murali Karicheri <m-karicheri2@ti.com>
Reviewed-by: Hannes Schmelzer <oe5hpm@oevsv.at>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Tested-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
6 years agonet: mvgbe: convert to DM
Chris Packham [Mon, 9 Jul 2018 09:34:00 +0000 (21:34 +1200)]
net: mvgbe: convert to DM

Add driver model support to the mvgbe driver. As a temporary measure
both DM and non-DM uses are supported. Once all the users have been
converted the non-DM support can be dropped.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Tested-by: Michael Walle <michael@walle.cc>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
6 years agonet: mvgbe: prepare for conversion to driver model
Chris Packham [Mon, 9 Jul 2018 09:33:59 +0000 (21:33 +1200)]
net: mvgbe: prepare for conversion to driver model

Extract some function bodies to helper functions that can be reused in
the DM/non-DM implementations.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
6 years agoinitialize net_mode.if_type
Andrew Thomas [Thu, 21 Jun 2018 23:21:01 +0000 (16:21 -0700)]
initialize net_mode.if_type

if_type is not correctly initialized

Failure to initialize if_type means that grub2/efinet sends
a bogus arp request. It therefore gets no response. On Raspberry Pi 3B+
this leads to a pause at:

lan78xx_eth Waiting for PHY auto negotiation to complete....... done
lan78xx_eth Waiting for PHY auto negotiation to complete....... done

Signed-off-by: Andrew Thomas <andrew.thomas@oracle.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
6 years agonet: Consolidate the parsing of bootfile
Joe Hershberger [Wed, 4 Jul 2018 00:36:43 +0000 (19:36 -0500)]
net: Consolidate the parsing of bootfile

The same basic parsing was implemented in tftp and nfs, so add a helper
function to do the work once.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
6 years agonet: Read bootfile from env on netboot_common()
Joe Hershberger [Wed, 4 Jul 2018 00:36:42 +0000 (19:36 -0500)]
net: Read bootfile from env on netboot_common()

Instead of depending on a env callback for bootfile, read it explicitly.

We do this because the bootfile can be specified on the command line and
if it is, we will overwrite the internal variable. If a netboot_common()
is called again with no bootfile parameter, we want to use the one in
the environment.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
6 years agonet: Make copy_filename() accept NULL src
Joe Hershberger [Wed, 4 Jul 2018 00:36:41 +0000 (19:36 -0500)]
net: Make copy_filename() accept NULL src

Rather than crashing, check the src ptr and set dst to empty string.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
6 years agonet: Re-check prerequisites when autoloading
Joe Hershberger [Wed, 4 Jul 2018 00:36:40 +0000 (19:36 -0500)]
net: Re-check prerequisites when autoloading

With net autoload, we check the prerequisites for the initial command,
but the greater prerequisites when autoloading are not checked.

If we would attempt to autoload, check those prerequisites too.

If we are not expecting a serverip from the server, then don't worry
about it not being set, but don't attempt to load if it isn't.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
6 years agonet: When checking prerequisites, consider boot_file_name
Joe Hershberger [Wed, 4 Jul 2018 00:36:39 +0000 (19:36 -0500)]
net: When checking prerequisites, consider boot_file_name

For net_boot_common, we allow the serverip to be specified as part of
the boot file name. For net commands that require serverip, include that
source as a valid specification of serverip.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Alexander Graf <agraf@suse.de>
6 years agonet: Always print basic info for nfs, just like tftp
Joe Hershberger [Wed, 4 Jul 2018 00:22:56 +0000 (19:22 -0500)]
net: Always print basic info for nfs, just like tftp

nfs was only printing basic info about the transfer in the case of a
DEBUG build. Print the same level of detail as tftp always.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
6 years agonet: Check subnet against the actual ip address in use for nfs
Joe Hershberger [Wed, 4 Jul 2018 00:22:55 +0000 (19:22 -0500)]
net: Check subnet against the actual ip address in use for nfs

The check for sending to the gateway was not using the correct variable
for comparison, so it was reporting that packets are sent to the gateway
when they were not.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
6 years agonet: Correct size of NFS buffers
Joe Hershberger [Wed, 4 Jul 2018 00:22:54 +0000 (19:22 -0500)]
net: Correct size of NFS buffers

Reported-by: Coverity (CID: 152888)
Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
6 years agosandbox: eth-raw: Add a SIMPLE_BUS to enumerate host interfaces
Joe Hershberger [Mon, 2 Jul 2018 19:47:54 +0000 (14:47 -0500)]
sandbox: eth-raw: Add a SIMPLE_BUS to enumerate host interfaces

Ask the OS for each of its interfaces and for each one, bind a U-Boot
device and then probe it. This will allocate the priv data structure
that is then populated.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agosandbox: eth-raw: Make random MAC addresses available to eth-raw
Joe Hershberger [Mon, 2 Jul 2018 19:47:53 +0000 (14:47 -0500)]
sandbox: eth-raw: Make random MAC addresses available to eth-raw

We don't necessarily know how many MAC addresses we'll need, so implement
a ROM read so we always have something valid.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agosandbox: eth-raw: Allow interface to be specified by index
Joe Hershberger [Mon, 2 Jul 2018 19:47:52 +0000 (14:47 -0500)]
sandbox: eth-raw: Allow interface to be specified by index

With systemd stable interface names, eth0 will almost never exist.
Instead of using that name in the sandbox.dts, use an index.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agosandbox: eth-raw: Add a function to ask the host about localhost
Joe Hershberger [Mon, 2 Jul 2018 19:47:51 +0000 (14:47 -0500)]
sandbox: eth-raw: Add a function to ask the host about localhost

Instead of doing a simple string compare against "lo", look for the flag
that indicates a localhost interface.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agonet: sandbox-raw: Convert raw eth driver to livetree
Joe Hershberger [Mon, 2 Jul 2018 19:47:50 +0000 (14:47 -0500)]
net: sandbox-raw: Convert raw eth driver to livetree

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agonet: sandbox: Convert sandbox mock eth driver to livetree
Joe Hershberger [Mon, 2 Jul 2018 19:47:49 +0000 (14:47 -0500)]
net: sandbox: Convert sandbox mock eth driver to livetree

Use the dev_ functions to access DT properties.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agonet: Correct comment in Kconfig
Joe Hershberger [Mon, 2 Jul 2018 19:47:48 +0000 (14:47 -0500)]
net: Correct comment in Kconfig

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agosandbox: eth-raw: Make sure descriptors are always initialized
Joe Hershberger [Mon, 2 Jul 2018 19:47:47 +0000 (14:47 -0500)]
sandbox: eth-raw: Make sure descriptors are always initialized

If we let descriptors equal 0, we can end up closing STDIN. Make sure
they start out as -1.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agonet: Only call halt on a driver that has been init'ed
Joe Hershberger [Mon, 2 Jul 2018 19:47:46 +0000 (14:47 -0500)]
net: Only call halt on a driver that has been init'ed

With driver model, we were not checking if the state of the device was
marked as active before calling the halt function. Check that the device
is probed and also marked as active. This avoids the case where we were
calling halt on the first device in net_init() and the driver would
operate on bogus data structures causing problems. In this case, the
priv was all 0, so halt() would close STDIN.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agosandbox: Fix format of fake-host-hwaddr in test.dts
Joe Hershberger [Mon, 2 Jul 2018 19:47:45 +0000 (14:47 -0500)]
sandbox: Fix format of fake-host-hwaddr in test.dts

test.dts specified the fake MAC address as a u32 array. Instead it
should be a u8 array.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agosandbox: eth-raw: Correct valid socket test in send/recv
Joe Hershberger [Mon, 2 Jul 2018 19:47:44 +0000 (14:47 -0500)]
sandbox: eth-raw: Correct valid socket test in send/recv

In open, the socket is correctly checked to be -1 in the error case.
In send and recv, we checked for 0, but that is a valid socket number.

Correct this by checking for -1 as a bad socket everywhere.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agosandbox: Don't disable ctrlc() on sandbox if in raw mode
Joe Hershberger [Tue, 3 Jul 2018 01:06:49 +0000 (20:06 -0500)]
sandbox: Don't disable ctrlc() on sandbox if in raw mode

In raw mode, handle ctrl-c as normal. This allows normal ctrl-c behavior
such as aborting a command that is timing out without completely
terminating the sandbox executable.

In [1], Simon disabled this.  His reason for it was that it interferes
with piping test scripts. Piping should be done in cooked mode, so this
change should still not interfere.

[1] commit 8969ea3e9f2db04a6b3675 ("sandbox: Disable Ctrl-C")

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agoconsole: Remember if ctrlc is disabled in console_tstc()
Joe Hershberger [Tue, 3 Jul 2018 01:06:48 +0000 (20:06 -0500)]
console: Remember if ctrlc is disabled in console_tstc()

We don't necessarily want to re-enable ctrl-c if it was already disabled
when calling tstc().

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agodrivers/ddr/fsl: fix '__hwconfig without a buffer' messages
Jeremy Gebben [Fri, 20 Jul 2018 22:00:36 +0000 (16:00 -0600)]
drivers/ddr/fsl: fix '__hwconfig without a buffer' messages

Pass an empty buffer instead of NULL if the hwconfig environment
variable isn't set.

Signed-off-by: Jeremy Gebben <jgebben@sweptlaser.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: York Sun <york.sun@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>
6 years agoarmv8: ls1046ardb: Add falcon mode for for QSPI boot
York Sun [Tue, 26 Jun 2018 21:48:29 +0000 (14:48 -0700)]
armv8: ls1046ardb: Add falcon mode for for QSPI boot

A new defconfig is introduced to support SPL boot from QSPI NOR
flash. This is to support falcon mode for faster booting into
Linux.

Signed-off-by: York Sun <york.sun@nxp.com>
6 years agoarmv8: layerscape: spl: Initialize QSPI AHB for QSPI boot
York Sun [Tue, 26 Jun 2018 21:48:28 +0000 (14:48 -0700)]
armv8: layerscape: spl: Initialize QSPI AHB for QSPI boot

To get full access of QSPI space, initialize AHB interface.

Signed-off-by: York Sun <york.sun@nxp.com>
6 years agospl: Add option SPL_PAYLOAD
York Sun [Thu, 14 Jun 2018 21:38:48 +0000 (14:38 -0700)]
spl: Add option SPL_PAYLOAD

Some legacy boards use RAW image for SPL boot. Add Kconfig option
SPL_PAYLOAD to set alternative image.

Signed-off-by: York Sun <york.sun@nxp.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
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>