oweals/u-boot.git
6 years agoconfigs: sama5d3_xplained: add onewire and eeprom drivers
Eugen Hristev [Tue, 18 Sep 2018 07:35:38 +0000 (10:35 +0300)]
configs: sama5d3_xplained: add onewire and eeprom drivers

SAMA5D3 SoC can have extra clip boards (PDAs) connected, which have
an EEPROM memory for identification. A special GPIO can be used to read
this memory over 1wire protocol.
Enabling one wire and eeprom drivers for this memory.

Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
6 years agoconfigs: sama5d2_xplained: add onewire and eeprom drivers
Eugen Hristev [Tue, 18 Sep 2018 07:35:37 +0000 (10:35 +0300)]
configs: sama5d2_xplained: add onewire and eeprom drivers

SAMA5D2 SoC can have extra clip boards (PDAs) connected, which have
an EEPROM memory for identification. A special GPIO can be used to read
this memory over 1wire protocol.
Enabling one wire and eeprom drivers for this memory.

Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
6 years agoconfigs: sandbox: add onewire w1 and sandbox eeprom
Eugen Hristev [Tue, 18 Sep 2018 07:35:36 +0000 (10:35 +0300)]
configs: sandbox: add onewire w1 and sandbox eeprom

To be able to test Dallas onewire protocol and one wire eeproms driver
and subsystem, add in sandbox defconfig the drivers' config.

Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
6 years agosandbox: DTS: w1: add node for one wire interface on GPIO
Eugen Hristev [Tue, 18 Sep 2018 07:35:35 +0000 (10:35 +0300)]
sandbox: DTS: w1: add node for one wire interface on GPIO

Add a node for the one wire uclass and one wire gpio driver
in sandbox.

Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
6 years agopinctrl: sandbox: add gpio onewire w1 group
Eugen Hristev [Tue, 18 Sep 2018 07:35:34 +0000 (10:35 +0300)]
pinctrl: sandbox: add gpio onewire w1 group

Add onewire "w1" groups and pin function for onewire GPIOs in sandbox.

Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
6 years agow1: add command for onewire protocol
Eugen Hristev [Tue, 18 Sep 2018 07:35:33 +0000 (10:35 +0300)]
w1: add command for onewire protocol

Add basic command for bus information and read for onewire
bus using Dallas 1-Wire protocol.

Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
6 years agodt-bindings: w1-eeprom: eep_sandbox: create bindings
Eugen Hristev [Tue, 18 Sep 2018 07:35:32 +0000 (10:35 +0300)]
dt-bindings: w1-eeprom: eep_sandbox: create bindings

Bindings for sandbox onewire eeprom driver

Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
6 years agoW1-EEPROM: add sandbox driver
Eugen Hristev [Tue, 18 Sep 2018 07:35:31 +0000 (10:35 +0300)]
W1-EEPROM: add sandbox driver

Add a sandbox driver for a one wire EEPROM memory

Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
6 years agodt-bindings: w1-eeprom: ds24xxx: create bindings
Eugen Hristev [Tue, 18 Sep 2018 07:35:30 +0000 (10:35 +0300)]
dt-bindings: w1-eeprom: ds24xxx: create bindings

Bindings for Maxim's ds24 onewire EEPROM families driver

Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
6 years agoW1-EEPROM: add support for Maxim DS24 eeprom families
Maxime Ripard [Tue, 18 Sep 2018 07:35:29 +0000 (10:35 +0300)]
W1-EEPROM: add support for Maxim DS24 eeprom families

Add a driver that supports Maxim 1 wire EEPROMs families
DS24B33 and DS2431.
Can be extended for other families as well.

Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
[eugen.hristev@microchip.com: reworked driver]
Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
6 years agow1: identify devices with w1-eeprom uclass
Eugen Hristev [Tue, 18 Sep 2018 07:35:28 +0000 (10:35 +0300)]
w1: identify devices with w1-eeprom uclass

When a new device is discovered, this may be a w1 eeprom device.
Attempt to find the proper node and driver from the w1-eeprom subsystem.

Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
6 years agoW1-EEPROM: Add an W1-EEPROM uclass for 1 wire EEPROMs
Maxime Ripard [Tue, 18 Sep 2018 07:35:27 +0000 (10:35 +0300)]
W1-EEPROM: Add an W1-EEPROM uclass for 1 wire EEPROMs

We might want to access data stored onto one wire EEPROMs.
Create a framework to provide a consistent API.

Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
[eugen.hristev@microchip.com: reworked patch]
Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
6 years agodt-bindings: W1: w1-gpio: added bindings for w1-gpio
Eugen Hristev [Tue, 18 Sep 2018 07:35:26 +0000 (10:35 +0300)]
dt-bindings: W1: w1-gpio: added bindings for w1-gpio

Added bindings specification for bitbanged gpio driver for Dallas
one wire protocol

Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
6 years agow1: Add 1-Wire gpio driver
Maxime Ripard [Tue, 18 Sep 2018 07:35:25 +0000 (10:35 +0300)]
w1: Add 1-Wire gpio driver

Add a bus driver for bitbanging a 1-Wire bus over a GPIO.

Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
[eugen.hristev@microchip.com: fixed some issues]
Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
6 years agow1: Add 1-Wire uclass
Maxime Ripard [Tue, 18 Sep 2018 07:35:24 +0000 (10:35 +0300)]
w1: Add 1-Wire uclass

We might want to use 1-Wire devices connected on boards such as EEPROMs in
U-Boot.

