]> git.dujemihanovic.xyz Git - u-boot.git/log
u-boot.git
4 years agoarm: mvebu: Espressobin: Disallow forwarding packets between wan and lan ports
Pali Rohár [Mon, 17 Aug 2020 14:36:38 +0000 (16:36 +0200)]
arm: mvebu: Espressobin: Disallow forwarding packets between wan and lan ports

By default Topaz switch on Espressobin board forwards packets between all
ethernet ports, including CPU (port 0), wan (port 1) and lan (ports 2,3).

This default U-Boot setup is unsuitable for using Espressobin as router as
it opens security hole in forwarding all packets between wan and lan ports.
E.g. dhcp packets from wan network leaks to lan network during small time
window until U-Boot boots Linux kernel which loads network drivers which
disallows forwarding between wan and lan.

This patch fixes above problem. For Espressobin board prior putting Topaz
switch into forwarding mode, Topaz switch is reconfigured to allow
forwarding packets from wan and lan ports only to CPU port. This ensures
that packets from wan port are not forwarded to lan ports and vice-versa.
Packets from CPU port are still forwarded to all other ports, so U-Boot
network boot works with any ethernet port as before.

This problem was already discussed on Espressobin forum [1] and on
Marvell's github issue tracker [2]. As a workaround people on Espressobin
forum patched U-Boot to completely disable lan ports on Topaz switch which
prevented forwarding packets. That workaround had an issue that U-Boot was
unable to netboot via lan ports anymore. Change in this patch does not have
such issue.

This security issue has been dicussed here as well: [3].

[1] - https://web.archive.org/web/20191231164238/http://espressobin.net/forums/topic/boot-behavior-of-the-switch-and-security/
[2] - https://github.com/MarvellEmbeddedProcessors/u-boot-marvell/issues/18
[3] - https://forum.armbian.com/topic/12635-espressobin-uboot-security-concerns-switch-init-portmask/

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Tested-by: Andre Heider <a.heider@gmail.com>
4 years agoMerge branch '2020-08-27-misc-fixes'
Tom Rini [Fri, 28 Aug 2020 12:51:37 +0000 (08:51 -0400)]
Merge branch '2020-08-27-misc-fixes'

- Fix for gd->ram_top and bootm_size calculations
- Assorted Kconfig entry cleanups / fixes.
- Make checkpatch.pl error on fdt_high/initrd_high=0xffffffff
- Resync scripts/setlocalversion
- Other minor bugfixes

4 years agoscripts/setlocalversion: sync with linux 5.8
Rasmus Villemoes [Tue, 25 Aug 2020 15:28:39 +0000 (17:28 +0200)]
scripts/setlocalversion: sync with linux 5.8

The linux changes since v3.16 are

78283edf2c01 kbuild: setlocalversion: print error to STDERR
b24413180f56 License cleanup: add SPDX GPL-2.0 license identifier to files with no license
6147b1cf1965 scripts/setlocalversion: git: Make -dirty check more robust
8ef14c2c41d9 Revert "scripts/setlocalversion: git: Make -dirty check more robust"
ff64dd485730 scripts/setlocalversion: Improve -dirty check with git-status --no-optional-locks
7a82e3fa28f1 scripts/setlocalversion: clear local variable to make it work for sh
991b78fbd223 scripts: setlocalversion: fix a bashism
3c96bdd0ebfa scripts: setlocalversion: replace backquote to dollar parenthesis

