oweals/u-boot.git
8 years agoboard: sama5d2_xplained: Set 'ethaddr' got from AT24MAC
Wenyou Yang [Mon, 17 Oct 2016 01:55:25 +0000 (09:55 +0800)]
board: sama5d2_xplained: Set 'ethaddr' got from AT24MAC

If 'ethaddr' is not set, we will get the ethernet address from AT24MAC,
and set it to 'ethaddr' variable.

Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
Signed-off-by: Songjun Wu <songjun.wu@microchip.com>
Reviewed-by: Andreas Bießmann <biessmann@corscience.de>
8 years agoboard: sama5d2_xplained: Clean up code
Wenyou Yang [Mon, 17 Oct 2016 01:55:24 +0000 (09:55 +0800)]
board: sama5d2_xplained: Clean up code

Since the introduction of pinctrl and clk driver, and the dts file,
remove unneeded the pin configurations and the clock enabling code.

Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Andreas Bießmann <andreas.devel@googlemail.com>
8 years agoboard: sama5d2_xplained: Move config options to defconfigs
Wenyou Yang [Mon, 17 Oct 2016 01:55:23 +0000 (09:55 +0800)]
board: sama5d2_xplained: Move config options to defconfigs

Move the config options from the include/configs/sama5d2_xplained.h
to configs/sama5d2_xplained_*_defconfig.

Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
Reviewed-by: Andreas Bießmann <andreas.devel@googlemail.com>
8 years agoserial: atmel_usart: Support enable an early debug UART
Wenyou Yang [Mon, 17 Oct 2016 01:49:55 +0000 (09:49 +0800)]
serial: atmel_usart: Support enable an early debug UART

Add support to enable an early debug UART for debugging.

Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Andreas Bießmann <andreas@biessmann.org>
8 years agoserial: Kconfig: Add ATMEL_USART option
Wenyou Yang [Mon, 17 Oct 2016 01:49:54 +0000 (09:49 +0800)]
serial: Kconfig: Add ATMEL_USART option

Add ATMEL_USART option to support to enable the Atmel usart driver
from Kconfig.

Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
Reviewed-by: Andreas Bießmann <andreas@biessmann.org>
8 years agommc: atmel_sdhci: Remove unnecessary clock calling
Wenyou Yang [Tue, 27 Sep 2016 03:00:34 +0000 (11:00 +0800)]
mmc: atmel_sdhci: Remove unnecessary clock calling

Due to the peripheral and generated clock driver improvement,
remove the unnecessary clock calling.

Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
8 years agousb: ehci-atmel: Remove unnecessary clock calling
Wenyou Yang [Tue, 27 Sep 2016 03:00:33 +0000 (11:00 +0800)]
usb: ehci-atmel: Remove unnecessary clock calling

Due to the peripheral clock driver improvement, remove the
unnecessary clock calling.

Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
Reviewed-by: Andreas Bießmann <andreas@biessmann.org>
8 years agoi2c: at91_i2c: Change error return -ENODEV to -EINVAL
Wenyou Yang [Tue, 27 Sep 2016 03:00:32 +0000 (11:00 +0800)]
i2c: at91_i2c: Change error return -ENODEV to -EINVAL

Change the error return value -ENODEV from to -EINVAL for more
reasonable.

Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
8 years agoi2c: at91_i2c: Remove unnecessary clock calling
Wenyou Yang [Tue, 27 Sep 2016 03:00:31 +0000 (11:00 +0800)]
i2c: at91_i2c: Remove unnecessary clock calling

Due to the peripheral clock driver improvement, remove the
unnecessary clock calling.

Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
8 years agogpio: atmel_pio4: Remove unnecessary clock calling
Wenyou Yang [Tue, 27 Sep 2016 03:00:30 +0000 (11:00 +0800)]
gpio: atmel_pio4: Remove unnecessary clock calling

Due to the peripheral clock driver improvement, remove the
unnecessary clock calling.

Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
Acked-by: Stephen Warren <swarren@nvidia.com>
8 years agoclk: at91: Improve the clock implementation
Wenyou Yang [Tue, 27 Sep 2016 03:00:29 +0000 (11:00 +0800)]
clk: at91: Improve the clock implementation

For the peripheral clock, provide the clock ops for the clock
provider, such as spi0_clk. The .of_xlate is to get the clk->id,
the .enable is to enable the spi0 peripheral clock, the .get_rate
is to get the clock frequency.

The driver for periph32ck node is responsible for recursively
binding its children as clk devices, not provide the clock ops.

So do the generated clock and system clock.

Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
Acked-by: Stephen Warren <swarren@nvidia.com>
8 years agoclk: clk-uclass: Assign clk->dev before call .of_xlate
Wenyou Yang [Tue, 27 Sep 2016 03:00:28 +0000 (11:00 +0800)]
clk: clk-uclass: Assign clk->dev before call .of_xlate

In order to make clk->dev available in ops->of_xlate() to get the
clock ID from the 'reg' property of the clock node, assign the
clk->dev before calling ops->of_xlate().

Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
Acked-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Simon Glass <sjg@chromium.org>
8 years agoARM: at91/dt: sama5d2: Fix the warning from dtc
Wenyou Yang [Sun, 18 Sep 2016 07:37:47 +0000 (15:37 +0800)]
ARM: at91/dt: sama5d2: Fix the warning from dtc

