project/bcm63xx/atf.git
6 years agoMerge pull request #1377 from robertovargas-arm/compiler-warnings
Dimitris Papastamos [Wed, 9 May 2018 12:40:35 +0000 (13:40 +0100)]
Merge pull request #1377 from robertovargas-arm/compiler-warnings

Compiler warnings

6 years agoxlat: Fix warning in CHECK_VIRT_ADDR_SPACE_SIZE
Roberto Vargas [Wed, 9 May 2018 10:27:30 +0000 (11:27 +0100)]
xlat: Fix warning in CHECK_VIRT_ADDR_SPACE_SIZE

When TF is compiled for aarch32 MAX_VIRT_ADDR_SPACE_SIZE is 2^32 in some cases,
which makes the test (size) <= MAX_VIRT_ADDR_SPACE_SIZE a tautology because
uintptr_t is a 32 bit value. The cast remove the warning for clang.

Change-Id: I1345f3400f8fbbe4ffd3caa990a90e7ba593dba5
Signed-off-by: Roberto Vargas <roberto.vargas@arm.com>
6 years agoDon't use variables as tf_printf format strings
Roberto Vargas [Wed, 9 May 2018 09:49:24 +0000 (10:49 +0100)]
Don't use variables as tf_printf format strings

Using variables as format strings can generate security problems when
the user can control those strings. Some compilers generate warnings
in that cases, even when the variables are constants and are not
controlled by the user.

Change-Id: I65dee1d1b66feab38cbf298290a86fa56e6cca40
Signed-off-by: Roberto Vargas <roberto.vargas@arm.com>
6 years agoMerge pull request #1368 from EvanLloyd/editorconfig
danh-arm [Tue, 8 May 2018 10:22:27 +0000 (11:22 +0100)]
Merge pull request #1368 from EvanLloyd/editorconfig

Add .editorconfig file

6 years agoMerge pull request #1354 from robertovargas-arm/mem_protect
danh-arm [Tue, 8 May 2018 10:21:04 +0000 (11:21 +0100)]
Merge pull request #1354 from robertovargas-arm/mem_protect

ARM platforms: Demonstrate mem_protect from el3_runtime

6 years agoMerge pull request #1374 from jonathanwright-ARM/jw/fix-memory-leaks-in-fiptool
danh-arm [Thu, 3 May 2018 15:48:50 +0000 (16:48 +0100)]
Merge pull request #1374 from jonathanwright-ARM/jw/fix-memory-leaks-in-fiptool

Fix memory leaks in fiptool

6 years agoMerge pull request #1370 from antonio-nino-diaz-arm/an/fix-parange
danh-arm [Thu, 3 May 2018 15:48:14 +0000 (16:48 +0100)]
Merge pull request #1370 from antonio-nino-diaz-arm/an/fix-parange

xlat: Have all values of PARange for 8.x architectures

6 years agoMerge pull request #1367 from robertovargas-arm/ndebug
danh-arm [Thu, 3 May 2018 15:46:44 +0000 (16:46 +0100)]
Merge pull request #1367 from robertovargas-arm/ndebug

Remove the unused macro NDEBUG

6 years agoMerge pull request #1366 from antonio-nino-diaz-arm/an/ignore-spdx
danh-arm [Thu, 3 May 2018 15:46:25 +0000 (16:46 +0100)]
Merge pull request #1366 from antonio-nino-diaz-arm/an/ignore-spdx

checkpatch: Ignore SPDX_LICENSE_TAG

6 years agoMerge pull request #1365 from jonathanwright-ARM/jw/fix-cert-create-makefile
danh-arm [Thu, 3 May 2018 15:45:17 +0000 (16:45 +0100)]
Merge pull request #1365 from jonathanwright-ARM/jw/fix-cert-create-makefile

Fix the makefile to remove the cert_create executable on 'make realclean'

6 years agoMerge pull request #1364 from Yann-lms/bl2_at_el3_mmu
danh-arm [Thu, 3 May 2018 15:45:01 +0000 (16:45 +0100)]
Merge pull request #1364 from Yann-lms/bl2_at_el3_mmu

BL2_AT_EL3: do not try to disable MMU twice on AARCH32

6 years agoMerge pull request #1371 from antonio-nino-diaz-arm/an/fix-checkpatch
danh-arm [Thu, 3 May 2018 15:42:07 +0000 (16:42 +0100)]
Merge pull request #1371 from antonio-nino-diaz-arm/an/fix-checkpatch

smccc: Fix checkpatch error in header file

6 years agotools/fiptool: fix memory leaks in fiptool
Jonathan Wright [Thu, 3 May 2018 14:05:09 +0000 (15:05 +0100)]
tools/fiptool: fix memory leaks in fiptool

Free desc->image->buffer before freeing desc->image. We make sure that
the desc->image is non-null before attempting this.

Change-Id: I35c5674629a41d7cf1a78b7b41ca4b930d0fb688
Signed-off-by: Jonathan Wright <jonathan.wright@arm.com>
6 years agoxlat: Have all values of PARange for 8.x architectures
Antonio Nino Diaz [Wed, 2 May 2018 10:23:56 +0000 (11:23 +0100)]
xlat: Have all values of PARange for 8.x architectures

In AArch64, the field ID_AA64MMFR0_EL1.PARange has a different set of
allowed values depending on the architecture version.

Previously, we only compiled the Trusted Firmware with the values that
were allowed by the architecture. However, given that this field is
read-only, it is easier to compile the code with all values regardless
of the target architecture.

Change-Id: I57597ed103dd0189b1fb738a9ec5497391c10dd1
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
6 years agosmccc: Fix checkpatch error in header file
Antonio Nino Diaz [Wed, 2 May 2018 08:52:35 +0000 (09:52 +0100)]
smccc: Fix checkpatch error in header file

Change-Id: Ice141dcc17f504025f922acace94d98f84acba9e
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
6 years agoAdd .editorconfig file
Evan Lloyd [Wed, 6 Dec 2017 19:05:40 +0000 (19:05 +0000)]
Add .editorconfig file

