Simon Glass [Fri, 14 Sep 2018 10:57:23 +0000 (04:57 -0600)]
binman: Allow control of whether a fake DT is used
We use a fake device tree in tests most of the time since tests don't
normally care about the actual data. For example, for U-Boot proper we use
U_BOOT_DTB_DATA which is just a four-character string. This makes testing
the image output against an expected value very easy.
However in some cases, such as when the test wants to check that the DT
output containing particular nodes, we do actually need the real DT. Add
support for this, along with a command-line option to select 'test mode'.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Fri, 14 Sep 2018 10:57:22 +0000 (04:57 -0600)]
binman: Obtain the list of device trees from the config
We always have a device tree for U-Boot proper. But we may also have one
for SPL and TPL. Add a new Entry method to find out what DTs an entry
has, and use that list when updating DTs.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Fri, 14 Sep 2018 10:57:21 +0000 (04:57 -0600)]
binman: Centralise device-tree updates within binman
At present we have a few calls to device-tree functions in binman and plan
to add more as we add new entry types which need to report their results.
It makes sense to put this code in a central place so that we can make
sure all device trees are updated. At present we only have U-Boot proper,
but plan to add SPL and TPL too.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Fri, 14 Sep 2018 10:57:20 +0000 (04:57 -0600)]
binman: Move state logic into the state module
Rather than reaching into this module from control, move the code that
needs this info into state.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Fri, 14 Sep 2018 10:57:19 +0000 (04:57 -0600)]
binman: Move state information into a new module
At present the control module has state information in it, since it is the
primary user of this. But it is a bit odd to have entries and other
modules importing control to obtain this information.
It seems better to have a dedicated state module, which control can use as
well. Create a new module using code from control and update other modules
to use it.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Fri, 14 Sep 2018 10:57:18 +0000 (04:57 -0600)]
binman: Add an entry method for getting the default filename
Various entry implementations provide a way to obtain the default filename
for an entry. But at present there is no base-class implementation for
this function. Add one so that the API is defined.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Fri, 14 Sep 2018 10:57:17 +0000 (04:57 -0600)]
dtoc: Add a way to create an Fdt object from a data block
Support creating an Fdt object without having to write the data to a file
first.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Fri, 14 Sep 2018 10:57:16 +0000 (04:57 -0600)]
dtoc: Add methods for adding and updating properties
Add a few more functions which allow creating and modifying property
values. If only we could do this so easily in the real world.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Fri, 14 Sep 2018 10:57:15 +0000 (04:57 -0600)]
dtoc: Support adding new nodes
Add a way to add new nodes and sync them back to the blob.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Fri, 14 Sep 2018 10:57:14 +0000 (04:57 -0600)]
dtoc: Fixed endianness in Prop.GetEmpty()
This should be big endian, since that is what device tree uses. Fix it.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Fri, 14 Sep 2018 10:57:13 +0000 (04:57 -0600)]
dtoc: Allow syncing of the device tree back to a file
At present we require the caller to manually update the device tree using
individual calls to libfdt functions. This is not ideal. It would be
better if we could make changes using the Python structure and then call a
Sync() function to write them back.
Add this feature to the Fdt class. Update binman and the tests to match.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Fri, 14 Sep 2018 10:57:12 +0000 (04:57 -0600)]
binman: Support building a selection of images
Sometimes it is useful to build only a subset of the images provided by
the binman configuration. Add a -i option for this. It can be given
multiple times to build several images. If the option is not given, all
images are built.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Fri, 14 Sep 2018 10:57:11 +0000 (04:57 -0600)]
binman: Tidy up the vblock entry
At present if there are two vblock entries an image their contents are
written to the same file in the output directory. This prevents checking
the contents of each separately.
Fix this by adding part of the entry path to the filename, and add some
missing comments.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Fri, 14 Sep 2018 10:57:10 +0000 (04:57 -0600)]
binman: Add x86 support for starting TPL
Sometimes we want to include TPL for x86 platforms, such as when we want
to select between different SPL images (e.g. for Chrome OS verified boot).
Add support for this.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Fri, 14 Sep 2018 10:57:09 +0000 (04:57 -0600)]
binman: Generate an error when text is not provided
When the value of a text entry is not provided an execption is generated
talking about a None type. This is confusing. Add a more explanatory error
and a test for this case.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Fri, 14 Sep 2018 10:57:08 +0000 (04:57 -0600)]
binman: Allow 'fill' entry to have a size of 0
The check for this should be for None, not 0. Fix it and add a test.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Fri, 14 Sep 2018 10:57:07 +0000 (04:57 -0600)]
binman: Move 'special properties' docs to README.entries
This information should be in the entry it relates to, not in the main
README. Move it.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Fri, 14 Sep 2018 10:57:06 +0000 (04:57 -0600)]
fdt: Add Python support for adding/removing nodes
Pull this support from these upstream commits:
bfbfab0 pylibfdt: Add a means to add and delete notes
9005f41 pylibfdt: Allow delprop() to return errors
Signed-off-by: Simon Glass <sjg@chromium.org>
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
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
Heinrich Schuchardt [Tue, 11 Sep 2018 20:38:09 +0000 (22:38 +0200)]
efi_loader: support modifiers for F1 - F4
Support modifiers for F1 - F4.
Add support for letters with ALT key.
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
Heinrich Schuchardt [Tue, 11 Sep 2018 20:38:08 +0000 (22:38 +0200)]
efi_loader: EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL
This patch implements the EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL.
The implementation of notification functions is postponed to a later
patch.
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
Heinrich Schuchardt [Tue, 11 Sep 2018 20:38:07 +0000 (22:38 +0200)]
test/py: rework test_efi_selftest_text_input()
Use more precise regular expressions.
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>