Fix the warning from dtc like,
---8<----
Warning (unit_address_vs_reg): Node /ahb/apb/pmc@f0014000/periph64ck/sdmmc0_hclk has a reg or ranges property, but no unit name
--->8----

Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
Acked-by: Stephen Warren <swarren@nvidia.com>
8 years agoclk: at91: Fix at91-pmc and at91-sckc's class ID
Wenyou Yang [Tue, 13 Sep 2016 02:25:55 +0000 (10:25 +0800)]
clk: at91: Fix at91-pmc and at91-sckc's class ID

The at91-pmc and at91-sckc aren't the clock providers, change their
class ID from UCLASS_CLK to UCLASS_SIMPLE_BUS, they also don't
need to bind the child nodes explicitly, the .post_bind callback
of simple_bus uclass will do it for them.

Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
Acked-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
8 years agoAT91: Correct misspelling of "redundent" in partition names
Robert P. J. Day [Thu, 1 Sep 2016 13:49:14 +0000 (09:49 -0400)]
AT91: Correct misspelling of "redundent" in partition names

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Reviewed-by: Andreas Bießmann <andreas@biessmann.org>
8 years agoarm, at91: add icache support
Heiko Schocher [Wed, 17 Aug 2016 07:13:25 +0000 (09:13 +0200)]
arm, at91: add icache support

add at least icache support for at91 based boards.
This speeds up NOR flash access on an at91sam9g15
based board from 15.2 seconds reading 8 MiB from
a SPI NOR flash to 5.7 seconds.

Signed-off-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Andreas Bießmann <andreas@biessmann.org>
8 years agoARM: at91: clock: correct PRES offset for at91sam9x5
Heiko Schocher [Wed, 17 Aug 2016 07:13:24 +0000 (09:13 +0200)]
ARM: at91: clock: correct PRES offset for at91sam9x5

on at91sam9x5 PRES offset is 4 in the PMC master
clock register.

Signed-off-by: Heiko Schocher <hs@denx.de>
Acked-by: Wenyou Yang <wenyou.yang@atmel.com>
Acked-by: Andreas Bießmann <andreas@biessmann.org>
8 years agoarm: at91: mpddrc: add missing MPDDRC_MD defines
Heiko Schocher [Wed, 17 Aug 2016 07:13:23 +0000 (09:13 +0200)]
arm: at91: mpddrc: add missing MPDDRC_MD defines

add missing MPDDRC_MD defines

Signed-off-by: Heiko Schocher <hs@denx.de>
Acked-by: Wenyou Yang <wenyou.yang@atmel.com>
Reviewed-by: Andreas Bießmann <andreas@biessmann.org>
8 years agotravis-ci: Add test.py for various qemu platforms
Tom Rini [Thu, 20 Oct 2016 15:26:40 +0000 (11:26 -0400)]
travis-ci: Add test.py for various qemu platforms

- Add a PPA for a more recent qemu (required for PowerPC to work)
- Add tests to run test.py for various QEMU platforms.  This relies on
  swarren's uboot-test-hooks repository to provide the abstractions.

Acked-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Signed-off-by: Tom Rini <trini@konsulko.com>
8 years agotravis-ci: Drop 'TEST_CMD'
Tom Rini [Thu, 20 Oct 2016 15:24:52 +0000 (11:24 -0400)]
travis-ci: Drop 'TEST_CMD'

We don't need to use TEST_CMD in order to run tests.  We need a BUILDMAN
and TOOLCHAIN variable to avoid having to duplicate logic or write some
wrapper function.  But this makes the tests harder as we add more
complex examples.

Signed-off-by: Tom Rini <trini@konsulko.com>
Acked-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
8 years agotravis-ci: Add more architectures
Tom Rini [Thu, 20 Oct 2016 15:23:15 +0000 (11:23 -0400)]
travis-ci: Add more architectures

We can now build for microblaze, sh4 and xtensa.

Signed-off-by: Tom Rini <trini@konsulko.com>
Acked-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
8 years agotravis-ci: Update toolchain and buildman usage
Tom Rini [Thu, 20 Oct 2016 15:08:26 +0000 (11:08 -0400)]
travis-ci: Update toolchain and buildman usage

- Drop the 'cache' line, travis-ci says to not cache apt packages (and
  does not).
- Get the Ubuntu provided toolchain for ARM and PowerPC.
- Add more toolchain options that buildman can fetch.

Signed-off-by: Tom Rini <trini@konsulko.com>
Acked-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
8 years agotravis-ci: Do not make buildman warnings fatal
Tom Rini [Thu, 20 Oct 2016 15:05:57 +0000 (11:05 -0400)]
travis-ci: Do not make buildman warnings fatal

We currently will always see a number of warnings due to device tree
issues.  These (and other warnings) should not make the build be marked
as failure so catch exit status 129 specifically and return 0 in that
case.

Signed-off-by: Tom Rini <trini@konsulko.com>
Acked-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
8 years agotravis-ci: Use a git URI for dtc.git
Tom Rini [Thu, 20 Oct 2016 15:04:10 +0000 (11:04 -0400)]
travis-ci: Use a git URI for dtc.git

Currently we fail to fetch the dtc.git tree due to an SSL issue within
the travis-ci environment.  The easiest fix here is to switch to a git
URI.

Signed-off-by: Tom Rini <trini@konsulko.com>
Acked-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
8 years agotravis-ci: Switch to Ubuntu 14.04 'Trusty Tahr'
Tom Rini [Thu, 20 Oct 2016 15:03:19 +0000 (11:03 -0400)]
travis-ci: Switch to Ubuntu 14.04 'Trusty Tahr'

