project/bcm63xx/atf.git
5 years agoplat/common/crash_console_helpers.S: Fix MULTI_CONSOLE_API support
Julius Werner [Mon, 19 Nov 2018 22:25:55 +0000 (14:25 -0800)]
plat/common/crash_console_helpers.S: Fix MULTI_CONSOLE_API support

Crash reporting via the default consoles registered by MULTI_CONSOLE_API
has been broken since commit d35cc34 (Console: Use callee-saved
registers), which was introduced to allow console drivers written in C.
It's not really possible with the current crash reporting framework to
support console drivers in C, however we should make sure that the
existing assembly drivers that do support crash reporting continue to
work through the MULTI_CONSOLE_API.

This patch fixes the problem by creating custom console_putc() and
console_flush() implementations for the crash reporting case that do not
use the stack. Platforms that want to use this feature will have to link
plat/common/aarch64/crash_console_helpers.S explicitly.

Also update the documentation to better reflect the new reality (of this
being an option rather than the expected default for most platforms).

Change-Id: Id0c761e5e2fddaf25c277bc7b8ab603946ca73cb
Signed-off-by: Julius Werner <jwerner@chromium.org>
5 years agoplat/common: Remove duplication of plat_crash_console functions/stubs
Julius Werner [Tue, 20 Nov 2018 21:02:27 +0000 (13:02 -0800)]
plat/common: Remove duplication of plat_crash_console functions/stubs

Commit e74afb652 (Deprecate weak crash console functions) deprecated the
default inclusion of weak definitions for plat_crash_console functions
in plat/common/aarch64/platform_helpers.S. The code was later copied out
to plat/common/aarch64/crash_console_helpers.S so platforms can link it
explicitly if they want to. However, since deprecation does not mean
removal, the same code is also still duplicated in platform_helpers.S.

The duplicated code contains both empty stubs for the !MULTI_CONSOLE_API
case, and a real implementation that used to work but was broken by
commit d35cc34 (Console: Use callee-saved registers) for
MULTI_CONSOLE_API. It's not great to have both of these duplicated in
two files, so this patch splits them up: in platform_helpers.S we'll
only keep the empty stubs (guarded by !ERROR_DEPRECATED), which should
not regress functionality since the MULTI_CONSOLE_API implementation was
already broken anyway. In crash_console_helpers.S, we'll only keep the
MULTI_CONSOLE_API version, which is enough both as an implementation in
itself and as a sample for how to reimplement these functions in a
platform-specific file.

Change-Id: I83d95a90ab6aac597dc2ea2f2797ac2c8ed075d4
Signed-off-by: Julius Werner <jwerner@chromium.org>
5 years agoMerge pull request #1693 from jeenu-arm/ehf-doc
Antonio Niño Díaz [Wed, 28 Nov 2018 10:55:53 +0000 (11:55 +0100)]
Merge pull request #1693 from jeenu-arm/ehf-doc

EHF and RAS documentation

5 years agoMerge pull request #1696 from satheesbalya-arm/sb1/sb1_2406_romlib_juno
Antonio Niño Díaz [Tue, 27 Nov 2018 08:06:15 +0000 (09:06 +0100)]
Merge pull request #1696 from satheesbalya-arm/sb1/sb1_2406_romlib_juno

romlib: Add juno support for romlib

5 years agoMerge pull request #1695 from satheesbalya-arm/sb1/sb1_2641_romlib_phase2
Antonio Niño Díaz [Tue, 27 Nov 2018 08:05:50 +0000 (09:05 +0100)]
Merge pull request #1695 from satheesbalya-arm/sb1/sb1_2641_romlib_phase2

romlib: Allow patching of romlib functions

6 years agodocs: Add RAS framework documentation
Jeenu Viswambharan [Fri, 12 Oct 2018 07:48:36 +0000 (08:48 +0100)]
docs: Add RAS framework documentation

Change-Id: Ibf2b21b12ebc0af5815fc6643532a3be9100bf02
Signed-off-by: Jeenu Viswambharan <jeenu.viswambharan@arm.com>
6 years agodocs: Add Exception Handling Framework documentation
Jeenu Viswambharan [Wed, 18 Oct 2017 13:30:53 +0000 (14:30 +0100)]
docs: Add Exception Handling Framework documentation

Change-Id: I77d38758d18ba6dda1652b1b1e644fbfb14386cc
Signed-off-by: Jeenu Viswambharan <jeenu.viswambharan@arm.com>
6 years agoSDEI: Unconditionally resume Secure if it was interrupted
Jeenu Viswambharan [Thu, 11 Oct 2018 08:50:26 +0000 (09:50 +0100)]
SDEI: Unconditionally resume Secure if it was interrupted