Provide a framework to be able to do that.

Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
[eugen.hristev@microchip.com: reworked]
Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
6 years agocommon: Generic loader for file system
Tien Fong Chee [Fri, 6 Jul 2018 08:28:03 +0000 (16:28 +0800)]
common: Generic loader for file system

This is file system generic loader which can be used to load
the file image from the storage into target such as memory.
The consumer driver would then use this loader to program whatever,
ie. the FPGA device.

Signed-off-by: Tien Fong Chee <tien.fong.chee@intel.com>
6 years agodoc: dtbinding: Add file system firmware loader binding document
Tien Fong Chee [Fri, 6 Jul 2018 08:27:35 +0000 (16:27 +0800)]
doc: dtbinding: Add file system firmware loader binding document

Add a document to describe file system firmware loader binding
information.

Signed-off-by: Tien Fong Chee <tien.fong.chee@intel.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agodoc: Add new doc for file system firmware loader driver model
Tien Fong Chee [Fri, 6 Jul 2018 08:27:08 +0000 (16:27 +0800)]
doc: Add new doc for file system firmware loader driver model

Provide information about

- overview of file system firmware loader driver model
- describe storage device and partition in device tree source
- describe fie system firmware loader API

Signed-off-by: Tien Fong Chee <tien.fong.chee@intel.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agoblock: Add a function to find block device descriptor
Tien Fong Chee [Fri, 6 Jul 2018 08:26:36 +0000 (16:26 +0800)]
block: Add a function to find block device descriptor

Add a function to find the block device descriptor of the parent
device.

Signed-off-by: Tien Fong Chee <tien.fong.chee@intel.com>
[trini: Move function declaration to avoid warning]
Signed-off-by: Tom Rini <trini@konsulko.com>
6 years agocmd: ubifs: Factor out some checking codes into cmd_ubifs_mount()
Tien Fong Chee [Fri, 6 Jul 2018 08:26:01 +0000 (16:26 +0800)]
cmd: ubifs: Factor out some checking codes into cmd_ubifs_mount()

cmd_ubifs_mount() function would be called directly instead of
involving whole command machinery for mounting ubifs in
generic firmware loader, so some checking codes need to be factored out
into cmd_ubifs_mount() without breaking original functionality design.

Signed-off-by: Tien Fong Chee <tien.fong.chee@intel.com>
Reviewed-by: Marek Vasut <marex@denx.de>
Reviewed-by: Heiko Schocher <hs@denx.de>
6 years agocmd: ubifs: Move ubifs_initialized checking into cmd_ubifs_umount()
Tien Fong Chee [Fri, 6 Jul 2018 08:25:12 +0000 (16:25 +0800)]
cmd: ubifs: Move ubifs_initialized checking into cmd_ubifs_umount()

cmd_ubifs_umount() function would be called directly instead of involving
whole command machinery in generic firmware loader, so checking on
ubifs_initialized status need to be done in cmd_ubifs_umount() without
breaking original functionality design.

Signed-off-by: Tien Fong Chee <tien.fong.chee@intel.com>
Reviewed-by: Marek Vasut <marex@denx.de>
Reviewed-by: Heiko Schocher <hs@denx.de>
[trini: Fix conflicting type error in cmd/ubi.c]
Signed-off-by: Tom Rini <trini@konsulko.com>
6 years agoMerge tag 'xilinx-for-v2018.11' of git://git.denx.de/u-boot-microblaze
Tom Rini [Thu, 27 Sep 2018 12:29:10 +0000 (08:29 -0400)]
Merge tag 'xilinx-for-v2018.11' of git://git.denx.de/u-boot-microblaze

Xilinx changes for v2018.11

- Handle BOARD_LATE_INIT via Kconfig

SPL:
- Enable GZIP for all partitions types(not only for kernel)

ZynqMP:
- Rearrange pmufw version handling
- Support newer PMUFW with improved fpga load sequence

Zynq:
- Cleanup config file
- Simplify zybo config by enabling option via Kconfig

net:
- Fix gems max-speed property reading
- Enable support for fixed-link phys

6 years agonet: zynq_gem: Add support for fixed-link phy
Michal Simek [Thu, 20 Sep 2018 07:42:27 +0000 (09:42 +0200)]
net: zynq_gem: Add support for fixed-link phy

Based on dt-specs fixed-link doesn't require phy-handle to be used.
Fix driver to only read phy related setting when phy-handle is found.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
6 years agoMerge tag 'signed-efi-next' of git://github.com/agraf/u-boot
Tom Rini [Wed, 26 Sep 2018 19:14:02 +0000 (15:14 -0400)]
Merge tag 'signed-efi-next' of git://github.com/agraf/u-boot

Patch queue for efi - 2018-09-26

A lot of goodness in this release. We're *very* close to running the
UEFI Shell and SCT natively. The only missing piece are HII protocols.

  - FAT write support (needed for SCT)
  - improved FAT directory support (needed for SCT)
  - RTC support with QEMU -M virt
  - Sandbox support (run UEFI binaries in Linux - yay)
  - Proper UTF-16 support
  - EFI_UNICODE_COLLATION_PROTOCOL support (for UEFI Shell)
  - EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL support (for UEFI Shell)
  - Fix window size determination
  - Fix Tegra by explicitly unmapping RAM
  - Clean up handle entanglement
  - Lots of generic code cleanup

[trini: Fixup merge conflict in include/configs/qemu-arm.h]
Signed-off-by: Tom Rini <trini@konsulko.com>
6 years agosandbox: Fix set_working_fdt_addr users
Alexander Graf [Wed, 26 Sep 2018 12:07:41 +0000 (14:07 +0200)]
sandbox: Fix set_working_fdt_addr users