The .editorconfig file provides an editor agnostic definition of a
project's file format requirements.
Details can be found at http://editorconfig.org/

This change should have little impact on users, but, it is hoped, will
help those who move across projects avoid making mistakes because of
foreign project editor configuration settings.

Change-Id: I8776526b5ab96b543d3d3e445c60e06b62049e68
Signed-off-by: Evan Lloyd <evan.lloyd@arm.com>
6 years agoMerge pull request #1362 from robertovargas-arm/dtc-warnings
danh-arm [Tue, 1 May 2018 16:13:11 +0000 (17:13 +0100)]
Merge pull request #1362 from robertovargas-arm/dtc-warnings

Remove dtc warnings

6 years agoMerge pull request #1361 from vchong/tool_add_img
danh-arm [Tue, 1 May 2018 16:12:51 +0000 (17:12 +0100)]
Merge pull request #1361 from vchong/tool_add_img

poplar: rename FIP_ADD_IMG to TOOL_ADD_IMG

6 years agoRemove the unused macro NDEBUG
Roberto Vargas [Fri, 15 Dec 2017 15:28:50 +0000 (15:28 +0000)]
Remove the unused macro NDEBUG

The C standards specify that this macro is used to
disable asserts but, in our code, the assert macro
is controlled with ENABLE_ASSERTIONS. Having this macro
here creates confusion about the behaviour of assert.

Change-Id: Iab8689a14dc2b8790729857d56585ce43c0c4f51
Signed-off-by: Roberto Vargas <roberto.vargas@arm.com>
6 years agoMerge pull request #1363 from antonio-nino-diaz-arm/an/res1-ap
danh-arm [Tue, 1 May 2018 14:31:44 +0000 (15:31 +0100)]
Merge pull request #1363 from antonio-nino-diaz-arm/an/res1-ap

xlat: Set AP[1] to 1 when it is RES1

6 years agoMerge pull request #1360 from antonio-nino-diaz-arm/an/smccc-v2
danh-arm [Tue, 1 May 2018 14:25:45 +0000 (15:25 +0100)]
Merge pull request #1360 from antonio-nino-diaz-arm/an/smccc-v2

Add support for the SMC Calling Convention 2.0

6 years agoARM platforms: Demonstrate mem_protect from el3_runtime
Roberto Vargas [Fri, 5 Jan 2018 16:00:05 +0000 (16:00 +0000)]
ARM platforms: Demonstrate mem_protect from el3_runtime

Previously mem_protect used to be only supported from BL2. This is not
helpful in the case when ARM TF-A BL2 is not used. This patch demonstrates
mem_protect from el3_runtime firmware on ARM Platforms specifically
when RESET_TO_BL31 or RESET_TO_SP_MIN flag is set as BL2 may be absent
in these cases. The Non secure DRAM is dynamically mapped into EL3 mmap
tables temporarily and then the protected regions are then cleared. This
avoids the need to map the non secure DRAM permanently to BL31/sp_min.

The stack size is also increased, because DYNAMIC_XLAT_TABLES require
a bigger stack.

Change-Id: Ia44c594192ed5c5adc596c0cff2c7cc18c001fde
Signed-off-by: Roberto Vargas <roberto.vargas@arm.com>
6 years agoMerge pull request #1255 from masahir0y/int-ll64
danh-arm [Tue, 1 May 2018 14:06:56 +0000 (15:06 +0100)]
Merge pull request #1255 from masahir0y/int-ll64

Use consistent int-ll64 typedefs for aarch32 and aarch64

6 years agocert_create: fix makefile to remove executable on 'make realclean'
Jonathan Wright [Mon, 30 Apr 2018 14:04:02 +0000 (15:04 +0100)]
cert_create: fix makefile to remove executable on 'make realclean'

Spurious whitespace existed in the BINARY shell variable which meant
the cert_tool executable was not being removed on 'make realclean'.

Change-Id: Ibfd2fd17889514f6613e33c6df58d53b9232ec14
Signed-off-by: Jonathan Wright <jonathan.wright@arm.com>
6 years agocheckpatch: Ignore SPDX_LICENSE_TAG
Antonio Nino Diaz [Fri, 27 Apr 2018 08:29:20 +0000 (09:29 +0100)]
checkpatch: Ignore SPDX_LICENSE_TAG

The Linux kernel expects the SPDX license tag in the first line of each
source code file in a comment.

In the context of the Linux kernel repository this makes sense because
they have many different license headers across their codebase. Moving
the tag to the first line of the source code files makes it easier for
analyzers to see the license of each file.

In the Trusted Firmware, we control all headers and make sure that they
follow the same pattern, so this is not needed.

Change-Id: Ie19802c7b65b1bdd63da9ece64311aec1f8ad7fe
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
6 years agotypes: use int-ll64 for both aarch32 and aarch64
Masahiro Yamada [Fri, 2 Feb 2018 06:09:36 +0000 (15:09 +0900)]
types: use int-ll64 for both aarch32 and aarch64

Since commit 031dbb122472 ("AArch32: Add essential Arch helpers"),
it is difficult to use consistent format strings for printf() family
between aarch32 and aarch64.

For example, uint64_t is defined as 'unsigned long long' for aarch32
and as 'unsigned long' for aarch64.  Likewise, uintptr_t is defined
as 'unsigned int' for aarch32, and as 'unsigned long' for aarch64.

A problem typically arises when you use printf() in common code.

One solution could be, to cast the arguments to a type long enough
for both architectures.  For example, if 'val' is uint64_t type,
like this:

  printf("val = %llx\n", (unsigned long long)val);

Or, somebody may suggest to use a macro provided by <inttypes.h>,
like this:

  printf("val = %" PRIx64 "\n", val);

But, both would make the code ugly.

The solution adopted in Linux kernel is to use the same typedefs for
all architectures.  The fixed integer types in the kernel-space have
been unified into int-ll64, like follows:

    typedef signed char           int8_t;
    typedef unsigned char         uint8_t;

    typedef signed short          int16_t;
    typedef unsigned short        uint16_t;

    typedef signed int            int32_t;
    typedef unsigned int          uint32_t;

    typedef signed long long      int64_t;
    typedef unsigned long long    uint64_t;