Secure world execution nearly always expect a controlled exit to
Non-secure world. SDEI interrupts, although targets EL3, occur on behalf
of Non-secure world, and may have higher priority than Secure world
interrupts. Therefore they might preempt Secure execution, and yield
execution to Non-secure SDEI handler. Upon completion of SDEI event
handling (regardless of whether it's COPLETE or COMPLETE_AND_RESUME), we
must resume Secure execution if it was preempted.

Change-Id: I6edd991032588588427ba2fe6c3d7668f7080e3d
Signed-off-by: Jeenu Viswambharan <jeenu.viswambharan@arm.com>
6 years agoMerge pull request #1697 from antonio-nino-diaz-arm/an/arch
Antonio Niño Díaz [Mon, 26 Nov 2018 10:51:57 +0000 (11:51 +0100)]
Merge pull request #1697 from antonio-nino-diaz-arm/an/arch

Synchronise arch.h and arch_helpers.h with TF-A-Tests

6 years agoSynchronise arch.h and arch_helpers.h with TF-A-Tests
Antonio Nino Diaz [Thu, 22 Nov 2018 15:53:17 +0000 (15:53 +0000)]
Synchronise arch.h and arch_helpers.h with TF-A-Tests

The headers forked at some point in the past and have diverged a lot. In
order to make it easier to share code between TF-A-Tests and TF-A, this
patch synchronises most of the definitions in the mentioned headers.

This is not a complete sync, it has to be followed by more cleanup.

This patch also removes the read helpers for the AArch32 instructions
ats1cpr and ats1hr (they are write-only).

Change-Id: Id13ecd7aeb83bd2318cd47156d71a42f1c9f6ba2
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
6 years agojuno: Add romlib support
Sathees Balya [Fri, 2 Nov 2018 14:56:06 +0000 (14:56 +0000)]
juno: Add romlib support

This patch adds support to build a combined BL1
and ROMLIB binary file with the right page
alignment in Juno. When USE_ROMLIB=1 is set for
Juno, it generates the combined file
bl1_romlib.bin which needs to be used instead of
bl1.bin

Change-Id: I407efbe48d3e522fa6ef855538a9587193cb1919
Signed-off-by: Sathees Balya <sathees.balya@arm.com>
6 years agoMerge pull request #1681 from Andre-ARM/allwinner/fixes
Antonio Niño Díaz [Fri, 23 Nov 2018 09:18:23 +0000 (10:18 +0100)]
Merge pull request #1681 from Andre-ARM/allwinner/fixes

allwinner: clock / power fixes

6 years agoMerge pull request #1691 from vijayenthiran-arm/sgi-dmc620-tzc
Antonio Niño Díaz [Fri, 23 Nov 2018 09:18:02 +0000 (10:18 +0100)]
Merge pull request #1691 from vijayenthiran-arm/sgi-dmc620-tzc

Add support for dmc620 tzc driver

6 years agoromlib: Add map file generation
Sathees Balya [Wed, 14 Nov 2018 11:59:12 +0000 (11:59 +0000)]
romlib: Add map file generation

Change-Id: I1f377d2d94c0fe8d2d9e62614f4a8e2dfcd9e745
Signed-off-by: Sathees Balya <sathees.balya@arm.com>
6 years agoromlib: Add calloc_free register function
Sathees Balya [Wed, 14 Nov 2018 11:57:10 +0000 (11:57 +0000)]
romlib: Add calloc_free register function

Register functions have to be added to the
jump table to allow patching in the
future

Change-Id: I57a885f7fc6290ea74a6096aea5b1867b2098eb7
Signed-off-by: Sathees Balya <sathees.balya@arm.com>
6 years agoromlib: Allow patching of romlib functions
Sathees Balya [Thu, 18 Oct 2018 18:14:21 +0000 (19:14 +0100)]
romlib: Allow patching of romlib functions

This change allows patching of functions in the
romlib. This can be done by adding "patch" at the
end of the jump table entry for the function that
needs to be patched in the file jmptbl.i.
Functions patched in the jump table list will be
built as part of the BL image and the romlib
version will not be used

Change-Id: Iefb200cb86e2a4b61ad3ee6180d3ecc39bad537f
Signed-off-by: Sathees Balya <sathees.balya@arm.com>
6 years agoRevert "aarch32: Apply workaround for errata 813419 of Cortex-A57"
Antonio Nino Diaz [Thu, 22 Nov 2018 15:38:05 +0000 (15:38 +0000)]
Revert "aarch32: Apply workaround for errata 813419 of Cortex-A57"

This reverts commit 6f512a3dfd61662dbdae4912fb6a320ae4d754d5.

According to the 'Cortex-A57 MPCore Software Developers Errata Notice':

    This bug will only affect secure AArch64 EL3. If the above
    conditions occur, the CPU will not invalidate the targeted EL3 TLB
    entries and incorrect translations might occur.

For this reason it is not needed in AArch32.

Change-Id: I6f7b333817515499723e8f306145790ad6af9975
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
6 years agoMerge pull request #1689 from antonio-nino-diaz-arm/an/alloc-va
Antonio Niño Díaz [Thu, 22 Nov 2018 14:21:47 +0000 (15:21 +0100)]
Merge pull request #1689 from antonio-nino-diaz-arm/an/alloc-va

xlat v2: Support mapping regions with allocated VA

6 years agoMerge pull request #1687 from ldts/rcar_gen3/maintain_4
Antonio Niño Díaz [Thu, 22 Nov 2018 13:59:38 +0000 (14:59 +0100)]
Merge pull request #1687 from ldts/rcar_gen3/maintain_4

rcar-gen3: lock RPC hyper-flash access

6 years agoxlat v2: Support mapping regions with allocated VA
Antonio Nino Diaz [Tue, 20 Nov 2018 16:03:11 +0000 (16:03 +0000)]
xlat v2: Support mapping regions with allocated VA

Provide new APIs to add new regions without specifying the base VA.

- `mmap_add_region_alloc_va` adds a static region to mmap choosing as
  base VA the first possible address after all the currently mapped
  regions. It is aligned to an appropriate boundary in relation to the
  size and base PA of the requested region. No attempt is made to fill
  any unused VA holes.

- `mmap_add_dynamic_region_alloc_va` it adds a region the same way as
  `mmap_add_region_alloc_va` does, but it's dynamic instead of static.

- `mmap_add_alloc_va` takes an array of non const `mmap_region_t`,
  maps them in the same way as `mmap_add_region_alloc_va` and fills
  their `base_va` field. A helper macro has been created to help create
  the array, called `MAP_REGION_ALLOC_VA`.

Change-Id: I5ef3f82ca0dfd0013d2e8034aa22f13ca528ba37
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
6 years agoplat/arm/sgi: add secure memory support for sgi575 and sgiclarka
Vijayenthiran Subramaniam [Thu, 25 Oct 2018 16:50:24 +0000 (22:20 +0530)]
plat/arm/sgi: add secure memory support for sgi575 and sgiclarka

Remove the platform common plat_arm_security_setup function to allow
platform specific implementations of the security setup function
implemented in the board directory of the platform.

For use by secure software, configure region0 of DMC-620 trustzone
controller to protect the upper 16MB of memory of the first DRAM block
from non-secure accesses.

Change-Id: I9a8c19656702c4fa4f6917b3655b692d443bb568
Signed-off-by: Vijayenthiran Subramaniam <vijayenthiran.subramaniam@arm.com>
6 years agodrivers/tzc-dmc620: add driver to setup DMC-620 TZC controller
Vijayenthiran Subramaniam [Mon, 22 Oct 2018 13:06:35 +0000 (18:36 +0530)]
drivers/tzc-dmc620: add driver to setup DMC-620 TZC controller

ARM CoreLink DMC-620 Dynamic Memory Controller includes a TZC controller
to setup secure or non-secure regions of DRAM memory. The TZC controller
allows to setup upto eight such regions of memory in DRAM. This driver
provides helper functions to setup the TZC controller within DMC-620.

Change-Id: Iee7692417c2080052bdb7b1c2873a024bc5d1d10
Signed-off-by: Vijayenthiran Subramaniam <vijayenthiran.subramaniam@arm.com>
6 years agoMerge pull request #1690 from pbatard/rpi3-docfix
Antonio Niño Díaz [Tue, 20 Nov 2018 16:33:30 +0000 (17:33 +0100)]
Merge pull request #1690 from pbatard/rpi3-docfix

rpi3: fix bad formatting in rpi3.rst

6 years agorpi3: fix bad formatting in rpi3.rst
Pete Batard [Tue, 20 Nov 2018 16:25:15 +0000 (16:25 +0000)]
rpi3: fix bad formatting in rpi3.rst

d4fd0219 (pull request #1685) introduced unwanted formatting
such as bold/italic in the description for RPI3_USE_UEFI_MAP.

6 years agoMerge pull request #1686 from antonio-nino-diaz-arm/an/backtrace
Antonio Niño Díaz [Tue, 20 Nov 2018 11:03:26 +0000 (12:03 +0100)]
Merge pull request #1686 from antonio-nino-diaz-arm/an/backtrace

backtrace: Extract rules from root Makefile

6 years agoMerge pull request #1685 from pbatard/rpi3-use-uefi-map
Antonio Niño Díaz [Tue, 20 Nov 2018 10:57:41 +0000 (11:57 +0100)]
Merge pull request #1685 from pbatard/rpi3-use-uefi-map

rpi3: add RPI3_USE_UEFI_MAP build option

6 years agorcar-gen3: control RPC hyper-flash access
Jorge Ramirez-Ortiz [Mon, 19 Nov 2018 18:26:56 +0000 (19:26 +0100)]
rcar-gen3: control RPC hyper-flash access

RCAR_RPC_HYPERFLASH_LOCKED can be set to 0 as a build option if the
user needs to allow u-boot to reprogram the ATF firmware using a FIP
image (as a faster alternative of toggling numerous DIP switches on
the board and using ascii-xfer of srec files)

The code being controlled with this commit should only be re-enabled for
debugging (_never_ on a product release)

Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez.ortiz@gmail.com>
6 years agoMerge pull request #1684 from oscardagrach/hikey-mmc-fix
Antonio Niño Díaz [Mon, 19 Nov 2018 11:49:07 +0000 (12:49 +0100)]
Merge pull request #1684 from oscardagrach/hikey-mmc-fix

hikey: increase delay after eMMC initialized

6 years agoMerge pull request #1682 from MISL-EBU-System-SW/migrate-multi-console
Antonio Niño Díaz [Mon, 19 Nov 2018 11:48:54 +0000 (12:48 +0100)]
Merge pull request #1682 from MISL-EBU-System-SW/migrate-multi-console

Marvell: Migrate to multi console API

6 years agobacktrace: Extract rules from root Makefile
Antonio Nino Diaz [Mon, 19 Nov 2018 11:48:30 +0000 (11:48 +0000)]
backtrace: Extract rules from root Makefile

It's better to have them in a separate file instead of having them spread
across the Makefile. This is what the stack protector is already doing.

Change-Id: Id30742c0af10de5ea6d10674ca25bf52b0f2b262
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
6 years agorpi3: add RPI3_USE_UEFI_MAP build option
Pete Batard [Thu, 15 Nov 2018 22:29:59 +0000 (22:29 +0000)]
rpi3: add RPI3_USE_UEFI_MAP build option

The default Raspberry Pi 3 memory mapping for ATF is geared towards
the use of uboot + Linux. This creates issues when trying to use
ATF with an UEFI payload and Windows on ARM64.

We therefore introduce new build option RPI3_USE_UEFI_MAP, that
enables the build process to use an alternate memory mapping that
is compatible with UEFI + Windows (as well as UEFI + Linux).

Fixes ARM-software/tf-issues#649

Signed-off-by: Pete Batard <pete@akeo.ie>
6 years agoMerge pull request #1683 from Yann-lms/stm32mp1_multi_console
Antonio Niño Díaz [Fri, 16 Nov 2018 13:46:37 +0000 (14:46 +0100)]
Merge pull request #1683 from Yann-lms/stm32mp1_multi_console

Add multi console support for STM32MP1

6 years agoMerge pull request #1680 from pbatard/rpi3-runtime-uart
Antonio Niño Díaz [Thu, 15 Nov 2018 15:36:12 +0000 (16:36 +0100)]
Merge pull request #1680 from pbatard/rpi3-runtime-uart

rpi3: add RPI3_RUNTIME_UART build option

6 years agohikey: increase delay after eMMC initialized
Ryan Grachek [Thu, 15 Nov 2018 14:41:25 +0000 (08:41 -0600)]
hikey: increase delay after eMMC initialized

Some eMMC chips require a longer delay. After testing
different chips, 20ms appears to work reliably.

Signed-off-by: Ryan Grachek <ryan@edited.us>
6 years agoplat/marvell: Migrate to multi-console API
Konstantin Porotchkin [Wed, 14 Nov 2018 15:15:08 +0000 (17:15 +0200)]
plat/marvell: Migrate to multi-console API

Migrate Marvell platforms from legacy console API to
multi-console API.

Change-Id: I647f5f49148b463a257a747af05b5f0c967f267c
Signed-off-by: Konstantin Porotchkin <kostap@marvell.com>
6 years agodrivers: st: uart: remove old API
Yann Gautier [Thu, 15 Nov 2018 10:52:32 +0000 (11:52 +0100)]
drivers: st: uart: remove old API

Now that MULTI_CONSOLE_API is enabled for the STM32MP1 platform,
we can remove the non MULTI_CONSOLE_API parts in the driver.

Signed-off-by: Yann Gautier <yann.gautier@st.com>
6 years agostm32mp1: use MULTI_CONSOLE_API
Yann Gautier [Wed, 14 Nov 2018 17:46:15 +0000 (18:46 +0100)]
stm32mp1: use MULTI_CONSOLE_API

Signed-off-by: Yann Gautier <yann.gautier@st.com>
6 years agodrivers: st: update console driver to support MULTI_CONSOLE_API
Yann Gautier [Thu, 15 Nov 2018 08:51:06 +0000 (09:51 +0100)]
drivers: st: update console driver to support MULTI_CONSOLE_API

Signed-off-by: Yann Gautier <yann.gautier@st.com>
6 years agostm32mp1: add a new file for UART registers definition
Yann Gautier [Wed, 14 Nov 2018 17:18:12 +0000 (18:18 +0100)]
stm32mp1: add a new file for UART registers definition

Signed-off-by: Yann Gautier <yann.gautier@st.com>
6 years agoutils_def: add an assembly version for GENMASK
Yann Gautier [Thu, 15 Nov 2018 08:49:24 +0000 (09:49 +0100)]
utils_def: add an assembly version for GENMASK

When compiling assembly files, stdint.h is not included.
UINT32_C and UINT64_C are then not defined.
A new GENMASK macro for assembly is then created.

Signed-off-by: Yann Gautier <yann.gautier@st.com>
6 years agoMerge pull request #1675 from SNG-ARM/integration
Antonio Niño Díaz [Thu, 15 Nov 2018 10:20:03 +0000 (11:20 +0100)]
Merge pull request #1675 from SNG-ARM/integration

SPM priority level changes

6 years agofix: plat/marvell: a3700: Remove encryption password
Konstantin Porotchkin [Tue, 6 Nov 2018 16:10:33 +0000 (18:10 +0200)]
fix: plat/marvell: a3700: Remove encryption password

According to "openssl" manual:
-K key
The actual key to use: this must be represented as a string
comprised only of hex digits. If only the key is specified,
the IV must additionally specified using the -iv option.
When both a key and a password are specified, the key given
with the -K option will be used and the IV generated from the
password will be taken.
It does not make much sense to specify both key and password.

This patch removes "-k 0" parameter from the encryption command
since we are already using "-K" and "-iv" for the key and IV.

Change-Id: Ia333cedaa3207e643c95d2ec7c229f50eeab96db
Signed-off-by: Konstantin Porotchkin <kostap@marvell.com>
Reviewed-on: http://vgitil04.il.marvell.com:8080/60745
Reviewed-by: Igal Liberman <igall@marvell.com>
Tested-by: iSoC Platform CI <ykjenk@marvell.com>
Reviewed-by: Sharon Habet <sharonh@marvell.com>
6 years agoallwinner: power: Add DCDC6 power rail
Andre Przywara [Wed, 24 Oct 2018 15:38:19 +0000 (16:38 +0100)]
allwinner: power: Add DCDC6 power rail

The DCDC6 power rail is typically driving VDD_SYS in the SoC, so it is
on by default and uses the default voltage.

As there seems to be at least on board using a different voltage, add
the rail to the list of known voltage lines, so we can setup the right
voltage as early as possible.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
6 years agoallwinner: power: add enable switches for DCDC1/5
Andre Przywara [Wed, 24 Oct 2018 15:38:12 +0000 (16:38 +0100)]
allwinner: power: add enable switches for DCDC1/5

The DCDC1 and DCDC5 power rails didn't specify the enable bits. This
isn't critical, since those rails are on by default (and are needed for
every board), but it is inconsistent.

Add the respective enable bits for those two rails.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
6 years agoallwinner: power: fix DRIVEVBUS pin setup
Andre Przywara [Mon, 5 Nov 2018 00:52:06 +0000 (00:52 +0000)]
allwinner: power: fix DRIVEVBUS pin setup

The DRIVEVBUS pin setup was broken in two ways:
- To configure this pin as an output pin, one has to *clear* the bit in
  register 0x8f. It is 0 by default, but rebooting from Linux might have
  left this bit set.
- Doing this just configures the pin as an output pin, but doesn't
  actually drive power to it. This is done via bit 2 in register 0x30.

Fix the routine to both properly configure the pin and drive power to
it. Add an axp_clrsetbits() helper on the way.

Now this isn't really perfect, still:
We only need to setup the PMIC power rails that are needed for U-Boot.
DRIVEVBUS typically controls the VBUS voltage for the host function of
an USB-OTG port, something we typically don't want in U-Boot (fastboot,
using the USB *device* functionality, is much more common). The
BananaPi-M64 uses the regulator in this way, but the Remix Mini PC
actually controls the power of both its USB ports via this line.