When running sandbox with the new pointer sanitization we just recently
introduced, we're running into a case with FIT images where we end up
interpreting pointers as addresses.

What happened is that most callers of set_working_fdt_addr() simply
convert pointers into addresses without taking into account that they
might be 2 separate address spaces. Fix the callers up to map their
pointers into addresses.

This makes sandbox tests pass for me again.

Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoarm: zynq: zybo: migrate CONFIG_DISPLAY to defconfig
Luis Araneda [Thu, 13 Sep 2018 04:02:07 +0000 (01:02 -0300)]
arm: zynq: zybo: migrate CONFIG_DISPLAY to defconfig

Only add CONFIG_DISPLAY to defconfig because CONFIG_I2C_EDID
is automatically selected by CONFIG_DISPLAY

Signed-off-by: Luis Araneda <luaraneda@gmail.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
6 years agonet: zynq_gem: Fix reading of max-speed property
Siva Durga Prasad Paladugu [Tue, 4 Sep 2018 13:38:53 +0000 (19:08 +0530)]
net: zynq_gem: Fix reading of max-speed property

max-speed property is part of phynode and it has to be
read using ofnode_read_u32_default(). This fixes the issue
of incorrect max-speed read from DT.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
6 years agospl: fit: Enable GZIP compression also for no kernel partitions
Michal Simek [Tue, 24 Jul 2018 13:05:00 +0000 (15:05 +0200)]
spl: fit: Enable GZIP compression also for no kernel partitions

There is no reason to limit gzip usage only for OS_BOOT and kernel image
type.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Tested-by: York Sun <york.sun@nxp.com>
6 years agofpga: zynqmp: Modify PL bitstream loading sequence
Siva Durga Prasad Paladugu [Tue, 21 Aug 2018 10:14:50 +0000 (15:44 +0530)]
fpga: zynqmp: Modify PL bitstream loading sequence

This patch modifies PL bitstream loading sequence as per
latest Xilfpga which supports all variants of bitstream images
generated from vivado and from bootgen. With this new change in
Xilfpga, uboot doesn't need to validate and swap bitstream as it will
be taken care inside Xilfpga. ZynqMP PL driver now checks for supporting
PMUFW version before skipping the validation and swap sequence as there
can be old PMUFW which doesn't supports this feature. In this case, driver
uses old way of PL bitstream loading sequence.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
6 years agoarm64: zynqmp: Return pmufw version for zynqmp_pmufw_version()
Siva Durga Prasad Paladugu [Tue, 21 Aug 2018 10:14:49 +0000 (15:44 +0530)]
arm64: zynqmp: Return pmufw version for zynqmp_pmufw_version()

Modify the zynqmp_pmufw_version() routine to return PMUFW version so
that it can be reused wherever required. Get PMUFW version from PMU
only once at bootup and later just return stored value.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
6 years agoarm64: zynqmp: Move PM version related macros to .h
Siva Durga Prasad Paladugu [Tue, 21 Aug 2018 10:14:48 +0000 (15:44 +0530)]
arm64: zynqmp: Move PM version related macros to .h

This patch moves the PM version related macros to .h file so that
they can be reused in other files.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
6 years agoarm: zynq: Remove useless comments from config file
Michal Simek [Wed, 15 Aug 2018 10:48:52 +0000 (12:48 +0200)]
arm: zynq: Remove useless comments from config file

Moving options to Kconfig some comments are useless now.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
6 years agoarm64: zynqmp: Handle CONFIG_BOARD_LATE_INIT via Kconfig
Michal Simek [Mon, 20 Aug 2018 06:24:14 +0000 (08:24 +0200)]
arm64: zynqmp: Handle CONFIG_BOARD_LATE_INIT via Kconfig

Disable BOARD_LATE_INIT via Kconfig.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
6 years agoconfig.mk: Remove duplicated -fno-strict-aliasing
Bin Meng [Mon, 17 Sep 2018 05:35:29 +0000 (22:35 -0700)]
config.mk: Remove duplicated -fno-strict-aliasing

Now that we already disable the "strict-aliasing" globally, remove
the duplicates in the nds32/riscv/x86 arch-specific Makefiles.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Rick Chen <rick@andestech.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agoMakefile: Use -fno-strict-aliasing globally
Bin Meng [Mon, 17 Sep 2018 05:35:28 +0000 (22:35 -0700)]
Makefile: Use -fno-strict-aliasing globally

The -fstrict-aliasing option is implicitly enabled at levels -O2,
-O3, -Os by GCC. This option allows the compiler to assume the
strictest aliasing rules applicable to the language being compiled.
For example, the practice of reading from a different union member
than the one most recently written to (called "type-punning") is
common. In this case, "type-punning" only works if the memory is
accessed through the union type, but might not work by taking the
address, casting the resulting pointer and dereferencing the result,
which is an undefined behavior per the "strict aliasing rules".

GCC's -Wstrict-aliasing (included in -Wall) option does not catch
all cases, but does attempt to catch the more common pitfalls. So
there are cases that GCC does not report but the codes are violating
the "strict aliasing rules".

Given lots of codes that may be written to rely on "type-punning",
and Linux kernel disables it by -fno-strict-aliasing globally, since
U-Boot currently does this on nds32/riscv/x86 builds only, extend
this for all architecture builds.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agoserial: omap: Add support for AM654 uart controller
Lokesh Vutla [Fri, 14 Sep 2018 14:13:35 +0000 (19:43 +0530)]
serial: omap: Add support for AM654 uart controller