[ Linux commit: 0c79a8e29b5fcbcbfd611daf9d500cfad8370fcf ]

This gets along with the codebase shared between 32 bit and 64 bit,
with the data model called ILP32, LP64, respectively.

The width for primitive types is defined as follows:

                   ILP32           LP64
    int            32              32
    long           32              64
    long long      64              64
    pointer        32              64

'long long' is 64 bit for both, so it is used for defining uint64_t.
'long' has the same width as pointer, so for uintptr_t.

We still need an ifdef conditional for (s)size_t.

All 64 bit architectures use "unsigned long" size_t, and most 32 bit
architectures use "unsigned int" size_t.  H8/300, S/390 are known as
exceptions; they use "unsigned long" size_t despite their architecture
is 32 bit.

One idea for simplification might be to define size_t as 'unsigned long'
across architectures, then forbid the use of "%z" string format.
However, this would cause a distortion between size_t and sizeof()
operator.  We have unknowledge about the native type of sizeof(), so
we need a guess of it anyway.  I want the following formula to always
return 1:

  __builtin_types_compatible_p(size_t, typeof(sizeof(int)))

Fortunately, ARM is probably a majority case.  As far as I know, all
32 bit ARM compilers use "unsigned int" size_t.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
6 years agoarch_helpers: use u_register_t for register read/write
Masahiro Yamada [Fri, 2 Feb 2018 12:19:17 +0000 (21:19 +0900)]
arch_helpers: use u_register_t for register read/write

u_register_t is preferred rather than uint64_t.  This is more
consistent with the aarch32 implementation.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
6 years agoFix pointer type mismatch of handlers
Masahiro Yamada [Wed, 18 Apr 2018 16:18:48 +0000 (01:18 +0900)]
Fix pointer type mismatch of handlers

Commit 4c0d03907652 ("Rework type usage in Trusted Firmware") changed
the type usage in struct declarations, but did not touch the definition
side.  Fix the type mismatch.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
6 years agoBL2_AT_EL3: do not try to disable MMU twice on AARCH32
Yann Gautier [Thu, 26 Apr 2018 17:07:17 +0000 (19:07 +0200)]
BL2_AT_EL3: do not try to disable MMU twice on AARCH32

If BL2_AT_EL3 is enabled, bl2_run_next_image is called at the end of BL2.
This function calls disable_mmu_icache_secure.
It is then useless to call it in bl2_main in that case.

fixes arm-software/tf-issues#582

Signed-off-by: Yann Gautier <yann.gautier@st.com>
6 years agoMerge pull request #1345 from dbasehore/udelay
Dimitris Papastamos [Thu, 26 Apr 2018 13:14:28 +0000 (14:14 +0100)]
Merge pull request #1345 from dbasehore/udelay

rockchip/rk3399: Fix sram_udelay

6 years agoxlat: Set AP[1] to 1 when it is RES1
Antonio Nino Diaz [Thu, 26 Apr 2018 11:59:08 +0000 (12:59 +0100)]
xlat: Set AP[1] to 1 when it is RES1

According to the ARMv8 ARM issue C.a:

    AP[1] is valid only for stage 1 of a translation regime that can
    support two VA ranges. It is RES 1 when stage 1 translations can
    support only one VA range.

This means that, even though this bit is ignored, it should be set to 1
in the EL3 and EL2 translation regimes.

For translation regimes consisting on EL0 and a higher regime this bit
selects between control at EL0 or at the higher Exception level. The
regimes that support two VA ranges are EL1&0 and EL2&0 (the later one
is only available since ARMv8.1).

This fix has to be applied to both versions of the translation tables
library.

Change-Id: If19aaf588551bac7aeb6e9a686cf0c2068e7c181
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
6 years agoRemove dtc warnings
Roberto Vargas [Mon, 23 Apr 2018 13:44:54 +0000 (14:44 +0100)]
Remove dtc warnings

DTC generates warnings when unit names begin with 0, or
when a node containing a reg or range property doesn't have a unit name
in the node name. This patch fixes those cases.

Change-Id: If24ec68ef3034fb3fcefb96c5625c47a0bbd8474
Signed-off-by: Roberto Vargas <roberto.vargas@arm.com>
6 years agopoplar: rename FIP_ADD_IMG to TOOL_ADD_IMG
Victor Chong [Mon, 23 Apr 2018 14:52:51 +0000 (15:52 +0100)]
poplar: rename FIP_ADD_IMG to TOOL_ADD_IMG

Fixes: f3d522b ("poplar: Support Trusted OS extra image (OP-TEE header) parsing")
Signed-off-by: Victor Chong <victor.chong@linaro.org>
6 years agoAdd support for the SMC Calling Convention 2.0
Antonio Nino Diaz [Mon, 23 Apr 2018 14:43:29 +0000 (15:43 +0100)]
Add support for the SMC Calling Convention 2.0

Due to differences in the bitfields of the SMC IDs, it is not possible
to support SMCCC 1.X and 2.0 at the same time.

The behaviour of `SMCCC_MAJOR_VERSION` has changed. Now, it is a build
option that specifies the major version of the SMCCC that the Trusted
Firmware supports. The only two allowed values are 1 and 2, and it
defaults to 1. The value of `SMCCC_MINOR_VERSION` is derived from it.

Note: Support for SMCCC v2.0 is an experimental feature to enable
prototyping of secure partition specifications. Support for this
convention is disabled by default and could be removed without notice.

Change-Id: I88abf9ccf08e9c66a13ce55c890edea54d9f16a7
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
6 years agospd: add static qualifier to locally used functions and data
Masahiro Yamada [Wed, 18 Apr 2018 16:14:42 +0000 (01:14 +0900)]
spd: add static qualifier to locally used functions and data

These are used locally in a file.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
6 years agoMerge pull request #1358 from omasab/sgi575_mt_flag
Dimitris Papastamos [Wed, 18 Apr 2018 09:54:40 +0000 (10:54 +0100)]
Merge pull request #1358 from omasab/sgi575_mt_flag