Technically we should differentiate here: if DRIVEVBUS controls a
microUSB-B socket, the power should stay off, any host-type A sockets
should be supplied, though.
For now just always enable the power, that shouldn't really hurt the
USB-OTG functionality anyway.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
6 years agoallwinner: A64/H5: setup missing bus clocks
Andre Przywara [Sun, 4 Nov 2018 23:37:48 +0000 (23:37 +0000)]
allwinner: A64/H5: setup missing bus clocks

The legacy Allwinner ATF port used to setup some clocks, and U-Boot is
still relying on this. We don't need to setup the full set, as the SPL
is doing most of it, but it misses one clock (AHB2) and programs another
(AHB1) to quite conservative values.

Fix this up during the platform setup to improve USB and Ethernet
performance, iperf values go up by 31% in my setup with that patch.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
6 years agoSPM: Raise running priority of the core while in Secure Partition
Sughosh Ganu [Wed, 14 Nov 2018 05:36:24 +0000 (11:06 +0530)]
SPM: Raise running priority of the core while in Secure Partition

The current secure partition design mandates that a) at a point, only
a single core can be executing in the secure partition, and b) a core
cannot be preempted by an interrupt while executing in secure
partition.

Ensure this by activating the SPM priority prior to entering the
parition. Deactivate the priority on return from the
partition.