AM654 uses a UART controller that is compatible (partially) with
existing OMAP UART, Introduce a compatible for adding support
for this controller.

Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
6 years agoconfigs: Drop CONFIG_SYS_SCSI_MAXDEVICE
Tuomas Tynkkynen [Wed, 12 Sep 2018 22:28:57 +0000 (01:28 +0300)]
configs: Drop CONFIG_SYS_SCSI_MAXDEVICE

This option has never been used for anything. Drop it.

Signed-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agoata: Drop CONFIG_SYS_SCSI_MAX_* from boards using DM_SCSI
Tuomas Tynkkynen [Wed, 12 Sep 2018 22:28:56 +0000 (01:28 +0300)]
ata: Drop CONFIG_SYS_SCSI_MAX_* from boards using DM_SCSI

These options are not used or necessary when device model is being used
for SCSI. Just drop them.

Signed-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agoata: ahci: Don't cap AHCI port count under CONFIG_DM_SCSI
Tuomas Tynkkynen [Wed, 12 Sep 2018 22:28:55 +0000 (01:28 +0300)]
ata: ahci: Don't cap AHCI port count under CONFIG_DM_SCSI

When using device model this sort of hardcoded limits aren't used or
necessary.

Signed-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agoata: ahci: Loop over the actual number of ports, not the maximum
Tuomas Tynkkynen [Wed, 12 Sep 2018 22:28:54 +0000 (01:28 +0300)]
ata: ahci: Loop over the actual number of ports, not the maximum

The loop in ahci_start_ports() is looping over the maximum number of
SCSI devices in the system, which can be larger than the amount of ports
a particular AHCI controller has. The extra looping isn't directly
harmful because the link_port_map bitmap won't have the bit set for a
nonexistent port, but it is wasteful. Replace the loop limit with the
port count of the AHCI controller instead.

Signed-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agoxtensa: use asm-generic/atomic.h
Chris Packham [Sat, 8 Sep 2018 09:39:07 +0000 (21:39 +1200)]
xtensa: use asm-generic/atomic.h

Make use of asm-generic/atomic.h.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Acked-by: Max Filippov <jcmvbkbc@gmail.com>
6 years agomips: use asm-generic/atomic.h
Chris Packham [Sat, 8 Sep 2018 09:39:06 +0000 (21:39 +1200)]
mips: use asm-generic/atomic.h

Make use of asm-generic/atomic.h.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
6 years agoARM: use asm-generic/atomic.h
Chris Packham [Sat, 8 Sep 2018 09:39:05 +0000 (21:39 +1200)]
ARM: use asm-generic/atomic.h

Make use of asm-generic/atomic.h retaining the smp_mb_... definitions.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
6 years agoAdd include/asm-generic/atomic.h
Chris Packham [Sat, 8 Sep 2018 09:39:04 +0000 (21:39 +1200)]
Add include/asm-generic/atomic.h

The arm, xtensa and mips version of atomic.h were already very similar
(the mips one was a copy of xtensa). Combine these implementations
together to produce a generic atomic.h that can be included by these
architectures (and any others that need it in future).

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
6 years agocmd: add conitrace command
Heinrich Schuchardt [Fri, 7 Sep 2018 17:43:11 +0000 (19:43 +0200)]
cmd: add conitrace command

The 'conitrace' command prints the codes received from the console input as
hexadecimal numbers.

This developer utility is useful for testing the handling of special keys
by keyboard drivers.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
6 years agommc: omap_hsmmc: Fix pbias for omap3_logic to enable CD pin
Adam Ford [Wed, 5 Sep 2018 09:11:08 +0000 (04:11 -0500)]
mmc: omap_hsmmc: Fix pbias for omap3_logic to enable CD pin

The MMC card detect pin is connected to gpio127 on omap3_logic.
When setting up the pbias register for MMC, let's also enable
gpio_127 for the card detect.  As part of the package deal,
gpio_126 and gpio_129 are also enabled.

Signed-off-by: Adam Ford <aford173@gmail.com>
6 years agodm: Update README.txt to clarify device tree usage
Tom Rini [Fri, 31 Aug 2018 15:59:11 +0000 (11:59 -0400)]
dm: Update README.txt to clarify device tree usage

In the section about Device Trees add a paragraph at the end that
clarifies how we decide of a tree is valid or not.  We say that all
bindings must either be in the specification (link provided) or in our
device-tree-bindings directory.  We say that most of these come from the
Linux Kernel and as such some design decisions are made for us already,
but that in most cases we wish to retain compatibility.

Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agoarm: spear: fix enabling of SSP2 clock
Quentin Schulz [Fri, 31 Aug 2018 14:28:31 +0000 (16:28 +0200)]
arm: spear: fix enabling of SSP2 clock

The SSP2 clock is at bit 6 in the register, so the value is 0x40 unlike
the current 0x70 which enables the clock of UART2, SSP1 and SSP2.

Signed-off-by: Quentin Schulz <quentin.schulz@bootlin.com>
Acked-by: Stefan Roese <sr@denx.de>
6 years agoarm: spear: enable SSP1, 2 and 3 clocks when SPI controller driver is built
Quentin Schulz [Fri, 31 Aug 2018 14:28:30 +0000 (16:28 +0200)]
arm: spear: enable SSP1, 2 and 3 clocks when SPI controller driver is built

SPI controllers SSP1, 2 and 3 require to enable their respective clocks.
Let's enable them only when the SPI controller driver is built.

