]> git.sur5r.net Git - u-boot/log
u-boot
6 years agodriver: fsl-mc: MC object cleanup when DPL not loaded
Yogesh Gaur [Tue, 28 Nov 2017 04:41:14 +0000 (10:11 +0530)]
driver: fsl-mc: MC object cleanup when DPL not loaded

For case when MC is loaded but DPL is not deployed perform MC
object [DPBP, DPIO, DPNI and DPRC] cleanup.

Signed-off-by: Yogesh Gaur <yogeshnarayan.gaur@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>
6 years agoSECURE BOOT: Add fall back option
Vinitha Pillai-B57223 [Wed, 22 Nov 2017 05:08:35 +0000 (10:38 +0530)]
SECURE BOOT: Add fall back option

Add fall back option, to boot from NOR/QSPI/SD for LS1043, LS1046,
LS1021 in case of distro boot failure.

For LS1046, add kernel validation in case of secure boot in sd_bootcmd
and qspi_bootcmd. For LS1043 and LS1021, add kernel validation in case
of secure boot in sd_bootcmd, qspi_bootcmdand  nor_bootcmd.

Signed-off-by: Vinitha Pillai <vinitha.pillai@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>
6 years agoarmv8: LS2080A_SECURE_BOOT: Enable CONFIG_FSL_LS_PPA.
Udit Agarwal [Wed, 22 Nov 2017 03:32:07 +0000 (09:02 +0530)]
armv8: LS2080A_SECURE_BOOT: Enable CONFIG_FSL_LS_PPA.

Adds config CONFIG_FSL_LS_PPA and CONFIG_FSL_CAAM in
LS2080AQDS and LS2080ARDB secure boot defconfig.

Removes CONFIG_FIT, as with CONFIG_FSL_LS_PPA enabled,
CONFIG_FIT is selected.

Removes CONFIG_SPL_RSA as in NOR boot SPL boot is not done.

Signed-off-by: Udit Agarwal <udit.agarwal@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>
6 years agoarmv8: LS1088A_QSPI: Add secure boot defconfigs for QSPI boot.
Udit Agarwal [Wed, 22 Nov 2017 03:31:27 +0000 (09:01 +0530)]
armv8: LS1088A_QSPI: Add secure boot defconfigs for QSPI boot.

Add the secure boot defconfigs for QSPI boot on LS1088ARDB
and LS1088AQDS platforms.

Signed-off-by: Udit Agarwal <udit.agarwal@nxp.com>
Signed-off-by: Vinitha Pillai-B57223 <vinitha.pillai@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>
6 years agoarmv8: LS1088A_QSPI: SECURE_BOOT: Images validation
Udit Agarwal [Wed, 22 Nov 2017 03:31:26 +0000 (09:01 +0530)]
armv8: LS1088A_QSPI: SECURE_BOOT: Images validation

Validates PPA, MC, DPC, Bootscript, DPL and Kernel images in ESBC
phase using esbc_validate command.

Enable validation of boot.scr script prior to its execution dependent
on "secureboot" flag in environment

Add header address for PPA to be validated during ESBC phase for
LS1088A platform based on LAyerscape Chasis 3.

Moves sec_init prior to ppa_init as for validation of PPA sec must
be initialised before the PPA is initialised.

Signed-off-by: Udit Agarwal <udit.agarwal@nxp.com>
Signed-off-by: Vinitha Pillai-B57223 <vinitha.pillai@nxp.com>
Signed-off-by: Sumit Garg <sumit.garg@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>
6 years agoarmv8: ls1012a: Modify Kernel and Environment offset
Bhaskar Upadhaya [Mon, 13 Nov 2017 23:35:10 +0000 (05:05 +0530)]
armv8: ls1012a: Modify Kernel and Environment offset

Kernel is now located at 0x1000000 instead of 0xa00000
and envirorment variables are located at 3MB offset instead of
2MB in Flash.

Signed-off-by: Bhaskar Upadhaya <Bhaskar.Upadhaya@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>
6 years agoarmv8: Workaround for USB erratua on LS1012A
Ran Wang [Mon, 13 Nov 2017 08:14:48 +0000 (16:14 +0800)]
armv8: Workaround for USB erratua on LS1012A

This is suplement for patch which handle below errata:
A-009007, A-009008, A-008997, A-009798

Signed-off-by: Ran Wang <ran.wang_1@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>
6 years agoarmv8: fsl-layerscape: Add support of disabling core prefetch
Prabhakar Kushwaha [Fri, 10 Nov 2017 06:02:52 +0000 (11:32 +0530)]
armv8: fsl-layerscape: Add support of disabling core prefetch

Instruction prefetch feature is by default enabled during core
release. This patch add support of disabling instruction prefetch
by setting core mask in PPA. Here each core mask bit represents a
core and prefetch is disabled at the time of core release.

Signed-off-by: Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>
6 years agoarmv8: ls1088: Add fsl_fdt_fixup_flash
Ashish Kumar [Thu, 9 Nov 2017 05:44:24 +0000 (11:14 +0530)]
armv8: ls1088: Add fsl_fdt_fixup_flash

IFC-NOR and QSPI-NOR signals are muxed on SoC to save pins

Add fsl_fdt_fixup_flash() to disable IFC-NOR node in dts
if QSPI is enabled and vice-versa

Signed-off-by: Ashish Kumar <Ashish.Kumar@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>
6 years agodriver: net: fsl-mc: flib changes for MC 10.3.0
Yogesh Gaur [Wed, 15 Nov 2017 06:29:31 +0000 (11:59 +0530)]
driver: net: fsl-mc: flib changes for MC 10.3.0

Existing MC driver framework is based on MC-9.x.x flib. This patch
migrates MC obj (DPBP, DPNI, DPRC, DPMAC etc) to use latest MC flib
which is MC-10.3.0.