Change-Id: Icb3473496d16b733564592eef06304a1028e4f5c
Signed-off-by: Sughosh Ganu <sughosh.ganu@arm.com>
6 years agoSPM: Register Secure Partition priority level with ehf module
Sughosh Ganu [Wed, 14 Nov 2018 05:12:46 +0000 (10:42 +0530)]
SPM: Register Secure Partition priority level with ehf module

Register a priority level, PLAT_SP_PRI, for secure partition with EL3
exception handling framework(ehf) module.

The secure partition manager(SPM) would raise the core's priority to
PLAT_SP_PRI before entering the secure partition, to protect the core
from getting interrupted while in secure partition.

Change-Id: I686897f052a4371e0efa9b929c07d3ad77249e95
Signed-off-by: Sughosh Ganu <sughosh.ganu@arm.com>
6 years agoSPM: EHF: Build EHF module along with Secure Partition Manager
Sughosh Ganu [Wed, 14 Nov 2018 05:10:33 +0000 (10:40 +0530)]
SPM: EHF: Build EHF module along with Secure Partition Manager

Add a dependency for building EL3 exception handling framework(EHF)
module with the secure partition manager(SPM).

The EHF module is needed for raising the core's running priority
before the core enters the secure partition, and lowering it
subsequently on exit from the secure partition.