Signed-off-by: Quentin Schulz <quentin.schulz@bootlin.com>
6 years agospi: add support for ARM PL022 SPI controller
Quentin Schulz [Fri, 31 Aug 2018 14:28:29 +0000 (16:28 +0200)]
spi: add support for ARM PL022 SPI controller

This adds support for the ARM PL022 SPI controller for the standard
variant (0x00041022) which has a 16bit wide and 8 locations deep TX/RX
FIFO.

A few parts were borrowed from the Linux kernel driver.

Cc: Armando Visconti <armando.visconti@st.com>
Cc: Vipin Kumar <vipin.kumar@st.com>
Signed-off-by: Quentin Schulz <quentin.schulz@bootlin.com>
6 years agoconfigs: am335x_evm: enable OF_BOARD_SETUP
Sekhar Nori [Thu, 23 Aug 2018 11:41:31 +0000 (17:11 +0530)]
configs: am335x_evm: enable OF_BOARD_SETUP

Enable CONFIG_OF_BOARD_SETUP as it is needed for Beaglebone
black to overwrite the Ethernet phy address present in DT
in case the phy latches on to a different address.

Signed-off-by: Sekhar Nori <nsekhar@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
6 years agoboard: ti: am335x: add support to fixup phy address
Sekhar Nori [Thu, 23 Aug 2018 11:41:30 +0000 (17:11 +0530)]
board: ti: am335x: add support to fixup phy address

On beaglebone black, it can so happen that PHY address
is not latched correctly on reset and board boots with
PHY responding to a different address than that
programmed in device-tree. For example, see this report:

https://groups.google.com/d/msg/beagleboard/9mctrG26Mc8/1FuI_i5KW10J

Workaround this by fixing up device-tree passed to kernel
by using the PHY address detected in hardware.

Beaglebone itself uses only one ethernet port and its DT
currently uses phy_id (obsoleted). But the function has
been written to handle multiple ports and phy_id as well
as phy-handle to make the function more generically useful.

Signed-off-by: Sekhar Nori <nsekhar@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
6 years agodrivers: net: cpsw: add support to update phy address
Sekhar Nori [Thu, 23 Aug 2018 11:41:29 +0000 (17:11 +0530)]
drivers: net: cpsw: add support to update phy address

On some boards using TI CPSW, it may be possible that
PHY address was not latched correctly, and the actual
address that the phy responds on is different from that
set in device-tree. For example, see this problem report
on beaglebone black:

https://groups.google.com/d/msg/beagleboard/9mctrG26Mc8/1FuI_i5KW10J

Add support to check for this condition and use the
detected phy address when its safe to do so.

Also, add a public API that exposes the phy address of
a given slave. This can be used to update device-tree that
is passed to Linux kernel.

Signed-off-by: Sekhar Nori <nsekhar@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
6 years agoconfigs: sama5d27_som1_ek: Add defconfig for ENV/boot from uSD
Codrin Ciubotariu [Tue, 21 Aug 2018 12:46:07 +0000 (15:46 +0300)]
configs: sama5d27_som1_ek: Add defconfig for ENV/boot from uSD

This adds a defconfig for sama5d27_som1_ek board to get environment from
uSD. The defconfig is made from sama5d27_som1_ek_mmc_defconfig, with
'bootcmd' and 'bootargs' changed to kernel, device-tree and rootfs from
uSD. The environment is expected to be found in uSD's FAT partition.

Signed-off-by: Codrin Ciubotariu <codrin.ciubotariu@microchip.com>
6 years agoconfigs: sama5d27_som1_ek: Set CONFIG_BOOTARGS using Kconfig
Codrin Ciubotariu [Tue, 21 Aug 2018 12:46:06 +0000 (15:46 +0300)]
configs: sama5d27_som1_ek: Set CONFIG_BOOTARGS using Kconfig

CONFIG_BOOTARGS can be set using Kconfig, so we no longer need it
in the config files.

Signed-off-by: Codrin Ciubotariu <codrin.ciubotariu@microchip.com>
6 years agoconfigs: sama5d27_som1_ek: Remove unnecessary FAT_ENV_xxx macros
Codrin Ciubotariu [Tue, 21 Aug 2018 12:46:05 +0000 (15:46 +0300)]
configs: sama5d27_som1_ek: Remove unnecessary FAT_ENV_xxx macros

FAT_ENV_xxx options can now be set using Kconfig, so we no longer
need them in the config files.

Signed-off-by: Codrin Ciubotariu <codrin.ciubotariu@microchip.com>
6 years agoconfigs: sama5d2_xplained: Add defconfig for ENV/boot from eMMC
Codrin Ciubotariu [Tue, 21 Aug 2018 09:52:22 +0000 (12:52 +0300)]
configs: sama5d2_xplained: Add defconfig for ENV/boot from eMMC

This adds a defconfig for sama5d2_xplained board to get environment from
eMMC. The defconfig is made from sama5d2_xplained_mmc_defconfig, with
'bootcmd' and 'bootargs' changed to kernel, device-tree and rootfs from
eMMC. The environment is expected to be found in eMMC's FAT
partition.

Signed-off-by: Codrin Ciubotariu <codrin.ciubotariu@microchip.com>
6 years agospl: Weed out CONFIG_SYS_TEXT_BASE usage
Marek Vasut [Tue, 14 Aug 2018 09:27:02 +0000 (11:27 +0200)]
spl: Weed out CONFIG_SYS_TEXT_BASE usage

The SPL loaders assume that the CONFIG_SYS_TEXT_BASE memory location
is available and can be corrupted by loading ie. uImage or fitImage
headers there. Sometimes it could be beneficial to load the headers
elsewhere, ie. if CONFIG_SYS_TEXT_BASE is not yet writable while we
still want to parse the image headers in some local onchip memory to
ie. extract firmware from that image.