css/sgi575: enable ARM_PLAT_MT flag

6 years agoMerge pull request #1357 from antonio-nino-diaz-arm/an/fix-misra
Dimitris Papastamos [Wed, 18 Apr 2018 09:54:26 +0000 (10:54 +0100)]
Merge pull request #1357 from antonio-nino-diaz-arm/an/fix-misra

Fix some MISRA defects in SPM code

6 years agocss/sgi575: enable ARM_PLAT_MT flag
Sudipto Paul [Mon, 16 Apr 2018 12:16:50 +0000 (17:46 +0530)]
css/sgi575: enable ARM_PLAT_MT flag

SGI-575 platform is based on Cortex-A75 processor which has its MT bit
in the MPIDR register set to '1'. So the Arm platform layer code has
to be made aware of this.

Signed-off-by: Sudipto Paul <sudipto.paul@arm.com>
6 years agoFix some MISRA defects in SPM code
Antonio Nino Diaz [Tue, 17 Apr 2018 14:10:18 +0000 (15:10 +0100)]
Fix some MISRA defects in SPM code

Change-Id: I989c1f4aef8e3cb20d5d19e6347575e6449bb60b
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
6 years agoMerge pull request #1250 from jollysxilinx/zynqmp-new-eemi-api
Dimitris Papastamos [Tue, 17 Apr 2018 11:08:34 +0000 (12:08 +0100)]
Merge pull request #1250 from jollysxilinx/zynqmp-new-eemi-api

plat/xilinx: Add support for new platform management APIs for ZynqMP

6 years agoMerge pull request #1346 from samarthp/sp/support-multiple-mhu-gen
Dimitris Papastamos [Mon, 16 Apr 2018 15:40:03 +0000 (16:40 +0100)]
Merge pull request #1346 from samarthp/sp/support-multiple-mhu-gen

plat/arm: Add MHUv2 support to SCMI driver

6 years agoplat/arm: Add MHUv2 support to SCMI driver
Samarth Parikh [Thu, 23 Nov 2017 08:53:21 +0000 (14:23 +0530)]
plat/arm: Add MHUv2 support to SCMI driver

Currently the SCMI driver supports MHUv1, but Arm platforms may have
varied versions of MHU driver, with MHUv2 controllers being in the
latest Arm platforms.

This patch updates the SCMI driver to support MHUv2, specifically that
the sender must send the wake-up to the receiver before initiating any
data transfer.

Also, the existing mhu driver files, css_mhu.c and css_mhu.h, have been
moved from the scpi directory to a new directory, css/drivers/mhu.

Change-Id: I9b46b492a3e1d9e26db12d83a9773958a8c8402f
Signed-off-by: Samarth Parikh <samarth.parikh@arm.com>
6 years agoMerge pull request #1356 from robertovargas-arm/misra-changes
Dimitris Papastamos [Mon, 16 Apr 2018 14:04:28 +0000 (15:04 +0100)]
Merge pull request #1356 from robertovargas-arm/misra-changes

Misra changes

6 years agoFix MISRA rule 8.4 Part 4
Roberto Vargas [Mon, 12 Feb 2018 12:36:17 +0000 (12:36 +0000)]
Fix MISRA rule 8.4 Part 4

Rule 8.4: A compatible declaration shall be visible when
          an object or function with external linkage is defined

Fixed for:
make DEBUG=1 PLAT=fvp SPD=tspd TRUSTED_BOARD_BOOT=1 \
     GENERATE_COT=1 ARM_ROTPK_LOCATION=devel_rsa \
     ROT_KEY=arm_rotprivk_rsa.pem MBEDTLS_DIR=mbedtls all

Change-Id: Ie4cd6011b3e4fdcdd94ccb97a7e941f3b5b7aeb8
Signed-off-by: Roberto Vargas <roberto.vargas@arm.com>
6 years agoFix MISRA rule 8.3 Part 4
Roberto Vargas [Mon, 12 Feb 2018 12:36:17 +0000 (12:36 +0000)]
Fix MISRA rule 8.3 Part 4

Rule 8.3: All declarations of an object or function shall
          use the same names and type qualifiers

Fixed for:
make DEBUG=1 PLAT=fvp SPD=tspd TRUSTED_BOARD_BOOT=1 \
     GENERATE_COT=1 ARM_ROTPK_LOCATION=devel_rsa \
     ROT_KEY=arm_rotprivk_rsa.pem MBEDTLS_DIR=mbedtls all

Change-Id: Ia34fe1ae1f142e89c9a6c19831e3daf4d28f5831
Signed-off-by: Roberto Vargas <roberto.vargas@arm.com>
6 years agoFix MISRA rule 8.4 Part 3
Roberto Vargas [Mon, 12 Feb 2018 12:36:17 +0000 (12:36 +0000)]
Fix MISRA rule 8.4 Part 3

Rule 8.4: A compatible declaration shall be visible when
          an object or function with external linkage is defined

Fixed for:
make DEBUG=1 PLAT=fvp SPD=tspd all

Change-Id: I0a16cf68fef29cf00ec0a52e47786f61d02ca4ae
Signed-off-by: Roberto Vargas <roberto.vargas@arm.com>
6 years agoFix MISRA rule 8.3 Part 3
Roberto Vargas [Mon, 12 Feb 2018 12:36:17 +0000 (12:36 +0000)]
Fix MISRA rule 8.3 Part 3

Rule 8.3: All declarations of an object or function shall
          use the same names and type qualifiers

Fixed for:
make DEBUG=1 PLAT=fvp SPD=tspd all

Change-Id: I4e31c93d502d433806dfc521479d5d428468b37c
Signed-off-by: Roberto Vargas <roberto.vargas@arm.com>
6 years agoFix MISRA rule 8.3 Part 2
Roberto Vargas [Mon, 12 Feb 2018 12:36:17 +0000 (12:36 +0000)]
Fix MISRA rule 8.3 Part 2

Rule 8.3: All declarations of an object or function shall
          use the same names and type qualifiers.

Fixed for:
make DEBUG=1 PLAT=juno LOG_LEVEL=50 all