Change-Id: Icbe2d0a63f00b46dc593ff3d86b676c9333506c3
Signed-off-by: Sughosh Ganu <sughosh.ganu@arm.com>
6 years agorpi3: add RPI3_RUNTIME_UART build option
Pete Batard [Tue, 13 Nov 2018 13:14:26 +0000 (13:14 +0000)]
rpi3: add RPI3_RUNTIME_UART build option

Some OSes (e.g. Ubuntu 18.04 LTS on Raspberry Pi 3) may disable the
runtime UART in a manner that prevents the system from rebooting if
ATF tries to send runtime messages there.

Also, we don't want the firmware to share the UART with normal
world, as this can be a DoS attack vector into the secure world.

This patch fixes these 2 issues by introducing new build option
RPI3_RUNTIME_UART, that disables the runtime UART by default.

Fixes ARM-software/tf-issues#647

Signed-off-by: Pete Batard <pete@akeo.ie>
6 years agoMerge pull request #1676 from Yann-lms/static_analysis
Antonio Nino Diaz [Tue, 13 Nov 2018 13:27:41 +0000 (13:27 +0000)]
Merge pull request #1676 from Yann-lms/static_analysis

Correct some issues found with static analysis tools

6 years agoMerge pull request #1677 from acolinisi/PR--drivers-cadence-uart-prototype
Antonio Niño Díaz [Tue, 13 Nov 2018 11:26:28 +0000 (12:26 +0100)]
Merge pull request #1677 from acolinisi/PR--drivers-cadence-uart-prototype

cadence: uart: comply to console_register prototype

6 years agocadence: uart: comply to console_register prototype
Alexei Colin [Fri, 9 Nov 2018 22:36:55 +0000 (17:36 -0500)]
cadence: uart: comply to console_register prototype

Signed-off-by: Alexei Colin <acolin@isi.edu>
6 years agoMerge pull request #1674 from jforissier/hisi-multi-console
Antonio Niño Díaz [Mon, 12 Nov 2018 10:40:11 +0000 (11:40 +0100)]
Merge pull request #1674 from jforissier/hisi-multi-console

hikey, hikey960, poplar: use new console APIs

6 years agoMerge pull request #1605 from sivadur/integration
Antonio Niño Díaz [Mon, 12 Nov 2018 09:56:41 +0000 (10:56 +0100)]
Merge pull request #1605 from sivadur/integration

Add support new Xilinx Versal ACAP platform

6 years agostm32mp1: remove duplicate function declaration
Yann Gautier [Fri, 9 Nov 2018 16:47:34 +0000 (17:47 +0100)]
stm32mp1: remove duplicate function declaration

It is already in include/drivers/st/stm32mp1_ddr_helpers.h.

Signed-off-by: Yann Gautier <yann.gautier@st.com>
6 years agostm32mp1: correct some static analysis tools issues
Yann Gautier [Fri, 9 Nov 2018 14:57:18 +0000 (15:57 +0100)]
stm32mp1: correct some static analysis tools issues

These issues wer found by sparse:

drivers/st/clk/stm32mp1_clk.c:1524:19:
 warning: incorrect type in assignment (different base types)
    expected restricted fdt32_t const [usertype] *pkcs_cell
    got unsigned int const [usertype] *

plat/st/stm32mp1/plat_image_load.c:13:6:
 warning: symbol 'plat_flush_next_bl_params' was not declared.
 Should it be static?
plat/st/stm32mp1/plat_image_load.c:21:16:
 warning: symbol 'plat_get_bl_image_load_info' was not declared.
 Should it be static?
plat/st/stm32mp1/plat_image_load.c:29:13:
 warning: symbol 'plat_get_next_bl_params' was not declared.
 Should it be static?

plat/st/stm32mp1/bl2_io_storage.c:40:10:
 warning: symbol 'block_buffer' was not declared. Should it be static?

Signed-off-by: Yann Gautier <yann.gautier@st.com>
6 years agodrivers: partition: correct some static analysis tools issues
Yann Gautier [Fri, 9 Nov 2018 17:21:04 +0000 (18:21 +0100)]
drivers: partition: correct some static analysis tools issues

cppcheck:
[drivers/partition/gpt.c:19] -> [drivers/partition/gpt.c:19]:
 (warning) Either the condition 'str_in!=((void*)0)' is redundant
 or there is possible null pointer dereference: name.

sparse:
drivers/partition/gpt.c:39:9:
 warning: Using plain integer as NULL pointer

Signed-off-by: Yann Gautier <yann.gautier@st.com>
6 years agopsci: put __dead2 attribute after void in plat_psci_ops
Yann Gautier [Fri, 9 Nov 2018 17:21:51 +0000 (18:21 +0100)]
psci: put __dead2 attribute after void in plat_psci_ops