Add the possibility to override the location where the headers get
loaded by introducing new function, spl_get_load_buffer() which takes
two arguments -- offset from the CONFIG_SYS_TEXT_BASE and size of the
data that are to be loaded there -- and returns a valid buffer address
or hangs the system. The default behavior is the same as before, add
the offset to CONFIG_SYS_TEXT_BASE and return that address. User can
override the weak spl_get_load_buffer() function though.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
6 years agoboard: st: stm32mp1: Add usb gadget support
Patrice Chotard [Fri, 10 Aug 2018 15:12:14 +0000 (17:12 +0200)]
board: st: stm32mp1: Add usb gadget support

Enable USB gadget support using DWC2 driver
Populate board_usb_init() to initialize clocks,
phy, reset and data needed for DWC2 IP.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
6 years agoconfigs: stm32mp15: Enable USB relative flags
Patrice Chotard [Fri, 10 Aug 2018 15:12:13 +0000 (17:12 +0200)]
configs: stm32mp15: Enable USB relative flags

Enable config USB relative flags in order to enable USB
EHCI, DWC2 gadget, download and mass_storage support.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
6 years agoARM: dts: stm32mp1: Add EHCI support for stm32mp157c-ev1 board
Patrice Chotard [Fri, 10 Aug 2018 15:12:12 +0000 (17:12 +0200)]
ARM: dts: stm32mp1: Add EHCI support for stm32mp157c-ev1 board

Add DT nodes to enable EHCI support

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
6 years agoARM: dts: stm32mp1: Add usb gadget support for stm32mp157c-ev1 board
Patrice Chotard [Fri, 10 Aug 2018 15:12:11 +0000 (17:12 +0200)]
ARM: dts: stm32mp1: Add usb gadget support for stm32mp157c-ev1 board

Add DT nodes to enable DWC2 gadget support

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
6 years agoefi_loader: refactor efi_setup_loaded_image()
Heinrich Schuchardt [Sun, 23 Sep 2018 15:21:51 +0000 (17:21 +0200)]
efi_loader: refactor efi_setup_loaded_image()

Create the handle of loaded images and the EFI_LOADED_IMAGE_PROTOCOL
inside efi_setup_loaded_image(). Do not use local variables.

Currently we expect the loaded image handle to point to the loaded image
protocol. Additionally we have appended private fields to the protocol.

With the patch the handle points to a loaded image object and the private
fields are added here. This matches how we handle the net and the gop
object.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoarm: qemu-arm: enable RTC (PL031) by default
AKASHI Takahiro [Fri, 14 Sep 2018 08:06:54 +0000 (17:06 +0900)]
arm: qemu-arm: enable RTC (PL031) by default

Virtual machine provided by qemu-arm has a ARM PL031 Real Time Clock
device. With this patch, the driver is enabled by default.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agortc: pl031: convert the driver to driver model
AKASHI Takahiro [Fri, 14 Sep 2018 08:06:53 +0000 (17:06 +0900)]
rtc: pl031: convert the driver to driver model

With this patch, PL031 driver is converted to driver-model-compliant
driver. In addition, CONFIG_SYS_RTC_PL031_BASE is no longer valid.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: Fix loaded_image handle passing from EL3
Alexander Graf [Sun, 23 Sep 2018 14:23:56 +0000 (16:23 +0200)]
efi_loader: Fix loaded_image handle passing from EL3

When running in EL3 mode on AArch64, we have to first drop to EL2
to execute a UEFI payload. When dropping down, the arguments to
the entry point have to stay identical to the ones for normal entry
though.

In commit ea54ad59286 ("efi_loader: pass handle of loaded image")
we incorrectly changed that logic and had the el3 entry path diverge.
Fix it up by syncing it back to what it's supposed to be.

Fixes: ea54ad59286 ("efi_loader: pass handle of loaded image")
Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Mark Kettenis <kettenis@openbsd.org>
6 years agoefi_loader: Disable efi selftest on sandbox for now
Alexander Graf [Sun, 23 Sep 2018 13:21:09 +0000 (15:21 +0200)]
efi_loader: Disable efi selftest on sandbox for now

The EFI selftest does not succeed on Sandbox yet. The network support
seems to need some love to actually make our current tests succeed.

So let's disable running the selftest on sandbox for now until "make
tests" just works. Then we can have more amazing CI than ever.

Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: remove efi_exit_caches()
Heinrich Schuchardt [Sun, 23 Sep 2018 12:33:47 +0000 (14:33 +0200)]
efi_loader: remove efi_exit_caches()

Since GRUB patch d0c070179d4d ("arm/efi: Switch to arm64 linux loader",
2018-07-09) we do not need a workaround for GRUB on 32bit ARM anymore.

So let's eliminate function efi_exit_caches().

This will require Linux distributions to update grub-efi-arm to the GRUB
git HEAD (a tag containing the aforementioned GRUB patch is not available
yet).

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agodm: video: check bounds for column and row
Heinrich Schuchardt [Wed, 19 Sep 2018 17:15:14 +0000 (19:15 +0200)]
dm: video: check bounds for column and row

CSI H can be used to position the cursor. The calling application may
specify a location that is beyond the limits of the screen. This may
lead to an illegal memory access.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: remove redundant statement
Heinrich Schuchardt [Thu, 20 Sep 2018 17:57:54 +0000 (19:57 +0200)]
efi_loader: remove redundant statement