In order to make other various improvements, update to the latest
environment travis-ci supports.

Signed-off-by: Tom Rini <trini@konsulko.com>
Acked-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
8 years agoapi: storage: Avoid enumeration for non-configured subsystem
Emmanuel Vadot [Wed, 19 Oct 2016 15:19:47 +0000 (17:19 +0200)]
api: storage: Avoid enumeration for non-configured subsystem

If a subsystem wasn't configured, avoid enumeration.

Signed-off-by: Emmanuel Vadot <manu@bidouilliste.com>
8 years agotools: moveconfig: support wildcards in --defconfigs file
Masahiro Yamada [Wed, 19 Oct 2016 05:39:54 +0000 (14:39 +0900)]
tools: moveconfig: support wildcards in --defconfigs file

Supporting shell-style wildcards for the --defconfigs option will be
useful to run the moveconfig tool against a specific platform.  For
example, "uniphier*" in the file passed by --defconfigs option will
be expanded to defconfig files that start with "uniphier".  This is
easier than listing out all defconfig files you are interested in.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
8 years agoFix codying style broken by recent libfdt sync
Masahiro Yamada [Mon, 17 Oct 2016 11:43:01 +0000 (20:43 +0900)]
Fix codying style broken by recent libfdt sync

Commit b02e4044ff8e ("libfdt: Bring in upstream stringlist
functions") broke codying style in some places especially
by inserting an extra whitespace before fdt_stringlist_count().

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Acked-by: Simon Glass <sjg@chromium.org>
8 years agolibfdt: fix fdt_stringlist_search()
Masahiro Yamada [Mon, 17 Oct 2016 11:22:34 +0000 (20:22 +0900)]
libfdt: fix fdt_stringlist_search()

If fdt_getprop() fails, negative error code should be returned.

[ DTC commit: daa75e8fa5942caa8e97931aed3a1ee0b7edd74b ]

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
8 years agolibfdt: fix fdt_stringlist_count()
Masahiro Yamada [Mon, 17 Oct 2016 11:22:33 +0000 (20:22 +0900)]
libfdt: fix fdt_stringlist_count()

If fdt_getprop() fails, negative error code should be returned.

[ DTC commit: e28eff5b787adb3f461d1653598818b2f1f25a73 ]

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
8 years agopower: twl6030: fix code refactoring
Nicolae Rosia [Thu, 13 Oct 2016 10:47:53 +0000 (13:47 +0300)]
power: twl6030: fix code refactoring

Commit a85362fb3e1fc7833723accddbbae431091d06b8 refactored the code
but the register read ended up in the wrong if branch.
Currently, the else branch checks a variable which is always 0.

Signed-off-by: Nicolae Rosia <nicolae_rosia@mentor.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
8 years agoext4: Only write journal entries for modified blocks in unlink_filename
Stefan Brüns [Sun, 9 Oct 2016 18:15:28 +0000 (20:15 +0200)]
ext4: Only write journal entries for modified blocks in unlink_filename

Instead of creating a journal entry for each directory block, even
if the block is unmodified, only log the modified block.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Lukasz Majewski <l.majewski@samsung.com>
8 years agoext4: Fix handling of direntlen in unlink_filename
Stefan Brüns [Sun, 9 Oct 2016 18:15:27 +0000 (20:15 +0200)]
ext4: Fix handling of direntlen in unlink_filename

The direntlen checks were quite bogus, i.e. the loop termination used
"len + offset == blocksize" (exact match only), and checked for a
direntlen less than 0. The latter can never happen as the len is
unsigned, this has been reported by Coverity, CID 153384.

Use the same code as in search_dir for directory traversal. This code
has the correct checks for direntlen >= sizeof(struct dirent), and
offset < blocksize.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Reported-by: Coverity (CID: 153383, 153384)
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Lukasz Majewski <l.majewski@samsung.com>
8 years agoext4: cleanup unlink_filename function
Stefan Brüns [Sun, 9 Oct 2016 18:15:26 +0000 (20:15 +0200)]
ext4: cleanup unlink_filename function

Use the same variable names as in search_dir, to make purpose of variables
more obvious.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
8 years agoMerge git://git.denx.de/u-boot-fdt
Tom Rini [Mon, 24 Oct 2016 12:04:21 +0000 (08:04 -0400)]
Merge git://git.denx.de/u-boot-fdt

8 years agoConvert CONFIG_SYS_STDIO_DEREGISTER to Kconfig
Simon Glass [Tue, 18 Oct 2016 02:13:02 +0000 (20:13 -0600)]
Convert CONFIG_SYS_STDIO_DEREGISTER to Kconfig

This converts the following to Kconfig:
   CONFIG_SYS_STDIO_DEREGISTER

This option should never be enabled in SPL, so use
CONFIG_IS_ENABLED(SYS_STDIO_DEREGISTER) when checking the option.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Re-sync]
Signed-off-by: Tom Rini <trini@konsulko.com>
8 years agoConvert CONFIG_USB_KEYBOARD to Kconfig
Simon Glass [Tue, 18 Oct 2016 02:13:01 +0000 (20:13 -0600)]
Convert CONFIG_USB_KEYBOARD to Kconfig

This converts the following to Kconfig:
   CONFIG_USB_KEYBOARD

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Fixup MPC86* configs]
Signed-off-by: Tom Rini <trini@konsulko.com>
8 years agoConvert CONFIG_SYS_CONSOLE_INFO_QUIET to Kconfig
Simon Glass [Tue, 18 Oct 2016 02:13:00 +0000 (20:13 -0600)]
Convert CONFIG_SYS_CONSOLE_INFO_QUIET to Kconfig