Change-Id: I0e4a03a0d2170cb1c632e079112a972091994a39
Signed-off-by: Roberto Vargas <roberto.vargas@arm.com>
6 years agoFix MISRA rule 8.5 in common code
Roberto Vargas [Mon, 12 Feb 2018 12:36:17 +0000 (12:36 +0000)]
Fix MISRA rule 8.5 in common code

Rule 8.5: An external object or function shall be declared
          once in one and only one file.

Change-Id: I7c3d4ec7d3ba763fdb4600008ba10b4b93ecdfce
Signed-off-by: Roberto Vargas <roberto.vargas@arm.com>
6 years agoFix MISRA rule 8.4 Part 1
Roberto Vargas [Mon, 12 Feb 2018 12:36:17 +0000 (12:36 +0000)]
Fix MISRA rule 8.4 Part 1

Rule 8.4: A compatible declaration shall be visible when
          an object or function with external linkage is defined

Fixed for:
make DEBUG=1 PLAT=fvp LOG_LEVEL=50 all

Change-Id: I32b223251b8bf5924149d89431a65d3405a73d3e
Signed-off-by: Roberto Vargas <roberto.vargas@arm.com>
6 years agoFix MISRA rule 8.3 Part 1
Roberto Vargas [Mon, 12 Feb 2018 12:36:17 +0000 (12:36 +0000)]
Fix MISRA rule 8.3 Part 1

Rule 8.3: All declarations of an object or function shall
          use the same names and type qualifiers.

Fixed for:

make DEBUG=1 PLAT=fvp LOG_LEVEL=50 all

Change-Id: I32d6fbce03bb4830ed5bf521afe7063505c6ed79
Signed-off-by: Roberto Vargas <roberto.vargas@arm.com>
6 years agoMerge pull request #1352 from hzhuang1/hikey_ddr
Dimitris Papastamos [Fri, 13 Apr 2018 08:54:29 +0000 (09:54 +0100)]
Merge pull request #1352 from hzhuang1/hikey_ddr

Hikey ddr

6 years agoMerge pull request #1355 from jonathanwright-ARM/jw/REVIDR-errata-workaround
Dimitris Papastamos [Fri, 13 Apr 2018 08:53:56 +0000 (09:53 +0100)]
Merge pull request #1355 from jonathanwright-ARM/jw/REVIDR-errata-workaround

Check presence of hardware fix for 2 errata on Cortex A53

6 years agoCheck presence of fix for errata 835769 in Cortex-A53
Jonathan Wright [Wed, 28 Mar 2018 15:55:54 +0000 (16:55 +0100)]
Check presence of fix for errata 835769 in Cortex-A53

A fix for errata 835769 may be available in revisions r0p2, r0p3 or r0p4
of the Cortex-A53 processor. The presence of the fix is determined by
checking bit 7 in the REVIDR register.

If the fix is present we report ERRATA_NOT_APPLIES which silences the
erroneous 'missing workaround' warning.

Change-Id: Ib75b008e755e9ac648554ca9398024fdbea4a91a
Signed-off-by: Jonathan Wright <jonathan.wright@arm.com>
6 years agoCheck presence of fix for errata 843419 in Cortex-A53
Jonathan Wright [Wed, 28 Mar 2018 14:52:03 +0000 (15:52 +0100)]
Check presence of fix for errata 843419 in Cortex-A53

A fix for errata 843419 may be available in revision r0p4 of the
Cortex-A53 processor. The presence of the fix is determined by checking
bit 8 in the REVIDR register.

If the fix is present we report ERRATA_NOT_APPLIES which silences the
erroneous 'missing workaround' warning.

Change-Id: Ibd2a478df3e2a6325442a6a48a0bb0259dcfc1d7
Signed-off-by: Jonathan Wright <jonathan.wright@arm.com>
6 years agoMerge pull request #1347 from davidcunado-arm/dc/affinities
Dimitris Papastamos [Thu, 12 Apr 2018 09:47:14 +0000 (10:47 +0100)]
Merge pull request #1347 from davidcunado-arm/dc/affinities

FVP: Fix function for translating MPIDR to linear index

6 years agoMerge pull request #1353 from JiafeiPan/upstream-platform-psci-bug
Dimitris Papastamos [Thu, 12 Apr 2018 08:20:12 +0000 (09:20 +0100)]
Merge pull request #1353 from JiafeiPan/upstream-platform-psci-bug

layerscape: fix integer handling issues

6 years agolayerscape: fix integer handling issues
Jiafei Pan [Wed, 11 Apr 2018 12:12:24 +0000 (12:12 +0000)]
layerscape: fix integer handling issues

Assert before actually using.

Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
6 years agohikey: clean sram before mcu used
Haojian Zhuang [Wed, 11 Apr 2018 11:06:14 +0000 (19:06 +0800)]
hikey: clean sram before mcu used

Clean cache to flush parameters into SRAM before MCU using them.

Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
6 years agohikey: save ddr parameters into SRAM
Haojian Zhuang [Wed, 11 Apr 2018 11:05:59 +0000 (19:05 +0800)]
hikey: save ddr parameters into SRAM

Store those DDR parameters into SRAM. They may be used by MCU
firmware.

Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
6 years agohikey: update ddr initialization
Haojian Zhuang [Wed, 11 Apr 2018 11:05:32 +0000 (19:05 +0800)]
hikey: update ddr initialization

Fix that DDR can't work at 533MHz. Now step to set DDR frequency
from 150MHz to 800MHz. DDR could work among these frequency, 150MHz,
266MHz, 400MHz, 533MHz and 800MHz.

Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
6 years agoMerge pull request #1342 from Summer-ARM/sq/support-tzmp1
Dimitris Papastamos [Wed, 11 Apr 2018 08:39:21 +0000 (09:39 +0100)]
Merge pull request #1342 from Summer-ARM/sq/support-tzmp1

support tzmp1

6 years agoMerge pull request #1348 from amitdanielkachhap/dmc500_single_if_v2
Dimitris Papastamos [Tue, 10 Apr 2018 14:08:53 +0000 (15:08 +0100)]
Merge pull request #1348 from amitdanielkachhap/dmc500_single_if_v2

