]> git.ipfire.org Git - thirdparty/u-boot.git/log
thirdparty/u-boot.git
4 years agotools: k3_fit_atf: Fix DM binary FIT load addresses
Suman Anna [Sat, 14 Aug 2021 06:49:01 +0000 (01:49 -0500)] 
tools: k3_fit_atf: Fix DM binary FIT load addresses

The DM binary runs on the MCU R5F Core0 after R5 SPL on J721E and J7200
SoCs. The binary is built alongside the TFA, OPTEE and A72 SPL binaries
and included in the tispl.bin FIT image. The R5 SPL loads the DM binary
at 0xA0000000 address, based on the value used in the FIT image build
script. The DM binary though is an ELF image and not a regular binary
file, and so is processed further to load the actual program segments
using the U-Boot's standard ELF loader library.

The DM binary does leverage a certain portion of DDR for its program
segments, and typically reserves 16 MB of DDR at 0xA0000000 with the
1st MB used for IPC between Linux and the remote processor, and
remaining memory for firmware segments. This can cause an incomplete
loading of the program segments if the DM binary is larger than 1 MB,
due to overlap of the initial loaded binary and the actual program
segments.

Fix this by using the address 0x89000000, which matches the current
"addr_mcur5f0_0load" env variable used by R5 SPL before the DM firmware
inclusion into the tispl.bin.

Fixes: df5363a67f35 ("tools: k3_fit_atf: add DM binary to the FIT image")
Signed-off-by: Suman Anna <s-anna@ti.com>
4 years agoarm: dts: k3-am642-evm-u-boot: Add u-boot, dm-spl tag in the pinmux node of mmc1
Aswath Govindraju [Mon, 9 Aug 2021 17:02:23 +0000 (22:32 +0530)] 
arm: dts: k3-am642-evm-u-boot: Add u-boot, dm-spl tag in the pinmux node of mmc1

Add u-boot,dm-spl tag in the pinmux device tree node, required for MMCSD1
subsystem.

Fixes: b6059ddc45b9 ("arm: dts: k3-am642: Add r5 specific dt support")
Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
4 years agoam33xx: Fix USB for am335x boards
Matwey V. Kornilov [Sat, 7 Aug 2021 11:17:38 +0000 (14:17 +0300)] 
am33xx: Fix USB for am335x boards

USB nodes were mistakenly disabled in

    commit 942853dd96df ("arm: dts: Resync BeagleBone device trees")

This commit is to fix the following issue:

    starting USB...
    No working controllers found
    USB is stopped. Please issue 'usb start' first.
    starting USB...
    No working controllers found

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=0782e8572ce43f521ed6ff15e4a7ab9aa5acdc85
Fixes: 942853dd96df ("arm: dts: Resync BeagleBone device trees")
Signed-off-by: Matwey V. Kornilov <matwey.kornilov@gmail.com>
Reviewed-by: Paul Barker <paul.barker@sancloud.com>
4 years agoinclude: configs: am64x_evm: Add env variables for booting to kernel using USB MSC...
Aswath Govindraju [Wed, 4 Aug 2021 13:12:46 +0000 (18:42 +0530)] 
include: configs: am64x_evm: Add env variables for booting to kernel using USB MSC device

Add env variables for booting to kernel from USB MSC device. The second
partition in the USB MSC device needs to formatted as ext4 file system with
kernel and dtb images, present in the /boot folder.

Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
4 years agoenvironment: ti: mmc.h: Make the finduuid generic for usage across different device...
Aswath Govindraju [Wed, 4 Aug 2021 13:12:45 +0000 (18:42 +0530)] 
environment: ti: mmc.h: Make the finduuid generic for usage across different device types

Make finduuid generic by making it dependent on the boot variable. For
example, this can now be used for finding the uuid of partitions in usb
device too.

Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
4 years agoboard: ti: am64x: Add support for fixing dr_mode while booting from USB
Aswath Govindraju [Wed, 4 Aug 2021 13:12:44 +0000 (18:42 +0530)] 
board: ti: am64x: Add support for fixing dr_mode while booting from USB

Fix the dr_mode in the U-Boot device tree blob, by reading the mode field
from the USB Boot Configuration fields. The dr_mode will only be fixed when
booting from USB.

Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
4 years agoARM: omap3: evm: Enable booting 'fitImage' with DEFAULT_FIT_TI_ARGS
Derald D. Woods [Mon, 2 Aug 2021 03:46:19 +0000 (03:46 +0000)] 
ARM: omap3: evm: Enable booting 'fitImage' with DEFAULT_FIT_TI_ARGS

This commit uses the existing DEFAULT_MMC_TI_ARGS and
DEFAULT_FIT_TI_ARGS defintions to replace the 'mmc*' environment
variables in the configuration. The check for the 'boot_fit' is handled
like the 'am335x_*' boards with 'CONFIG_BOOTCOMMAND'.

Signed-off-by: Derald D. Woods <woods.technical@gmail.com>
4 years agoarm: am335x: Enable SPL_OF_CONTROL on some configs
Tom Rini [Sat, 31 Jul 2021 23:21:58 +0000 (19:21 -0400)] 
arm: am335x: Enable SPL_OF_CONTROL on some configs

Both am335x_boneblack_vboot and am335x_evm_spiboot require
SPL_OF_CONTROL to function but are currently missing this option.  Add
it.

Signed-off-by: Tom Rini <trini@konsulko.com>
4 years agoMerge https://source.denx.de/u-boot/custodians/u-boot-marvell
Tom Rini [Fri, 10 Sep 2021 12:24:19 +0000 (08:24 -0400)] 
Merge https://source.denx.de/u-boot/custodians/u-boot-marvell

- mvebu: dts: Armada8k enable mdio (Sven)
- a37xx: pci: Fix / enhance error handling (Pali)
- mvebu: espressobin/turris_: Enable GPT partition support (Pali)
- mvebu: sata_mv: Probe all ports (Tony)
- a37xx: pci: Don't spam about PIO Response Status (Marek)

4 years agommc: fix device_remove when HS400_ES is enabled
Ye Li [Tue, 17 Aug 2021 09:20:34 +0000 (17:20 +0800)] 
mmc: fix device_remove when HS400_ES is enabled

HS400_ES is missed when down grade to HS mode during
device_remove the mmc device

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
4 years agommc: fix switch issue with send_status disabled
Ye Li [Tue, 17 Aug 2021 09:20:33 +0000 (17:20 +0800)] 
mmc: fix switch issue with send_status disabled

When send_status is false or wait_dat0 is not supported, the switch
function should not send CMD13 but directly return.

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
4 years agodoc: usage: mmc: Document usage of speed mode in "mmc dev" and "mmc rescan"
Aswath Govindraju [Fri, 13 Aug 2021 17:34:42 +0000 (23:04 +0530)] 
doc: usage: mmc: Document usage of speed mode in "mmc dev" and "mmc rescan"