Changes introduced due to migration:
1. To get OBJ token, pair of create and open API replaces create APIs
2. Pair of close and destroy APIs replaces destroy APIs
3. For version read, get_version APIs replaces get_attributes APIs
4. dpni_get/reset_statistics APIs replaces dpni_get/set_counter APIs
5. Simplifies struct dpni_cfg and removes dpni_extended_cfg struct
6. Single API dpni_get_buffer_layout/set_buffer_layout replaces
   dpni_get_rx/set_rx, tx related, tx_conf_buffer_layout related APIs.
   New API takes a queue type as an argument.
7. Similarly dpni_get_queue/set_queue replaces
   dpni_get_rx_flow/set_rx_flow , tx_flow related, tx_conf related
   APIs

Signed-off-by: Yogesh Gaur <yogeshnarayan.gaur@nxp.com>
Signed-off-by: Priyanka Jain <priyanka.jain@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>
6 years agoarmv8: ls1088a: Unset USE_BOOTCOMMAND in defconfig
Ashish Kumar [Thu, 23 Nov 2017 09:03:49 +0000 (14:33 +0530)]
armv8: ls1088a: Unset USE_BOOTCOMMAND in defconfig

Unset USE_BOOTCOMMAND for all ls1088 defconfig files to fix
redefinition error. USE_BOOTCOMMAND was introduced in commit
b6251db8c3f ("Kconfig: Introduce USE_BOOTCOMMAND and migrate
BOOTCOMMAND").

Signed-off-by: Ashish Kumar <Ashish.Kumar@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>
6 years agopowerpc: mpc85xx: Fix static TLB table for SDRAM
York Sun [Tue, 5 Dec 2017 18:57:54 +0000 (10:57 -0800)]
powerpc: mpc85xx: Fix static TLB table for SDRAM

Most predefined TLB tables don't have memory coherence bit set for
SDRAM. This wasn't an issue before invalidate_dcache_range() function
was enabled. Without the coherence bit, dcache invalidation doesn't
automatically flush the cache. The coherence bit is already set when
dynamic TLB table is used. For some boards with different SPL boot
method, or with legacy fixed setting, this bit needs to be set in
TLB files.

Signed-off-by: York Sun <york.sun@nxp.com>
6 years agopowerpc/p1_p2_rdb_pc: Fix endian access issue on EHCI intinalization
Ran Wang [Mon, 27 Nov 2017 02:51:55 +0000 (10:51 +0800)]
powerpc/p1_p2_rdb_pc: Fix endian access issue on EHCI intinalization

This issue is exposed after commit 9000eddbae0d ("drivers/usb/ehci:
Use platform-specific accessors"), the wrong endianness of EHCI
controller programing will cause USB function down.

Signed-off-by: Ran Wang <ran.wang_1@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>
6 years agopowerpc/T104xRDB: Fix endian access issue on EHCI intinalization
Ran Wang [Mon, 27 Nov 2017 02:51:54 +0000 (10:51 +0800)]
powerpc/T104xRDB: Fix endian access issue on EHCI intinalization

This issue is exposed after commit 9000eddbae0d ("drivers/usb/ehci:
Use platform-specific accessors"), the wrong endianness of EHCI
controller programing will cause USB function down.

Signed-off-by: Ran Wang <ran.wang_1@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>
6 years agotools: omapimage: fix corner-case in byteswap path
Philipp Tomsich [Mon, 4 Dec 2017 16:04:02 +0000 (17:04 +0100)]
tools: omapimage: fix corner-case in byteswap path

Since commit 2614a208471e ("common: command: tempory buffer should
have size of command line buf"), there have been consistent Travis CI
failures on my builds (interestingly not for Tom, even though building
the same commit id) due to a SEGV in building the byteswapped
omapimage:
          arm: pcm051_rev3
     make[2]: *** [MLO.byteswap] Error 139
                       ^^^ error code for a SEGV

Turns out that the word-based byte-swapping loop in omapimage.c is to
blame. With the loop condition
       while (swapped <= (sbuf->st_size / sizeof(uint32_t)))
there had been one-too-many iterations for all file sizes divisible by
the sizeof(uint32_t).  I.e. we had 1 iteration for 0 bytes (and also 1
through 3 bytes) and 2 iterations at 4 bytes... clearly overshooting
on 0 and 4 bytes.

This commit fixes the calculation of an up-rounded word-count and
makes sure to keep the zero-based loop-counter below the number of
words to be processed.

References: 2614a20 ("common: command: tempory buffer should have size of command line buf")
Fixes: 79b9ebb ("omapimage: Add support for byteswapped SPI images")
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Martin Elshuber <martin.elshuber@theobroma-systems.com>
6 years agoMerge tag 'signed-efi-next' of git://github.com/agraf/u-boot
Tom Rini [Tue, 5 Dec 2017 22:52:16 +0000 (17:52 -0500)]
Merge tag 'signed-efi-next' of git://github.com/agraf/u-boot

Patch queue for efi - 2017-12-05

Highlights for this release:

  - Dynamic EFI object creation (lists instead of static arrays)
  - EFI selftest improvements
  - Minor fixes

6 years agoefi_stub: Use efi_uintn_t
Alexander Graf [Mon, 4 Dec 2017 15:33:51 +0000 (16:33 +0100)]
efi_stub: Use efi_uintn_t

Commit f5a2a93892f ("efi_loader: consistently use efi_uintn_t in boot
services") changed the internal EFI API header without adapting its existing
EFI stub users. Let's adapt the EFI stub as well.

Fixes: f5a2a93892f ("efi_loader: consistently use efi_uintn_t in boot services")
Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
6 years agoARM: Samsung: Add Exynos5422-based Odroid HC1 support
Marek Szyprowski [Fri, 3 Nov 2017 08:30:30 +0000 (09:30 +0100)]
ARM: Samsung: Add Exynos5422-based Odroid HC1 support

Odroid HC1 board is based on Odroid XU4 board, but it has no HDMI,
no eMMC, no build-in USB3.0 hub, no extension port pins, and no GPIO
button. USB3.0 ports are used for build-in JMicron USB to SATA bridge
and Gigabit R8152 ethernet chips. HC1 uses only passive cooling.

This patch also updates Odroid's ADCmax array and reduces ADC tolerance
to 1% to ensure that XU4 and HC1 revisions are properly detected.

I've tested this with XU3, XU3-lite, XU4 and HC1 boards. In case of my test
boards I got following values from ADC register: 372, 370, 1281 and 1313.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Tested-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
6 years agoarm: dts: exynos4: fix the device-tree compile warning
Jaehoon Chung [Tue, 28 Nov 2017 07:20:39 +0000 (16:20 +0900)]
arm: dts: exynos4: fix the device-tree compile warning

After updating dtc-1.4.5 version, there are too many warning.
This patch is to fix about exynos4 series.

Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
6 years agoPrepare v2018.01-rc1 v2018.01-rc1
Tom Rini [Mon, 4 Dec 2017 23:27:17 +0000 (18:27 -0500)]
Prepare v2018.01-rc1

Signed-off-by: Tom Rini <trini@konsulko.com>
6 years agoMerge git://git.denx.de/u-boot-uniphier
Tom Rini [Mon, 4 Dec 2017 15:24:35 +0000 (10:24 -0500)]
Merge git://git.denx.de/u-boot-uniphier

6 years agoMerge git://git.denx.de/u-boot-cfi-flash
Tom Rini [Mon, 4 Dec 2017 15:24:32 +0000 (10:24 -0500)]
Merge git://git.denx.de/u-boot-cfi-flash

6 years agoarm: Make gcc 6.0 or later a hard requirement now.
Tom Rini [Sun, 3 Dec 2017 01:11:31 +0000 (20:11 -0500)]
arm: Make gcc 6.0 or later a hard requirement now.

Move the warning to an error as we have been promising would happen in
this release.

Signed-off-by: Tom Rini <trini@konsulko.com>
6 years agoscripts: spl: fix typo
Peng Fan [Thu, 30 Nov 2017 02:07:07 +0000 (10:07 +0800)]
scripts: spl: fix typo

Typo fix: CONIFG->CONFIG

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agodrivers: firmware: psci: use pr_* log functions instead of printf()
Masahiro Yamada [Wed, 29 Nov 2017 06:04:40 +0000 (15:04 +0900)]
drivers: firmware: psci: use pr_* log functions instead of printf()

In Linux, the warning messages are printed out by pr_warn().

We can use Linux-like log functions in tree-wide.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agoomap3: evm: Explicitly use DISTRO_DEFAULTS features at startup
Derald D. Woods [Wed, 29 Nov 2017 03:28:55 +0000 (03:28 +0000)]
omap3: evm: Explicitly use DISTRO_DEFAULTS features at startup

[primary] Check MMC 0:1 for /extlinux/extlinux.conf and boot
[fallback 1] Check MMC 0:1 zImage and run mmcbootz
[fallback 2] Check MMC 0:1 uImage and run mmcboot
[fallback 3] Check NAND partitions and run nandboot

If 'extlinux.conf' is not found on MMC 0, the previous boot behavior is
followed.

Signed-off-by: Derald D. Woods <woods.technical@gmail.com>
6 years agoarmv8: mmu: fix page table mapping
Peng Fan [Tue, 28 Nov 2017 02:31:28 +0000 (10:31 +0800)]
armv8: mmu: fix page table mapping

To page mapping the lowest 2 bits needs to be 0x3.
If not fix this, the final lowest 3 bits for page mapping is 0x1
which is marked as reserved.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>
6 years agoarm64 :show_regs: show the address before relocation
Peng Fan [Tue, 28 Nov 2017 02:08:08 +0000 (10:08 +0800)]
arm64 :show_regs: show the address before relocation

After relocation, when error happends, it is hard to track
ELR and LR with asm file objdumped from elf file.

So subtract the gd->reloc_off the reflect the compliation address.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agoARM: arch-meson: build memory banks using reported memory from registers
Neil Armstrong [Mon, 27 Nov 2017 09:35:46 +0000 (10:35 +0100)]
ARM: arch-meson: build memory banks using reported memory from registers

As discussed at [1], the Amlogic Meson GX SoCs can embed a BL31 firmware
and a secondary BL32 firmware.
Since mid-2017, the reserved memory address of the BL31 firmware was moved
and grown for security reasons.

But mainline U-Boot and Linux has the old address and size fixed.

These SoCs have a register interface to get the two firmware reserved
memory start and sizes.

This patch adds a dynamic reservation of the memory zones in the device tree bootmem
reserved memory zone used by the kernel in early boot.
To be complete, the memory zones are also added to the EFI reserved zones.

Depends on patchset "Add support for Amlogic GXL Based SBCs" at [2].

[1] http://lists.infradead.org/pipermail/linux-amlogic/2017-October/004860.html
[2] http://lists.infradead.org/pipermail/linux-amlogic/2017-November/005410.html

Changes since v1:
- switched the #if to if(IS_ENABLED()) to compile all code paths
- renamed function to meson_board_add_reserved_memory()
- added a mem.h header with comment
- updated all boards ft_board_setup()

Changes since RFC v2:
- reduced preprocessor load
- kept Odroid-C2 static memory mapping as exception

Changes since RFC v1:
- switch to fdt rsv mem table and efi reserve memory
- replaced in_le32 by readl()

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
[trini: Fix warning on khadas-vim over missing <asm/arch/mem.h>
Signed-off-by: Tom Rini <trini@konsulko.com>
6 years agoarm: Add Khadas VIM support based on Meson GXL family
Neil Armstrong [Mon, 27 Nov 2017 09:16:20 +0000 (10:16 +0100)]
arm: Add Khadas VIM support based on Meson GXL family

This adds platform code for the Khadas VIM board based on a
Meson GXL (S905X) SoC with the Meson GXL configuration.

This initial submission supports UART, MMC/SDCard and Ethernet with the
Internal RMII PHY.

The meson-gxl-s905x-khadas-vim.dts is synchronised from the linux 4.13
stable tree as of 4.13.8.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
6 years agoarm: Add LibreTech CC support based on Meson GXL family
Neil Armstrong [Mon, 27 Nov 2017 09:16:19 +0000 (10:16 +0100)]
arm: Add LibreTech CC support based on Meson GXL family

This adds platform code for the Libre Computer CC "Le Potato" board based on a
Meson GXL (S905X) SoC with the Meson GXL configuration.

This initial submission supports UART, MMC/SDCard and Ethernet with the
Internal RMII PHY.

The meson-gxl-s905x-libretech-cc.dts is synchronised from the linux 4.13
stable tree as of 4.13.8.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
6 years agoboard: p212: use common ethernet init function
Neil Armstrong [Mon, 27 Nov 2017 09:16:18 +0000 (10:16 +0100)]
board: p212: use common ethernet init function

Switch P212 Ethernet init to the common Ethernet init function.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
6 years agoboard: odroid-c2: use common ethernet init function
Neil Armstrong [Mon, 27 Nov 2017 09:16:17 +0000 (10:16 +0100)]
board: odroid-c2: use common ethernet init function

Switch Odroid-C2 Ethernet init to the common Ethernet init function.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
6 years agoARM: arch-meson: add ethernet common init function
Neil Armstrong [Mon, 27 Nov 2017 09:16:16 +0000 (10:16 +0100)]
ARM: arch-meson: add ethernet common init function

Introduce a generic common Ethernet Hardware init function
common to all Amlogic GX SoCs with support for the
Internal PHY enable for GXL SoCs.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
6 years agolibfdt: migrate fdt_wip.c to a wrapper of scripts/dtc/libfdt/fdt_wip.c
Masahiro Yamada [Mon, 27 Nov 2017 07:06:07 +0000 (16:06 +0900)]
libfdt: migrate fdt_wip.c to a wrapper of scripts/dtc/libfdt/fdt_wip.c

Now, lib/libfdt/fdt_wip.c is the same as scripts/dtc/libfdt/fdt_wip.c

Change the former to a wrapper of the latter.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agolibfdt: move fdt_find_regions() to fdt_region.c from fdt_wip.c
Masahiro Yamada [Mon, 27 Nov 2017 07:06:06 +0000 (16:06 +0900)]
libfdt: move fdt_find_regions() to fdt_region.c from fdt_wip.c

All the other fdt_*_region() functions are located in fdt_region.c,
while only fdt_find_regions() was added to fdt_wip.c, strangely.

Move it to the suitable place.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agoarmv8: shrink exception table code
Andre Przywara [Mon, 27 Nov 2017 00:47:09 +0000 (00:47 +0000)]
armv8: shrink exception table code

In the moment our exception entry code needs 34 instructions, so we
can't use put it directly into the table entry, which offers "only"
32 instructions there. Right now we just put an unconditional branch
there, then use a macro to place the 34 instructions *per entry* after
that. That effectivly doubles the size of our exception table, which
is quite a waste, given that we use it mostly for debugging purposes.

Since the register saving part is actually identical, let's just convert
that macro into a function, and "bl" into it directly from the exception
slot, of course after having saved at least the original LR.
This saves us about 950 bytes of code, which is quite a relief for some
tight SPLs, in particular the 64-bit Allwinner ones.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
6 years agoadd support for Raspberry Pi Zero W
Dmitry Korunov [Sun, 26 Nov 2017 09:38:53 +0000 (13:38 +0400)]
add support for Raspberry Pi Zero W

Signed-off-by: Dmitry Korunov <dessel.k@gmail.com>
6 years agotest: compression: Convert to unit test framework
Simon Glass [Sat, 25 Nov 2017 18:57:33 +0000 (11:57 -0700)]
test: compression: Convert to unit test framework

Adjust this test to use the unit test framework. Drop the two existing
commands for running the tests and replace them with a single
'ut compression' command, with sub-commands.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Continue to have ret = run_test_internal(...) in run_test so ret
is always initialized]
Signed-off-by: Tom Rini <trini@konsulko.com>
6 years agomtd: nand: denali: consolidate include directives
Masahiro Yamada [Thu, 30 Nov 2017 04:45:27 +0000 (13:45 +0900)]
mtd: nand: denali: consolidate include directives

Include necessary headers explicitly without relying on indirect
header inclusion.

<common.h>, <malloc.h> are unneeded.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
6 years agomtd: nand: denali_dt: replace printf() with pr_err()
Masahiro Yamada [Thu, 30 Nov 2017 04:45:26 +0000 (13:45 +0900)]
mtd: nand: denali_dt: replace printf() with pr_err()

The Linux derived log functions can be used anywhere and easily
turned on/off by CONFIG_LOGLEVEL.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
6 years agomtd: nand: include <asm/cache.h> from include/linux/mtd/rawnand.h
Masahiro Yamada [Thu, 30 Nov 2017 04:45:25 +0000 (13:45 +0900)]
mtd: nand: include <asm/cache.h> from include/linux/mtd/rawnand.h

This is needed for ARCH_DMA_MINALIGN.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
6 years agomtd: nand: Rename nand.h into rawnand.h
Masahiro Yamada [Thu, 30 Nov 2017 04:45:24 +0000 (13:45 +0900)]
mtd: nand: Rename nand.h into rawnand.h

This header was renamed to rawnand.h in Linux.

The following is the corresponding commit in Linux.

  commit d4092d76a4a4e57b65910899948a83cc8646c5a5
  Author: Boris Brezillon <boris.brezillon@free-electrons.com>
  Date:   Fri Aug 4 17:29:10 2017 +0200

      mtd: nand: Rename nand.h into rawnand.h

      We are planning to share more code between different NAND based
      devices (SPI NAND, OneNAND and raw NANDs), but before doing that
      we need to move the existing include/linux/mtd/nand.h file into
      include/linux/mtd/rawnand.h so we can later create a nand.h header
      containing all common structure and function prototypes.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
6 years agomtd: nand: denali: remove ad-hoc board_nand_init() entry
Masahiro Yamada [Wed, 29 Nov 2017 10:19:09 +0000 (19:19 +0900)]
mtd: nand: denali: remove ad-hoc board_nand_init() entry

This driver is highly dependent on the configuration from denali_dt.c
Please enable CONFIG_NAND_DENALI_DT if you use this driver.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
6 years agomtd: nand: denali: remove bogus __maybe_unused
Masahiro Yamada [Wed, 29 Nov 2017 10:18:18 +0000 (19:18 +0900)]
mtd: nand: denali: remove bogus __maybe_unused

denali_setup_data_interface() is always used.

I put __maybe_unused for a temporal use, then forgot to delete it.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
6 years agoARM: uniphier: clean up board_init
Masahiro Yamada [Wed, 29 Nov 2017 06:01:22 +0000 (15:01 +0900)]
ARM: uniphier: clean up board_init

Remove unnecessary DECLARE_GLOBAL_DATA_PTR and header includes.

<common.h> has been replaced with <linux/errno.h> and <linux/printk.h>.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
6 years agomtd: cfi: Fix checking status register feature
York Sun [Sat, 18 Nov 2017 19:09:08 +0000 (11:09 -0800)]
mtd: cfi: Fix checking status register feature

Commit 72443c7f7d21 ("mtd: cfi: Add support for status register
polling") added a feature check to determine if status register
is available for certain flash chips. The "lower software bits"
register used to determine this feature is not backward compati-
ble. Older flash chips without this feature has reserved value
0xff. Instead of checking "lower software bits" register, use
CFI primary vendor-specific extended query. Since CFI version
1.4, software features can be read from offset 0x53 according to
document AN201168 from Cypress.

Signed-off-by: York Sun <york.sun@nxp.com>
CC: Marek Vasut <marek.vasut@gmail.com>
Tested-by: Marek Vasut <marek.vasut@gmail.com>
Signed-off-by: Stefan Roese <sr@denx.de>
6 years agotest/py: Allow any unit test suite to be found
Simon Glass [Sat, 25 Nov 2017 18:57:32 +0000 (11:57 -0700)]
test/py: Allow any unit test suite to be found

The u-boot.sym file is scanned to find unit test suites for execution. At
present it only finds those whose names start with 'dm' or 'env'. This
code is buried in the bowels of the test code so when adding a new suite
it is not easy to discover why it is ignored by the test framework.

There seems to be no need to make this restriction. Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Stephen Warren <swarren@nvidia.com>
6 years agotest: compression: Put test variables in a struct
Simon Glass [Sat, 25 Nov 2017 18:57:31 +0000 (11:57 -0700)]
test: compression: Put test variables in a struct

At present the test setup is somewhat mixed with the test itself. But if
the test setup fails (which it should not) then the test is actually
invalid. Put all the test buffers and sizes in a struct and separate out
the core code into a function.

This will make it easier to move the code to use the unit test framework.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agotest: overlay: Use cmd_ut_category()
Simon Glass [Sat, 25 Nov 2017 18:57:30 +0000 (11:57 -0700)]
test: overlay: Use cmd_ut_category()

Adjust the code to use the common test-execution function.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agotest: Add a command function for test execution
Simon Glass [Sat, 25 Nov 2017 18:57:29 +0000 (11:57 -0700)]
test: Add a command function for test execution

The logic to either iterate through a list of tests or pick a named test
is common to at lest two test suits. Move this logic into a new function
and call it from the environment tests.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agoomap2: set the ethaddr as well as the usbethaddr env var to ensure static MAC
Peter Robinson [Thu, 23 Nov 2017 13:14:17 +0000 (13:14 +0000)]
omap2: set the ethaddr as well as the usbethaddr env var to ensure static MAC

The kernel gets the ethernet MAC from the ethaddr variable, the omap boards for
devices with USB based eth adapters just set the usbethaddr which doesn't appear
to get passed to the kernel. The same Raspberry Pi code sets both ethaddr and
usbethaddr so lets do that so linux (tested 4.13 and 4.14) get a static rather
than a random MAC address, while not regressing users of usbethaddr.

Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
6 years agosunxi: video: HDMI: split VSYNC and HSYNC polarity settings
Vasily Khoruzhick [Wed, 29 Nov 2017 06:33:27 +0000 (22:33 -0800)]
sunxi: video: HDMI: split VSYNC and HSYNC polarity settings

These are actually different bits, and since some monitors (Benq BL2420PT)
have modes with different HSYNC and VSYNC polarity, we should set them
independently

Tested on Pine64-LTS with Benq BL2420PT monitor.

Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
Reviewed-by: Anatolij Gustschin <agust@denx.de>
Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>
6 years agosunxi: set the default CPUx frequency of H5 to 816MHz
Icenowy Zheng [Mon, 30 Oct 2017 23:36:28 +0000 (07:36 +0800)]
sunxi: set the default CPUx frequency of H5 to 816MHz

Some H5 boards are designed to start at 1.1V CPUx voltage (e.g. Nano Pi
NEO2), which may not work properly at 1008MHz if the chip's quality is
not so good.

Lower the default CPUx frequency of H5 to 816MHz.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
Reviewed-by: Jagan Teki <jagan@openedev.com>
6 years agovideo: sunxi: de2: add support for LCD SimpleFB
Icenowy Zheng [Wed, 1 Nov 2017 14:18:07 +0000 (22:18 +0800)]
video: sunxi: de2: add support for LCD SimpleFB

Add support for setting up SimpleFB for LCD display output in DE2
SimpleFB setup code.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
Reviewed-by: Jagan Teki <jagan@openedev.com>
Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
6 years agoMerge git://git.denx.de/u-boot-rockchip
Tom Rini [Sat, 2 Dec 2017 00:08:30 +0000 (19:08 -0500)]
Merge git://git.denx.de/u-boot-rockchip

6 years agorockchip: clk: rk3128: fix DCLK_VOP_DIV_CON_MASK
Philipp Tomsich [Fri, 1 Dec 2017 23:19:14 +0000 (00:19 +0100)]
rockchip: clk: rk3128: fix DCLK_VOP_DIV_CON_MASK

The DCLK_VOP_DIV_CON_MASK should cover only bits 8 through 15.
Fix this to remove an "integer-overflow on shifted constant" warning.

Fixes: 9246d9e ("rockchip: rk3128: add clock driver")
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
6 years agorockchip: clk: rk3128: fix NANDC_PLL_SEL_MASK
Philipp Tomsich [Fri, 1 Dec 2017 23:14:55 +0000 (00:14 +0100)]
rockchip: clk: rk3128: fix NANDC_PLL_SEL_MASK

The PLL selector field for NANDC is only 2 bits wide.
This fixes an 'int-overflow on shift' warning.

Fixes: 9246d9e ("rockchip: rk3128: add clock driver")
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
6 years agoefi_loader helloworld.efi: Fix building with -Os
Alexander Graf [Fri, 1 Dec 2017 21:09:50 +0000 (22:09 +0100)]
efi_loader helloworld.efi: Fix building with -Os

Depending on your compiler, when compiling the hello world efi binary
with -Os, gcc might think it's a smart idea to replace common patterns
such as memory copies with explicit calls to memcpy().

While that sounds great at first, we don't have any memcpy() available
in our helloworld build target. So let's indicate to gcc that we really
do want to have the code be built as freestanding.

Fixes: bbf75dd9 ("efi_loader: output load options in helloworld")
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: Fix partition offsets
Alexander Graf [Fri, 1 Dec 2017 15:10:33 +0000 (16:10 +0100)]
efi_loader: Fix partition offsets

Commit 884bcf6f65 (efi_loader: use proper device-paths for partitions) tried
to introduce the el torito scheme to all partition table types: Spawn
individual disk objects for each partition on a disk.

Unfortunately, that code ended up creating partitions with offset=0 which meant
that anyone accessing these objects gets data from the raw block device instead
of the partition.

Furthermore, all the el torito logic to spawn devices for partitions was
duplicated. So let's merge the two code paths and give partition disk objects
good offsets to work from, so that payloads can actually make use of them.

Fixes: 884bcf6f65 (efi_loader: use proper device-paths for partitions)
Reported-by: Yousaf Kaukab <yousaf.kaukab@suse.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: add missing breaks
Rob Clark [Thu, 30 Nov 2017 14:02:45 +0000 (09:02 -0500)]
efi_loader: add missing breaks

Otherwise with GUID partition types you would end up with things like:

  .../HD(Part0,Sig6252c819-4624-4995-8d16-abc9cd5d4130)/HD(Part0,MBRType=02,SigType=02)

Signed-off-by: Rob Clark <robdclark@gmail.com>
[agraf: rebased]
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_loader: comments for EFI_DEVICE_PATH_TO_TEXT_PROTOCOL
Heinrich Schuchardt [Thu, 23 Nov 2017 21:21:58 +0000 (22:21 +0100)]
efi_loader: comments for EFI_DEVICE_PATH_TO_TEXT_PROTOCOL

Provide comments for efi_convert_device_node_to_text()
and efi_convert_device_path_to_text().

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_loader: helper function to add EFI object to list
Heinrich Schuchardt [Sun, 26 Nov 2017 13:05:23 +0000 (14:05 +0100)]
efi_loader: helper function to add EFI object to list

To avoid duplicate coding provide a helper function that
initializes an EFI object and adds it to the EFI object
list.

efi_exit() is the only place where we dereference a handle
to obtain a protocol interface. Add a comment to the function.

Suggested-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_loader: pass handle of loaded image
Heinrich Schuchardt [Sun, 26 Nov 2017 13:05:22 +0000 (14:05 +0100)]
efi_loader: pass handle of loaded image

The handle of a loaded image is the value of the handle
member of the loaded image info object and not the
address of the loaded image info.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agotest/py: check return code of helloworld
Heinrich Schuchardt [Sun, 26 Nov 2017 13:05:21 +0000 (14:05 +0100)]
test/py: check return code of helloworld

Check that helloworld.efi returns EFI_SUCCESS.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_loader: output load options in helloworld
Heinrich Schuchardt [Sun, 26 Nov 2017 13:05:20 +0000 (14:05 +0100)]
efi_loader: output load options in helloworld

We need to test if we pass a valid image handle when loading
and EFI application. This cannot be done in efi_selftest as
it is not loaded as an image.

So let's enhance helloworld a bit.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_selftest: add missing line feed
Heinrich Schuchardt [Sun, 26 Nov 2017 13:05:19 +0000 (14:05 +0100)]
efi_selftest: add missing line feed

Add a missing line feed for an error message.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_selftest: compile without special compiler flags
Heinrich Schuchardt [Sun, 26 Nov 2017 13:05:18 +0000 (14:05 +0100)]
efi_selftest: compile without special compiler flags

As the selftest is not compiled as an EFI binary we do not
need special compiler flags.

This avoids the checkarmreloc error on vexpress_ca15_tc2.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_loader: manage protocols in a linked list
Heinrich Schuchardt [Sun, 26 Nov 2017 13:05:17 +0000 (14:05 +0100)]
efi_loader: manage protocols in a linked list

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_loader: simplify find_obj
Heinrich Schuchardt [Sun, 26 Nov 2017 13:05:16 +0000 (14:05 +0100)]
efi_loader: simplify find_obj

Use function efi_search_protocol().

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_loader: simplify efi_open_protocol
Heinrich Schuchardt [Sun, 26 Nov 2017 13:05:15 +0000 (14:05 +0100)]
efi_loader: simplify efi_open_protocol

Use function efi_search_protocol.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_loader: efi_gop: use efi_add_protocol
Heinrich Schuchardt [Sun, 26 Nov 2017 13:05:14 +0000 (14:05 +0100)]
efi_loader: efi_gop: use efi_add_protocol

Use efi_add_protocol to add protocol.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_loader: efi_net: use efi_add_protocol
Heinrich Schuchardt [Sun, 26 Nov 2017 13:05:13 +0000 (14:05 +0100)]
efi_loader: efi_net: use efi_add_protocol

Use efi_add_protocol to add protocols.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_loader: efi_disk: use efi_add_protocol
Heinrich Schuchardt [Sun, 26 Nov 2017 13:05:12 +0000 (14:05 +0100)]
efi_loader: efi_disk: use efi_add_protocol

Use efi_add_protocol to install protocols.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_selftest: test EFI_DEVICE_PATH_TO_TEXT_PROTOCOL
Heinrich Schuchardt [Sun, 26 Nov 2017 13:05:11 +0000 (14:05 +0100)]
efi_selftest: test EFI_DEVICE_PATH_TO_TEXT_PROTOCOL

Provide a test for the EFI_DEVICE_PATH_TO_TEXT_PROTOCOL protocol.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_loader: reimplement LocateDevicePath
Heinrich Schuchardt [Sun, 26 Nov 2017 13:05:10 +0000 (14:05 +0100)]
efi_loader: reimplement LocateDevicePath

The current implementation of efi_locate_device_path does not match
the UEFI specification. It completely ignores the protocol
parameters.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_loader: fix efi_convert_device_node_to_text
Heinrich Schuchardt [Sun, 26 Nov 2017 13:05:09 +0000 (14:05 +0100)]
efi_loader: fix efi_convert_device_node_to_text

We need to implement to different functions for the
EFI_DEVICE_PATH_TO_TEXT_PROTOCOL:
ConvertDeviceNodeToText
ConvertDevicePathToText

A recent patch screwed up efi_convert_device_node_to_text
to expect a device path and not a node.

The patch makes both service functions work again.

efi_convert_device_node_to_text is renamed to
efi_convert_single_device_node_to_text and
efi_convert_device_node_to_text_ext is renamed to
efi_convert_device_node_to_text to avoid future
confusion.

A test of ConvertDeviceNodeToText will be provided in
a follow-up patch.

Fixes: adae4313cdd efi_loader: flesh out device-path to text
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_loader: efi_dp_str should print path not node
Heinrich Schuchardt [Sun, 26 Nov 2017 13:05:08 +0000 (14:05 +0100)]
efi_loader: efi_dp_str should print path not node

efi_dp_str is meant to print a device path and not a device
node.

The old coding only worked because efi_convert_device_node_to_text
was screwed up to expect paths instead of nodes.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_loader: size of media device path node represenation
Heinrich Schuchardt [Sun, 26 Nov 2017 13:05:07 +0000 (14:05 +0100)]
efi_loader: size of media device path node represenation

In the format specifier we want to specify the maximum width
in case an ending \0 is missing.

So slen must be used as precision and not as field width.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_loader: Exit in efi_set_bootdev() upon invalid "desc"
Stefan Roese [Fri, 17 Nov 2017 07:47:09 +0000 (08:47 +0100)]
efi_loader: Exit in efi_set_bootdev() upon invalid "desc"

When trying to load an image from a non-existent USB key, U-Boot v2017.11
crashes on my x86 platform:

=> load usb 0:1 03000000 abc
General Protection
EIP: 0010:[<7b59030d>] EFLAGS: 00010286
Original EIP :[<fff4330d>]
...

This used to work in v2017.09. Testing has shown, that this bug was
introduced with patch 95c5553e [efi_loader: refactor boot device and
loaded_image handling].

This patch now checks if a valid "desc" is returned from blk_get_dev()
and only continues when "desc" is available. Resulting in this cmd
output (again):

=> load usb 0:1 03000000 abc
** Bad device usb 0 **

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_loader: helloworld.c: remove superfluous include
Heinrich Schuchardt [Sun, 26 Nov 2017 13:05:06 +0000 (14:05 +0100)]
efi_loader: helloworld.c: remove superfluous include

Remove a superfluous include from helloworld.c

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_loader: initialise partition_signature memory
Jonathan Gray [Wed, 22 Nov 2017 03:18:59 +0000 (14:18 +1100)]
efi_loader: initialise partition_signature memory

Zero partition_signature in the efi_device_path_hard_drive_path
structure when signature_type is 0 (no signature) as required by the
UEFI specification.

This is required so that efi_dp_match() will work as expected
when doing memcmp() comparisons.  Previously uninitialised memory
would cause it not match nodes when it should have when the signature
type was not GUID.

Corrects a problem where the loaded image protocol would not return a
device path with MEDIA_DEVICE causing the OpenBSD bootloader to fail
on rpi_3 and other targets.

v2: Also handle signature_type 1 (MBR) as described in the specification

Signed-off-by: Jonathan Gray <jsg@jsg.id.au>
Tested-by: Artturi Alm <artturi.alm@gmail.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_loader: efi_console: use helper functions
Heinrich Schuchardt [Thu, 26 Oct 2017 17:25:59 +0000 (19:25 +0200)]
efi_loader: efi_console: use helper functions

Use helper functions efi_created_handle and efi_add_protocol
for creating the console handles and instaling the respective
protocols.

This change is needed if we want to move from an array of
protocols to a linked list of protocols.

Eliminate EFI_PROTOCOL_OBJECT which is not used anymore.

Currently we have not defined protocol interfaces to be const.
So efi_con_out and efi_console_control cannot be defined as const.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_loader: refactor efi_setup_loaded_image
Heinrich Schuchardt [Thu, 26 Oct 2017 17:25:58 +0000 (19:25 +0200)]
efi_loader: refactor efi_setup_loaded_image

Use helper functions to add protocols.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_loader: simplify efi_locate_protocol
Heinrich Schuchardt [Thu, 26 Oct 2017 17:25:57 +0000 (19:25 +0200)]
efi_loader: simplify efi_locate_protocol

Use helper function efi_search_protocol.

Do not print protocol guid twice in debug mode.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_loader: simplify efi_uninstall_protocol_interface
Heinrich Schuchardt [Thu, 26 Oct 2017 17:25:56 +0000 (19:25 +0200)]
efi_loader: simplify efi_uninstall_protocol_interface

Use function efi_search_obj, efi_search_protocol and
efi_remove_protocol to simplify the coding.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_loader: simplify efi_search
Heinrich Schuchardt [Thu, 26 Oct 2017 17:25:55 +0000 (19:25 +0200)]
efi_loader: simplify efi_search

Use helper function efi_search_protocol in efi_search.
Add missing comments.
Put default handling into default branch of switch statement.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_loader: simplify efi_install_protocol_interface
Heinrich Schuchardt [Thu, 26 Oct 2017 17:25:54 +0000 (19:25 +0200)]
efi_loader: simplify efi_install_protocol_interface

Use helper functio efi_add_protocol.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_loader: helper functions for protocol management
Heinrich Schuchardt [Thu, 26 Oct 2017 17:25:53 +0000 (19:25 +0200)]
efi_loader: helper functions for protocol management

This patch provides helper functions to manage protocols.
efi_search_protocol - find a protocol on a handle
efi_add_protocol - install a protocol on a handle
efi_remove_protocol - remove a protocol from a handle
efi_remove_all_protocols - remove all protocols from a handle

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_selftest: test for graphics output protocol
Heinrich Schuchardt [Thu, 26 Oct 2017 17:25:52 +0000 (19:25 +0200)]
efi_selftest: test for graphics output protocol

Supply a test for the graphics output protocol.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_loader: efi_gop: use correct types for parameters
Heinrich Schuchardt [Thu, 26 Oct 2017 17:25:51 +0000 (19:25 +0200)]
efi_loader: efi_gop: use correct types for parameters

Use efi_uintn_t instead of unsigned long.

EFI_GRAPHICS_OUTPUT_BLT_OPERATION is an enum. If we don't
define an enum we have to pass it as u32.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_loader: argument of efi_search_obj should be const
Heinrich Schuchardt [Thu, 26 Oct 2017 17:25:50 +0000 (19:25 +0200)]
efi_loader: argument of efi_search_obj should be const

The argument of efi_search_obj is not changed so it should
be marked as const.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_loader: make efi_create_handle non-static
Heinrich Schuchardt [Thu, 26 Oct 2017 17:25:49 +0000 (19:25 +0200)]
efi_loader: make efi_create_handle non-static

Export function efi_create_handle.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_loader: efi_dp_match should have const arguments
Heinrich Schuchardt [Thu, 26 Oct 2017 17:25:48 +0000 (19:25 +0200)]
efi_loader: efi_dp_match should have const arguments

efi_dp_match does not change its arguments.
So they should be marked as const.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_loader: efi_net: check return value of calloc
Heinrich Schuchardt [Thu, 26 Oct 2017 17:25:47 +0000 (19:25 +0200)]
efi_loader: efi_net: check return value of calloc

Calloc may return NULL. So we must check the return value.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_loader: efi_disk: check return value of calloc
Heinrich Schuchardt [Thu, 26 Oct 2017 17:25:46 +0000 (19:25 +0200)]
efi_loader: efi_disk: check return value of calloc

Calloc may return NULL. We should check the return value.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_loader: efi_gop: check calloc return value
Heinrich Schuchardt [Thu, 26 Oct 2017 17:25:45 +0000 (19:25 +0200)]
efi_loader: efi_gop: check calloc return value

Calloc may return NULL. We have to check the return value.

Fixes: be8d324191f efi_loader: Add GOP support
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_loader implement UninstallMultipleProtocolInterfaces
Heinrich Schuchardt [Thu, 26 Oct 2017 17:25:44 +0000 (19:25 +0200)]
efi_loader implement UninstallMultipleProtocolInterfaces

Implement UninstallMultipleProtocolInterfaces.
The efi_uninstall_multipled_protocol_interfaces tries to
uninstall protocols one by one. If an error occurs all
uninstalled protocols are reinstalled.

As the implementation efi_uninstall_protocol_interface is
still incomplete the function will fail.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_loader: debug output efi_install_protocol_interface
Heinrich Schuchardt [Thu, 26 Oct 2017 17:25:43 +0000 (19:25 +0200)]
efi_loader: debug output efi_install_protocol_interface

efi_install_protocol_interface should provide the created or
provided handle in the debug output.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
7 years agoefi_loader: fix typo efi_install_multiple_protocol_interfaces
Heinrich Schuchardt [Thu, 26 Oct 2017 17:25:42 +0000 (19:25 +0200)]
efi_loader: fix typo efi_install_multiple_protocol_interfaces

%s/occured/occurred/g

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