DMC500: Add platform support to set system interface count

6 years agoMerge pull request #1349 from amitdanielkachhap/juno_fix_bl2_sizes
Dimitris Papastamos [Tue, 10 Apr 2018 14:08:42 +0000 (15:08 +0100)]
Merge pull request #1349 from amitdanielkachhap/juno_fix_bl2_sizes

Juno: Increase bl2 max size to fix build when SPD=opteed

6 years agoMerge pull request #1341 from vwadekar/improve-mmap-efficiency
Dimitris Papastamos [Tue, 10 Apr 2018 12:17:16 +0000 (13:17 +0100)]
Merge pull request #1341 from vwadekar/improve-mmap-efficiency

lib: xlat_tables_v2: reduce time required to add a mmap region

6 years agoMerge pull request #1306 from JiafeiPan/master
Dimitris Papastamos [Tue, 10 Apr 2018 12:04:38 +0000 (13:04 +0100)]
Merge pull request #1306 from JiafeiPan/master

layerscape: Initial ATF support for LS1043ardb

6 years agoJuno: Add support for TrustZone Media Protection 1 (TZMP1)
Summer Qin [Fri, 2 Mar 2018 07:51:14 +0000 (15:51 +0800)]
Juno: Add support for TrustZone Media Protection 1 (TZMP1)

Add TZMP1 support on Juno and increase the BL2 size accordingly due to the
extra data structures to describe the TZC regions and the additional code.

Signed-off-by: Summer Qin <summer.qin@arm.com>
6 years agoplat/arm: Allow override of default TZC regions
Summer Qin [Mon, 12 Mar 2018 03:28:26 +0000 (11:28 +0800)]
plat/arm: Allow override of default TZC regions

This patch allows the ARM Platforms to specify the TZC regions to be
specified to the ARM TZC helpers in arm_tzc400.c and arm_tzc_dmc500.c.
If the regions are not specified then the default TZC region will be
configured by these helpers.

This override mechanism allows specifying special regions for TZMP1
usecase.

Signed-off-by: Summer Qin <summer.qin@arm.com>
6 years agoAdd NXP to contributor list
Jiafei Pan [Wed, 28 Mar 2018 01:34:33 +0000 (09:34 +0800)]
Add NXP to contributor list

Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
6 years agolayerscape: Initial TF-A support for LS1043ardb
Jiafei Pan [Fri, 2 Mar 2018 07:23:30 +0000 (07:23 +0000)]
layerscape: Initial TF-A support for LS1043ardb

This patch introduce TF-A support for NXP's ls1043a platform.
more details information of ls1043a chip and ls1043ardb board
can be found at docs/plat/ls1043a.rst.

Boot sequence on ls1043a is: bootrom loads bl1 firstly, then bl1
loads bl2, bl2 will load bl31, bl32 and bl33, bl31 will boot
bl32(tee os) and bl33(u-boot or uefi), bl33 boot Linux kernel.

Now TF-A on ls1043ardb platform has the following features in this patch:
* Support boot from Nor flash.
* TF-A can boot bl33 which runs in el2 of non-secure world.
* TF-A boot OPTee OS.
* Support PSCI

Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
Signed-off-by: Chenyin.Ha <Chenyin.Ha@nxp.com>
Signed-off-by: Chenhui Zhao <chenhui.zhao@nxp.com>
Signed-off-by: jiaheng.fan <jiaheng.fan@nxp.com>
Signed-off-by: Wen He <wen.he_1@nxp.com>
6 years agolib: xlat_tables_v2: reduce time required to add a mmap region
Varun Wadekar [Tue, 3 Apr 2018 17:44:41 +0000 (10:44 -0700)]
lib: xlat_tables_v2: reduce time required to add a mmap region

The last entry in the mapping table is not necessarily the same as the
end of the table. This patch loops through the table to find the last
entry marker, on every new mmap addition. The memove operation then
has to only move the memory between current entry and the last entry.
For platforms that arrange their MMIO map properly, this opearation
turns out to be a NOP.

The previous implementation added significant overhead per mmap
addition as the memmove operation always moved the difference between
the current mmap entry and the end of the table.

Tested on Tegra platforms and this new approach improves the memory
mapping time by ~75%, thus significantly reducing boot time on some
platforms.

Change-Id: Ie3478fa5942379282ef58bee2085da799137e2ca
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
6 years agoMerge pull request #1328 from JiafeiPan/upstream-bl2-rom
Dimitris Papastamos [Mon, 9 Apr 2018 12:36:42 +0000 (13:36 +0100)]
Merge pull request #1328 from JiafeiPan/upstream-bl2-rom

Add support for BL2 in XIP memory

6 years agoJuno: Increase bl2 max size to fix build when SPD=opteed
Amit Daniel Kachhap [Fri, 23 Mar 2018 06:26:23 +0000 (11:56 +0530)]
Juno: Increase bl2 max size to fix build when SPD=opteed

Building TBBR(SPD=opteed) and non-TBBR TF-A images is breaking for
Juno for different configurations listed below:

* Overflow error of 4096 bytes for rsa algorithm.
* Overflow error of 8192 bytes for ecdsa algorithm.
* Overflow error of 4096 bytes for rsa+ecdsa algorithm.
* Overflow error of 4096 bytes for non-TBBR case.

So this patch increments macro PLAT_ARM_MAX_BL2_SIZE for all the above
cases accordingly.

Change-Id: I75ec6c0a718181d34553fe55437f0496f467683f
Signed-off-by: Amit Daniel Kachhap <amit.kachhap@arm.com>
6 years agoDMC500: Add platform support to set system interface count
Amit Daniel Kachhap [Mon, 9 Apr 2018 11:23:01 +0000 (16:53 +0530)]
DMC500: Add platform support to set system interface count

Some low end platforms using DMC500 memory controller do not have
CCI(Cache Coherent Interconnect) interface and only have non-coherent
system interface support. Hence this patch makes the system interface
count configurable from the platforms.