This converts the following to Kconfig:
   CONFIG_SYS_CONSOLE_INFO_QUIET

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Make this default n, re-run the migration]
Signed-off-by: Tom Rini <trini@konsulko.com>
8 years agoConvert CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE to Kconfig
Simon Glass [Tue, 18 Oct 2016 02:12:59 +0000 (20:12 -0600)]
Convert CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE to Kconfig

This converts the following to Kconfig:
   CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
8 years agoConvert CONFIG_SYS_CONSOLE_ENV_OVERWRITE to Kconfig
Simon Glass [Tue, 18 Oct 2016 02:12:58 +0000 (20:12 -0600)]
Convert CONFIG_SYS_CONSOLE_ENV_OVERWRITE to Kconfig

This converts the following to Kconfig:
   CONFIG_SYS_CONSOLE_ENV_OVERWRITE

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
8 years agoConvert CONFIG_CONSOLE_SCROLL_LINES to Kconfig
Simon Glass [Tue, 18 Oct 2016 02:12:57 +0000 (20:12 -0600)]
Convert CONFIG_CONSOLE_SCROLL_LINES to Kconfig

This converts the following to Kconfig:
   CONFIG_CONSOLE_SCROLL_LINES

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
8 years agovideo: Drop CONFIG_CONSOLE_INFO_QUIET
Simon Glass [Tue, 18 Oct 2016 02:12:55 +0000 (20:12 -0600)]
video: Drop CONFIG_CONSOLE_INFO_QUIET

This is not used in U-Boot. Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
8 years agovideo: Move video_get_info_str() prototype to a header file
Simon Glass [Tue, 18 Oct 2016 02:12:54 +0000 (20:12 -0600)]
video: Move video_get_info_str() prototype to a header file

This should be defined in a header file so that arguments are checked.
Move it to video.h.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
8 years agoConvert CONFIG_CONSOLE_EXTRA_INFO to Kconfig
Simon Glass [Tue, 18 Oct 2016 02:12:53 +0000 (20:12 -0600)]
Convert CONFIG_CONSOLE_EXTRA_INFO to Kconfig

This converts the following to Kconfig:
   CONFIG_CONSOLE_EXTRA_INFO

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
8 years agoConvert CONFIG_VIDEO_SW_CURSOR to Kconfig
Simon Glass [Tue, 18 Oct 2016 02:12:51 +0000 (20:12 -0600)]
Convert CONFIG_VIDEO_SW_CURSOR to Kconfig

This converts the following to Kconfig:
   CONFIG_VIDEO_SW_CURSOR

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
[trini: Re-convert, find all the cases where this is off]
Signed-off-by: Tom Rini <trini@konsulko.com>
8 years agovideo: Drop CONFIG_VIDEO_HW_CURSOR
Simon Glass [Tue, 18 Oct 2016 02:12:50 +0000 (20:12 -0600)]
video: Drop CONFIG_VIDEO_HW_CURSOR

This is not used in U-Boot.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
8 years agoConvert CONFIG_VGA_AS_SINGLE_DEVICE to Kconfig
Simon Glass [Tue, 18 Oct 2016 02:12:49 +0000 (20:12 -0600)]
Convert CONFIG_VGA_AS_SINGLE_DEVICE to Kconfig

This converts the following to Kconfig:
   CONFIG_VGA_AS_SINGLE_DEVICE

Once we migrate to driver model for video, we should be able to drop this
option.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agovideo: Drop the sed13806 driver
Simon Glass [Tue, 18 Oct 2016 02:12:48 +0000 (20:12 -0600)]
video: Drop the sed13806 driver

This is not used in U-Boot.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
8 years agovideo: Drop the s3c-fb driver
Simon Glass [Tue, 18 Oct 2016 02:12:47 +0000 (20:12 -0600)]
video: Drop the s3c-fb driver

This is not used in U-Boot.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Minkyu Kang <mk7.kang@samsung.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
8 years agovideo: Drop the imx25lcdc driver
Simon Glass [Tue, 18 Oct 2016 02:12:46 +0000 (20:12 -0600)]
video: Drop the imx25lcdc driver

This is not used anywhere in U-Boot.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
8 years agovideo: Drop the smiLynxEM driver
Simon Glass [Tue, 18 Oct 2016 02:12:45 +0000 (20:12 -0600)]
video: Drop the smiLynxEM driver

This is not used in U-Boot anymore.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
8 years agoConvert CONFIG_SYS_CONSOLE_BG_COL et al to Kconfig
Simon Glass [Tue, 18 Oct 2016 02:12:44 +0000 (20:12 -0600)]
Convert CONFIG_SYS_CONSOLE_BG_COL et al to Kconfig

This converts the following to Kconfig:
   CONFIG_SYS_CONSOLE_BG_COL
   CONFIG_SYS_CONSOLE_FG_COL

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
8 years agoConvert CONFIG_VIDEO_CT69000 to Kconfig
Simon Glass [Tue, 18 Oct 2016 02:12:43 +0000 (20:12 -0600)]
Convert CONFIG_VIDEO_CT69000 to Kconfig

This converts the following to Kconfig:
   CONFIG_VIDEO_CT69000

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
8 years agoConvert CONFIG_CFB_CONSOLE_ANSI to Kconfig
Simon Glass [Tue, 18 Oct 2016 02:12:42 +0000 (20:12 -0600)]
Convert CONFIG_CFB_CONSOLE_ANSI to Kconfig