These warnings were issued by sparse:
plat/st/stm32mp1/stm32mp1_pm.c:365:36:
 warning: incorrect type in initializer (different modifiers)
    expected void ( *[noreturn] pwr_domain_pwr_down_wfi )( ... )
    got void ( [noreturn] *<noident> )( ... )
plat/st/stm32mp1/stm32mp1_pm.c:366:23:
 warning: incorrect type in initializer (different modifiers)
    expected void ( *[noreturn] system_off )( ... )
    got void ( [noreturn] *<noident> )( ... )
plat/st/stm32mp1/stm32mp1_pm.c:367:25:
 warning: incorrect type in initializer (different modifiers)
    expected void ( *[noreturn] system_reset )( ... )
    got void ( [noreturn] *<noident> )( ... )

This cannot be changed the other way in all platforms pm drivers
or else there is a compilation error:
plat/st/stm32mp1/stm32mp1_pm.c:234:1: error: attributes should be specified
 before the declarator in a function definition

Signed-off-by: Yann Gautier <yann.gautier@st.com>
6 years agoarm64: versal: Add support for new Xilinx Versal ACAPs
Siva Durga Prasad Paladugu [Tue, 25 Sep 2018 13:14:58 +0000 (18:44 +0530)]
arm64: versal: Add support for new Xilinx Versal ACAPs

Xilinx is introducing Versal, an adaptive compute acceleration platform
(ACAP), built on 7nm FinFET process technology. Versal ACAPs combine Scalar
Processing Engines, Adaptable Hardware Engines, and Intelligent Engines with
leading-edge memory and interfacing technologies to deliver powerful
heterogeneous acceleration for any application. The Versal AI Core series has
five devices, offering 128 to 400 AI Engines. The series includes dual-core Arm
Cortex-A72 application processors, dual-core Arm Cortex-R5 real-time
processors, 256KB of on-chip memory with ECC, more than 1,900 DSP engines
optimized for high-precision floating point with low latency.

This patch adds Virtual QEMU platform support for
this SoC "versal_virt".

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
6 years agopoplar: Use new console APIs
Jerome Forissier [Thu, 8 Nov 2018 11:57:30 +0000 (11:57 +0000)]
poplar: Use new console APIs

Switch to the new console APIs enabled by setting MULTI_CONSOLE_API=1.
Enables building with ERROR_DEPRECATED=1.

Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
6 years agohikey960: Use new console APIs
Jerome Forissier [Thu, 8 Nov 2018 08:59:29 +0000 (09:59 +0100)]
hikey960: Use new console APIs

Switch to the new console APIs enabled by setting MULTI_CONSOLE_API=1.
Enables building with ERROR_DEPRECATED=1.

Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
6 years agohikey: Use new console APIs
Jerome Forissier [Thu, 8 Nov 2018 10:17:47 +0000 (10:17 +0000)]
hikey: Use new console APIs

Switch to the new console APIs enabled by setting MULTI_CONSOLE_API=1.
Enables building with ERROR_DEPRECATED=1.

Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
6 years agoMerge pull request #1673 from antonio-nino-diaz-arm/an/headers
Antonio Niño Díaz [Thu, 8 Nov 2018 11:22:42 +0000 (12:22 +0100)]
Merge pull request #1673 from antonio-nino-diaz-arm/an/headers

Standardise header guards across codebase

6 years agoStandardise header guards across codebase
Antonio Nino Diaz [Thu, 8 Nov 2018 10:20:19 +0000 (10:20 +0000)]
Standardise header guards across codebase

All identifiers, regardless of use, that start with two underscores are
reserved. This means they can't be used in header guards.

The style that this project is now to use the full name of the file in
capital letters followed by 'H'. For example, for a file called
"uart_example.h", the header guard is UART_EXAMPLE_H.

The exceptions are files that are imported from other projects:

- CryptoCell driver
- dt-bindings folders
- zlib headers

Change-Id: I50561bf6c88b491ec440d0c8385c74650f3c106e
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
6 years agoMerge pull request #1672 from sandrine-bailleux-arm/sb/fix-dram-constants
Soby Mathew [Wed, 7 Nov 2018 17:03:45 +0000 (17:03 +0000)]
Merge pull request #1672 from sandrine-bailleux-arm/sb/fix-dram-constants

Arm platforms: Fix DRAM address macros

6 years agoMerge pull request #1668 from ldts/rcar_gen3/e3_build
Soby Mathew [Wed, 7 Nov 2018 17:00:49 +0000 (17:00 +0000)]
Merge pull request #1668 from ldts/rcar_gen3/e3_build

rcar_gen3: E3 target: fix compilation issues

6 years agoMerge pull request #1670 from antonio-nino-diaz-arm/an/misra-arm
Soby Mathew [Wed, 7 Nov 2018 16:58:03 +0000 (16:58 +0000)]
Merge pull request #1670 from antonio-nino-diaz-arm/an/misra-arm

plat/arm: Fix MISRA defects in common code

6 years agoMerge pull request #1669 from sandrine-bailleux-arm/sb/rm-tzc-top-fn
Soby Mathew [Wed, 7 Nov 2018 16:56:03 +0000 (16:56 +0000)]
Merge pull request #1669 from sandrine-bailleux-arm/sb/rm-tzc-top-fn

Remove unneeded _tzc_get_max_top_addr() function

6 years agoMerge pull request #1666 from pmanish87/mp2/manish_local
Soby Mathew [Wed, 7 Nov 2018 16:54:17 +0000 (16:54 +0000)]
Merge pull request #1666 from pmanish87/mp2/manish_local

plat/arm: Support direct Linux kernel boot in AArch32

6 years agoArm platforms: Fix DRAM address macros
Sandrine Bailleux [Wed, 31 Oct 2018 13:28:17 +0000 (14:28 +0100)]
Arm platforms: Fix DRAM address macros

On AArch32, ARM_DRAM1_BASE and ARM_DRAM1_SIZE constants are currently
32-bit values (because they are suffixed with UL and the value
0x80000000 fits in a unsigned long int, i.e. a 32-bit value). When
summing them up, the result overflows the maximum value that can be
encoded in a 32-bit value so it wraps around and does not result in
the expected value.