Change-Id: I6d54c90eb72fd18026c6470c1f7fd26c59dc4b9a
Signed-off-by: Amit Daniel Kachhap <amit.kachhap@arm.com>
6 years agoMerge pull request #1339 from dp-arm/dp/smccc
Dimitris Papastamos [Mon, 9 Apr 2018 10:15:08 +0000 (11:15 +0100)]
Merge pull request #1339 from dp-arm/dp/smccc

Fixup SMCCC_FEATURES return value for SMCCC_ARCH_WORKAROUND_1

6 years agofix instruction address range limitation
Jiafei Pan [Tue, 27 Mar 2018 15:00:55 +0000 (23:00 +0800)]
fix instruction address range limitation

For the adr instruction, it require the label's offset from the
address of this instruction must be in the range +/-1MB. If the
option "BL2_IN_XIP_MEM" is set to '1', in some cases, BL2's RW
memory will not in the range of +/-1MB from BL2's RO memory region.
so we need to use ldr instruction to cover this case.

Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
6 years agoAdd support for BL2 in XIP memory
Jiafei Pan [Wed, 21 Mar 2018 07:20:09 +0000 (07:20 +0000)]
Add support for BL2 in XIP memory

In some use-cases BL2 will be stored in eXecute In Place (XIP) memory,
like BL1. In these use-cases, it is necessary to initialize the RW sections
in RAM, while leaving the RO sections in place. This patch enable this
use-case with a new build option, BL2_IN_XIP_MEM. For now, this option
is only supported when BL2_AT_EL3 is 1.

Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
6 years agorockchip/rk3399: Fix sram_udelay
Derek Basehore [Fri, 6 Apr 2018 23:45:24 +0000 (16:45 -0700)]
rockchip/rk3399: Fix sram_udelay

This fixes an off by 576x bug the the sram_udelay code. The wrong
value was multipled by the system ticks per mhz value (which is 24),
so we delayed for 1/576th of the requested time.

Signed-off-by: Derek Basehore <dbasehore@chromium.org>
6 years agoFVP: Fix function for translating MPIDR to linear index
David Cunado [Thu, 5 Apr 2018 16:40:13 +0000 (17:40 +0100)]
FVP: Fix function for translating MPIDR to linear index

The current AArch32 version of plat_arm_calc_core_pos uses an incorrect
algorithm to calculate the linear position of a core / PE from its
MPIDR.

This patch corrects the algorithm to:

(ClusterId * FVP_MAX_CPUS_PER_CLUSTER) * FVP_MAX_PE_PER_CPU
+ (CPUId * FVP_MAX_PE_PER_CPU)
+ ThreadId

which supports cores where there are more than 1 PE per CPU.

NOTE: the AArch64 version was fixed in 39b21d1

Change-Id: I72aea89d8f72f8b1fef54e2177a0fa6fef0f5513
Signed-off-by: David Cunado <david.cunado@arm.com>
6 years agoMerge pull request #1338 from antonio-nino-diaz-arm/an/spm-flag-check
Dimitris Papastamos [Wed, 4 Apr 2018 08:58:24 +0000 (09:58 +0100)]
Merge pull request #1338 from antonio-nino-diaz-arm/an/spm-flag-check

SPM: Assert value of `ENABLE_SPM` build flag

6 years agoFixup SMCCC_FEATURES return value for SMCCC_ARCH_WORKAROUND_1
Dimitris Papastamos [Wed, 28 Mar 2018 11:06:40 +0000 (12:06 +0100)]
Fixup SMCCC_FEATURES return value for SMCCC_ARCH_WORKAROUND_1

Only return -1 if the workaround for CVE-2017-5715 is not compiled in.

Change-Id: I1bd07c57d22b4a13cf51b35be141a1f1ffb065ff
Signed-off-by: Dimitris Papastamos <dimitris.papastamos@arm.com>
6 years agoMerge pull request #1334 from michpappas/tf-issues#572_qemu_dont_use_C_for_crash_console
Dimitris Papastamos [Tue, 3 Apr 2018 10:59:55 +0000 (11:59 +0100)]
Merge pull request #1334 from michpappas/tf-issues#572_qemu_dont_use_C_for_crash_console

qemu: don't use C functions for the crash console callbacks

6 years agoSPM: Assert value of `ENABLE_SPM` build flag
Antonio Nino Diaz [Mon, 26 Mar 2018 14:57:17 +0000 (15:57 +0100)]
SPM: Assert value of `ENABLE_SPM` build flag

The Makefile was missing a check to verify that the value of
`ENABLE_SPM` is boolean.

Change-Id: I97222e4df9ae2fbd89cdb3263956dca52d360993
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
6 years agoqemu: don't use C functions for the crash console callbacks
Michalis Pappas [Tue, 27 Mar 2018 04:32:31 +0000 (12:32 +0800)]
qemu: don't use C functions for the crash console callbacks

Use the console_pl011_core_* functions directly in the crash console
callbacks.

This bypasses the MULTI_CONSOLE_API for the crash console (UART1), but
allows using the crash console before the C runtime has been initialized
(eg to call ASM_ASSERT). This retains backwards compatibility with respect
to functionality when the old API is used.

Use the MULTI_CONSOLE_API to register UART0 as the boot and runtime
console.

Fixes ARM-software/tf-issues#572

Signed-off-by: Michalis Pappas <mpappas@fastmail.fm>
6 years agoMerge pull request #1327 from npoushin/npoushin/sgi575
Dimitris Papastamos [Thu, 29 Mar 2018 13:20:42 +0000 (14:20 +0100)]
Merge pull request #1327 from npoushin/npoushin/sgi575

ARM platforms: Add support for SGI575

6 years agoMerge pull request #1313 from jonathanwright-ARM/jw/MISRA-switch-statements
Dimitris Papastamos [Thu, 29 Mar 2018 12:20:05 +0000 (13:20 +0100)]
Merge pull request #1313 from jonathanwright-ARM/jw/MISRA-switch-statements

Fix switch statements to comply with MISRA rules