and it's ff64dd485730 that is the motivation for this sync. It fixes
false positive "-dirty" added to the version string when building with
Yocto
(https://lists.openembedded.org/g/openembedded-core/message/137702).

There has been one U-Boot specific patch since this was synced with
linux 3.16: 81630a3b38c2 (scripts: setlocalversion: safely extract
variables from auto.conf using awk).  Keep these changes applied.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
[trini: Re-add 81630a3b38c2 and reword message]
Signed-off-by: Tom Rini <trini@konsulko.com>
4 years agoimage: don't exceed gd->ram_top in bootm_size
Baruch Siach [Mon, 24 Aug 2020 17:14:05 +0000 (20:14 +0300)]
image: don't exceed gd->ram_top in bootm_size

When board_get_usable_ram_top() limits gd->ram_top, env_get_bootm_size()
must not exceed that limit. Otherwise, boot_relocate_fdt() might put fdt
out of the allowed RAM range.

The similar commit 8ce1f10cf2b1 ("ARM: bootm: take into account
gd->ram_top") exposed this bug.

This fixes boot on Armada 8040 based Clearfog GT-8K where ram_top is set
to 0x80000000 (2GB), but bi_dram[0].size might be up to 0xc0000000
(3GB). Note the relocated fdt address (0xbfff4000) in the console output
listed below:

Found /extlinux/extlinux.conf
Retrieving file: /extlinux/extlinux.conf
62 bytes read in 21 ms (2 KiB/s)
1: linux
Retrieving file: /extlinux/Image
13740544 bytes read in 1266 ms (10.4 MiB/s)
Retrieving file: /extlinux/armada-8040-clearfog-gt-8k.dtb
33368 bytes read in 31 ms (1 MiB/s)
   Booting using the fdt blob at 0x4f00000
   Loading Device Tree to 00000000bfff4000, end 00000000bffff257 ... "Synchronous Abort" handler, esr 0x96000045
elr: 000000000006e1cc lr : 0000000000068fd8 (reloc)
elr: 000000007ffa91cc lr : 000000007ffa3fd8
x0 : ffffffffffffffff x1 : 00000000bfffc258
x2 : 0000000000000000 x3 : ffffffffffff7da7
x4 : 0000000004f08258 x5 : 00000000bfff4000
x6 : 00000000bfff4000 x7 : 000000000000000f
x8 : 000000007fb23bf8 x9 : 0000000000000008
x10: 00000000bffff257 x11: 00000000bffff257
x12: 0000000000000000 x13: fffffffffffff000
x14: 00000000bfff4000 x15: 0000000000000021
x16: 000000007ff7bc38 x17: 0000000000000000
x18: 000000007fb2add0 x19: 00000000bfff4000
x20: 0000000004f00000 x21: 000000000000b258
x22: 0000000058820000 x23: 0000000000000010
x24: 000000007ffe3c40 x25: 000000007fb23cb8
x26: 00000000c0000000 x27: 0000000000000000
x28: 000000007fc3fd50 x29: 000000007fb23bd0

Code: 54000061 aa0603e0 d65f03c0 38606882 (38206822)
Resetting CPU ...

Thanks to Patrice CHOTARD who directed me to the right way.

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
4 years agocmd: mem: Remove already removed CONFIG_SYS_MEMTEST_SCRATCH
Michal Simek [Mon, 24 Aug 2020 11:17:00 +0000 (13:17 +0200)]
cmd: mem: Remove already removed CONFIG_SYS_MEMTEST_SCRATCH

The commit e519f03a1846 ("cmd: mem: Remove CONFIG_SYS_MEMTEST_SCRATCH
mapping") removed CONFIG_SYS_MEMTEST_SCRATCH but commit 091401131085
("command: Remove the cmd_tbl_t typedef") has added it back. That's why
symbol is still in the tree that's why remove it again.

Fixes: 091401131085 ("command: Remove the cmd_tbl_t typedef
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agolib/rsa: correct check after allocation in fdt_add_bignum()
Heinrich Schuchardt [Thu, 20 Aug 2020 19:11:17 +0000 (21:11 +0200)]
lib/rsa: correct check after allocation in fdt_add_bignum()

After allocating to pointer ctx we should check that pointer and not
another pointer already checked above.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agotest: undefined reference to 'sscanf'
Heinrich Schuchardt [Fri, 21 Aug 2020 01:56:17 +0000 (03:56 +0200)]
test: undefined reference to 'sscanf'

Compiling with CONFIG_UNIT_TEST=y leads to:

aarch64-linux-gnu-ld.bfd:
test/lib/sscanf.c:50: undefined reference to `sscanf'

Add missing build dependency.

Fixes:e87dfb0526be ("lib: sscanf: add sscanf implementation")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agocheckpatch.pl: Make fdt / initrd relocation disabling an error
Tom Rini [Thu, 20 Aug 2020 12:37:49 +0000 (08:37 -0400)]
checkpatch.pl: Make fdt / initrd relocation disabling an error

Entirely disabling relocation of the device tree or initrd is almost
never the right answer.  Doing this by default leads to hard to diagnose
run-time failures.

Signed-off-by: Tom Rini <trini@konsulko.com>
4 years agoenv: Kconfig: Add missing dependency for ENV_IS_IN_EXT4
Michal Simek [Wed, 19 Aug 2020 08:44:23 +0000 (10:44 +0200)]
env: Kconfig: Add missing dependency for ENV_IS_IN_EXT4

ENV_IS_IN_EXT4 also need to enable FS_EXT4 which is not covered in Kconfig.
Kconfig reports this as:
WARNING: unmet direct dependencies detected for EXT4_WRITE
  Depends on [n]: FS_EXT4 [=n]
  Selected by [y]:
  - ENV_IS_IN_EXT4 [=y] && !CHAIN_OF_TRUST [=n]

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
4 years agoarc: Kconfig: Add missing DM dependency
Michal Simek [Wed, 19 Aug 2020 08:44:20 +0000 (10:44 +0200)]
arc: Kconfig: Add missing DM dependency

ARC is selecting TIMER which depends on DM but DM is not selected and
doesn't need to be enabled. Fix it by selecting DM for ARC architecture.

Kconfig is showing this missing dependency by:
WARNING: unmet direct dependencies detected for TIMER
  Depends on [n]: DM [=n]
  Selected by [y]:
  - ARC [=y] && <choice>

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agocmd: Kconfig: Change dependency for CMD_ADC
Michal Simek [Wed, 19 Aug 2020 08:44:17 +0000 (10:44 +0200)]
cmd: Kconfig: Change dependency for CMD_ADC

CMD_ADC selected DM_REGULATOR unconditionally without enabling DM.
That's why change select to depends on to cover it.

Kconfig is showing this issue as:
WARNING: unmet direct dependencies detected for REGMAP
  Depends on [n]: DM [=n]
  Selected by [y]:
  - DM_REGULATOR_PBIAS [=y] && DM_REGULATOR [=y]

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
[trini: Update CMD_ADC=y configs to enable DM_REGULATOR now]
Signed-off-by: Tom Rini <trini@konsulko.com>
4 years agopci: kconfig: Setup proper dependency for PCIE_ROCKCHIP
Michal Simek [Wed, 19 Aug 2020 08:44:15 +0000 (10:44 +0200)]
pci: kconfig: Setup proper dependency for PCIE_ROCKCHIP

There is missing dependency for PCIE_ROCKCHIP which selects
PHY_ROCKCHIP_PCIE which directly depends on ARCH_ROCKCHIP.

WARNING: unmet direct dependencies detected for PHY_ROCKCHIP_PCIE
  Depends on [n]: ARCH_ROCKCHIP [=n]
  Selected by [y]:
  - PCIE_ROCKCHIP [=y] && PCI [=y]

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
4 years agodrivers: usb: Fix config indentation
Ruben Di Battista [Thu, 6 Aug 2020 10:12:30 +0000 (12:12 +0200)]
drivers: usb: Fix config indentation

The indentation was messing up with the scripts/build-whitelist.sh that
was marking SYS_USB_EVENT_POLL_VIA_INT_QUEUE (and probably also the
other indented options) erroneously as ad-hoc configure option with the
following error:

```
Error: You must add new CONFIG options using Kconfig
The following new ad-hoc CONFIG options were detected:
CONFIG_SYS_USB_EVENT_POLL_VIA_INT_QUEUE
```

4 years agoPrepare v2020.10-rc3
Tom Rini [Wed, 26 Aug 2020 21:18:06 +0000 (17:18 -0400)]
Prepare v2020.10-rc3

Signed-off-by: Tom Rini <trini@konsulko.com>
4 years agoconfigs: Resync with savedefconfig
Tom Rini [Wed, 26 Aug 2020 21:26:24 +0000 (17:26 -0400)]
configs: Resync with savedefconfig

Rsync all defconfig files using moveconfig.py

Signed-off-by: Tom Rini <trini@konsulko.com>
4 years agoMerge tag 'u-boot-imx-20200825' of https://gitlab.denx.de/u-boot/custodians/u-boot-imx
Tom Rini [Wed, 26 Aug 2020 03:12:43 +0000 (23:12 -0400)]
Merge tag 'u-boot-imx-20200825' of https://gitlab.denx.de/u-boot/custodians/u-boot-imx

For 2020.10
-----------

- mx6: SOCs user selectable
       Fix for imx6q_logic
       Some DM conversion
- mx7: introduce secondary boot device

Travis: https://travis-ci.org/github/sbabic/u-boot-imx/builds/720918010

Signed-off-by: Tom Rini <trini@konsulko.com>
4 years agoMerge https://gitlab.denx.de/u-boot/custodians/u-boot-marvell
Tom Rini [Tue, 25 Aug 2020 14:24:40 +0000 (10:24 -0400)]
Merge https://gitlab.denx.de/u-boot/custodians/u-boot-marvell

- Add basic Marvell/Cavium OcteonTX/TX2 support (Suneel)
- Infrastructure changes to PCI uclass to support these SoC's (Suneel)
- Add PCI, MMC & watchdog driver drivers for OcteonTX/TX2 (Suneel)
- Increase CONFIG_SYS_MALLOC_F_LEN for qemu-x86 (Stefan)

4 years agoMerge tag 'i2c-bugfixes-for-v2020.10' of https://gitlab.denx.de/u-boot/custodians...
Tom Rini [Tue, 25 Aug 2020 12:19:41 +0000 (08:19 -0400)]
Merge tag 'i2c-bugfixes-for-v2020.10' of https://gitlab.denx.de/u-boot/custodians/u-boot-i2c

i2c bugfixes for v2020.10
- fix some issues with octeon_i2c driver on ARM Octeon TX2
- fix link failure with CONFIG_SPL and CONFIG_I2C_MUX_PCA954x

4 years agoMerge tag 'u-boot-rockchip-20200820' of https://gitlab.denx.de/u-boot/custodians...
Tom Rini [Tue, 25 Aug 2020 12:19:14 +0000 (08:19 -0400)]
Merge tag 'u-boot-rockchip-20200820' of https://gitlab.denx.de/u-boot/custodians/u-boot-rockchip

- Fix rk3399 evb sdcard support
- Fix for SPL_LED support

4 years agoMerge https://gitlab.denx.de/u-boot/custodians/u-boot-riscv
Tom Rini [Tue, 25 Aug 2020 12:18:50 +0000 (08:18 -0400)]
Merge https://gitlab.denx.de/u-boot/custodians/u-boot-riscv

- Sipeed Maix support S-mode.
- Provide command sbi.
- Use fdtdec_get_addr_size_auto_parent to get fu540 cache base address.
- Fix a compiler error with CONFIG_SPL_SMP=n.
- Fix sifive ram driver 32 compiler warnings.
- Fix kendryte/pll.h redefine nop() warning.

4 years agoMerge branch '2020-08-24-misc-improvements'
Tom Rini [Tue, 25 Aug 2020 00:24:21 +0000 (20:24 -0400)]
Merge branch '2020-08-24-misc-improvements'

- Squashfs compression support
- Coverity fixes
- XEN guest updates
- Finish previous MediaTek updates
- Arm Total Compute platform support

4 years agox86: qemu-x86_defconfig: Increase CONFIG_SYS_MALLOC_F_LEN
Stefan Roese [Tue, 25 Aug 2020 06:53:30 +0000 (08:53 +0200)]
x86: qemu-x86_defconfig: Increase CONFIG_SYS_MALLOC_F_LEN

With the upcoming increase of the malloc area in U-Boot
("pci: pci-uclass: Dynamically allocate the PCI regions"), the CI QEMU
x86 test fails:

U-Boot 2020.10-rc2-g0a668f6d38 (Aug 25 2020 - 06:12:51 +0000)

alloc space exhausted
Error binding driver 'cpu_qemu': -12
Some drivers failed to bind
alloc space exhausted
initcall sequence fff6a760 failed at call fff13b3d (err=-19)

This patch now increases CONFIG_SYS_MALLOC_F_LEN to 0x1000, which is
already used on qemu-x86_64_defconfig.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
4 years agoimx8m: config: convert to bootm_size
Grygorii Tertychnyi [Fri, 21 Aug 2020 13:39:43 +0000 (15:39 +0200)]
imx8m: config: convert to bootm_size

Restrict the memory range available for image processing in the
"bootm" to 256 MiB so the kernel can access it and FDT or initrd are
not overwritten on ARM64.

Signed-off-by: Grygorii Tertychnyi <grygorii.tertychnyi@leica-geosystems.com>
Cc: Peng Fan <peng.fan@nxp.com>
Cc: Marek Vasut <marex@denx.de>
Cc: Andrey Zhizhikin <andrey.zhizhikin@leica-geosystems.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
4 years agoARM: imx6q_logic: Fix broken booting by moving fdt_addr_r address
Adam Ford [Thu, 20 Aug 2020 13:56:49 +0000 (08:56 -0500)]
ARM: imx6q_logic: Fix broken booting by moving fdt_addr_r address

The loading address is too close to the kernel address, so newer kernels
may overlap memory space, so loading the device tree may corrupt zImage.

This patch moves the fdt_addr_r to 0x14000000 which is also consistent
with guidance that the kernel be allocated 32MB.  This places it
in the same place as the ramdisk, so this patch moves the ramdisk address
512KB after the fdt.

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
4 years agopico-imx6: Remove unneeded CONFIG_DM_MDIO
Fabio Estevam [Tue, 18 Aug 2020 22:58:55 +0000 (19:58 -0300)]
pico-imx6: Remove unneeded CONFIG_DM_MDIO

As explained in the CONFIG_DM_MDIO text inside drivers/net/Kconfig:

"Useful in particular for systems that support
DM_ETH and have a stand-alone MDIO hardware block shared by multiple
Ethernet interfaces."

i.MX6 has a single FEC instance, so there is no need to select
CONFIG_DM_MDIO.

Signed-off-by: Fabio Estevam <festevam@gmail.com>
4 years agoarm: mx6: Make all i.MX6 SoCs user-selectable
Tom Rini [Tue, 18 Aug 2020 11:43:50 +0000 (07:43 -0400)]
arm: mx6: Make all i.MX6 SoCs user-selectable

We have a number of platforms that are a combination of a carrier board
and System-on-Module (SoM) that in turn allows for the board to have
different SoCs on it.  In some cases, this is handled via board-specific
Kconfig options.  In other cases we make use of
CONFIG_SYS_EXTRA_OPTIONS.  This latter case however can lead to invalid
configurations as we will not in turn get options that in Kconfig are
selected by or depend on that setting.

To resolve this, make the SoC option a choice in Kconfig and make boards
depend on what they can support.  This change opens us up for further
clean-ups in the cases where a single CONFIG_TARGET_xxx can support
different SoCs and today they do not, or do not cleanly do so.

Reported-by: Matt Porter <mporter@konsulko.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Fabio Estevam <festevam@gmail.com>
Cc: "NXP i.MX U-Boot Team" <uboot-imx@nxp.com>
Cc: Soeren Moch <smoch@web.de>
Cc: Markus Niebel <Markus.Niebel@tq-group.com>
Cc: Igor Opaniuk <igor.opaniuk@toradex.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: Hannes Schmelzer <hannes.schmelzer@br-automation.com>
Cc: Otavio Salvador <otavio@ossystems.com.br>
Cc: Nikita Kiryanov <nikita@compulab.co.il>
Cc: Andreas Geisreiter <ageisreiter@dh-electronics.de>
Cc: Ludwig Zenz <lzenz@dh-electronics.de>
Cc: Lukasz Majewski <lukma@denx.de>
Cc: Akshay Bhat <akshaybhat@timesys.com>
Cc: Ken Lin <Ken.Lin@advantech.com.tw>
Cc: Ian Ray <ian.ray@ge.com>
Cc: Tim Harvey <tharvey@gateworks.com>
Cc: Jagan Teki <jagan@amarulasolutions.com>
Cc: Raffaele RECALCATI <raffaele.recalcati@bticino.it>
Cc: Simone CIANNI <simone.cianni@bticino.it>
Cc: Adam Ford <aford173@gmail.com>
Cc: Marcin Niestroj <m.niestroj@grinn-global.com>
Cc: "Eric Bénard" <eric@eukrea.com>
Cc: Baruch Siach <baruch@tkos.co.il>
Cc: Jason Liu <jason.hui.liu@nxp.com>
Cc: Ye Li <ye.li@nxp.com>
Cc: Eric Nelson <eric@nelint.com>
Cc: Troy Kisky <troy.kisky@boundarydevices.com>
Cc: Peng Fan <peng.fan@nxp.com>
Cc: Parthiban Nallathambi <parthiban@linumiz.com>
Cc: Marek Vasut <marex@denx.de>
Cc: "Sébastien Szymanski" <sebastien.szymanski@armadeus.com>
Cc: Christian Gmeiner <christian.gmeiner@gmail.com>
Cc: Niel Fourie <lusus@denx.de>
Cc: Martyn Welch <martyn.welch@collabora.com>
Cc: Richard Hu <richard.hu@technexion.com>
Cc: Stefan Roese <sr@denx.de>
Cc: Boris Brezillon <bbrezillon@kernel.org>
Cc: Arkadiusz Karas <arkadiusz.karas@somlabs.com>
Cc: Breno Lima <breno.lima@nxp.com>
Cc: Francesco Montefoschi <francesco.montefoschi@udoo.org>
Cc: Silvio Fricke <open-source@softing.de>
Tested-by: Matt Porter <mporter@konsulko.com> [colibri_imx6]
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Marcin Niestroj <m.niestroj@grinn-global.com>
4 years agoarm: octeontx2: Add support for OcteonTX2 SoC platforms
Suneel Garapati [Sun, 20 Oct 2019 01:47:37 +0000 (18:47 -0700)]
arm: octeontx2: Add support for OcteonTX2 SoC platforms

This patch adds support for all OcteonTX2 96xx/95xx
boards from Marvell.
For 96xx boards, use octeontx_96xx_defconfig and
for 95xx boards, use octeontx_95xx_defconfig.

Signed-off-by: Suneel Garapati <sgarapati@marvell.com>
4 years agoarm: octeontx: Add support for OcteonTX SoC platforms
Suneel Garapati [Sun, 20 Oct 2019 01:37:55 +0000 (18:37 -0700)]
arm: octeontx: Add support for OcteonTX SoC platforms

This patch adds support for all OcteonTX 81xx/83xx
boards from Marvell.
For 81xx boards, use octeontx_81xx_defconfig and
for 83xx boards, use octeontx_83xx_defconfig.

Signed-off-by: Suneel Garapati <sgarapati@marvell.com>
4 years agowatchdog: Add reset support for OcteonTX / TX2
Suneel Garapati [Mon, 21 Oct 2019 23:09:36 +0000 (16:09 -0700)]
watchdog: Add reset support for OcteonTX / TX2

Adds support for Core 0 watchdog poke on OcteonTX and OcteonTX2
platforms.

Signed-off-by: Suneel Garapati <sgarapati@marvell.com>
Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agommc: Add MMC controller driver for OcteonTX / TX2
Suneel Garapati [Sun, 20 Oct 2019 01:03:01 +0000 (18:03 -0700)]
mmc: Add MMC controller driver for OcteonTX / TX2

Adds support for MMC controllers found on OcteonTX or
OcteonTX2 SoC platforms.

Signed-off-by: Aaron Williams <awilliams@marvell.com>
Signed-off-by: Suneel Garapati <sgarapati@marvell.com>
Cc: Peng Fan <peng.fan@nxp.com>
4 years agopci: Add PCI controller driver for OcteonTX / TX2
Suneel Garapati [Sun, 20 Oct 2019 00:28:01 +0000 (17:28 -0700)]
pci: Add PCI controller driver for OcteonTX / TX2

Adds support for PCI ECAM/PEM controllers found on OcteonTX
or OcteonTX2 SoC platforms.

Signed-off-by: Suneel Garapati <sgarapati@marvell.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
4 years agoata: ahci: Add BAR index quirk for Cavium PCI SATA device
Suneel Garapati [Sun, 20 Oct 2019 00:48:25 +0000 (17:48 -0700)]
ata: ahci: Add BAR index quirk for Cavium PCI SATA device

For SATA controller found on OcteonTX SoC's, use non-standard PCI BAR0
instead of BAR5.

Signed-off-by: Suneel Garapati <sgarapati@marvell.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agoarm: octeontx2: Add headers for OcteonTX2
Suneel Garapati [Sun, 20 Oct 2019 01:35:54 +0000 (18:35 -0700)]
arm: octeontx2: Add headers for OcteonTX2

Signed-off-by: Suneel Garapati <sgarapati@marvell.com>
4 years agoarm: octeontx: Add headers for OcteonTX
Suneel Garapati [Sun, 20 Oct 2019 01:32:33 +0000 (18:32 -0700)]
arm: octeontx: Add headers for OcteonTX

Signed-off-by: Suneel Garapati <sgarapati@marvell.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agoarm: include/asm/io.h: Add 64bit clrbits and setbits helpers
Suneel Garapati [Sun, 20 Oct 2019 00:20:27 +0000 (17:20 -0700)]
arm: include/asm/io.h: Add 64bit clrbits and setbits helpers

Add 64bit API for clrbits and setbits.

Signed-off-by: Suneel Garapati <sgarapati@marvell.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agopci: pci-uclass: Check validity of ofnode
Suneel Garapati [Tue, 5 May 2020 04:25:25 +0000 (21:25 -0700)]
pci: pci-uclass: Check validity of ofnode

Add check if the referenced ofnode is valid.

Signed-off-by: Suneel Garapati <sgarapati@marvell.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
4 years agopci: pci-uclass: Add support for Alternate-RoutingID capability
Suneel Garapati [Thu, 24 Oct 2019 01:40:36 +0000 (18:40 -0700)]
pci: pci-uclass: Add support for Alternate-RoutingID capability

If ARI capability is found on device, use it to update next function
number in bus scan and also helps to skip unnecessary bdf scans.

Signed-off-by: Suneel Garapati <sgarapati@marvell.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
4 years agopci: pci-uclass: Add VF BAR map support for Enhanced Allocation
Suneel Garapati [Sat, 19 Oct 2019 23:34:16 +0000 (16:34 -0700)]
pci: pci-uclass: Add VF BAR map support for Enhanced Allocation

Makes dm_pci_map_bar API available to map BAR for Virtual function
PCI devices which support Enhanced Allocation.

Signed-off-by: Suneel Garapati <sgarapati@marvell.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
4 years agopci: pci-uclass: Add support for Single-Root I/O Virtualization
Suneel Garapati [Sat, 19 Oct 2019 23:07:20 +0000 (16:07 -0700)]
pci: pci-uclass: Add support for Single-Root I/O Virtualization

SR-IOV - Single Root I/O Virtualization
PF - Physical Function VF - Virtual Function

If SR-IOV capability is present, use it to initialize Virtual Function
PCI device instances. pci_sriov_init function will read SR-IOV
registers to create VF devices under the PF PCI device and also bind
driver if available. This function needs to be invoked from Physical
function device driver which expects VF device support, creating
minimal impact on existing framework.

Signed-off-by: Suneel Garapati <sgarapati@marvell.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
4 years agopci: pci-uclass: Add support for Enhanced Allocation in Bridges
Suneel Garapati [Sat, 19 Oct 2019 22:52:32 +0000 (15:52 -0700)]
pci: pci-uclass: Add support for Enhanced Allocation in Bridges

If Enhanced Allocation capability is present in bridges, use it
to read the fixed sub-ordinate bus number.

Signed-off-by: Suneel Garapati <sgarapati@marvell.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
4 years agopci: pci-uclass: Add multi entry support for memory regions
Suneel Garapati [Sun, 20 Oct 2019 00:10:20 +0000 (17:10 -0700)]
pci: pci-uclass: Add multi entry support for memory regions

Enable PCI memory regions in ranges property to be of multiple entry.
This helps to add support for SoC's like OcteonTX/TX2 where every
peripheral is on PCI bus.

Signed-off-by: Suneel Garapati <sgarapati@marvell.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
4 years agoLink failure with CONFIG_SPL and CONFIG_I2C_MUX_PCA954x
Trommel, Kees (Contractor) [Mon, 3 Aug 2020 14:49:47 +0000 (14:49 +0000)]
Link failure with CONFIG_SPL and CONFIG_I2C_MUX_PCA954x

Fix for the case of a U-Boot configuration with CONFIG_SPL,
CONFIG_I2C_MUX, CONFIG_I2C_MUX_PCA954x, no CONFIG_SPL_DM and no
CONFIG_SPL_I2C_MUX. Without this fix linking of pca954x fails because
dm_write_i2c does not exist because CONFIG_SPL_DM is not defined.

Signed-off-by: Kees Trommel <kees.trommel.contractor@draeger.com>
Cc: Heiko Schocher <hs@denx.de>
4 years agoi2c: octeon_i2c: Misc fixes for ARM Octeon TX2 support
Stefan Roese [Thu, 23 Jul 2020 12:09:36 +0000 (14:09 +0200)]
i2c: octeon_i2c: Misc fixes for ARM Octeon TX2 support

This patch fixes a few issues noticed, when testing this new driver on
ARM Octeon TX2 again. Here the details:

- Remove "common.h" header inclusion
- Use correct THP define on Octeon TX2
- Octeon TX2 uses the same compatible as Octeon TX. We can't distinguish
  both platforms this way. Remove the unused "cavium,thunder2-99xx-twsi"
  compatible and add a check to the Octeon TX2 specific
  "cavium,thunderx-i2c" so that the correct driver data is selected.
- Removed "struct pci_device_id" definition and U_BOOT_PCI_DEVICE()
  as its not needed for the PCI based probing on Octeon TX2

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: Suneel Garapati <sgarapati@marvell.com>
Cc: Aaron Williams <awilliams@marvell.com>
Cc: Chandrakala Chavva <cchavva@marvell.com>
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
4 years agopci: pci-uclass: Make DT subnode parse optional
Suneel Garapati [Sat, 19 Oct 2019 23:02:48 +0000 (16:02 -0700)]
pci: pci-uclass: Make DT subnode parse optional

Parse subnode DT properties only if parent node is valid.
Otherwise, assert is triggered on ofnode_valid in ofnode_first_subnode
from dev_for_each_subnode.

Signed-off-by: Suneel Garapati <sgarapati@marvell.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
4 years agopci: pci-uclass: Fix incorrect argument in map_physmem
Suneel Garapati [Sat, 19 Oct 2019 23:44:35 +0000 (16:44 -0700)]
pci: pci-uclass: Fix incorrect argument in map_physmem

Fix argument ordering for map_physmem() called in dm_pci_map_ea_bar().
Additinally minor spelling correction.

Signed-off-by: Suneel Garapati <sgarapati@marvell.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
4 years agopci: pci-uclass: Dynamically allocate the PCI regions
Stefan Roese [Thu, 23 Jul 2020 14:34:10 +0000 (16:34 +0200)]
pci: pci-uclass: Dynamically allocate the PCI regions

Instead of using a fixed length pre-allocated array of regions, this
patch moves to dynamically allocating the regions based on the number
of available regions plus the necessary regions for DRAM banks.

Since MAX_PCI_REGIONS is not needed any more, its removed completely
with this patch.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Thierry Reding <treding@nvidia.com>
Cc: Marek Vasut <marek.vasut+renesas@gmail.com>
4 years agoARM: renesas: Drop unnecessary function ft_board_setup()
Stefan Roese [Thu, 6 Aug 2020 15:49:49 +0000 (17:49 +0200)]
ARM: renesas: Drop unnecessary function ft_board_setup()

Marek explained on IRC, that ft_board_setup() is not used / necessary
at all. So its best to just drop it completely, as it interferes with
the cleanup of CONFIG_MAX_PCI_REGIONS (completely removed).

Signed-off-by: Stefan Roese <sr@denx.de>
Suggested-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agopci: pci-uclass: Remove #ifdef CONFIG_NR_DRAM_BANKS as its always set
Stefan Roese [Thu, 23 Jul 2020 14:26:07 +0000 (16:26 +0200)]
pci: pci-uclass: Remove #ifdef CONFIG_NR_DRAM_BANKS as its always set

Since the migration to Kconfig, CONFIG_NR_DRAM_BANKS is configured for
all boards. Hence we can remove the conditional compilation and the code
path that will never get compiled.

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Bin Meng <bmeng.cn@gmail.com>
4 years agodm: core: Add API to read PCI bus-range property
Stefan Roese [Wed, 5 Aug 2020 11:56:11 +0000 (13:56 +0200)]
dm: core: Add API to read PCI bus-range property

Add dev_read_pci_bus_range() to read bus-range property values

Signed-off-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agofdtdec: Add API to read pci bus-range property
Suneel Garapati [Sat, 19 Oct 2019 22:19:35 +0000 (15:19 -0700)]
fdtdec: Add API to read pci bus-range property

Add fdtdec_get_pci_bus_range to read bus-range property
values.

Signed-off-by: Suneel Garapati <sgarapati@marvell.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agocmd: provide command sbi
Heinrich Schuchardt [Thu, 20 Aug 2020 17:43:39 +0000 (19:43 +0200)]
cmd: provide command sbi

Provide a command to display information about the SBI implementation.

The output might look like:

=> sbi
SBI 0.2
OpenSBI
Extensions:
  sbi_set_timer
  sbi_console_putchar
  sbi_console_getchar
  sbi_clear_ipi
  sbi_send_ipi
  sbi_remote_fence_i
  sbi_remote_sfence_vma
  sbi_remote_sfence_vma_asid
  sbi_shutdown
  SBI Base Functionality
  Timer Extension
  IPI Extension
  RFENCE Extension
  Hart State Management Extension

The command can be used to construct a unit test checking that the
communication with the SEE is working.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Atish Patra <atish.patra@wdc.com>
Reviewed-by: Bin Meng <bin.meng@windriver.com>
Tested-by: Bin Meng <bin.meng@windriver.com>
Reviewed-by: Pragnesh Patel <pragnesh.patel@openfive.com>
Tested-by: Pragnesh Patel <pragnesh.patel@openfive.com>
Reviewed-by: Rick Chen <rick@andestech.com>
Tested-by: Rick Chen <rick@andestech.com>
4 years agoconfigs: defconfig for Sipeed Maix in S-mode
Heinrich Schuchardt [Mon, 17 Aug 2020 10:35:39 +0000 (12:35 +0200)]
configs: defconfig for Sipeed Maix in S-mode

Provide a defconfig that can be used to build U-Boot for the Maix boards
running upon OpenSBI.

Update the documentation.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Bin Meng <bin.meng@windriver.com>
Reviewed-by: Sean Anderson <seanga2@gmail.com>
4 years agoriscv: fix building with CONFIG_SPL_SMP=n
Heinrich Schuchardt [Sat, 15 Aug 2020 07:49:26 +0000 (09:49 +0200)]
riscv: fix building with CONFIG_SPL_SMP=n

Building with CONFIG_SPL_SMP=n results in:

arch/riscv/lib/spl.c: In function ‘jump_to_image_no_args’:
arch/riscv/lib/spl.c:33:6:
error: unused variable ‘ret’ [-Werror=unused-variable]
   33 |  int ret;
      |      ^~~

Define the variable ret as __maybe_unused.

Fixes: 191636e44898 ("riscv: Introduce SPL_SMP Kconfig option for U-Boot SPL")
Fixes: 8c59f2023cc8 ("riscv: add SPL support")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Bin Meng <bin.meng@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Rick Chen <rick@andestech.com>
Reviewed-by: Pragnesh Patel <pragnesh.patel@openfive.com>
4 years agoclk: kendryte/pll.h: do not redefine nop()
Heinrich Schuchardt [Tue, 28 Jul 2020 15:52:23 +0000 (17:52 +0200)]
clk: kendryte/pll.h: do not redefine nop()

The kendryte PLL code uses nop as barrier. The macro is not defined for
the sandbox on x86 but is defined on RISC-V.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Bin Meng <bin.meng@windriver.com>
4 years agoram: sifive: Fix compiler warnings for 32-bit
Bin Meng [Tue, 18 Aug 2020 08:09:21 +0000 (01:09 -0700)]
ram: sifive: Fix compiler warnings for 32-bit

priv->info.size is of type 'size_t' but the length modifier is l.
Fix this by casting priv->info.size. Note 'z' cannot be used as
the modifier as SPL does not support that.

Signed-off-by: Bin Meng <bin.meng@windriver.com>
Reviewed-by: Rick Chen <rick@andestech.com>
Reviewed-by: Pragnesh Patel <pragnesh.patel@openfive.com>
4 years agoriscv: fu540: Use correct API to get L2 cache controller base address
Bin Meng [Tue, 18 Aug 2020 08:09:20 +0000 (01:09 -0700)]
riscv: fu540: Use correct API to get L2 cache controller base address

At present fdtdec_get_addr() is used to get L2 cache controller base
address. This only works for a fixed #address-cells and #size-cells.
Change to use fdtdec_get_addr_size_auto_parent() instead.

Signed-off-by: Bin Meng <bin.meng@windriver.com>
Reviewed-by: Rick Chen <rick@andestech.com>
Reviewed-by: Pragnesh Patel <pragnesh.patel@openfive.com>
4 years agoMerge tag 'efi-2020-10-rc3-3' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi
Tom Rini [Mon, 24 Aug 2020 21:28:18 +0000 (17:28 -0400)]
Merge tag 'efi-2020-10-rc3-3' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi

Pull request for UEFI sub-system for efi-2020-10-rc3 (3)

The following bug fixes are contained in this pull-request:

* ResetSystem() should no hang if not implemented.
* Device paths in Bootxxxx variables should be verified.
* Use ':' as separator for command setenv -e -i instead of ','.
* Correct comments for functions.
* Update UEFI documentation.

4 years agoxen: Code style conformity
Anastasiia Lukianenko [Fri, 21 Aug 2020 09:10:04 +0000 (12:10 +0300)]
xen: Code style conformity

Cleaning up the following:

ERROR: do not use assignment in if condition
#281: FILE: drivers/xen/pvblock.c:260:
+       if ((err = xenbus_switch_state(XBT_NIL, nodename,
CHECK:COMPARISON_TO_NULL: Comparison to NULL could be written "err"
#52: FILE: drivers/xen/pvblock.c:298:
+       if (err != NULL) {
ERROR: do not use assignment in if condition
#176: FILE: drivers/xen/gnttab.c:103:
+               if ((flags = nflags) & (GTF_reading | GTF_writing)) {
WARNING: Missing or malformed SPDX-License-Identifier tag in line 1
#329: FILE: include/xen/gnttab.h:1:
+/*
WARNING: Misplaced SPDX-License-Identifier tag - use line 1 instead
#330: FILE: include/xen/gnttab.h:2:
+ * SPDX-License-Identifier: GPL-2.0
ERROR: do not use assignment in if condition
#630: FILE: lib/sscanf.c:558:
+                               if ((n = inr) < width) {

Signed-off-by: Anastasiia Lukianenko <anastasiia_lukianenko@epam.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agoboard: xen: Remove unnecessary CONFIG_INITRD_TAG and CONFIG_CMDLINE_TAG
Anastasiia Lukianenko [Fri, 21 Aug 2020 09:10:03 +0000 (12:10 +0300)]
board: xen: Remove unnecessary CONFIG_INITRD_TAG and CONFIG_CMDLINE_TAG

Signed-off-by: Anastasiia Lukianenko <anastasiia_lukianenko@epam.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agoboard: xen: Remove CONFIG_CMD_RUN define and clean xenguest_arm64_defconfig
Anastasiia Lukianenko [Fri, 21 Aug 2020 09:10:02 +0000 (12:10 +0300)]
board: xen: Remove CONFIG_CMD_RUN define and clean xenguest_arm64_defconfig

CONFIG_CMD_RUN is set on by default in Kconfig.
Create xenguest_arm64_defconfig by using savedefconfig to avoid unnecessary
options.

Signed-off-by: Anastasiia Lukianenko <anastasiia_lukianenko@epam.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agoMAINTAINERS: Add maintainers to XEN section
Anastasiia Lukianenko [Fri, 21 Aug 2020 09:10:01 +0000 (12:10 +0300)]
MAINTAINERS: Add maintainers to XEN section

Signed-off-by: Anastasiia Lukianenko <anastasiia_lukianenko@epam.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agoboard: xen: Remove unnecessary CONFIG_BOARD_EARLY_INIT_F define and board_early_init_...
Anastasiia Lukianenko [Fri, 21 Aug 2020 09:10:00 +0000 (12:10 +0300)]
board: xen: Remove unnecessary CONFIG_BOARD_EARLY_INIT_F define and board_early_init_f function

Signed-off-by: Anastasiia Lukianenko <anastasiia_lukianenko@epam.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
4 years agoarm: dts: mt7623: add USB nodes
Frank Wunderlich [Thu, 20 Aug 2020 14:37:58 +0000 (16:37 +0200)]
arm: dts: mt7623: add USB nodes

This adds USB nodes for MT7623/BPI-R2

Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
Reviewed-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
4 years agoarm: dts: mt7622: add USB nodes
Frank Wunderlich [Thu, 20 Aug 2020 14:37:57 +0000 (16:37 +0200)]
arm: dts: mt7622: add USB nodes

Add DTS nodes for MT7622/BPI-R64

Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
Reviewed-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
4 years agoarm: dts: rename mt7622-bpi-r64.dts
Frank Wunderlich [Thu, 20 Aug 2020 14:37:56 +0000 (16:37 +0200)]
arm: dts: rename mt7622-bpi-r64.dts

rename mt7622-bpi-r64.dts to mt7622-bananapi-bpi-r64.dts
to follow naming convensions

Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
4 years agoclk: mt7622: add needed clocks for ssusb-node
Frank Wunderlich [Thu, 20 Aug 2020 14:37:55 +0000 (16:37 +0200)]
clk: mt7622: add needed clocks for ssusb-node

MT7622 needs additional clock definitions to work properly

Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
4 years agoahci: mediatek: fix copyright and author-lines
Frank Wunderlich [Thu, 20 Aug 2020 14:37:54 +0000 (16:37 +0200)]
ahci: mediatek: fix copyright and author-lines

after review of sam copyright should be on one line and link should
not between author lines

just remove the link and put ryder first as he is author of linux-driver

Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
4 years agoreset: drop unnecessary comment for pciesys
Frank Wunderlich [Thu, 20 Aug 2020 14:37:53 +0000 (16:37 +0200)]
reset: drop unnecessary comment for pciesys

after review from sam this comment should be removed

Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
4 years agophy: mtk-tphy: make shared reg optional for v1
Frank Wunderlich [Thu, 20 Aug 2020 14:37:52 +0000 (16:37 +0200)]
phy: mtk-tphy: make shared reg optional for v1

make the shared reg optional when version is v1 for sata

Suggested-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
Reviewed-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
4 years agofs/squashfs: Fix Coverity Scan defects
Joao Marcos Costa [Wed, 19 Aug 2020 16:28:41 +0000 (18:28 +0200)]
fs/squashfs: Fix Coverity Scan defects

Fix defects such as uninitialized variables and untrusted pointer
operations. Most part of the tainted variables and the related defects
actually comes from Linux's macro get_unaligned_le**, extensively used
in SquashFS code. Add sanity checks for those variables.

Signed-off-by: Joao Marcos Costa <joaomarcos.costa@bootlin.com>
4 years agovirtio_blk: set log2blksz correctly
AKASHI Takahiro [Wed, 19 Aug 2020 09:07:32 +0000 (18:07 +0900)]
virtio_blk: set log2blksz correctly

'log2blksz' in blk_desc structure must always be initialized, otherwise
it will cause a lot of weird failures in file operations.

For example, fs_set_blk_dev[_with_part]() examines a block device against
every file system with its probe function. In particular, ext4 file
system's ext4_probe() will calls fs_devread() to fetch a super block.
If log2blksz is 0, the actual 'read' size, i.e. block_len >> log2blksz, is
much bigger than a buffer's size, and it can end up with memory corruption.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Fixes: f4802209e59d ("virtio: Add block driver support")
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agotest/py: Add tests for LZO and ZSTD
Joao Marcos Costa [Tue, 18 Aug 2020 15:17:25 +0000 (17:17 +0200)]
test/py: Add tests for LZO and ZSTD

Improve SquashFS tests architecture. Add 'Compression' class. LZO
algorithm may crash if the file is fragmented, so the fragments are
disabled when testing LZO.

Signed-off-by: Joao Marcos Costa <joaomarcos.costa@bootlin.com>
4 years agofs/squashfs: add support for LZO decompression
Joao Marcos Costa [Tue, 18 Aug 2020 15:17:24 +0000 (17:17 +0200)]
fs/squashfs: add support for LZO decompression

Add call to lzo's lzo1x_decompress_safe() into sqfs_decompress().

U-Boot's LZO sources may still have some unsolved issues that could make the
decompression crash when dealing with fragmented files, so those should be
avoided. The "-no-fragments" option can be passed to mksquashfs.

Signed-off-by: Joao Marcos Costa <joaomarcos.costa@bootlin.com>
4 years agofs/squashfs: add support for ZSTD decompression
Joao Marcos Costa [Tue, 18 Aug 2020 15:17:23 +0000 (17:17 +0200)]
fs/squashfs: add support for ZSTD decompression

Add call to ZSTD's ZSTD_decompressDCtx(). In this use case, the caller
can upper bound the decompressed size, which will be the SquashFS data
block (or metadata block) size, so there is no need to use streaming
API. Add ZSTD's worskpace to squashfs_ctxt structure.

Signed-off-by: Joao Marcos Costa <joaomarcos.costa@bootlin.com>
4 years agofs/squashfs: replace sqfs_decompress() parameter
Joao Marcos Costa [Tue, 18 Aug 2020 15:17:22 +0000 (17:17 +0200)]
fs/squashfs: replace sqfs_decompress() parameter

Replace 'u16 comp_type' by a reference to squashfs_ctxt structure.

Signed-off-by: Joao Marcos Costa <joaomarcos.costa@bootlin.com>
4 years agofs/squashfs: Add init and clean-up functions to decompression
Joao Marcos Costa [Tue, 18 Aug 2020 15:17:21 +0000 (17:17 +0200)]
fs/squashfs: Add init and clean-up functions to decompression

Add sqfs_decompressor_init() and sqfs_decompressor_cleanup(). These
functions are called respectively in sqfs_probe() and sqfs_close(). For
now, only ZSTD requires an initialization logic. ZSTD support will be
added in a follow-up commit.

Move squashfs_ctxt definition to sqfs_filesystem.h. This structure is
passed to sqfs_decompressor_init() and sqfs_decompressor_cleanup(), so
it can no longer be local to sqfs.c.

Signed-off-by: Joao Marcos Costa <joaomarcos.costa@bootlin.com>
4 years agocmd: fix clone coverity scan
John Chau [Mon, 17 Aug 2020 07:53:01 +0000 (15:53 +0800)]
cmd: fix clone coverity scan

This patch fixes coverity scan MISSING_BREAK issues, and also an error
on block size check.

Signed-off-by: John Chau <john@harmon.hk>
4 years agofirmware: psci: Do not bind driver if U-Boot runs in EL3
Michal Simek [Thu, 13 Aug 2020 10:43:22 +0000 (12:43 +0200)]
firmware: psci: Do not bind driver if U-Boot runs in EL3

There is no reason to bind psci driver if U-Boot runs in EL3 because
SMC/HVC instructions can't be called. That's why detect this state and
don't let user to crash from prompt by performing reset or poweroff
commands (if enabled).

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
4 years agoboard: armltd: Add support for Total Compute platform
Usama Arif [Wed, 12 Aug 2020 15:12:53 +0000 (16:12 +0100)]
board: armltd: Add support for Total Compute platform

Total Compute is based on ARM architecture and has
the following features enabled in u-boot:
- PL011 UART
- PL180 MMC
- NOR Flash
- FIT image with Signature
- AVB

Signed-off-by: Usama Arif <usama.arif@arm.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
4 years agoavb: Make AVB independent of fastboot
Usama Arif [Tue, 11 Aug 2020 14:46:03 +0000 (15:46 +0100)]
avb: Make AVB independent of fastboot

AVB only uses CONFIG_FASTBOOT_BUF_ADDR from fastboot for memory.
This memory is used for assigning temporary buffers.
This can be assigned a new variable and used as CONFIG_AVB_BUF_ADDR.
This is to support future boards that support AVB but dont support
USB and therefore dont support FASTBOOT.

Signed-off-by: Usama Arif <usama.arif@arm.com>
Cc: Igor Opaniuk <igor.opaniuk@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Acked-by: Igor Opaniuk <igor.opaniuk@gmail.com>
[trini: Change defaults]
Signed-off-by: Tom Rini <trini@konsulko.com>
4 years agoefi_loader: use ':' as separator for setenv -i
Heinrich Schuchardt [Mon, 24 Aug 2020 06:27:49 +0000 (08:27 +0200)]
efi_loader: use ':' as separator for setenv -i

setenv -e -i <address>,<filesize> can be used to set a UEFI variable
from memory.

For separating an address and a size we use ':' in most commands.
Let's do the same for setenv -e -i.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agoefi_loader: validate device path length in boot manager
Heinrich Schuchardt [Sun, 23 Aug 2020 08:59:17 +0000 (10:59 +0200)]
efi_loader: validate device path length in boot manager

Bootxxxx variables are provided by the user and therefore cannot be
trusted. We have to validate them before usage.

A device path provided by a Bootxxxx variable must have an end node within
the indicated device path length.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agotest: unit test for efi_dp_check_length()
Heinrich Schuchardt [Sun, 23 Aug 2020 08:53:50 +0000 (10:53 +0200)]
test: unit test for efi_dp_check_length()

Provide a unit test for function efi_dp_check_length().

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agoefi_loader: efi_dp_check_length()
Heinrich Schuchardt [Sun, 23 Aug 2020 08:49:46 +0000 (10:49 +0200)]
efi_loader: efi_dp_check_length()

We need to check that device paths provided via UEFI variables are not
malformed.

Provide function efi_dp_check_length() to check if a device path has an
end node within a given number of bytes.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agoinclude: kernel.h: define SSIZE_MAX
Heinrich Schuchardt [Sun, 23 Aug 2020 07:54:44 +0000 (09:54 +0200)]
include: kernel.h: define SSIZE_MAX

Define SSIZE_MAX, the largest value fitting into a variable of type
ssize_t.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agoefi_selftest: substitute ResetSystem() by do_reset()
Heinrich Schuchardt [Sat, 22 Aug 2020 07:14:56 +0000 (09:14 +0200)]
efi_selftest: substitute ResetSystem() by do_reset()

If ResetSystem() is not implemented at runtime, call do_reset() after
test completion.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agoefi_selftest: add a test for ResetSystem()
Heinrich Schuchardt [Thu, 20 Aug 2020 10:16:54 +0000 (12:16 +0200)]
efi_selftest: add a test for ResetSystem()

The unit test will reset the system by calling the ResetSystem() runtime
service before or after ExitBootServices() according to the users choice
by setting environment variable efi_selftest to:

* 'reset system' or
* 'reset system runtime'.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agoefi_loader: ResetSystem() should not hang
Heinrich Schuchardt [Sat, 22 Aug 2020 06:29:53 +0000 (08:29 +0200)]
efi_loader: ResetSystem() should not hang

If ResetSystem() is not implemented at runtime, it should return instead
of hanging in an endless loop. This allows the operating system to reset
the system by other means as Linux does. It also matches what EDK II
suggests in comments for functions ResetShutdown() and ResetWarm() in
OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agodoc: update UEFI documentation
Heinrich Schuchardt [Sun, 16 Aug 2020 10:27:19 +0000 (12:27 +0200)]
doc: update UEFI documentation

* UEFI variables can be persisted
* describe that the sequence of files loaded before bootefi matters

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agoefi_loader: remove empty comment line
Heinrich Schuchardt [Sat, 15 Aug 2020 21:09:35 +0000 (23:09 +0200)]
efi_loader: remove empty comment line

Remove a line leading to a warning in make htmldocs.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agoefi_loader: document parameters of do_bootefi_exec()
Heinrich Schuchardt [Sat, 15 Aug 2020 21:10:22 +0000 (23:10 +0200)]
efi_loader: document parameters of do_bootefi_exec()

Add the missing description of the load_options parameter.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agoMerge tag 'u-boot-clk-24Aug2020' of https://gitlab.denx.de/u-boot/custodians/u-boot-clk
Tom Rini [Mon, 24 Aug 2020 13:06:02 +0000 (09:06 -0400)]
Merge tag 'u-boot-clk-24Aug2020' of https://gitlab.denx.de/u-boot/custodians/u-boot-clk

- Add CCF clocks definitions for iMX6Q enet (ETH)
- Several fixes for CCF framework - the most notable is the one, which
  adds get_rate helper to clk-mux.c
- Improvements for clk command - better visibility and alignment.

4 years agoclk: ccf: Add missing #include <dm/uclass.h> to clk-mux.c
Lukasz Majewski [Mon, 24 Aug 2020 09:12:18 +0000 (11:12 +0200)]
clk: ccf: Add missing #include <dm/uclass.h> to clk-mux.c

After adding custom get_rate helper function it was necessary to include
<dm/uclass.h> to avoid warnings about missing uclass_get_device_by_name.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
Series-to: u-boot
4 years agocmd: clk: correctly handle depth for clk dump
Patrick Delaunay [Thu, 30 Jul 2020 12:04:10 +0000 (14:04 +0200)]
cmd: clk: correctly handle depth for clk dump

Update depth only when clock uclass is found to have correct display
of command "clk dump".

Without this patch, the displayed depth is the binding depth for
all the uclass and that can be strange as only clock uclass nodes
are displayed.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agocmd: clk: cosmetic: correct code alignment in show_clks
Patrick Delaunay [Thu, 30 Jul 2020 12:04:09 +0000 (14:04 +0200)]
cmd: clk: cosmetic: correct code alignment in show_clks

Correct code alignment in show_clks() function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agoclk: ccf: mux: change the get_rate helper
Dario Binacchi [Wed, 3 Jun 2020 13:36:25 +0000 (15:36 +0200)]
clk: ccf: mux: change the get_rate helper

The previous version of the get_rate helper does not work if the mux
clock parent is changed after the probe. This error has not been
detected because this condition has not been tested. The error occurs
because the set_parent helper does not change the parent of the clock
device but only the clock selection register. Since changing the parent
of a probed device can be tricky, the new version of the get_rate helper
provides the rate of the selected clock and not that of the parent.

Signed-off-by: Dario Binacchi <dariobin@libero.it>
4 years agoclk: ccf: mux: fix access to the sandbox register
Dario Binacchi [Sat, 2 May 2020 15:58:33 +0000 (17:58 +0200)]
clk: ccf: mux: fix access to the sandbox register

The tests developed for the mux clock are run on the sandbox. They don't
call the clk_mux_set_parent routine and therefore they do not detect
this error.

Signed-off-by: Dario Binacchi <dariobin@libero.it>
4 years agoclk: ccf: mux: fix typo
Dario Binacchi [Sat, 2 May 2020 15:58:32 +0000 (17:58 +0200)]
clk: ccf: mux: fix typo

Close the opening bracket.

Signed-off-by: Dario Binacchi <dariobin@libero.it>
4 years agoclk: ccf: mux: change include order
Dario Binacchi [Sat, 2 May 2020 15:58:31 +0000 (17:58 +0200)]
clk: ccf: mux: change include order

Apply u-boot coding style on include files order.

Signed-off-by: Dario Binacchi <dariobin@libero.it>
4 years agoclk: fix the console output of clk_register
Dario Binacchi [Sat, 2 May 2020 15:38:11 +0000 (17:38 +0200)]
clk: fix the console output of clk_register

The parent->name variable can be used only in case the
uclass_get_device_by_name routine returns successfully.

Signed-off-by: Dario Binacchi <dariobin@libero.it>