This patch changes the suffix of these constants into ULL so that they
always are 64-bit values.

Change-Id: I3b19b1805e35cc7e43050458df379081b1e882d5
Signed-off-by: Sandrine Bailleux <sandrine.bailleux@arm.com>
6 years agoRemove _tzc_get_max_top_addr() function
Sandrine Bailleux [Wed, 31 Oct 2018 12:41:47 +0000 (13:41 +0100)]
Remove _tzc_get_max_top_addr() function

This function was needed at the time where we didn't have the
compiler_rt lib. An AArch32-specific variant was provided to handle
the 64-bit shift operation in 32-bit. This is no longer needed.

Change-Id: Ibab709a95e3a723ae2eeaddf873dba70ff2012b3
Signed-off-by: Sandrine Bailleux <sandrine.bailleux@arm.com>
6 years agocompiler_rt: Import lshrdi3.c file
Sandrine Bailleux [Wed, 31 Oct 2018 12:37:42 +0000 (13:37 +0100)]
compiler_rt: Import lshrdi3.c file

Imported from the LLVM compiler_rt library on master branch as of
30 Oct 2018 (SVN revision: r345645).

This is to get the __aeabi_llsr() builtin, which is required by a
subsequent patch that uses a logical right shift operator in AArch32.

Change-Id: I9884139a12855a8a87206fb572aaa7dd35582b09
Signed-off-by: Sandrine Bailleux <sandrine.bailleux@arm.com>
6 years agocompiler_rt: Import latest changes on int_lib.h
Sandrine Bailleux [Wed, 31 Oct 2018 12:35:01 +0000 (13:35 +0100)]
compiler_rt: Import latest changes on int_lib.h

Imported from the LLVM compiler_rt library on master branch as of
30 Oct 2018 (SVN revision: r345645).

Change-Id: I058cfb5894daf1d12e1ef971c0ba36b0aa089be5
Signed-off-by: Sandrine Bailleux <sandrine.bailleux@arm.com>
6 years agoplat/arm: Fix MISRA defects in common code
Antonio Nino Diaz [Tue, 6 Nov 2018 13:14:21 +0000 (13:14 +0000)]
plat/arm: Fix MISRA defects in common code

Change-Id: I2419416fadfcdf64da8b7690a348007591c4edf3
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
6 years agoMerge pull request #1665 from antonio-nino-diaz-arm/an/fdt-helpers
Antonio Niño Díaz [Tue, 6 Nov 2018 11:45:09 +0000 (12:45 +0100)]
Merge pull request #1665 from antonio-nino-diaz-arm/an/fdt-helpers

Introduce new fdt helpers

6 years agorcar_gen3: E3 target: fix compilation issues
ldts [Tue, 6 Nov 2018 09:17:12 +0000 (10:17 +0100)]
rcar_gen3: E3 target: fix compilation issues

Target builds but has not been tested.

Signed-off-by: ldts <jorge.ramirez.ortiz@gmail.com>
6 years agoplat: rcar: support plat_crash_console_flush
ldts [Tue, 6 Nov 2018 10:01:19 +0000 (11:01 +0100)]
plat: rcar: support plat_crash_console_flush

Signed-off-by: ldts <jorge.ramirez.ortiz@gmail.com>
6 years agoMerge pull request #1661 from hzhuang1/emmc_delay
Soby Mathew [Tue, 6 Nov 2018 06:53:48 +0000 (06:53 +0000)]
Merge pull request #1661 from hzhuang1/emmc_delay

hikey: add delay after eMMC initialized

6 years agoplat/arm: Support direct Linux kernel boot in AArch32
Manish Pandey [Fri, 2 Nov 2018 13:28:25 +0000 (13:28 +0000)]
plat/arm: Support direct Linux kernel boot in AArch32

This option allows the Trusted Firmware to directly jump to Linux
kernel for aarch32 without the need of an intermediate loader such
as U-Boot.

Similar to AArch64 ARM_LINUX_KERNEL_AS_BL33 only available with
RESET_TO_SP_MIN=1 as well as BL33 and DTB are preloaded in memory.

Change-Id: I908bc1633696be1caad0ce2f099c34215c8e0633
Signed-off-by: Manish Pandey <manish.pandey2@arm.com>
6 years agoIntroduce fdtw_read_array() helper
Antonio Nino Diaz [Tue, 26 Jun 2018 09:34:10 +0000 (10:34 +0100)]
Introduce fdtw_read_array() helper

fdtw_read_cells() can only read one or two cells, sometimes it may be
needed to read more cells from one property.

Change-Id: Ie70dc76d1540cd6a04787cde7cccb4d1bafc7282
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
6 years agoIntroduce new fdt helper to read string properties
Antonio Nino Diaz [Tue, 26 Jun 2018 09:34:07 +0000 (10:34 +0100)]
Introduce new fdt helper to read string properties

Introduced fdtw_read_string() to read string properties.

Change-Id: I854eef0390632cf2eaddd2dce60cdb98c117de43
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
6 years agolibc: Adapt strlcpy to this codebase
Antonio Nino Diaz [Thu, 27 Sep 2018 08:22:19 +0000 (09:22 +0100)]
libc: Adapt strlcpy to this codebase

Change-Id: I2f5f64aaf90caae936510e1179392a8835f493e0
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
6 years agolibc: Import strlcpy from FreeBSD
Antonio Nino Diaz [Thu, 27 Sep 2018 08:18:57 +0000 (09:18 +0100)]
libc: Import strlcpy from FreeBSD

From commit aafd1cf4235d78ce85b76d7da63e9589039344b3:

- lib/libc/strlcpy.c

Change-Id: Iaa7028fcc26706bdd6ee3f1e4bd55dd5873a30c6
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
6 years agoMerge pull request #1663 from sudeep-holla/scpi_build_fix
Antonio Niño Díaz [Fri, 2 Nov 2018 10:15:56 +0000 (11:15 +0100)]
Merge pull request #1663 from sudeep-holla/scpi_build_fix

plat: juno: fix build for !CSS_USE_SCMI_DRIVER