ascii2unicode() always ends the u16 string with '\0'.
Remove redundant assignment.

Add description for efi_str_to_u16() and ascii2unicode().

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: create root node
Heinrich Schuchardt [Thu, 20 Sep 2018 19:58:23 +0000 (21:58 +0200)]
efi_loader: create root node

Currently we assign a lot of protocols to loaded images though
these protocols are not related to them. Instead they should be
installed on a separate handle. Via the device path it is the
parent to the devices like the network adapter.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: avoid out of bound access in efi_get_variable()
Heinrich Schuchardt [Sun, 23 Sep 2018 02:08:09 +0000 (04:08 +0200)]
efi_loader: avoid out of bound access in efi_get_variable()

In efi_get_variable() a string is longer than the allocated space which
results in overwriting the linked list of malloc().

The prefixes used for variables are 41 characters long, e.g.
efi_67029eb5-0af2-f6b1-da53-fcb566dd1ce6_

Change PREFIX_LEN to 41.

Fixes: faff21556748 ("efi_loader: remove limit on variable length")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_selftest: test qemu-arm(64)_defconfig
Heinrich Schuchardt [Sun, 23 Sep 2018 02:25:12 +0000 (04:25 +0200)]
efi_selftest: test qemu-arm(64)_defconfig

We should run the EFI selftest on both a 32bit and a 64bit ARM platform on
Travis to catch possible errors.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_driver: convert function descriptions to Sphinx style
Heinrich Schuchardt [Tue, 18 Sep 2018 16:52:46 +0000 (18:52 +0200)]
efi_driver: convert function descriptions to Sphinx style

Convert the function descriptions to Sphinx style.
efi_driver_init() is cCalled by efi_init_obj_list().

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: query serial console size reliably
Heinrich Schuchardt [Sat, 15 Sep 2018 21:52:07 +0000 (23:52 +0200)]
efi_loader: query serial console size reliably