6 years agoMerge pull request #1333 from jeenu-arm/icfg-fix
Dimitris Papastamos [Thu, 29 Mar 2018 12:19:04 +0000 (13:19 +0100)]
Merge pull request #1333 from jeenu-arm/icfg-fix

GIC: Fix interrupt setting interrupt configuration

6 years agoMerge pull request #1325 from michpappas/tf-issues#568_qemu_add_ENABLE_STACK_PROTECTOR
Dimitris Papastamos [Thu, 29 Mar 2018 10:27:36 +0000 (11:27 +0100)]
Merge pull request #1325 from michpappas/tf-issues#568_qemu_add_ENABLE_STACK_PROTECTOR

qemu: Add support for stack canary protection

6 years agoMerge pull request #1331 from hzhuang1/reboot_delay
Dimitris Papastamos [Thu, 29 Mar 2018 10:26:10 +0000 (11:26 +0100)]
Merge pull request #1331 from hzhuang1/reboot_delay

hikey960: add delay before reset

6 years agoMerge pull request #1329 from antonio-nino-diaz-arm/an/rpi3-multi-console
Dimitris Papastamos [Thu, 29 Mar 2018 09:04:06 +0000 (10:04 +0100)]
Merge pull request #1329 from antonio-nino-diaz-arm/an/rpi3-multi-console

rpi3: Migrate to the multi console API

6 years agoMerge pull request #1335 from JoelHutton/jh/cleanup_void_pointers
Dimitris Papastamos [Thu, 29 Mar 2018 08:59:52 +0000 (09:59 +0100)]
Merge pull request #1335 from JoelHutton/jh/cleanup_void_pointers

Clean usage of void pointers to access symbols

6 years agoMerge pull request #1336 from jonathanwright-ARM/jw/MISRA-init-arrays
Dimitris Papastamos [Thu, 29 Mar 2018 08:59:35 +0000 (09:59 +0100)]
Merge pull request #1336 from jonathanwright-ARM/jw/MISRA-init-arrays

psci: initialize array fully to comply with MISRA

6 years agoARM platforms: Add support for SGI575
Nariman Poushin [Mon, 26 Feb 2018 06:52:04 +0000 (06:52 +0000)]
ARM platforms: Add support for SGI575

Add support for System Guidance for Infrastructure platform SGI575.

Change-Id: I0125c2ed4469fbc8367dafcc8adce770b6b3147d
Signed-off-by: Nariman Poushin <nariman.poushin@linaro.org>
6 years agohikey960: add delay before reset
Haojian Zhuang [Mon, 26 Mar 2018 05:18:13 +0000 (13:18 +0800)]
hikey960: add delay before reset

If system is still accessing storage device, reboot operation
may cause data broken. So add the flush and delay operation
before system reset.

Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
6 years agopsci: initialize array fully to comply with MISRA
Jonathan Wright [Tue, 20 Mar 2018 14:34:01 +0000 (14:34 +0000)]
psci: initialize array fully to comply with MISRA

Initializes each element of the last_cpu_in_non_cpu_pd array in PSCI
stat implementation to -1, the reset value. This satisfies MISRA rule
9.3.

Previously, only the first element of the array was initialized to -1.

Change-Id: I666c71e6c073710c67c6d24c07a219b1feb5b773
Signed-off-by: Jonathan Wright <jonathan.wright@arm.com>
6 years agoClean usage of void pointers to access symbols
Joel Hutton [Wed, 21 Mar 2018 11:40:57 +0000 (11:40 +0000)]
Clean usage of void pointers to access symbols

Void pointers have been used to access linker symbols, by declaring an
extern pointer, then taking the address of it. This limits symbols
values to aligned pointer values. To remove this restriction an
IMPORT_SYM macro has been introduced, which declares it as a char
pointer and casts it to the required type.

Change-Id: I89877fc3b13ed311817bb8ba79d4872b89bfd3b0
Signed-off-by: Joel Hutton <Joel.Hutton@Arm.com>
6 years agorpi3: Use new console APIs
Antonio Nino Diaz [Tue, 27 Mar 2018 08:39:47 +0000 (09:39 +0100)]
rpi3: Use new console APIs

Switch to the new console APIs enabled by setting MULTI_CONSOLE_API=1.

The crash console doesn't use this API, it uses internally the core
functions of the 16550 console.

`bl31_plat_runtime_setup` is no longer needed. When this platform port
was introduced, that function used to disable the console. It was needed
to override that behaviour. The new behaviour is to switch to the
runtime console. The console is registered for all scopes (boot, crash
and runtime) in `rpi3_console_init` so it is not needed to override the
default behaviour anymore.

Update documentation.

Change-Id: If2ee8f91044216183b7ef142e5c05ad6220ae92f
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
6 years agoservices: fix switch statements to comply with MISRA rules
Jonathan Wright [Wed, 14 Mar 2018 15:56:21 +0000 (15:56 +0000)]
services: fix switch statements to comply with MISRA rules

Ensure (where possible) that switch statements in services comply with
MISRA rules 16.1 - 16.7.

Change-Id: I47bf6ed4a026201e6fe125ce51842482e99e8bb0
Signed-off-by: Jonathan Wright <jonathan.wright@arm.com>
6 years agoplat: fix switch statements to comply with MISRA rules
Jonathan Wright [Wed, 14 Mar 2018 15:24:00 +0000 (15:24 +0000)]
plat: fix switch statements to comply with MISRA rules

Ensure (where possible) that switch statements in plat comply with MISRA
rules 16.1 - 16.7.

Change-Id: Ie4a7d2fd10f6141c0cfb89317ea28a755391622f
Signed-off-by: Jonathan Wright <jonathan.wright@arm.com>
6 years agolib: fix switch statements to comply with MISRA rules
Jonathan Wright [Tue, 13 Mar 2018 17:45:42 +0000 (17:45 +0000)]
lib: fix switch statements to comply with MISRA rules

Ensure (where possible) that switch statements in lib comply with MISRA
rules 16.1 - 16.7.

Change-Id: I52bc896fb7094d2b7569285686ee89f39f1ddd84
Signed-off-by: Jonathan Wright <jonathan.wright@arm.com>