This converts the following to Kconfig:
   CONFIG_CFB_CONSOLE_ANSI

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
8 years agoConvert CONFIG_CFB_CONSOLE to Kconfig
Simon Glass [Tue, 18 Oct 2016 02:12:41 +0000 (20:12 -0600)]
Convert CONFIG_CFB_CONSOLE to Kconfig

This converts the following to Kconfig:
   CONFIG_CFB_CONSOLE

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agoconfig: Drop CONFIG_CONSOLE_DEV
Simon Glass [Tue, 18 Oct 2016 02:12:39 +0000 (20:12 -0600)]
config: Drop CONFIG_CONSOLE_DEV

This is not really a config. Rename it to avoid confusion.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Jagan Teki <jteki@openedev.com>
8 years agoconfig: Drop CONFIG_CONSOLE
Simon Glass [Tue, 18 Oct 2016 02:12:38 +0000 (20:12 -0600)]
config: Drop CONFIG_CONSOLE

This is not really a config. Rename it to avoid confusion.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Jagan Teki <jteki@openedev.com>
8 years agoConvert CONFIG_SYS_CONSOLE_IS_IN_ENV and CONFIG_CONSOLE_MUX to Kconfig
Simon Glass [Tue, 18 Oct 2016 02:12:37 +0000 (20:12 -0600)]
Convert CONFIG_SYS_CONSOLE_IS_IN_ENV and CONFIG_CONSOLE_MUX to Kconfig

This converts the following to Kconfig:
   CONFIG_SYS_CONSOLE_IS_IN_ENV
   CONFIG_CONSOLE_MUX

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Re-order, re-migrate]
Signed-off-by: Tom Rini <trini@konsulko.com>
8 years agoConvert CONFIG_LCD to Kconfig
Simon Glass [Tue, 18 Oct 2016 02:12:56 +0000 (20:12 -0600)]
Convert CONFIG_LCD to Kconfig

This converts the following to Kconfig:
   CONFIG_LCD

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Jagan Teki <jteki@openedev.com>
8 years agoConvert CONFIG_VIDEO to Kconfig
Simon Glass [Tue, 18 Oct 2016 02:12:40 +0000 (20:12 -0600)]
Convert CONFIG_VIDEO to Kconfig

This converts the following to Kconfig:
   CONFIG_VIDEO

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Jagan Teki <jteki@openedev.com>
8 years agoConvert CONSOLE_PRE_CONSOLE_BUFFER options to Kconfig
Simon Glass [Tue, 18 Oct 2016 02:12:36 +0000 (20:12 -0600)]
Convert CONSOLE_PRE_CONSOLE_BUFFER options to Kconfig

Move these option to Kconfig and tidy up existing uses.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Jagan Teki <jteki@openedev.com>
8 years agoConvert SILENT_CONSOLE options to Kconfig
Simon Glass [Tue, 18 Oct 2016 02:12:35 +0000 (20:12 -0600)]
Convert SILENT_CONSOLE options to Kconfig

Move these option to Kconfig and tidy up existing uses.

The Power PC boards don't have a suitable common element: the common header
files don't appear to line up with the Kconfig files as far as I can tell.
This results in a lot of defconfig changes.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Jagan Teki <jteki@openedev.com>
[trini: Re-migrate, update common/console.c logic]
Signed-off-by: Tom Rini <trini@konsulko.com>
8 years agoRemove some merge markers
Simon Glass [Tue, 18 Oct 2016 02:12:34 +0000 (20:12 -0600)]
Remove some merge markers

These two files have patch merge markers in them, within comments or
strings. Remove then, so that a search for merge markers does not show up
matches in these files.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Jagan Teki <jteki@openedev.com>
8 years agotest/py: ensure a log section exists for skipped tests
Stephen Warren [Mon, 17 Oct 2016 23:25:52 +0000 (17:25 -0600)]
test/py: ensure a log section exists for skipped tests

In pytest 3, runtestprotocol() may not call pytest_runtest_setup() if
the test is skipped. That call is required to create a section for the
test in the log file. If this is skipped, the call to log.end_section()
at the tail of pytest_runtest_protocol() will throw an exception. This
patch ensures that a log section always exists, both to avoid the
exception and to ensure that a consistently structured log file is
always created.

Cc: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Reported-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Tested-by: Tom Rini <trini@konsulko.com>
8 years agolibfdt: Sync overlay with upstream
Maxime Ripard [Mon, 17 Oct 2016 20:50:18 +0000 (22:50 +0200)]
libfdt: Sync overlay with upstream

Now that the overlay code has been merge upstream, update our copy to
what's been merged, since a significant number of issues have been fixed
during the merge process.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Simon Glass <sjg@chromium.org>
8 years agoMerge tag 'signed-efi-next' of git://github.com/agraf/u-boot
Tom Rini [Wed, 19 Oct 2016 11:48:16 +0000 (07:48 -0400)]
Merge tag 'signed-efi-next' of git://github.com/agraf/u-boot

Patch queue for efi - 2016-10-19

Highlights this time around:

  - Add run time service (power control) support for PSCI (fixed in v3)
  - Add efi gop pointer exposure
  - SMBIOS support for EFI (on ARM)
  - efi pool memory unmap support (needed for 4.8)
  - initial x86 efi payload support (fixed up in v2)
  - various bug fixes

Signed-off-by: Tom Rini <trini@konsulko.com>
Conflicts:
include/tables_csum.h