Not all terminals understand CSI [18t for querying the console size.
We should adhere to escape sequences documented in the console_codes
manpage and the ECMA-48 standard.

So here we follow a different approach. We position the cursor to the
bottom right and query its position. Before leaving the function we
restore the original cursor position.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: Merge memory map entries
Alexander Graf [Sun, 16 Sep 2018 15:05:29 +0000 (17:05 +0200)]
efi_loader: Merge memory map entries

We currently do not combine memory entries that are adjacent and have
the same attributes. The problem with that is that our memory map can
easily grow multiple hundreds of entries in a simple UEFI Shell
environment.

So let's make sure we always combine all entries to make the memory
map as small as possible. That way every other piece of code that
loops through it should also gain some nice speed ups.

Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: memory leak in efi_set_bootdev()
Heinrich Schuchardt [Sun, 16 Sep 2018 05:20:21 +0000 (07:20 +0200)]
efi_loader: memory leak in efi_set_bootdev()

efi_set_bootdev() may be called repeatedly.
Free the memory allocated for device paths in previous calls.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: do not use local variable for handle
Heinrich Schuchardt [Sun, 16 Sep 2018 05:19:48 +0000 (07:19 +0200)]
efi_loader: do not use local variable for handle

Do not use a local variable for the handle backing the memory device path.
Adjust relate comments.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_selftest: missing braces in efi_selftest_textinputex.c
Heinrich Schuchardt [Sat, 15 Sep 2018 19:00:52 +0000 (21:00 +0200)]
efi_selftest: missing braces in efi_selftest_textinputex.c

gcc 4.8.4 wants to see all levels of braces when initializing a
structure to zeros.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: check parameter new_handle of efi_file_open()
Heinrich Schuchardt [Sat, 15 Sep 2018 18:43:46 +0000 (20:43 +0200)]
efi_loader: check parameter new_handle of efi_file_open()

We should not check parameter file twice.
We should check parameter new_handle.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agosandbox: Allow to execute from RAM
Alexander Graf [Fri, 22 Jun 2018 12:44:13 +0000 (14:44 +0200)]
sandbox: Allow to execute from RAM

With efi_loader, we may want to execute payloads from RAM. By default,
permissions on the RAM region don't allow us to execute from there though.

So let's change the default allocation scheme for RAM to also allow
execution from it. That way payloads that live in U-Boot RAM can be
directly executed.

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 agosandbox: Fix setjmp/longjmp
Alexander Graf [Fri, 22 Jun 2018 12:44:12 +0000 (14:44 +0200)]
sandbox: Fix setjmp/longjmp

In sandbox, longjmp returns to itself in an endless loop because
os_longjmp() calls into longjmp() which is provided by U-Boot which
again calls os_longjmp().

Setjmp on the other hand must not return because otherwise the
return freees up stack elements that we need during longjmp().

The only straight forward fix that doesn't involve nasty hacks I
could find is to directly link against the system setjmp/longjmp
implementations. That means we just provide the compiler with
hints that the symbol will be available and actually fill them
out with versions from libc.

This approach should be reasonably platform agnostic

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: terminal left upper corner is [1, 1]
Heinrich Schuchardt [Fri, 14 Sep 2018 16:49:26 +0000 (18:49 +0200)]
efi_loader: terminal left upper corner is [1, 1]

For the VT102 and the Linux console the left upper corner is [1, 1].
EFI uses [0, 0] as left upper corner.

Check parameters of the SetCursorPosition() service.

Use CSI H like EDK2 for positioning.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: more debug info for efi_file_getinfo()
Heinrich Schuchardt [Fri, 14 Sep 2018 20:46:34 +0000 (22:46 +0200)]
efi_loader: more debug info for efi_file_getinfo()

efi_file_getinfo() is called with a GUID. In EFI_ENTRY use %pUl as
format type. This way the GUID is printed in debug mode.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi: sandbox: Enable selftest command
Simon Glass [Sat, 15 Sep 2018 06:51:01 +0000 (00:51 -0600)]
efi: sandbox: Enable selftest command

Enable this for sandbox since it almost passes now.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi: Correct the operation of efi_file_write()
Simon Glass [Sat, 15 Sep 2018 06:51:00 +0000 (00:51 -0600)]
efi: Correct the operation of efi_file_write()

We should not directly cast between pointers and addresses since it breaks
sandbox. Fix this and simplify the code in file_read().

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agosandbox: Enhance map_to_sysmem() to handle foreign pointers
Simon Glass [Sat, 15 Sep 2018 06:50:56 +0000 (00:50 -0600)]
sandbox: Enhance map_to_sysmem() to handle foreign pointers

At present map_sysmem() maps an address into the sandbox RAM buffer,
return a pointer, while map_to_sysmem() goes the other way.

The mapping is currently just 1:1 since a case was not found where a more
flexible mapping was needed. PCI does have a separate and more complex
mapping, but uses its own mechanism.

However this arrange cannot handle one important case, which is where a
test declares a stack variable and passes a pointer to it into a U-Boot
function which uses map_to_sysmem() to turn it into a address. Since the
pointer is not inside emulated DRAM, this will fail.

Add a mapping feature which can handle any such pointer, mapping it to a
simple tag value which can be passed around in U-Boot as an address.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agosandbox: Add support for calling abort()
Simon Glass [Sat, 15 Sep 2018 06:50:55 +0000 (00:50 -0600)]
sandbox: Add support for calling abort()

This function is useful to signal that the application needs to exit
immediate. It can be caught with a debugger (e.g. gdb). Add a stub for it
so that it can be called from within sandbox when an internal error
occurs.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agosandbox: Align RAM buffer to the machine page size
Simon Glass [Sat, 15 Sep 2018 06:50:54 +0000 (00:50 -0600)]
sandbox: Align RAM buffer to the machine page size

At present the sandbox RAM buffer is not aligned to any particular
address boundary. This makes the internal pointers somewhat random with
respect to the associated RAM buffer addresses.

Align the buffer to the page size of the machine to help with this. Note
that there is a header at the start of the allocated pointer. To avoid
returning a pointer which is not aligned to a page boundary, we waste
almost an entire page of memory for each allocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi: sandbox: Enable EFI loader build for sandbox
Simon Glass [Sat, 15 Sep 2018 06:50:53 +0000 (00:50 -0600)]
efi: sandbox: Enable EFI loader build for sandbox

This allows this feature to build within sandbox. This is useful for
testing.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi: sandbox: Add distroboot support
Simon Glass [Sat, 15 Sep 2018 06:50:52 +0000 (00:50 -0600)]
efi: sandbox: Add distroboot support

With sandbox these values depend on the host system. Let's assume that it
is x86_64 for now.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: loosen check of parameters of efi_file_open()
Heinrich Schuchardt [Thu, 13 Sep 2018 19:31:49 +0000 (21:31 +0200)]
efi_loader: loosen check of parameters of efi_file_open()

The UEFI spec requires that attributes are only set for when
EFI_FILE_MODE_CREATE is set in open_mode.

The SCT tries to read a directory with EFI_FILE_DIRECTORY.

As EDK2 allows this we should not be more strict.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agofs: fat: unaligned buffers are not an error
Heinrich Schuchardt [Thu, 13 Sep 2018 17:42:47 +0000 (19:42 +0200)]
fs: fat: unaligned buffers are not an error

The FAT driver supports unaligned reads and writes and EFI applications
will make use of these. So a misaligned buffer is only worth a debug
message.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: provide description of file_open()
Heinrich Schuchardt [Wed, 12 Sep 2018 17:00:02 +0000 (19:00 +0200)]
efi_loader: provide description of file_open()

Replace urban slang by proper description.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: check parameters of efi_file_open()
Heinrich Schuchardt [Wed, 12 Sep 2018 16:43:58 +0000 (18:43 +0200)]
efi_loader: check parameters of efi_file_open()

Check the parameters of efi_file_open().

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: unset CONFIG_EFI_UNICODE_CAPITALIZATION
Heinrich Schuchardt [Tue, 11 Sep 2018 20:38:14 +0000 (22:38 +0200)]
efi_loader: unset CONFIG_EFI_UNICODE_CAPITALIZATION

Unset CONFIG_EFI_UNICODE_CAPITALIZATION on boards with tough size
restrictions.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_selftest: test key notification functions
Heinrich Schuchardt [Tue, 11 Sep 2018 20:38:13 +0000 (22:38 +0200)]
efi_selftest: test key notification functions

Use a key notification function to leave the
EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL test.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: implement key notify functions
Heinrich Schuchardt [Tue, 11 Sep 2018 20:38:12 +0000 (22:38 +0200)]
efi_loader: implement key notify functions

Implement registering and unregistreing key notify functions in the
EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agotest/py: test EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL
Heinrich Schuchardt [Tue, 11 Sep 2018 20:38:11 +0000 (22:38 +0200)]
test/py: test EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL

Add a unit test for the EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_selftest: test EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL
Heinrich Schuchardt [Tue, 11 Sep 2018 20:38:10 +0000 (22:38 +0200)]
efi_selftest: test EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL

Provide a unit test for the EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL.

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