Commit graph

74252 commits

Author SHA1 Message Date
Ashok Reddy Soma
affcba728b mmc: zynq_sdhci: Allow configuring zero Tap values
Allow configuring ITAP and OTAP values with zero to avoid failures in
some cases (one of them is SD boot mode). Legacy, SDR12 modes require
to program the ITAP and OTAP values as zero, whereas for SDR50 and SDR104
modes ITAP value is zero.

In SD boot mode firmware configures the SD ITAP and OTAP values and
in this case u-boot has to re-configure required tap values(including zero)
based on the operating mode.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
2021-07-26 09:18:45 +02:00
Ashok Reddy Soma
8e34aa00e9 mmc: zynq_sdhci: Resolve uninitialized return value
set_phase() functions are not modifying the ret value and returning
the same uninitialized ret, return 0 instead.

Keep the return type as int to return errors when the tapdelay's are
set via xilinx_pm_request() in future.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
2021-07-26 09:18:45 +02:00
Ricardo Salveti
677a24cbc3 xilinx: zynqmp: increase CONFIG_SYS_SPL_MALLOC_SIZE to 16MB
commit 03f1f78a9b ("spl: fit: Prefer a malloc()'d buffer for loading
images")' changed the way buffer allocation worked for SPL to a more
flexible method.

For xilinx zynqmp the 1MB buffer is not necessarily enough when dealing
with complex fit images (e.g. containing FPGA/TF-A/OP-TEE/U-Boot
proper), which can easily reach up to 10MB, so increase the default
CONFIG_SYS_SPL_MALLOC_SIZE size to 16MB to cover more advanced
scenarios.

Signed-off-by: Ricardo Salveti <ricardo@foundries.io>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
2021-07-26 09:18:44 +02:00
Tom Rini
ec22c365e3 Pull request for efi-2021-10-rc1-3
Documentation:
 	provide Makefile documentation
 
 SMBIOS:
 	generate BIOS release date based on UEFI version
 	improve error handling in SMBIOS table generation
 
 UEFI:
 	correct handling of signed capsule if authentication if off
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEbcT5xx8ppvoGt20zxIHbvCwFGsQFAmD75MQACgkQxIHbvCwF
 GsRJSA//dN89UMt95N22v5LbmvjfBJUlLcq+FBBeHV6RxwEKwke11CSnXbrG/xq0
 +aGw/ZuONel63undx/3MWKQLjzd6WApjRWkTzkVryzyHYULiqn2JMtVy9whuoxjm
 IIGWdudnY+72IOI6jQr6Bg+979YuPjMYFDyVQCeXrgaDrCssGv1/2Vy9wB29Y0gm
 o5JDKQ1RfCU9CnsO8nYaa/sWek8KXMw/2q5My/cyV+pYDqEtTiwVLJHhp7t9pXYX
 fAhia8Kw/RqzWOcpeI0KE97r86tcoj0cBI6HxRFkfEyFkChwfwO7KuiP2uE/jZwK
 405ZntNIZBSqFMGidFu+DyuQCM5IRrok2NStAp/GBPpbd+TlRI6Kq3B/6b5dOn8D
 csMGo1XCJKcc90sie53f9t6blhJdDWXpt5Mz4g2cPBAoKSpITKf477iQG23R3VMF
 dorjcAZhXUkpA6gPhvjeNgd/NXBd6G8vJ4g4HKhJRghMRKPMfmD1/33p4Q8BcjBX
 NAgCZUkp3JfkB+FW8CZ/I0JgTVg5T9dO40xe8pMwWC1EmK9xC0+4S6FVf7gj8vSv
 MdFLuOQs94poiAc7UKoJ4+CCb9GZ6SGk3t2eJmQ00sTHjuG2JQTwa3msarh3skAB
 j0m9XAX+k9Ezr0rvBF4gIxPOCyEH0gSiDH9VOPwNDpn9LZSRUGM=
 =n6EU
 -----END PGP SIGNATURE-----

Merge tag 'efi-2021-10-rc1-3' of https://source.denx.de/u-boot/custodians/u-boot-efi

Pull request for efi-2021-10-rc1-3

Documentation:
	provide Makefile documentation

SMBIOS:
	generate BIOS release date based on UEFI version
	improve error handling in SMBIOS table generation

UEFI:
	correct handling of signed capsule if authentication if off
2021-07-24 16:41:25 -04:00
Tom Rini
7d4ce5ea53 Merge branch '2021-07-24-arm-and-platform-updates'
- dragonboard410c, synquacer, aspeed fixes / updates
- pl011 serial driver fixes
- Two generic arm bugfixes
2021-07-24 16:39:36 -04:00
Chen Baozi
91a043896d serial: pl011: Enable DEBUG_UART_PL011 in SPL
Commit b81406db51 ("arm: serial: Add debug UART capability to the
pl01x driver") add supports to use pl01x as a debug UART. However,
due to CONFIG_IS_ENABLED macro requires CONFIG_SPL_* prefix, the
_debug_uart_init() would not choose TYPE_PL011 in SPL build. This
patch fixes the bug by judging CONFIG_DEBUG_UART_PL011 explicitly.

Signed-off-by: Chen Baozi <chenbaozi@phytium.com.cn>
Reviewed-by: Simon Glass <sjg@chromium.org>
2021-07-24 08:57:53 -04:00
Chia-Wei Wang
bc7b38450b reset: ast2600: Fix missing reference operator
Fix missing reference operator '&' to correctly get
HW register addresses for writel().

Signed-off-by: Chia-Wei Wang <chiawei_wang@aspeedtech.com>
2021-07-24 08:57:53 -04:00
AKASHI Takahiro
d75f48a83d MAINTAINERS: correct the path of UEFI docs
Change the path from doc/uefi to doc/develop/uefi.

Fixes: commit d1ceeeff6c ("doc: Move UEFI under develop/")
Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2021-07-24 10:49:51 +02:00
AKASHI Takahiro
67778ff83a test/py: efi_capsule: align with efidebug syntax changes
After the commit c70f44817d ("efi_loader: simplify 'printenv -e'"),
"-all" option is no longer necessary.
Just remove them in the test script.

Fixes: c70f44817d ("efi_loader: simplify 'printenv -e'")
Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2021-07-24 10:49:51 +02:00
AKASHI Takahiro
86a3d43bff efi_loader: remove asm/setjmp.h from efi_api.h
In the commit c982874e93 ("efi_loader: refactor
efi_setup_loaded_image()"), setjmp-related definitions were moved to
efi_loaded_image_obj in efi_loader.h. So setjmp.h is no longer
refererenced in efi_api.h.

This also fixes some error when efi_api.h will be included in
mkeficapsule.c.

Fixes: c982874e93 ("efi_loader: refactor efi_setup_loaded_image()")
Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2021-07-24 10:49:51 +02:00
AKASHI Takahiro
c2cc60c1f9 efi_loader: capsule: remove authentication data
If capsule authentication is disabled and yet a capsule file is signed,
its signature must be removed from image data to flush.
Otherwise, the firmware will be corrupted after update.

Fixes: 04be98bd6b ("efi: capsule: Add support for uefi capsule
	authentication")
Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
2021-07-24 10:49:51 +02:00
AKASHI Takahiro
ef890f6331 efi_loader: capsule: remove unused guid
efi_guid_capsule_root_cert_guid is never used.
Just remove it.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2021-07-24 10:49:51 +02:00
Heinrich Schuchardt
c193d9bd28 smbios: error handling for invalid addresses
SMBIOS tables only support 32bit addresses. If we don't have memory here
handle the error gracefully:

* on x86_64 fail to start U-Boot
* during UEFI booting ignore the missing table

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
2021-07-24 10:49:51 +02:00
Pali Rohár
11275e4f72 smbios: Fix calculating BIOS Release Date
BIOS Release Date must be in format mm/dd/yyyy and must be release date.
U-Boot currently sets BIOS Release Date from U_BOOT_DMI_DATE macro which is
generated from current build timestamp.

Fix this issue by setting U_BOOT_DMI_DATE macro to U-Boot version which is
better approximation of U-Boot release date than current build timestamp.
Current U-Boot versioning is in format yyyy.mm so as a day choose 01.

Some operating systems are using BIOS Release Date for detecting when was
SMBIOS table filled or if it could support some feature (e.g. BIOS from
1990 cannot support features invented in 2000). So this change also ensures
that recompiling U-Boot from same sources but in different year does not
change behavior of some operating systems.

Macro U_BOOT_DMI_DATE is not used in other file than lib/smbios.c
so remove it from global autogenerated files and also from Makefile.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
2021-07-24 10:49:51 +02:00
Heinrich Schuchardt
1364029263 doc: fix board/openpiton/riscv64.rst
* remove duplicate heading to avoid build error with 'make htmldocs'
* length of underlines must match header
* use appropriate header levels
* fix type %s/linux/Linux/

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2021-07-24 10:49:51 +02:00
Heinrich Schuchardt
30c5cbf31b doc: remove qemu_capsule_update from index
Commit 316ab801c0 ("doc: Update CapsuleUpdate READMEs") deleted file
doc/board/emulation/qemu_capsule_update.rst. Update the index. this avoids

    doc/board/emulation/index.rst:6: WARNING:
    toctree contains reference to nonexisting document
    'board/emulation/qemu_capsule_update'

Fixes: 316ab801c0 ("doc: Update CapsuleUpdate READMEs")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2021-07-24 10:49:51 +02:00
Simon Glass
00ac4b414f doc: Bring in Makefile documentation
U-Boot uses the Linux Kbuild build system. Add the associated
documentation so that people can understand the Makefiles better.

This is taken from Linux v5.12

Signed-off-by: Simon Glass <sjg@chromium.org>
2021-07-24 10:49:51 +02:00
Chen Baozi
198201509a serial: pl011: Resend the character if FIFO is full in debug uart
pl01x_putc() might return -EAGAIN if there was no space in FIFO. In that
case, high-level caller should wait until there is space and resend the
character.

Signed-off-by: Chen Baozi <chenbaozi@phytium.com.cn>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
2021-07-23 18:53:46 -04:00
Siew Chin Lim
8f20c48079 command: Fix SMC and HVC maximum number of arguments
smc and hvc commands take upto 8 user input arguments, the maximum
number of arguments of the U_BOOT_CMD macro should set to 9.

Besides, fix the typo (arg7 -> arg6) in hvc command's help message.

Signed-off-by: Siew Chin Lim <elly.siew.chin.lim@intel.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2021-07-23 18:53:46 -04:00
Peter Hoyes
c48fec6e7c armv8: Initialize CNTFRQ if at highest exception level
CNTFRQ_EL0 is only writable from the highest supported exception
level on the platform. For Armv8-A, this is typically EL3, but
technically EL2 and EL3 are optional so it may need to be
initialized at EL2 or EL1. For Armv8-R, the highest exception
level is always EL2.

This patch moves the initialization outside of the switch_el
block and uses a new macro branch_if_not_highest_el which
dynamically detects whether it is at the highest supported
exception level.

Linux's docs state that CNTFRQ_EL0 should be initialized by the
bootloader. If not set, the the U-Boot prompt countdown hangs.

Signed-off-by: Peter Hoyes <Peter.Hoyes@arm.com>
2021-07-23 18:53:46 -04:00
Stephan Gerhold
ad7e967738 serial: serial_msm: Delay initialization to let pins stabilize
For some reason, the DragonBoard 410c aborts autoboot immediately if
U-Boot is started without LK. It looks like it picks up a single broken
character via serial and therefore believes a key was pressed to abort
autoboot.

After some debugging, it seems like adding some delay after pinctrl
setup but before UART initialization fixes the issue. It's also worth
mentioning that unlike when booting from LK, the pinctrl setup is
actually necessary when booting U-Boot without LK since UART is broken
if the pinctrl line is removed.

I suspect that reconfiguring the pins might take some time to stabilize
and if the UART controller is enabled too quickly it will pick up some
random noise. Adding a few milliseconds of delay fixes the issue and
shouldn't have any other negative side effects.

3ms seems to be the minimum delay required in my tests, use 5ms instead
just to be sure.

Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
2021-07-23 18:53:46 -04:00
Stephan Gerhold
ccb8de2387 board: dragonboard410c: Fix fastboot
At the moment pressing the volume down key does not actually launch
fastboot. This is because setting "bootdelay" to "-1" actually
disables autoboot and drops to the U-Boot console. It does not execute
the "bootcmd".

The correct value for "bootdelay" here would be "-2", which disables
the delay and key checking and would immediately execute the "bootcmd".

However, even better in this case is using "preboot" to trigger Fastboot.
The advantage is that running "fastboot continue" will actually continue
the autoboot process instead of ending up in the U-Boot shell.

Also make sure to unset "preboot" again immediately in case the user
saves the environment after triggering fastboot.

Cc: Ramon Fried <rfried.dev@gmail.com>
Fixes: aa043ee91a ("db410c: automatically launch fastboot")
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
2021-07-23 18:53:46 -04:00
Stephan Gerhold
1d667227ea board: dragonboard410c: Fix PHYS_SDRAM_1_SIZE
The DragonBoard 410c has proprietary firmware from Qualcomm that
reserves 8 MiB of memory for tz/smem/hyp/rmtfs/rfsa from 0x86000000
to 0x86800000. I'm not aware of any ATF (ARM Trusted Firmware) port
for DB410c that would reserve 30 MiB of memory at the end of RAM.
I suspect the comment might have been copied from hikey.h which has
a very similar comment (and which actually does have an ATF port).

Reducing the memory size just prevents U-Boot from using the end of
the RAM, not the reserved region inbetween. Therefore we might as well
display the correct DRAM size (1 GiB) instead of strange 986 MiB.

Fixes: 626f048bbc ("board: Add Qualcomm Dragonboard 410C support")
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
2021-07-23 18:53:45 -04:00
Stephan Gerhold
0204d1b56b board: dragonboard410c: Load U-Boot directly without LK
At the moment the U-Boot port for the DragonBoard 410c is designed
to be loaded as an Android boot image after Qualcomm's Little Kernel (LK)
bootloader. This is simple to set up but LK is redundant in this case,
since everything done by LK can be also done directly by U-Boot.

Dropping LK entirely has at least the following advantages:
  - Easier installation/board code (no need for Android boot images)
  - (Slightly) faster boot
  - Boot directly in 64-bit without a round trip to 32-bit for LK

So far this was not possible yet because of unsolved problems:

  1. Signing tool: The firmware expects a "signed" ELF image with extra
     (Qualcomm-specific) ELF headers, usually used for secure boot.
     The DragonBoard 410c does not have secure boot by default but the
     extra ELF headers are still required.

  2. PSCI bug: There seems to be a bug in the PSCI implementation
     (part of the TrustZone/tz firmware) that causes all other CPU cores
     to be started in 32-bit mode if LK is missing in the boot chain.
     This causes Linux to hang early during boot.

There is a solution for both problems now:

  1. qtestsign (https://github.com/msm8916-mainline/qtestsign)
     can be used as a "signing" tool for U-Boot and other firmware.

  2. A workaround for the "PSCI bug" is to execute the TZ syscall when
     entering U-Boot. That way PSCI is made aware of the 64-bit switch
     and starts all other CPU cores in 64-bit mode as well.

Simplify the dragonboard410c board by removing all the extra code that
is only used to build an Android boot image that can be loaded by LK.
This allows dropping the custom linker script, special image magic,
as well as most of the special build/installation instructions.

CONFIG_REMAKE_ELF is used to build a new ELF image that has both U-Boot
and the appended DTB combined. The resulting u-boot.elf can then be
passed to the "signing" tool (e.g. qtestsign).

The PSCI workaround is placed in the "boot0" hook that is enabled
with CONFIG_ENABLE_ARM_SOC_BOOT0_HOOK. The extra check for EL1 allows
compatibility with custom firmware that enters U-Boot in EL2 or EL3,
e.g. qhypstub (https://github.com/msm8916-mainline/qhypstub).

As a first step these changes apply only to DragonBoard410c.
Similar changes could likely also work for the DragonBoard 820c.

Note that removing LK wouldn't be possible that easily without a lot of
work already done three years ago by Ramon Fried. A lot of missing
initialization, pinctrl etc was already added back then even though
it was not strictly needed yet.

Cc: Ramon Fried <rfried.dev@gmail.com>
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
2021-07-23 18:53:45 -04:00
Masami Hiramatsu
10189cb700 configs: synquacer: Ignore OsIndications on DeveloperBox
Since we can not set OsIndications from Runtime Services
SetVariables at this moment, it is better to ignore the
OsIndications if there is any capsule file in the
correct place.

Signed-off-by: Masami Hiramatsu <masami.hiramatsu@linaro.org>
2021-07-23 18:53:45 -04:00
Masami Hiramatsu
9e2c1fefde configs: synquacer: Use RAW capsule image instead of FIT
Since the recent commit;

 commit b891ff18f8 ("efi_loader: Force a single FMP instance per hardware store")

forces a single FMP instances for a storage, we can not
enable both RAW and FIT capsule image support at once.
Since RAW capsule image support is simpler than FIT,
enable RAW capsule image instead of FIT by default.

Signed-off-by: Masami Hiramatsu <masami.hiramatsu@linaro.org>
2021-07-23 18:53:45 -04:00
Masami Hiramatsu
f4f11985bd configs: synquacer: Enable UEFI secure boot
Enable UEFI secure boot on synquacer. Note that unless user
setup their keys, the secure boot will not work.

Signed-off-by: Masami Hiramatsu <masami.hiramatsu@linaro.org>
2021-07-23 18:53:45 -04:00
Masami Hiramatsu
62c0136f36 configs: synquacer: Drop Ext2/4 support by default
Since the U-Boot for the SynQuacer DeveloperBox is designed for
compatible with EDK2 boot, we don't need to support Ext2/4 fs
support by default. Drop it.

Signed-off-by: Masami Hiramatsu <masami.hiramatsu@linaro.org>
2021-07-23 18:53:45 -04:00
Masami Hiramatsu
59bd18d4c4 configs: synquacer: Remove mtdparts settings and update DFU setting
Since MTD partitions are based on the devicetree name,
remove unneeded mtdparts settings and update DFU setting.

Signed-off-by: Masami Hiramatsu <masami.hiramatsu@linaro.org>
2021-07-23 18:53:45 -04:00
Masami Hiramatsu
11cd1d6a34 dts: synquacer: Add partition information to the spi-nor
Add partition information to the spi-nor flash.
This is required for accessing NOR flash via mtdparts.

Signed-off-by: Masami Hiramatsu <masami.hiramatsu@linaro.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
2021-07-23 18:53:45 -04:00
Masami Hiramatsu
f7e16bb0c5 configs: synquacer: Make U-Boot binary position independent
Make the U-Boot binary for SynQuacer position independent so
that the previous bootloader (SCP firmware or BL2) can load
the U-Boot anywhere.

Signed-off-by: Masami Hiramatsu <masami.hiramatsu@linaro.org>
2021-07-23 18:53:45 -04:00
Masami Hiramatsu
1ad3c8365a board: synquacer: Initialize SCBM SMMU at board_init()
Since the SCBM SMMU is not only connected to the NETSEC
but also shared with the F_SDH30 (eMMC controller), that
should be initialized at board level instead of NETSEC.

Move the SMMU initialization code into board support
and call it from board_init().

Without this fix, if the NETSEC is disabled, the Linux
eMMC ADMA cause an error because SMMU is not initialized.

Signed-off-by: Masami Hiramatsu <masami.hiramatsu@linaro.org>
2021-07-23 18:53:45 -04:00
Tom Rini
edecc15eb9 Merge branch '2021-07-23-reboot-mode-and-cryptfs-passwd-support'
- A new driver uclass is created to handle the reboot mode control.
- Add support for libcrypt-style passwords for autoboot
2021-07-23 14:50:43 -04:00
Steffen Jaeckel
25c8b9f298 test: add first autoboot unit tests
This adds tests for the crypt-based and plain SHA256-based password hashing
algorithms in the autoboot flow.

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
2021-07-23 13:36:20 -04:00
Steffen Jaeckel
33198740ac common: add support to fallback to plain SHA256
In case crypt-based hashing is enabled this will be the default mechanism
that is used. If a user wants to have support for both, the environment
variable `bootstopusesha256` can be set to `true` to allow plain SHA256
based hashing of the password.

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
2021-07-23 13:36:20 -04:00
Steffen Jaeckel
d199c3ab1c common: add AUTOBOOT_FLUSH_STDIN option
The key-sequence based unlock mechanisms are sensitive to junk symbols
that could have been sent to stdin and are still waiting to be retrieved.
Enabling this option will read all symbols off stdin before displaying the
autoboot prompt (and starting to read the password from stdin).

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
2021-07-23 13:36:20 -04:00
Steffen Jaeckel
6c0ce6d3ca common: allow disabling of timeout for password entry
In case a user has to enter a complicated password it is sometimes
desireable to give the user more time than the default timeout.
Enabling this feature will disable the timeout entirely in case the user
presses the <Enter> key before entering any other character.

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
2021-07-23 13:36:20 -04:00
Steffen Jaeckel
1b2d68033b common: Rename macro appropriately
While doing code-review internally this got nitpicked by 2 reviewers, so
I decided to include this here.

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>
2021-07-23 13:36:20 -04:00
Steffen Jaeckel
1a4a778666 common: integrate crypt-based passwords
Hook into the autoboot flow as an alternative to the existing
mechanisms.

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>
2021-07-23 13:36:20 -04:00
Steffen Jaeckel
29bbe71ccf lib: wrap crypt API to hide errno usage
In order to prevent using the global errno, replace it with a static
version and create a wrapper function which returns the error value.

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>
2021-07-23 13:36:20 -04:00
Steffen Jaeckel
26dd993657 lib: add crypt subsystem
Add the basic functionality required to support the standard crypt
format.
The files crypt-sha256.c and crypt-sha512.c originate from libxcrypt and
their formatting is therefor retained.
The integration is done via a crypt_compare() function in crypt.c.

```
libxcrypt $ git describe --long --always --all
tags/v4.4.17-0-g6b110bc
```

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>
2021-07-23 13:36:14 -04:00
Nandor Han
c74675bd90 reboot-mode: read the boot mode from RTC memory
RTC devices could provide battery-backed memory that can be used for
storing the reboot mode magic value.

Add a new reboot-mode back-end that uses RTC to store the reboot-mode
magic value. The driver also supports both endianness modes.

Signed-off-by: Nandor Han <nandor.han@vaisala.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2021-07-23 10:16:39 -04:00
Nandor Han
f9db2f16cb reboot-mode: read the boot mode from GPIOs status
A use case for controlling the boot mode is when the user wants
to control the device boot by pushing a button without needing to
go in user-space.

Add a new backed for reboot mode where GPIOs are used to control the
reboot-mode. The driver is able to scan a predefined list of GPIOs
and return the magic value. Having the modes associated with
the magic value generated based on the GPIO values, allows the
reboot mode uclass to select the proper mode.

Signed-off-by: Nandor Han <nandor.han@vaisala.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2021-07-23 10:16:39 -04:00
Nandor Han
2541ce2c1a reboot-mode: add support for reboot mode control
A new driver uclass is created to handle the reboot mode control.

The new uclass driver is updating an environment variable with the
configured reboot mode. The mode is extracted from a map provided
at initialization time. The map contains a list of modes
and associated ids.

Signed-off-by: Nandor Han <nandor.han@vaisala.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2021-07-23 10:16:39 -04:00
Tom Rini
f534d93cbf Merge branch '2021-07-23-assorted-fixes'
- Assorted FIT, optee, pcf8575, mux, vexpress64 and distro bootcmd fixes.
- Allow pinmux status to take pin names
2021-07-23 08:30:48 -04:00
Michal Simek
988002dcd9 net: remove CONFIG_NET_MULTI (again)
CONFIG_NET_MULTI has been removed long time ago by commit 795428fc67
("net: remove CONFIG_NET_MULTI") but 4 boards were added later which wasn't
found.  The patch is removing this reference from 4 boards.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
2021-07-23 07:13:25 -04:00
Patrick Wildt
0523326af4 mux: correct prototype for mux_control_try_select()
The macro should be passed a state, which should be passed
to the actual function.  Otherwise using that macro would
yield a build error.

Signed-off-by: Patrick Wildt <patrick@blueri.se>
Reviewed-by: Pratyush Yadav <p.yadav@ti.com>
2021-07-23 07:13:25 -04:00
Andre Przywara
d3c1b514dc arm: vexpress64: juno: Enable distro_bootcmd functionality
The ARM Juno boards can be used as somewhat decent machines to run
off-the-shelf distributions, with USB, SATA, GBit Ethernet and 8GB of
DRAM.

With stable DTs in the board's NOR flash this would work really nicely,
however the default boot command is to fetch a kernel and an initrd from
the on-board NOR flash, which sounds somewhat embedded.

Include the config_distro_bootcmd.h header and define the available
devices (starting with USB, to catch USB installer sticks) to make
distributions and UEFI work out of the box.
The NOR flash kernel functionality is still preserved as the last
resort, should all other methods fail.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
2021-07-23 07:13:25 -04:00
Andre Przywara
ccadfca251 distro_boot: Fix block device after DHCP boot sequence
The generic distro boot sequence iterates over several types of devices,
trying one after another. In doing do, it starts with setting the
"devtype" variable, then uses this later in more generic commands.

Now most (block) device types use a local variable for that, but DHCP
puts the type into the environment, where it shadows any local variables.
As a consequence any boot attempt after bootcmd_dhcp has been run fails:
===========================
VExpress64# run bootcmd_dhcp
...
VExpress64# run bootcmd_sata0
SATA#0:
        (3.0 Gbps)
SATA#1:
        (No RDY)
Device 0: Model: 16GB SATA Flash Drive  ....
... is now current device
Couldn't find partition dhcp 0:1
===========================
This problem typically doesn't show, because DHCP is mostly the last
command to try, but is a problem when this order is different, or when
distro_bootcmd or bootcmd_xxx are run separately or multiple times.

Let bootcmd_dhcp use a local variable, as the other kids do, to make the
order of boot commands irrelevant, and allow repeated calls.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2021-07-23 07:13:25 -04:00
Tom Rini
55adabbbfc Kconfig.boot: Make 0x0 the default SYS_TEXT_BASE for POSITION_INDEPENDENT
When we build U-Boot with POSITION_INDEPENDENT we must have
SYS_TEXT_BASE be set to zero.  Make this the default in that case.

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Mark Kettenis <kettenis@openbsd.org>
2021-07-23 07:13:25 -04:00