8 years agoefi_loader: Revert device_handle to disk after net boot
Alexander Graf [Tue, 18 Oct 2016 13:49:40 +0000 (15:49 +0200)]
efi_loader: Revert device_handle to disk after net boot

When you boot an efi payload from network, then exit that payload
and load another payload from disk afterwords, the disk payload will
currently see the network device as its boot path.

This breaks grub2 for example which tries to find its modules based
on the path it was loaded from.

This patch fixes that issue by always reverting to disk paths if we're
not in the network boot. That way the data structures after a network
boot look the same as before.

Signed-off-by: Alexander Graf <agraf@suse.de>
8 years agoefi_loader: Rename EFI_RUNTIME_{TEXT, DATA} to __efi_runtime{, _data}
Alexander Graf [Fri, 14 Oct 2016 11:45:30 +0000 (13:45 +0200)]
efi_loader: Rename EFI_RUNTIME_{TEXT, DATA} to __efi_runtime{, _data}

Compiler attributes are more commonly __foo style tags rather than big
upper case eye sores like EFI_RUNTIME_TEXT.

Simon Glass felt quite strongly about this, so this patch converts our
existing defines over to more eye friendly ones.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
8 years agox86: efi: Add EFI loader support for x86
Simon Glass [Sun, 25 Sep 2016 21:27:35 +0000 (15:27 -0600)]
x86: efi: Add EFI loader support for x86

Add the required pieces to support the EFI loader on x86.

Since U-Boot only builds for 32-bit on x86, only a 32-bit EFI application
is supported. If a 64-bit kernel must be booted, U-Boot supports this
directly using FIT (see doc/uImage.FIT/kernel.its). U-Boot can act as a
payload for both 32-bit and 64-bit EFI.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
8 years agoefi: Fix missing EFIAPI specifiers
Simon Glass [Sun, 25 Sep 2016 21:27:32 +0000 (15:27 -0600)]
efi: Fix missing EFIAPI specifiers

These are missing in some functions. Add them to keep things consistent.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
8 years agoefi: Use asmlinkage for EFIAPI
Simon Glass [Sun, 25 Sep 2016 21:27:31 +0000 (15:27 -0600)]
efi: Use asmlinkage for EFIAPI

This is required for x86 and is also correct for ARM (since it is empty).

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
8 years agosmbios: Provide serial number
Alexander Graf [Thu, 18 Aug 2016 23:23:31 +0000 (01:23 +0200)]
smbios: Provide serial number

If the system has a valid "serial#" environment variable set (which boards that
can find it out programatically set automatically), use that as input for the
serial number and UUID fields in the SMBIOS tables.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
8 years agoefi_loader: Fix efi_install_configuration_table
Alexander Graf [Thu, 18 Aug 2016 23:23:30 +0000 (01:23 +0200)]
efi_loader: Fix efi_install_configuration_table

So far we were only installing the FDT table and didn't have space
to store any other. Hence nobody realized that our efi table allocation
was broken in that it didn't set the indicator for the number of tables
plus one.

This patch fixes it, allowing code to allocate new efi tables.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
8 years agosmbios: Expose in efi_loader as table
Alexander Graf [Thu, 18 Aug 2016 23:23:29 +0000 (01:23 +0200)]
smbios: Expose in efi_loader as table

We can pass SMBIOS easily as EFI configuration table to an EFI payload. This
patch adds enablement for that case.

While at it, we also enable SMBIOS generation for ARM systems, since they support
EFI_LOADER.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
8 years agosmbios: Generate type 4 on non-x86 systems
Alexander Graf [Thu, 18 Aug 2016 23:23:28 +0000 (01:23 +0200)]
smbios: Generate type 4 on non-x86 systems

The type 4 table generation code is very x86 centric today. Refactor things
out into the device model cpu class to allow the tables to get generated for
other architectures as well.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
8 years agocpu: Add get_vendor callback
Alexander Graf [Thu, 18 Aug 2016 23:23:27 +0000 (01:23 +0200)]
cpu: Add get_vendor callback

The CPU udevice already has a few callbacks to retreive information
about the currently running CPUs. This patch adds a new get_vendor()
call that returns the vendor of the main CPUs.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
8 years agocpu: Add DMTF id and family fields
Alexander Graf [Thu, 18 Aug 2016 23:23:26 +0000 (01:23 +0200)]
cpu: Add DMTF id and family fields

For SMBIOS tables we need to know the CPU family as well as CPU IDs. This
patches allocates some space for them in the cpu device and populates it
on x86.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
8 years agosmbios: Allow compilation on 64bit systems
Alexander Graf [Thu, 18 Aug 2016 23:23:25 +0000 (01:23 +0200)]
smbios: Allow compilation on 64bit systems

The SMBIOS generation code passes pointers as u32. That causes the compiler
to warn on casts to pointers. This patch moves all address pointers to
uintptr_t instead.

Technically u32 would be enough for the current SMBIOS2 style tables, but
we may want to extend the code to SMBIOS3 in the future which is 64bit
address capable.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
8 years agoefi_loader: Expose efi_install_configuration_table
Alexander Graf [Thu, 18 Aug 2016 23:23:24 +0000 (01:23 +0200)]
efi_loader: Expose efi_install_configuration_table

We want to be able to add configuration table entries from our own code as
well as from EFI payload code. Export the boot service function internally
too, so that we can reuse it.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
8 years agox86: Move smbios generation into arch independent directory
Alexander Graf [Thu, 18 Aug 2016 23:23:23 +0000 (01:23 +0200)]
x86: Move smbios generation into arch independent directory