Add documentation on the usage of "mmc dev" and "mmc rescan" commands to
set user defined speed modes.

Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
4 years agommc: Add support for enumerating MMC card in a given mode using mmc command
Aswath Govindraju [Fri, 13 Aug 2021 17:34:41 +0000 (23:04 +0530)] 
mmc: Add support for enumerating MMC card in a given mode using mmc command

Add support for enumerating MMC card in a given mode using mmc rescan and
mmc dev commands. The speed mode is provided as the last argument in these
commands and is indicated using the index from enum bus_mode in
include/mmc.h. A speed mode can be set only if it has already been enabled
in the device tree.

Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
Tested-by: Jaehoon Chung <jh80.chung@samsung.com>
4 years agoRevert "mmc: sdhci: set to INT_DATA_END when there are data"
Yuezhang.Mo@sony.com [Wed, 17 Mar 2021 06:44:37 +0000 (06:44 +0000)] 
Revert "mmc: sdhci: set to INT_DATA_END when there are data"

This reverts commit 17ea3c862865c0d704646f67dbf8412f9ff54f59.

In eMMC specification, for the response-with-busy(R1b, R5b)
command, the DAT0 will driven to LOW as BUSY status, and in
sdhci specification, the transfer complete bit should be wait
for BUSY status de-assert.

All response-with-busy commands don't contain data, the data
judgement is no need.

Signed-off-by: Yuezhang.Mo <Yuezhang.Mo@sony.com>
Reviewed-by: Andy Wu <Andy.Wu@sony.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
4 years agoarm: a37xx: pci: Don't spam about PIO Response Status
Marek Behún [Tue, 7 Sep 2021 15:27:08 +0000 (17:27 +0200)] 
arm: a37xx: pci: Don't spam about PIO Response Status

Use dev_dbg() instead of dev_err() in pcie_advk_check_pio_status().

For example CRS is not an error status, it just says that the request
should be retried.

Without this, U-Boot spams the terminal with
  pcie_advk pcie@d0070000: Non-posted PIO Response Status: UR, 0xc80 @ 0x100000
  pcie_advk pcie@d0070000: Non-posted PIO Response Status: UR, 0xc80 @ 0x108000
  pcie_advk pcie@d0070000: Non-posted PIO Response Status: UR, 0xc80 @ 0x110000
  pcie_advk pcie@d0070000: Non-posted PIO Response Status: UR, 0xc80 @ 0x120000
  pcie_advk pcie@d0070000: Non-posted PIO Response Status: UR, 0xc80 @ 0x128000
  pcie_advk pcie@d0070000: Non-posted PIO Response Status: UR, 0xc80 @ 0x130000
  ...
when a device is not connected to a PCIe switch (Unsupported Request
from the switch).

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
4 years agoarm: marvell: Dreamplug: fix typo in eth1 name
Tony Dinh [Mon, 6 Sep 2021 23:28:35 +0000 (16:28 -0700)] 
arm: marvell: Dreamplug: fix typo in eth1 name

Ethernet 1 should be ethernet-controller@76000.

Signed-off-by: Tony Dinh <mibodhi@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
4 years agoarm: mvebu : sata_mv should probe all ports
Tony Dinh [Sun, 5 Sep 2021 21:48:25 +0000 (14:48 -0700)] 
arm: mvebu : sata_mv should probe all ports

While a board could have multiple SATA ports, some of the ports might
not have a disk attached to them. So while probing for disks,
sata_mv_probe() should continue probing all ports, and skip one with
no disk attached.

Tests with:

- Seagate Goflex Net (Marvell Kirkwood 88F6281) out-of-tree u-boot.
- Zyxel NSA325 (Marvell Kirkwood 88F6282 out-of-tree u-boot.

Observation:

If a board has 2 or more SATA ports, and there is only one disk
attached to one of the ports, sata_mv_probe() does not return
a successful probe status. And if only one disk is attached to the
2nd port (i.e. port 1), it is not probed at all.

Patch Description:

Let sata_mv_probe() continues probing all ports, even if there
is error in probing a given port, and then return a successful
status if there is at least one port was probed successfully.

Signed-off-by: Tony Dinh <mibodhi@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
4 years agoarm: mvebu: a38x: Fix 5200000 baudrate
Pali Rohár [Thu, 2 Sep 2021 10:00:51 +0000 (12:00 +0200)] 
arm: mvebu: a38x: Fix 5200000 baudrate

Fix baudrate value 5150000 which was added in commit ead4864fa6cc ("arm:
mvebu: a38x: Define supported UART baudrates").

Exact value for divisor 3 with 250 MHz TCLK is 5208333 baudrate. In above
commit I incorrectly rounded it to 5150000 value due to testing with
USB-UART hw which incorrectly reported exact value and divisor configured
on other other end of UART link.

Fix this value to 520000 baudrate which is more close to the exact hardware
value and also has less fraction parts.

Signed-off-by: Pali Rohár <pali@kernel.org>
Fixes: ead4864fa6cc ("arm: mvebu: a38x: Define supported UART baudrates")
Reviewed-by: Stefan Roese <sr@denx.de>
4 years agoarm: mvebu: espressobin: Enable GPT partition support
Pali Rohár [Thu, 2 Sep 2021 08:46:37 +0000 (10:46 +0200)] 
arm: mvebu: espressobin: Enable GPT partition support

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
4 years agoarm: mvebu: turris_{omnia, mox}: GPT partition support
Pali Rohár [Thu, 2 Sep 2021 08:34:00 +0000 (10:34 +0200)] 
arm: mvebu: turris_{omnia, mox}: GPT partition support

This allows U-Boot to access filesystems on GPT partitioned disks.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
4 years agoarm: a37xx: pci: Implement re-issuing config requests on CRS response
Pali Rohár [Fri, 27 Aug 2021 12:14:44 +0000 (14:14 +0200)] 
arm: a37xx: pci: Implement re-issuing config requests on CRS response

According to PCIe base specification, if CRS Software Visibility is not
enabled, the Root Complex must re-issue the Configuration Request as a new
Request.

Normally this part of Root Complex is implemented in hardware but aardvark
is somehow special and does not implement it in hardware and expect that
handling of config requests are fully implemented in software.

This re-issuing functionality is required also because U-Boot does not
support CRS Software Visibility feature and therefore expects that Root
Complex re-issues requests as is specified in PCIe base specification.

Retry / re-issue config request up to the PIO_MAX_RETRIES, to prevent
infinite loop. After retry count exceed PIO_MAX_RETRIES, returns failure.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
4 years agoarm: a37xx: pci: Disable returning CRS response
Pali Rohár [Fri, 27 Aug 2021 12:14:43 +0000 (14:14 +0200)] 
arm: a37xx: pci: Disable returning CRS response

There was mistake in commit 4cd61c43fd51 ("arm: a37xx: pci: Fix handling
PIO config error responses"). U-Boot does not support handling of CRS
return value for PCI_VENDOR_ID config read request and also does not set
CRSSVE bit.

Therefore disable returning CRS response for now.

Signed-off-by: Pali Rohár <pali@kernel.org>
Fixes: 4cd61c43fd51 ("arm: a37xx: pci: Fix handling PIO config error responses")
Reviewed-by: Stefan Roese <sr@denx.de>
4 years agoarm: mvebu: dts: Armada8k enable mdio
Sven Auhagen [Tue, 24 Aug 2021 08:14:25 +0000 (10:14 +0200)] 
arm: mvebu: dts: Armada8k enable mdio

Since mvpp2 is using the new mdio driver and the cp110 has been
synced with the linux upstream, the mdio has to enabled in the
device tree file.
This is missing for some device tree files and therefore the
network cards do not come online.

Signed-off-by: Sven Auhagen <sven.auhagen@voleatech.de>
Reviewed-by: Stefan Roese <sr@denx.de>
4 years agoarm: kirkwood: Sheevaplug: Update board maintainer
Tony Dinh [Thu, 12 Aug 2021 21:33:34 +0000 (14:33 -0700)] 
arm: kirkwood: Sheevaplug: Update board maintainer

Change maintainer to me. Prafulla is no longer active in U-Boot community.

Signed-off-by: Tony Dinh <mibodhi@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
4 years agoMAINTAINERS: Update ARM TI entry
Lokesh Vutla [Fri, 3 Sep 2021 07:15:37 +0000 (12:45 +0530)] 
MAINTAINERS: Update ARM TI entry

Move TI maintainership to Tom.
Updated with the following commands:
find ./ -name MAINTAINERS | xargs sed -i s/"Lokesh Vutla <lokeshvutla@ti.com>"/"Tom Rini <trini@konsulko.com>"/g

Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Reviewed-by: Nishanth Menon <nm@ti.com>
Acked-by: Tom Rini <trini@konsulko.com>
4 years agoKconfig: Drop duplicate 'select SHA512' instances
Tom Rini [Thu, 9 Sep 2021 14:57:34 +0000 (10:57 -0400)] 
Kconfig: Drop duplicate 'select SHA512' instances

When dropping SHA512_ALGO in general, we didn't catch some cases where
an option was selecting  both SHA512 and SHA512_ALGO and caused them to
select SHA512 twice.  Kconfig doesn't complain, but this is still wrong
and should be corrected.

Fixes: e60e44993120 ("lib: Drop SHA512_ALGO in lieu of SHA512")
Reported-by: Andreas Schwab <schwab@suse.de>
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
4 years agoMerge branch '2021-09-08-fix-FIT-hash-algos-in-SPL'
Tom Rini [Thu, 9 Sep 2021 01:23:55 +0000 (21:23 -0400)] 
Merge branch '2021-09-08-fix-FIT-hash-algos-in-SPL'

- Merge some fixes to how we enable hash algorithms for FIT images in
  SPL.  This fixes a few cases where we should have had some options
  enabled, but did not.  This also removes otherwise unused options in a
  few other cases.

4 years agoimage: Drop IMAGE_ENABLE_{MD5, CRC32} #defines
Alexandru Gagniuc [Fri, 3 Sep 2021 00:54:22 +0000 (19:54 -0500)] 
image: Drop IMAGE_ENABLE_{MD5, CRC32} #defines

These are no longer used, so drop them.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
4 years agoimage: Drop if/elseif hash selection in calculate_hash()
Alexandru Gagniuc [Fri, 3 Sep 2021 00:54:21 +0000 (19:54 -0500)] 
image: Drop if/elseif hash selection in calculate_hash()

calculate_hash() would try to select the appropriate hashing function
by a if/elseif contruct. But that is exactly why hash_lookup_algo()
exists, so use it instead.

This does mean that we now have to 'select HASH' to make sure we get
the hash_lookup_algo() symbol. However, the change makes sense because
even basic FITs will have to deal with "hash" nodes.

My only concern is that the 'select SPL_HASH' might cause some
platform to grow above its SPL size allowance

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
[trini: Make FSL_CAAM be implied only on ARM && SPL]
Signed-off-by: Tom Rini <trini@konsulko.com>
4 years agocommon: Move MD5 hash to hash_algo[] array.
Alexandru Gagniuc [Fri, 3 Sep 2021 00:54:20 +0000 (19:54 -0500)] 
common: Move MD5 hash to hash_algo[] array.

MD5 is being called directly in some places, but it is not available
via hash_lookup_algo("md5"). This is inconsistent with other hasing
routines. To resolve this, add an "md5" entry to hash_algos[].

The #ifdef clause looks funnier than those for other entries. This is
because both MD5 and SPL_MD5 configs exist, whereas the other hashes
do not have "SPL_" entries. The long term plan is to get rid of the
ifdefs, so those should not be expected to survive much longer.

The md5 entry does not have .hash_init/update/finish members. That's
okay because hash_progressive_lookup_algo() will catch that, and
return -EPROTONOSUPPORT, while hash_lookup_algo() will return the
correct pointer.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
[trini: Use CONFIG_IS_ENABLED not IS_ENABLED for MD5 check]
Signed-off-by: Tom Rini <trini@konsulko.com>
4 years agocommon/spl: Drop [ST]PL_HASH_SUPPORT in favor of [ST]PL_HASH
Alexandru Gagniuc [Fri, 3 Sep 2021 00:54:19 +0000 (19:54 -0500)] 
common/spl: Drop [ST]PL_HASH_SUPPORT in favor of [ST]PL_HASH

All of these configs exist. Stick to using CONFIG_[ST]PL_HASH, and drop all
references to CONFIG_[ST]PL_HASH_SUPPORT.  This means we need for
CHAIN_OF_TRUST to select SPL_HASH now.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
[trini: Add TPL case, fix CHAIN_OF_TRUST, other tweaks]
Signed-off-by: Tom Rini <trini@konsulko.com>
4 years agolib: Drop SHA512_ALGO in lieu of SHA512
Alexandru Gagniuc [Fri, 3 Sep 2021 00:54:18 +0000 (19:54 -0500)] 
lib: Drop SHA512_ALGO in lieu of SHA512

SHA512_ALGO was used as a "either SHA512 or SHA384", although the
implementations of these two algorithms share a majority of code.

From a Kconfig interface perspective, it makes sense to present two
distinct options. This requires #ifdefing out the SHA512
implementation from sha512.c. The latter doesn't make any sense.

It's reasonable to say in Kconfig that SHA384 depends on SHA512, and
seems to be the more polite way to handle the selection.

Thus, automatically select SHA512 when SHA384 is enabled.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
4 years agocommon: Remove unused CONFIG_FIT_SHAxxx selectors
Alexandru Gagniuc [Fri, 3 Sep 2021 00:54:17 +0000 (19:54 -0500)] 
common: Remove unused CONFIG_FIT_SHAxxx selectors

Originally CONFIG_FIT_SHAxxx enabled specific SHA algos for and only
for hash_calculate() in common/image-fit.c. However, since commit
14f061dcb1 ("image: Drop IMAGE_ENABLE_SHAxxx"),
the correct selector was changed to CONFIG_SHAxxx.

The extra "_FIT_" variants are neither used, nor needed. Remove them.
One defconfig disables FIT_SHA256, which is now changed to 'SHA256'.

CMD_MVEBU_BUBT needs to select select SHA256 to avoid undefined
references to "sha256_*()". bubt.c needs sha256, so this selection is
correct. It is not clear why this problem did not manifest before.

Note that SHA selection in SPL is broken for this exact reason. There
is no corresponding SPL_SHAxxx. Fixing this is is beyond the scope of
this change.

Also note that we make CONFIG_FIT now imply SHA256, to make up for
FIT_SHA256 previously being a default y option.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
[trini: Add imply SHA256 to FIT]
Signed-off-by: Tom Rini <trini@konsulko.com>
4 years agoMerge branch '2021-09-07-ATAGs-and-related-migration' into next
Tom Rini [Wed, 8 Sep 2021 02:29:57 +0000 (22:29 -0400)] 
Merge branch '2021-09-07-ATAGs-and-related-migration' into next

- Merge ATAGs and MACH_ID options to Kconfig, and then disable them for
  nearly all platforms.  A small number of platforms actively require
  this support still, and have it still enabled.  Otherwise, it's migrated
  and disabled.

4 years agoarm: Finish migration of CONFIG_MACH_TYPE
Tom Rini [Mon, 30 Aug 2021 13:16:32 +0000 (09:16 -0400)] 
arm: Finish migration of CONFIG_MACH_TYPE

As this is only useful when booting with ATAGs, which are now largely
disabled, remove this value for the remaining platforms.  We have a few
places in the code that had been testing for MACH_TYPE as a sort of
internal logic.  Update those to use different but still correct CONFIG
symbols.

Cc: Phil Sutter <phil@nwl.cc>
Signed-off-by: Tom Rini <trini@konsulko.com>
4 years agoarm: Add Kconfig entry for MACH_TYPE
Tom Rini [Mon, 30 Aug 2021 13:16:31 +0000 (09:16 -0400)] 
arm: Add Kconfig entry for MACH_TYPE

As part of migrating support for ATAGs to Kconfig, add an option for
setting and passing MACH_TYPE.

Signed-off-by: Tom Rini <trini@konsulko.com>
4 years agoarm: Disable ATAGs support
Tom Rini [Mon, 30 Aug 2021 13:16:30 +0000 (09:16 -0400)] 
arm: Disable ATAGs support

With the exceptions of ds109, ds414, icnova-a20-swac, nokia_rx51 and
stemmy, disable ATAG support.  A large number of platforms had enabled
support but never supported a kernel so old as to require it.  Further,
some platforms are old enough to support both, but are well supported by
devicetree booting, and have been for a number of years.  This is
because some of the ATAGs related functions have been re-used to provide
the same kind of information, but for devicetree or just generally to
inform the user.  When needed still, rename these functions to
get_board_revision() instead, to avoid conflicts.  In other cases, these
functions were simply unused, so drop them.

Cc: Andre Przywara <andre.przywara@arm.com>
Cc: Jagan Teki <jagan@amarulasolutions.com>
Cc: Phil Sutter <phil@nwl.cc>
Cc: Stefan Bosch <stefan_b@posteo.net>
Signed-off-by: Tom Rini <trini@konsulko.com>
4 years agoimx: Convert SERIAL_TAG support to ENV_VARS_UBOOT_RUNTIME_CONFIG
Tom Rini [Mon, 30 Aug 2021 13:16:29 +0000 (09:16 -0400)] 
imx: Convert SERIAL_TAG support to ENV_VARS_UBOOT_RUNTIME_CONFIG

No iMX platforms have supported ATAG-based booting.  They have however
re-used the CONFIG_SERIAL_TAG option as a way to enable support of
reading the OTP fuses and setting the serial# environment variable in
some cases.  Change the warp7 support to use this symbol, use this for
updating the rest of the imx7 code, and update the imx8 conditionals.

Cc: Stefano Babic <sbabic@denx.de>
Cc: Fabio Estevam <festevam@gmail.com>
Cc: NXP i.MX U-Boot Team <uboot-imx@nxp.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
4 years agoConvert CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG to Kconfig
Tom Rini [Mon, 30 Aug 2021 13:16:28 +0000 (09:16 -0400)] 
Convert CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG to Kconfig

This converts the following to Kconfig:
   CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG

Signed-off-by: Tom Rini <trini@konsulko.com>
4 years agoMerge https://source.denx.de/u-boot/custodians/u-boot-riscv
Tom Rini [Tue, 7 Sep 2021 11:58:56 +0000 (07:58 -0400)] 
Merge https://source.denx.de/u-boot/custodians/u-boot-riscv

4 years agoriscv: lib: modify the indent
Zong Li [Wed, 1 Sep 2021 07:01:43 +0000 (15:01 +0800)] 
riscv: lib: modify the indent

We usually use a space in function declaration, rather than a tab.

Signed-off-by: Zong Li <zong.li@sifive.com>
Reviewed-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Rick Chen <rick@andestech.com>
4 years agoboard: sifive: use ccache driver instead of helper function
Zong Li [Wed, 1 Sep 2021 07:01:42 +0000 (15:01 +0800)] 
board: sifive: use ccache driver instead of helper function

Invokes the common cache_init function to initialize ccache.

Signed-off-by: Zong Li <zong.li@sifive.com>
Reviewed-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Rick Chen <rick@andestech.com>
4 years agoriscv: lib: implement enable_caches for sifive cache
Zong Li [Wed, 1 Sep 2021 07:01:41 +0000 (15:01 +0800)] 
riscv: lib: implement enable_caches for sifive cache

The enable_caches is a generic hook for architecture-implemented, we
define this function to enable composable cache of sifive platforms.

In sifive_cache, it invokes the generic cache_enable interface of cache
uclass to execute the relative implementation in SiFive ccache driver.

Signed-off-by: Zong Li <zong.li@sifive.com>
Reviewed-by: Rick Chen <rick@andestech.com>
4 years agocommon: board_r: support enable_caches for RISC-V
Zong Li [Wed, 1 Sep 2021 07:01:40 +0000 (15:01 +0800)] 
common: board_r: support enable_caches for RISC-V

The enable_caches is a generic hook for architecture-implemented, we
leverage this function to enable caches for RISC-V

Signed-off-by: Zong Li <zong.li@sifive.com>
Reviewed-by: Rick Chen <rick@andestech.com>
4 years agocache: add sifive composable cache driver
Zong Li [Wed, 1 Sep 2021 07:01:39 +0000 (15:01 +0800)] 
cache: add sifive composable cache driver

This driver is currently responsible for enabling all ccache ways.
Composable cache could be configure as RAM or cache, we will use it as
RAM at the beginning to put the u-boot SPL there. In u-boot proper
phrase, we will use the composable cache as cache, and try to enable the
cache ways.

Signed-off-by: Zong Li <zong.li@sifive.com>
Reviewed-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Rick Chen <rick@andestech.com>
4 years agoriscv: Add missing sentinel in ocores_i2c.c
Thomas Skibo [Sun, 15 Aug 2021 23:04:03 +0000 (16:04 -0700)] 
riscv: Add missing sentinel in ocores_i2c.c

The ocores_i2c.c driver is missing a sentinel at the end of
the compatible strings list.  This causes the "dm compat" command
to spew garbage.

Signed-off-by: Thomas Skibo <thomas-git@skibo.net>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
4 years agoriscv: show code leading to exception
Heinrich Schuchardt [Sat, 4 Sep 2021 08:36:49 +0000 (10:36 +0200)] 
riscv: show code leading to exception

To make analyzing exceptions easier output the code that leads to it.
We already do the same on the ARM platform.

Here is an example:

    => exception ebreak
    Unhandled exception: Breakpoint
    EPC: 000000008ff5d50e RA: 000000008ff5d62c TVAL: 0000000000000000
    EPC: 000000008020b50e RA: 000000008020b62c reloc adjusted

    Code: 2785 0693 07a0 dce3 fef6 47a5 d563 00e7 (9002)

To disassemble the code we can use the decodecode script:

    $ echo 'Code: 2785 0693 07a0 dce3 fef6 47a5 d563 00e7 (9002)' | \
      CROSS_COMPILE=riscv64-linux-gnu- scripts/decodecode

    Code: 2785 0693 07a0 dce3 fef6 47a5 d563 00e7 (9002)
    All code
    ========
       0:   2785                    addiw   a5,a5,1
       2:   07a00693                li      a3,122
       6:   fef6dce3                bge     a3,a5,0xfffffffffffffffe
       a:   47a5                    li      a5,9
       c:   00e7d563                bge     a5,a4,0x16
      10:*  9002                    ebreak         <-- trapping instruction
            ...

    Code starting with the faulting instruction
    ===========================================
       0:   9002                    ebreak
            ...

As it is not always clear if the first 16 bits are at the start or in the
middle of a 32bit instruction it may become necessary to strip the first
u16 from the output before calling decodecode to get the correct
disassembled code.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Sean Anderson <seanga2@gmail.com>
4 years agoconfigs: qemu-riscvXX_spl_defconfig enable CMD_SBI
Heinrich Schuchardt [Sat, 4 Sep 2021 09:53:36 +0000 (11:53 +0200)] 
configs: qemu-riscvXX_spl_defconfig enable CMD_SBI

Both for 64bit and 32bit at least on one board we should compile the sbi
command. Enabling it on QEMU will allow to write a test for it.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agoriscv: enable booting HiFive Unmatched from SATA
Heinrich Schuchardt [Wed, 25 Aug 2021 16:21:57 +0000 (18:21 +0200)] 
riscv: enable booting HiFive Unmatched from SATA

On the HiFive Unmatched a PCI to SATA adapter may be used to install a SATA
drive. Enable booting from it.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Mark Kettenis <kettenis@openbsd.org>
4 years agoMerge tag 'u-boot-stm32-20210906' of https://source.denx.de/u-boot/custodians/u-boot-stm
Tom Rini [Mon, 6 Sep 2021 14:31:56 +0000 (10:31 -0400)] 
Merge tag 'u-boot-stm32-20210906' of https://source.denx.de/u-boot/custodians/u-boot-stm

- fix EFI boot with OP-TEE for STM32MP15 boards

4 years agostm32mp: Fix board_get_usable_ram_top()
Patrice Chotard [Wed, 1 Sep 2021 07:56:02 +0000 (09:56 +0200)] 
stm32mp: Fix board_get_usable_ram_top()

When booting in EFI, lib/efi_loader/efi_memory.c calls
board_get_usable_ram_top(0) which returns by default
gd->ram_base + gd->ram_size which is the top of DDR.

In case of OPTEE boot, the top of DDR is currently reserved by OPTEE,
board_get_usable_ram_top(0) must return an address outside OPTEE
reserved memory.

gd->ram_top matches this constraint as it has already been initialized
by substracting all DT reserved-memory (included OPTEE memory area).

Fixes: 92b611e8b003 ("stm32mp: correctly handle board_get_usable_ram_top(0)")
Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
4 years agoMerge tag 'efi-2021-10-rc4' of https://source.denx.de/u-boot/custodians/u-boot-efi
Tom Rini [Sat, 4 Sep 2021 19:59:00 +0000 (15:59 -0400)] 
Merge tag 'efi-2021-10-rc4' of https://source.denx.de/u-boot/custodians/u-boot-efi

Pull request for efi-2021-10-rc4

Documentation:

    Remove invalid reference to configuration variable in UEFI doc

UEFI:

    Parameter checks for the EFI_TCG2_PROTOCOL
    Improve support of preseeding UEFI variables.
    Correct the calculation of the size of loaded images.
    Allow for UEFI images with zero VirtualSize

4 years agoconfigs: Resync with savedefconfig
Tom Rini [Sat, 4 Sep 2021 19:47:53 +0000 (15:47 -0400)] 
configs: Resync with savedefconfig

Rsync all defconfig files using moveconfig.py

Signed-off-by: Tom Rini <trini@konsulko.com>
4 years agoMerge branch '2021-09-04-makefile-cleanups-part-b' into next
Tom Rini [Sat, 4 Sep 2021 19:43:59 +0000 (15:43 -0400)] 
Merge branch '2021-09-04-makefile-cleanups-part-b' into next

- Further Makefile/Kconfig namespace cleanups from Simon.  This migrates
  a number of symbols to Kconfig and replaces some inconsistencies
  between CONFIG_FOO and CONFIG_SPL_FOO_SUPPORT/CONFIG_TPL_FOO_SUPPORT.

4 years agonet: Move network rules to drivers/net
Simon Glass [Sun, 8 Aug 2021 18:20:31 +0000 (12:20 -0600)] 
net: Move network rules to drivers/net

The code under drivers/net is related to ethernet networking drivers, in
some fashion or another.  Drop these from the top-level Makefile and
also move the phy rule into drivers/net/Makefile which is where it
belongs.  Make the new rule for drivers/net check for the build-stage
relevant ETH symbol.

Fix up some Kconfig dependencies while we're here to mirror how the
Makefile logic now works.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Introduce ETH, Kconfig dependency changes, am43xx fix]
Signed-off-by: Tom Rini <trini@konsulko.com>
4 years agonet: Rename SPL_NET_SUPPORT to SPL_NET
Simon Glass [Sun, 8 Aug 2021 18:20:30 +0000 (12:20 -0600)] 
net: Rename SPL_NET_SUPPORT to SPL_NET

Rename this option so that CONFIG_IS_ENABLED can be used with it.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agopower: Refactor Makefile rules
Simon Glass [Sun, 8 Aug 2021 18:20:29 +0000 (12:20 -0600)] 
power: Refactor Makefile rules

Move the power/ rules into drivers/power to avoid clutter in the Makefile
and drivers/Makefile files.

We must select SPL_POWER if SPL_POWER_DOMAIN is used, since the two are
currently independent and boards do not necessarily enable SPL_POWER.

Add a TPL_POWER as well, as that is used by one board.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
4 years agopower: Add a POWER config
Simon Glass [Sun, 8 Aug 2021 18:20:28 +0000 (12:20 -0600)] 
power: Add a POWER config

At present we have SPL_POWER but not piain POWER. This works because
there is a special build rule in Makefile that always includes the
drivers/power directory.

It is better to have all driver directories included by drivers/Makefile
and there is already a rule in there for this purpose. It just needs a
Kconfig for U-Boot proper, so add one.

Update the pmic.h header file so that it defines the old pmic struct
always, when driver model is not in use. That will avoid build errors
for boards which enable POWER but not DM_PMIC.

Enable this option always. That seems strange at first sight, but it
actually but mimics the current Makefile behaviour. Once we can drop the
old PMICs it should be easy enough to rename DM_PMIC to POWWER, or
something similar.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agoi2c: Convert CONFIG_POWER_I2C et al to Kconfig
Simon Glass [Sun, 8 Aug 2021 18:20:27 +0000 (12:20 -0600)] 
i2c: Convert CONFIG_POWER_I2C et al to Kconfig

This converts the following to Kconfig:
   CONFIG_POWER_I2C
   CONFIG_POWER_LEGACY

They are handled at the same time due to a dependency between them.
Update the Makefile rule to use legacy power only in U-Boot proper.
Unfortunately a separate rule is needed in SPL to be able to build
legacy power.  Add SPL related symbols for both, to allow for SPL-only
usage.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
[trini: More SPL related cleanups, reword commit message]
Signed-off-by: Tom Rini <trini@konsulko.com>
4 years agopower: Rename CONFIG_POWER to CONFIG_POWER_LEGACY
Simon Glass [Sun, 8 Aug 2021 18:20:26 +0000 (12:20 -0600)] 
power: Rename CONFIG_POWER to CONFIG_POWER_LEGACY

This option is used in pre-driver model code and much of it has never
been converted to driver model.

We want to add a new option to enable power support, so we can use a
simple rule in the Makefile. Rename this one, which is really about
a particular implementation of power.

Also update the pmic.h header file so it either includes the legacy
API or the driver model one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
4 years agopower: Tidy up #undef of CONFIG_DM_PMIC
Simon Glass [Sun, 8 Aug 2021 18:20:25 +0000 (12:20 -0600)] 
power: Tidy up #undef of CONFIG_DM_PMIC

Add a proper Kconfig option for SPL so we can remove the hack in some of
the board config files.

This involves adding CONFIG_SPL_DM_PMIC to some of the configs as well
as updateing the Makefile rule for PMIC_RK8XX to exclude SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
[trini: Add SPL_PMIC_RK8XX, enable when needed, handle undef of
        CONFIG_DM_PMIC_PFUZE100 as well]
Signed-off-by: Tom Rini <trini@konsulko.com>
4 years agogpio: Add a GPIO config
Simon Glass [Sun, 8 Aug 2021 18:20:24 +0000 (12:20 -0600)] 
gpio: Add a GPIO config

At present we have SPL_GPIO and TPL_GPIO but not piain GPIO. This
works because there is a special build rule in Makefile that always
includes the drivers/gpio directory.

It is better to have all driver directories included by drivers/Makefile
and there is already a rule in there for this purpose. It just needs a
Kconfig for U-Boot proper, so add one.

Enable the option always for now, since this mimics current behaviour.
This can be updated once DM_GPIO is used everywhere.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agotegra: gpio: Drop use of CONFIG_xxx variables
Simon Glass [Sun, 8 Aug 2021 18:20:23 +0000 (12:20 -0600)] 
tegra: gpio: Drop use of CONFIG_xxx variables

It is not a good idea to use things called CONFIG_xxx in the source code
since this prefix is reserved for use by Kconfig. Rename these variables.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agoMakefile: Move drivers/dma/ into drivers/Makefile
Simon Glass [Sun, 8 Aug 2021 18:20:22 +0000 (12:20 -0600)] 
Makefile: Move drivers/dma/ into drivers/Makefile

This rule should not be in the top-level Makefile. Move it, making use
of the new LEGACY_DMA Kconfig.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agoConvert CONFIG_DMA_LPC32XX to Kconfig
Simon Glass [Sun, 8 Aug 2021 18:20:21 +0000 (12:20 -0600)] 
Convert CONFIG_DMA_LPC32XX to Kconfig

This converts the following to Kconfig:
   CONFIG_DMA_LPC32XX

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agoti: Convert CONFIG_TI_EDMA3 to Kconfig
Simon Glass [Sun, 8 Aug 2021 18:20:20 +0000 (12:20 -0600)] 
ti: Convert CONFIG_TI_EDMA3 to Kconfig

This converts the following to Kconfig:
   CONFIG_TI_EDMA3

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Lokesh Vutla <lokeshvutla@ti.com>
4 years agodma: Add a Kconfig for legacy DMA
Simon Glass [Sun, 8 Aug 2021 18:20:19 +0000 (12:20 -0600)] 
dma: Add a Kconfig for legacy DMA

We cannot use the existing DMA config for the MCD driver because it is
not migrated to driver model. In order to move it to drivers/Makefile
we need some sort of option for it. Add a new DMA_LEGACY option, which
also acts as a signal that it should be migrated.

Enable this for devkit3250 which uses CONFIG_DMA_LPC32XX which is not
converted to Kconfig.

For now this is not used in the Makefile. That update happens in a
following patch.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agoMakefile: Unify the rules for BOOTCOUNT_LIMIT
Simon Glass [Sun, 8 Aug 2021 18:20:18 +0000 (12:20 -0600)] 
Makefile: Unify the rules for BOOTCOUNT_LIMIT

Use a single rule that works for all phases.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agosata: Rename SATA_SUPPORT to SATA
Simon Glass [Sun, 8 Aug 2021 18:20:17 +0000 (12:20 -0600)] 
sata: Rename SATA_SUPPORT to SATA

Rename this options so that CONFIG_IS_ENABLED can be used with it.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agoppc: Rename MPC8XXX_INIT_DDR_SUPPORT to MPC8XXX_INIT_DDR
Simon Glass [Sun, 8 Aug 2021 18:20:16 +0000 (12:20 -0600)] 
ppc: Rename MPC8XXX_INIT_DDR_SUPPORT to MPC8XXX_INIT_DDR

Rename these options so that CONFIG_IS_ENABLED can be used with them.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agoRename CACHE_SUPPORT to CACHE
Simon Glass [Sun, 8 Aug 2021 18:20:15 +0000 (12:20 -0600)] 
Rename CACHE_SUPPORT to CACHE

Rename this option so that CONFIG_IS_ENABLED can be used with it.

Oddly there is already an SPL_CACHE option. Drop it in favour of this one.

Drop the special SPL Makefile rule which is now superfluous.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agospi: Rename SPI_SUPPORT to SPI
Simon Glass [Sun, 8 Aug 2021 18:20:14 +0000 (12:20 -0600)] 
spi: Rename SPI_SUPPORT to SPI

Rename these options so that CONFIG_IS_ENABLED can be used with them.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agoserial: Add a SERIAL config
Simon Glass [Sun, 8 Aug 2021 18:20:13 +0000 (12:20 -0600)] 
serial: Add a SERIAL config

At present we have SPL_SERIAL and TPL_SERIAL but not piain SERIAL. This
works because there is a special build rule in Makefile that always
includes the drivers/serial directory.

It is better to have all driver directories included by drivers/Makefile
and there is already a rule in there for this purpose. It just needs a
Kconfig for U-Boot proper, so add one.

It is always enabled, for now, since that mimics the current behaviour.
It should be possible to drop the strange 'SERIAL_PRESENT' option at some
point and use SERIAL instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agoserial: Rename SERIAL_SUPPORT to SERIAL
Simon Glass [Sun, 8 Aug 2021 18:20:12 +0000 (12:20 -0600)] 
serial: Rename SERIAL_SUPPORT to SERIAL

Rename these options so that CONFIG_IS_ENABLED can be used with them.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agortc: Rename RTC_SUPPORT to RTC
Simon Glass [Sun, 8 Aug 2021 18:20:11 +0000 (12:20 -0600)] 
rtc: Rename RTC_SUPPORT to RTC

Rename these options so that CONFIG_IS_ENABLED can be used with them.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agopch: Rename PCH_SUPPORT to PCH
Simon Glass [Sun, 8 Aug 2021 18:20:10 +0000 (12:20 -0600)] 
pch: Rename PCH_SUPPORT to PCH

Rename these options so that CONFIG_IS_ENABLED can be used with them.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agommc: Rename MMC_SUPPORT to MMC
Simon Glass [Sun, 8 Aug 2021 18:20:09 +0000 (12:20 -0600)] 
mmc: Rename MMC_SUPPORT to MMC

Rename these options so that CONFIG_IS_ENABLED can be used with them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
[trini: Fixup some incorrect renames]
Signed-off-by: Tom Rini <trini@konsulko.com>
4 years agoefi_loader: fix efi_tcg2_hash_log_extend_event() parameter check
Masahisa Kojima [Fri, 3 Sep 2021 01:55:52 +0000 (10:55 +0900)] 
efi_loader: fix efi_tcg2_hash_log_extend_event() parameter check

TCG EFI Protocol Specification defines that PCRIndex parameter
passed from caller must be 0 to 23.
TPM2_MAX_PCRS is currently used to check the range of PCRIndex,
but TPM2_MAX_PCRS is tpm2 device dependent and may have larger value.
This commit newly adds EFI_TCG2_MAX_PCR_INDEX macro, it is used to
check the range of PCRIndex parameter.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Acked-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
4 years agoefi_loader: fix boot_service_capability_min calculation
Masahisa Kojima [Fri, 3 Sep 2021 01:55:51 +0000 (10:55 +0900)] 
efi_loader: fix boot_service_capability_min calculation

TCG EFI Protocol Specification requires to the input
ProtocolCapability.Size < size of the EFI_TCG2_BOOT_SERVICE_CAPABILITY
up to and including the vendor ID field.
Current implementation does different calculation, let's fix it.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agoefi_loader: add missing parameter check for EFI_TCG2_PROTOCOL api
Masahisa Kojima [Fri, 3 Sep 2021 01:55:50 +0000 (10:55 +0900)] 
efi_loader: add missing parameter check for EFI_TCG2_PROTOCOL api

TCG EFI Protocol Specification defines the required parameter
checking and return value for each API.
This commit adds the missing parameter check and
fixes the wrong return value to comply the specification.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
4 years agoefi_loader: correct determination of secure boot state
Heinrich Schuchardt [Thu, 2 Sep 2021 05:11:45 +0000 (07:11 +0200)] 
efi_loader: correct determination of secure boot state

When U-Boot is started we have to use the existing variables to determine
in which secure boot state we are.

* If a platform key PK is present and DeployedMode=1, we are in deployed
  mode.
* If no platform key PK is present and AuditMode=1, we are in audit mode.
* Otherwise if a platform key is present, we are in user mode.
* Otherwise if no platform key is present, we are in setup mode.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agoefi_loader: efi_auth_var_type for AuditMode, DeployedMode
Heinrich Schuchardt [Thu, 26 Aug 2021 02:30:24 +0000 (04:30 +0200)] 
efi_loader: efi_auth_var_type for AuditMode, DeployedMode

Writing variables AuditMode and DeployedMode serves to switch between
Secure Boot modes. Provide a separate value for these in efi_auth_var_type.

With this patch the variables will not be read from from file even if they
are marked as non-volatile by mistake.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
4 years agoefi_loader: don't load signature database from file
Heinrich Schuchardt [Wed, 25 Aug 2021 17:13:24 +0000 (19:13 +0200)] 
efi_loader: don't load signature database from file

The UEFI specification requires that the signature database may only be
stored in tamper-resistant storage. So these variable may not be read
from an unsigned file.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
4 years agoefi_loader: rounding of image size
Heinrich Schuchardt [Sun, 29 Aug 2021 09:52:44 +0000 (11:52 +0200)] 
efi_loader: rounding of image size

We should not first allocate memory and then report a rounded up value as
image size. Instead first round up according to section allocation and then
allocate the memory.

Fixes: 82786754b9d2 ("efi_loader: ImageSize must be multiple of SectionAlignment")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
4 years agoefi_loader: sections with zero VirtualSize
Heinrich Schuchardt [Sun, 29 Aug 2021 09:52:44 +0000 (11:52 +0200)] 
efi_loader: sections with zero VirtualSize

In a section header VirtualSize may be zero. This is for instance seen in
the .sbat section of shim. In this case use SizeOfRawData as section size.

Fixes: 9d30a941cce5 ("efi_loader: don't load beyond VirtualSize")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Asherah Connor <ashe@kivikakk.ee>
4 years agodoc: Remove information about CAPSULE_FMP_HEADER
Michal Simek [Fri, 27 Aug 2021 10:41:38 +0000 (12:41 +0200)] 
doc: Remove information about CAPSULE_FMP_HEADER

This Kconfig symbol was never added to U-Boot but it was mentioned in the
origin commit c35df7c9e43e ("qemu: arm64: Add documentation for capsule
update"). That's why remove it from documentation to be accurate.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agoMerge branch '2021-09-03-xyz-modem-fixes' into next
Tom Rini [Fri, 3 Sep 2021 21:15:44 +0000 (17:15 -0400)] 
Merge branch '2021-09-03-xyz-modem-fixes' into next

- Assorted x/y/z modem fixes from Pali

4 years agoxyz-modem: Allow to cancel transfer also by CTRL+C
Pali Rohár [Tue, 3 Aug 2021 14:28:44 +0000 (16:28 +0200)] 
xyz-modem: Allow to cancel transfer also by CTRL+C

Currently it is possible to cancel loadx and loady commands by pressing
CTRL+X (CAN character) at least 3 times quickly.

All other U-Boot commands, including loadb and loads can be cancelled by
CTRL+C. So allow it also in xyz-modem code used by loadx and loady
commands. Implement it by handling CTRL+C (ETX character) in the same way
as CTRL+X (CAN character).

Due to how x/y-modem protocol works, it is required to press
CTRL+C or CTRL+X at least 3 times quickly.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agoxyz-modem: Show information about finished transfer
Pali Rohár [Tue, 3 Aug 2021 14:28:43 +0000 (16:28 +0200)] 
xyz-modem: Show information about finished transfer

Show "## Start Addr" or "## Binary (...) download aborted" information like
in Kermit "loadb" command.

Signed-off-by: Pali Rohár <pali@kernel.org>
4 years agoxyz-modem: Properly abort/terminate transfer on error
Pali Rohár [Tue, 3 Aug 2021 14:28:42 +0000 (16:28 +0200)] 
xyz-modem: Properly abort/terminate transfer on error

Transfer termination tries to instruct sender that transfer was terminated.

Print error message and indicates aborted transfer in return value.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agoxyz-modem: Close stream after processing/sending terminate sequence
Pali Rohár [Tue, 3 Aug 2021 14:28:41 +0000 (16:28 +0200)] 
xyz-modem: Close stream after processing/sending terminate sequence

Obviously it is not possible to send terminate sequence over stream after
closing stream.

Signed-off-by: Pali Rohár <pali@kernel.org>
4 years agoxyz-modem: Put xyzModem_stream_close debug diagnostic message into ZM_DEBUG()
Pali Rohár [Tue, 3 Aug 2021 14:28:40 +0000 (16:28 +0200)] 
xyz-modem: Put xyzModem_stream_close debug diagnostic message into ZM_DEBUG()

This is how all other debug / diagnostic messages are handled.

Signed-off-by: Pali Rohár <pali@kernel.org>
4 years agoxyz-modem: Fix x-modem "xyzModem_eof error" at the end of file
Pali Rohár [Tue, 3 Aug 2021 14:28:39 +0000 (16:28 +0200)] 
xyz-modem: Fix x-modem "xyzModem_eof error" at the end of file

In x-modem protocol EOF is not an error state at the end of file.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agoxyz-modem: Fix crash after cancelling transfer
Pali Rohár [Tue, 3 Aug 2021 14:28:38 +0000 (16:28 +0200)] 
xyz-modem: Fix crash after cancelling transfer

Variable xyz.len is set to -1 on error. At the end xyzModem_stream_read()
function calls memcpy() with length from variable xyz.len. If this variable
is set to -1 then value passed to memcpy is casted to unsigned value, which
means to copy whole address space. Which then cause U-Boot crash. E.g. on
arm64 it cause CPU crash: "Synchronous Abort" handler, esr 0x96000006

Fix this issue by checking that value stored in xyz.len is valid prior
trying to use it.

Signed-off-by: Pali Rohár <pali@kernel.org>
Acked-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
4 years agoMerge tag 'xilinx-for-v2021.10-rc4' of https://gitlab.denx.de/u-boot/custodians/u...
Tom Rini [Fri, 3 Sep 2021 17:17:43 +0000 (13:17 -0400)] 
Merge tag 'xilinx-for-v2021.10-rc4' of https://gitlab.denx.de/u-boot/custodians/u-boot-microblaze

Xilinx changes for v2021.10-rc4

doc:
- Fix uefi documentation

spi:
- Fix gqspi driver for single configuration

4 years agoRevert most of the series for adding vexpress_aemv8r support
Tom Rini [Fri, 3 Sep 2021 14:40:28 +0000 (10:40 -0400)] 
Revert most of the series for adding vexpress_aemv8r support

Per a request from Andre Przywara and agreed with by Peter Hoyes, the
vexpress aemv8r support wasn't quite ready to be merged, but the
discussion had moved off list.  We should keep the first patch in the
series for now, but revert the rest.  This reverts the following
commits:

e0bd6f31ce41 doc: Add documentation for the Arm vexpress board configs
30e5a449e8c7 arm: Use armv8_switch_to_el1 env to switch to EL1
b53bbca63bf4 vexpress64: Add BASER_FVP vexpress board variant
2f5b7b74903f armv8: Add ARMv8 MPU configuration logic
37a757e227cc armv8: Ensure EL1&0 VMSA is enabled

Signed-off-by: Tom Rini <trini@konsulko.com>
4 years agospi: zynqmp_gqspi: Fix dma alignment issue
Ashok Reddy Soma [Fri, 20 Aug 2021 13:43:17 +0000 (07:43 -0600)] 
spi: zynqmp_gqspi: Fix dma alignment issue

DMA is aligned to ARCH_DMA_MINALIGN(64 bytes), but as per spec, alignment
required is 4bytes only. Change DMA alignment from ARCH_DMA_MINALIGN to
GQSPI_DMA_ALIGN. Remove alignment of data length in non-exponential case.

Some minor improvements in the initialization to initialize gen_fifo
threshold and disable qspi controller while setting config register.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Tested-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
4 years agospi: zynqmp_gqspi: Switch genfifo start to manual mode
Ashok Reddy Soma [Fri, 20 Aug 2021 13:43:16 +0000 (07:43 -0600)] 
spi: zynqmp_gqspi: Switch genfifo start to manual mode

Current implementation uses auto mode for starting generic FIFO.
The recommendation from IP designers is to use manual mode, hence
change to manual start mode.

In fill genfifo first write to genfio and then trigger manual start.

Also enable and check for genfifo empty interrupt status in place of
genfifo not full interrupt.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Tested-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
4 years agodoc: Remove information about CAPSULE_FMP_HEADER
Michal Simek [Fri, 27 Aug 2021 10:27:46 +0000 (12:27 +0200)] 
doc: Remove information about CAPSULE_FMP_HEADER

This Kconfig symbol was never added to U-Boot but it was mentioned in the
origin commit c35df7c9e43e ("qemu: arm64: Add documentation for capsule
update"). That's why remove it from documentation to be accurate.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agoMerge branch '2021-09-02-assorted-platform-and-bugfixes' into next
Tom Rini [Thu, 2 Sep 2021 22:39:28 +0000 (18:39 -0400)] 
Merge branch '2021-09-02-assorted-platform-and-bugfixes' into next

- Add position independent execution support for ARMv7
- Snapdragon, synquacer, vexpress64 fixes / improvements
- Prevent NEON register use on ARMv8
- Other assorted fixes