6 years agoMerge pull request #1660 from antonio-nino-diaz-arm/an/misra
Antonio Niño Díaz [Fri, 2 Nov 2018 10:14:54 +0000 (11:14 +0100)]
Merge pull request #1660 from antonio-nino-diaz-arm/an/misra

Several MISRA defect fixes

6 years agoplat: juno: fix build for !CSS_USE_SCMI_DRIVER
Sudeep Holla [Thu, 1 Nov 2018 16:17:30 +0000 (16:17 +0000)]
plat: juno: fix build for !CSS_USE_SCMI_DRIVER

When CSS_USE_SCMI_DRIVER is not defined or set to 0, we get the
following build error.

plat/arm/board/juno/juno_topology.c:16:19: error: ‘CSS_SCMI_PAYLOAD_BASE’ undeclared here (not in a function)
   .scmi_mbx_mem = CSS_SCMI_PAYLOAD_BASE,
                   ^~~~~~~~~~~~~~~~~~~~~
plat/arm/board/juno/juno_topology.c:17:38: error: ‘CSS_SCMI_MHU_DB_REG_OFF’ undeclared here (not in a function)
   .db_reg_addr = PLAT_CSS_MHU_BASE + CSS_SCMI_MHU_DB_REG_OFF,
                                      ^~~~~~~~~~~~~~~~~~~~~~~
                                      CSS_CPU_PWR_STATE_OFF

Fix the error in order to get function legacy SCPI support functional.

Change-Id: I00cb80db9968aa0be546e33a3a682a2db87719be
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
6 years agobakery: Fix MISRA defects
Antonio Nino Diaz [Wed, 31 Oct 2018 15:55:57 +0000 (15:55 +0000)]
bakery: Fix MISRA defects

Change-Id: I600bc13522ae977db355b6dc5a1695bce39ec130
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
6 years agoplat/arm: Fix MISRA defects in dyn config
Antonio Nino Diaz [Tue, 30 Oct 2018 16:32:48 +0000 (16:32 +0000)]
plat/arm: Fix MISRA defects in dyn config

Change-Id: Iae6758ca6395560131d1e1a69a1ecfe50ca8bf83
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
6 years agoplat/arm: Fix types of constants in headers
Antonio Nino Diaz [Tue, 30 Oct 2018 16:12:32 +0000 (16:12 +0000)]
plat/arm: Fix types of constants in headers

Change-Id: I33eaee8e7c983b3042635a448cb8d689ea4e3a12
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
6 years agocontext_mgmt: Fix MISRA defects
Antonio Nino Diaz [Wed, 31 Oct 2018 15:25:35 +0000 (15:25 +0000)]
context_mgmt: Fix MISRA defects

The macro EL_IMPLEMENTED() has been deprecated in favour of the new
function el_implemented().

Change-Id: Ic9b1b81480b5e019b50a050e8c1a199991bf0ca9
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
6 years agoMerge pull request #1658 from glneo/plat-arm-remove
Antonio Niño Díaz [Thu, 1 Nov 2018 11:46:24 +0000 (12:46 +0100)]
Merge pull request #1658 from glneo/plat-arm-remove

ti: k3: common: Remove use of ARM platform code

6 years agoMerge pull request #1657 from antonio-nino-diaz-arm/an/libfdt
Antonio Niño Díaz [Thu, 1 Nov 2018 11:45:32 +0000 (12:45 +0100)]
Merge pull request #1657 from antonio-nino-diaz-arm/an/libfdt

libfdt: Downgrade to version 1.4.6-9

6 years agoMerge pull request #1656 from masahir0y/uniphier
Antonio Niño Díaz [Thu, 1 Nov 2018 11:45:22 +0000 (12:45 +0100)]
Merge pull request #1656 from masahir0y/uniphier

uniphier: clean-up and improve SCP handling code

6 years agoMerge pull request #1623 from MISL-EBU-System-SW/a3700-support
Antonio Niño Díaz [Thu, 1 Nov 2018 11:44:24 +0000 (12:44 +0100)]
Merge pull request #1623 from MISL-EBU-System-SW/a3700-support

Add support for Armada 3700 and COMPHY porting layer

6 years agoplat: marvell: Add support for Armada-37xx SoC platform
Konstantin Porotchkin [Mon, 8 Oct 2018 13:53:09 +0000 (16:53 +0300)]
plat: marvell: Add support for Armada-37xx SoC platform

Add supprot for Marvell platforms based on Armada-37xx SoC.
This includes support for the official Armada-3720 modular
development board and EspressoBin community board.
The Armada-37xx SoC contains dual Cortex-A53 Application CPU,
single secure CPU (Cortex-M3) and the following interfaces:
- SATA 3.0
- USB 3.0 and USB 2.0
- PCIe
- SDIO (supports boot from eMMC)
- SPI
- UART
- I2c
- Gigabit Ethernet

Signed-off-by: Konstantin Porotchkin <kostap@marvell.com>
6 years agoMerge pull request #1650 from chandnich/sgiclark-ares-support
Antonio Niño Díaz [Wed, 31 Oct 2018 14:47:21 +0000 (15:47 +0100)]
Merge pull request #1650 from chandnich/sgiclark-ares-support

Sgiclark ares support

6 years agoMerge pull request #1655 from deepan02/deepak-arm/introduce-n1sdp
Antonio Niño Díaz [Wed, 31 Oct 2018 14:32:58 +0000 (15:32 +0100)]
Merge pull request #1655 from deepan02/deepak-arm/introduce-n1sdp

plat/arm: Introduce the N1SDP.

6 years agoMerge pull request #1659 from vwadekar/sdei-fix-compilation
Antonio Niño Díaz [Wed, 31 Oct 2018 14:31:32 +0000 (15:31 +0100)]
Merge pull request #1659 from vwadekar/sdei-fix-compilation

sdei: include "context.h" to fix compilation errors

6 years agoMerge pull request #1646 from Andre-ARM/allwinner/pmic-v2
Antonio Niño Díaz [Wed, 31 Oct 2018 11:02:22 +0000 (12:02 +0100)]
Merge pull request #1646 from Andre-ARM/allwinner/pmic-v2

Allwinner/pmic v2