We will need the SMBIOS generation function on ARM as well going forward,
so let's move it into a non arch specific location.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
8 years agox86: Move table csum into separate file
Alexander Graf [Thu, 18 Aug 2016 23:23:21 +0000 (01:23 +0200)]
x86: Move table csum into separate file

We need the checksum function without all the other table functionality
soon, so let's split it out into its own C file.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
8 years agoefi_loader: gop: Expose fb when 32bpp
Alexander Graf [Mon, 6 Jun 2016 22:57:05 +0000 (00:57 +0200)]
efi_loader: gop: Expose fb when 32bpp

When we're running in 32bpp mode, expose the frame buffer address
to our payloads so that Linux efifb can pick it up.

Signed-off-by: Alexander Graf <agraf@suse.de>
8 years agoefi_loader: Allow bouncing for network
Alexander Graf [Tue, 6 Sep 2016 12:26:27 +0000 (14:26 +0200)]
efi_loader: Allow bouncing for network

So far bounce buffers were only used for disk I/O, but network I/O
may suffer from the same problem.

On platforms that have problems doing DMA on high addresses, let's
also bounce outgoing network packets. Incoming ones always already
get bounced.

This patch fixes EFI PXE boot on ZynqMP for me.

Signed-off-by: Alexander Graf <agraf@suse.de>
8 years agoefi_loader: Add generic PSCI RTS
Alexander Graf [Tue, 16 Aug 2016 19:08:49 +0000 (21:08 +0200)]
efi_loader: Add generic PSCI RTS

Now that we have generic PSCI reset and shutdown support in place, we can
advertise those as EFI Run Time Services, allowing efi applications and
OSs to reset and shut down systems.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
8 years agoarm: Provide common PSCI based reset handler
Alexander Graf [Tue, 16 Aug 2016 19:08:48 +0000 (21:08 +0200)]
arm: Provide common PSCI based reset handler

Most armv8 systems have PSCI support enabled in EL3, either through
ARM Trusted Firmware or other firmware.

On these systems, we do not need to implement system reset manually,
but can instead rely on higher level firmware to deal with it.

The exclude list seems excessive right now, but NXP is working on
providing an in-tree PSCI implementation, so that all NXP systems
can eventually use PSCI as well.

Signed-off-by: Alexander Graf <agraf@suse.de>
[agraf: fix meson]
Reviewed-by: Simon Glass <sjg@chromium.org>
8 years agoMerge branch 'master' of git://git.denx.de/u-boot-uniphier
Tom Rini [Tue, 18 Oct 2016 22:48:04 +0000 (18:48 -0400)]
Merge branch 'master' of git://git.denx.de/u-boot-uniphier

8 years agoMerge git://git.denx.de/u-boot-x86
Tom Rini [Tue, 18 Oct 2016 14:20:26 +0000 (10:20 -0400)]
Merge git://git.denx.de/u-boot-x86

8 years agox86: Add implementations of setjmp() and longjmp()
Simon Glass [Tue, 18 Oct 2016 02:29:07 +0000 (20:29 -0600)]
x86: Add implementations of setjmp() and longjmp()

Bring in these functions from Linux v4.4. They will be needed for EFI loader
support.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
8 years agox86: Move table csum into separate header
Alexander Graf [Thu, 18 Aug 2016 23:23:22 +0000 (01:23 +0200)]
x86: Move table csum into separate header

We need the checksum function without all the other table functionality
soon, so let's split it out into its own header file.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
8 years agoarm: Add PSCI shutdown function
Alexander Graf [Tue, 16 Aug 2016 19:08:47 +0000 (21:08 +0200)]
arm: Add PSCI shutdown function

Using PSCI you can not only reset the system, you can also shut it down!
This patch exposes a function to do exactly that to whatever code wants
to make use of it.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
8 years agoarm: Disable HVC PSCI calls by default
Alexander Graf [Tue, 16 Aug 2016 19:08:46 +0000 (21:08 +0200)]
arm: Disable HVC PSCI calls by default

All systems that are running on armv8 are running bare metal with firmware
that implements PSCI running in EL3. That means we don't really need to expose
the hypercall variants of them.

This patch leaves the code in, but makes the code explicit enough to have the
compiler optimize it out. With this we don't need to worry about hvc vs smc
calling convention when calling psci helper functions.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
8 years agoefi_loader: Allow boards to implement get_time and reset_system
Alexander Graf [Tue, 16 Aug 2016 19:08:45 +0000 (21:08 +0200)]
efi_loader: Allow boards to implement get_time and reset_system

EFI allows an OS to leverage firmware drivers while the OS is running. In the
generic code we so far had to stub those implementations out, because we would
need board specific knowledge about MMIO setups for it.

However, boards can easily implement those themselves. This patch provides the
framework so that a board can implement its own versions of get_time and
reset_system which would actually do something useful.

While at it we also introduce a simple way for code to reserve MMIO pointers
as runtime available.

Signed-off-by: Alexander Graf <agraf@suse.de>
8 years agoefi_loader: Do not leak memory when unlinking a mapping
Stefan Brüns [Sat, 1 Oct 2016 21:32:29 +0000 (23:32 +0200)]
efi_loader: Do not leak memory when unlinking a mapping

As soon as a mapping is unlinked from the list, there are no further
references to it, so it should be freed. If it not unlinked,
update the start address and length.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Reviewed-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
8 years agoefi_loader: Keep memory mapping sorted when splitting an entry
Stefan Brüns [Sat, 1 Oct 2016 21:32:28 +0000 (23:32 +0200)]
efi_loader: Keep memory mapping sorted when splitting an entry

The code assumes sorted mappings in descending address order. When
splitting a mapping, insert the new part next to the current mapping.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Reviewed-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
8 years agoefi_loader: Readd freed pages to memory pool
Stefan Brüns [Sat, 1 Oct 2016 21:32:27 +0000 (23:32 +0200)]
efi_loader: Readd freed pages to memory pool

Currently each allocation creates a new mapping. Readding the mapping
as free memory (EFI_CONVENTIONAL_MEMORY) potentially allows to hand out
an existing mapping, thus limiting the number of mapping descriptors in
the memory map.

Mitigates a problem with current (4.8rc7) linux kernels when doing an
efi_get_memory map, resulting in an infinite loop. Space for the memory
map is reserved with allocate_pool (implicitly creating a new mapping) and
filled. If there is insufficient slack space (8 entries) in the map, the
space is freed and a new round is started, with space for one more entry.
As each round increases requirement and allocation by exactly one, there
is never enough slack space. (At least 32 entries are allocated, so as
long as there are less than 24 entries, there is enough slack).
Earlier kernels reserved no slack, and did less allocations, so this
problem was not visible.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Reviewed-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
8 years agoefi_loader: Track size of pool allocations to allow freeing
Stefan Brüns [Sun, 9 Oct 2016 20:17:26 +0000 (22:17 +0200)]
efi_loader: Track size of pool allocations to allow freeing

We need a functional free_pool implementation, as otherwise each
allocate_pool causes growth of the memory descriptor table.

Different to free_pages, free_pool does not provide the size for the
to be freed allocation, thus we have to track the size ourselves.

As the only EFI requirement for pool allocation is an alignment of
8 bytes, we can keep allocating a range using the page allocator,
reserve the first 8 bytes for our bookkeeping and hand out the
remainder to the caller. This saves us from having to use any
independent data structures for tracking.

To simplify the conversion between pool allocations and the corresponding
page allocation, we create an auxiliary struct efi_pool_allocation.

Given the allocation size free_pool size can handoff freeing the page
range, which was indirectly allocated by a call to allocate_pool,
to free_pages.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Reviewed-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
8 years agoefi_loader: Move efi_allocate_pool implementation to efi_memory.c
Stefan Brüns [Sun, 9 Oct 2016 20:17:18 +0000 (22:17 +0200)]
efi_loader: Move efi_allocate_pool implementation to efi_memory.c

We currently handle efi_allocate_pool() in our boot time service
file. In the following patch, pool allocation will receive additional
internal semantics that we should preserve inside efi_memory.c instead.

As foundation for those changes, split the function into an externally
facing efi_allocate_pool_ext() for use by payloads and an internal helper
efi_allocate_pool() in efi_memory.c that handles the actual allocation.

While at it, change the magic 0xfff / 12 constants to the more obvious
EFI_PAGE_MASK/SHIFT defines.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Reviewed-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
8 years agoefi_loader: Fix crash on 32-bit systems
Robin Randhawa [Tue, 13 Sep 2016 17:36:53 +0000 (18:36 +0100)]
efi_loader: Fix crash on 32-bit systems

A type mismatch in the efi_allocate_pool boot service flow causes
hazardous memory scribbling on 32-bit systems.

This is efi_allocate_pool's prototype:

static efi_status_t EFIAPI efi_allocate_pool(int pool_type,
    unsigned long size,
    void **buffer);

Internally, it invokes efi_allocate_pages as follows:

efi_allocate_pages(0, pool_type, (size + 0xfff) >> 12,
    (void*)buffer);

This is efi_allocate_pages' prototype:

efi_status_t efi_allocate_pages(int type, int memory_type,
unsigned long pages,
uint64_t *memory);

The problem: efi_allocate_pages does this internally:

    *memory = addr;

This fix in efi_allocate_pool uses a transitional uintptr_t cast to
ensure the correct outcome, irrespective of the system's native word
size.

This was observed when bootefi'ing the EFI instance of FreeBSD's first
stage bootstrap (boot1.efi) on a 32-bit ARM platform (Qemu VExpress +
Cortex-a9).

Signed-off-by: Robin Randhawa <robin.randhawa@arm.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
8 years agoefi_loader: Fix memory map size check to avoid out-of-bounds access
Stefan Brüns [Sun, 9 Oct 2016 20:17:07 +0000 (22:17 +0200)]
efi_loader: Fix memory map size check to avoid out-of-bounds access

The current efi_get_memory_map() function overwrites the map_size
property before reading its value. That way the sanity check whether our
memory map fits into the given array always succeeds, potentially
overwriting arbitrary payload memory.

This patch moves the property update write after its sanity check, so
that the check actually verifies the correct value.

So far this has not triggered any known bugs, but we're better off safe
than sorry.

If the buffer is to small, the returned memory_map_size indicates the
required size to the caller.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Reviewed-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
8 years agoefi_loader: Update description of internal efi_mem_carve_out
Stefan Brüns [Sat, 1 Oct 2016 21:32:23 +0000 (23:32 +0200)]
efi_loader: Update description of internal efi_mem_carve_out

In 74c16acce30bb882ad5951829d8dafef8eea564c the return values where
changed, but the description was kept.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Reviewed-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Alexander Graf <agraf@suse.de>