project/bcm63xx/atf.git
7 years agoTegra: delay_timer: fix MISRA defects
Anthony Zhou [Thu, 27 Apr 2017 14:00:54 +0000 (22:00 +0800)]
Tegra: delay_timer: fix MISRA defects

Main fixes:

* Include header file for function declarations [Rule 8.4]
* Move global object into function [Rule 8.9]

Change-Id: I1bc9f3f0ebd4ffc0b8444ac856cd97b0cb56bda4
Signed-off-by: Anthony Zhou <anzhou@nvidia.com>
7 years agoTegra: gic: fix MISRA defects
Varun Wadekar [Fri, 26 May 2017 01:06:59 +0000 (18:06 -0700)]
Tegra: gic: fix MISRA defects

Main fixes:

* Use int32_t replace int, use uint32_t replace unsign int [Rule 4.6]
* Added explicit casts (e.g. 0U) to integers in order for them to be
  compatible with whatever operation they're used in [Rule 10.1]
* Force operands of an operator to the same type category [Rule 10.4]
* Fixed assert/if statements conditions to be essentially boolean [Rule 14.4]
* Added curly braces ({}) around if statements in order to
  make them compound [Rule 15.6]
* Convert macros form headers to unsigned ints

Change-Id: I8051cc16499cece2039c9751bd347645f40f0901
Signed-off-by: Anthony Zhou <anzhou@nvidia.com>
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
7 years agoTegra: fiq_glue: fix MISRA defects
Anthony Zhou [Fri, 24 Feb 2017 06:44:21 +0000 (14:44 +0800)]
Tegra: fiq_glue: fix MISRA defects

Main fixes:

* Added explicit casts (e.g. 0U) to integers in order for them to be
  compatible with whatever operation they're used in [Rule 10.1]

* Convert object type to match the type of function parameters
  [Rule 10.3]

* Added curly braces ({}) around if statements in order to
  make them compound [Rule 15.6]

* Expressions resulting from the expansion of macro parameters
  shall be enclosed in parentheses[Rule 20.7]

Change-Id: I5cf83caafcc1650b545ca731bf3eb8f0bfeb362b
Signed-off-by: Anthony Zhou <anzhou@nvidia.com>
7 years agoTegra: pmc: fix defects flagged during MISRA analysis
Anthony Zhou [Mon, 13 Mar 2017 08:47:58 +0000 (16:47 +0800)]
Tegra: pmc: fix defects flagged during MISRA analysis

Main fixes:

* Fixed if/while statement conditional to be essentially boolean [Rule 14.4]

* Added curly braces ({}) around if/for/while statements in order to
  make them compound [Rule 15.6]

* Added explicit casts (e.g. 0U) to integers in order for them to be
  compatible with whatever operation they're used in [Rule 10.1]

Change-Id: Ic72b248aeede6cf18bf85051188ea7b8fd8ae829
Signed-off-by: Anthony Zhou <anzhou@nvidia.com>
7 years agoTegra: memctrl: check GPU reset state from common place
Varun Wadekar [Wed, 26 Apr 2017 15:31:50 +0000 (08:31 -0700)]
Tegra: memctrl: check GPU reset state from common place

This patch moves the GPU reset state check, during VideoMem resize, to the
common SiP handler, to reduce code duplication.

Change-Id: I3818c5f104b809da83dc2a61d6a8149606f81c13
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
7 years agoTegra: memctrl_v2: fix software logic to check "flush complete"
Varun Wadekar [Tue, 18 Apr 2017 16:55:54 +0000 (09:55 -0700)]
Tegra: memctrl_v2: fix software logic to check "flush complete"

This patch fixes the logic to check if the command written to the
MC_CLIENT_HOTRESET_CTRLx registers, was accepted by the hardware module.

Change-Id: If94fff9424555cb4688042eda17b4b20f4eb399a
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
7 years agoTegra: add explicit casts for integer macros
Varun Wadekar [Mon, 24 Apr 2017 21:17:12 +0000 (14:17 -0700)]
Tegra: add explicit casts for integer macros

This patch adds explicit casts (U(x)) to integers in the tegra_def.h
headers, to make them compatible with whatever operation they're used
in [MISRA-C Rule 10.1]

Change-Id: Ic5fc611aad986a2c6e6e6f625e0753ab9b69eb02
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
7 years agoinclude: add U()/ULL() macros for constants
Varun Wadekar [Fri, 26 May 2017 01:04:48 +0000 (18:04 -0700)]
include: add U()/ULL() macros for constants

This patch uses the U() and ULL() macros for constants, to fix some
of the signed-ness defects flagged by the MISRA scanner.

Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
7 years agoAdd U() macro to share constants between C and other sources
Varun Wadekar [Thu, 18 May 2017 17:32:51 +0000 (10:32 -0700)]
Add U() macro to share constants between C and other sources

This patch adds the U(_x) macros to utils_def.h to allow constants to
be shared between C and other sources.

Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
7 years agoUnique names for defines in the CPU libraries
Varun Wadekar [Mon, 5 Jun 2017 21:54:46 +0000 (14:54 -0700)]
Unique names for defines in the CPU libraries

This patch makes all the defines in the CPU libraries unique,
by prefixing them with the CPU name.

NOTE: PLATFORMS USING THESE MACROS WILL HAVE TO UPDATE THEIR CODE
TO START USING THE UPDATED NAMES

Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
7 years agoTegra: enable 'signed-comparison' compilation warning/errors
Varun Wadekar [Wed, 7 Jun 2017 16:57:42 +0000 (09:57 -0700)]
Tegra: enable 'signed-comparison' compilation warning/errors

This patch enables the 'sign-compare' flag, to enable warning/errors
for comparisons between signed/unsigned variables. The warning has
been enabled for all the Tegra platforms, to start with.

Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
7 years agoMerge pull request #979 from soby-mathew/sm/aarch32_macro_fix
davidcunado-arm [Wed, 14 Jun 2017 13:59:36 +0000 (14:59 +0100)]
Merge pull request #979 from soby-mathew/sm/aarch32_macro_fix

Fix stdlib defines for AArch32

7 years agoMerge pull request #974 from masahir0y/uniphier
davidcunado-arm [Tue, 13 Jun 2017 21:18:17 +0000 (22:18 +0100)]
Merge pull request #974 from masahir0y/uniphier

UniPhier Initial Support

7 years agoMerge pull request #982 from hzhuang1/fix_hikey960
davidcunado-arm [Tue, 13 Jun 2017 08:21:09 +0000 (09:21 +0100)]
Merge pull request #982 from hzhuang1/fix_hikey960

Fix hikey960

7 years agohikey960: fix the calculation in boardid
Haojian Zhuang [Mon, 12 Jun 2017 14:20:38 +0000 (22:20 +0800)]
hikey960: fix the calculation in boardid

Since the type of ADC value is always unsigned int, don't
need to check the value with negative value.

Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
7 years agoufs: fix the and operator
Haojian Zhuang [Mon, 12 Jun 2017 14:18:15 +0000 (22:18 +0800)]
ufs: fix the and operator

Should use AND (&), not &&.

Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
7 years agouniphier: add TSP support
Masahiro Yamada [Mon, 15 May 2017 04:00:00 +0000 (13:00 +0900)]
uniphier: add TSP support

Add TSP to test BL32 without relying on external projects.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
7 years agouniphier: support Socionext UniPhier platform
Masahiro Yamada [Sat, 3 Sep 2016 02:37:40 +0000 (11:37 +0900)]
uniphier: support Socionext UniPhier platform

Initial commit for Socionext UniPhier SoC support.  BL1, Bl2, and
BL31 are supported.  Refer to docs/plat/socionext-uniphier.md for
more detais.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
7 years agoFix stdlib defines for AArch32
Soby Mathew [Tue, 6 Jun 2017 09:01:03 +0000 (10:01 +0100)]
Fix stdlib defines for AArch32

Some of the macro defines in the header files of `include/lib/stdlib/machine/`
folder are not correct for AArch32. This patch fixes the same.

Change-Id: I8bfaf638a7986fd902648d2074537bd26c313cb3
Signed-off-by: Soby Mathew <soby.mathew@arm.com>
7 years agoMerge pull request #972 from achingupta/ag/freebsd-dt-change
davidcunado-arm [Fri, 9 Jun 2017 12:49:39 +0000 (13:49 +0100)]
Merge pull request #972 from achingupta/ag/freebsd-dt-change

Device tree changes to boot FreeBSD on FVPs

7 years agoMerge pull request #971 from Xilinx/tegra
davidcunado-arm [Fri, 9 Jun 2017 12:49:25 +0000 (13:49 +0100)]
Merge pull request #971 from Xilinx/tegra

tegra: Fix build errors

7 years agoMerge pull request #973 from danh-arm/dh/add-maintainers
davidcunado-arm [Fri, 9 Jun 2017 11:03:52 +0000 (12:03 +0100)]
Merge pull request #973 from danh-arm/dh/add-maintainers

Docs: Clarify copyright requirements

7 years agoMerge pull request #968 from antonio-nino-diaz-arm/an/snprintf-alt
davidcunado-arm [Fri, 9 Jun 2017 11:03:35 +0000 (12:03 +0100)]
Merge pull request #968 from antonio-nino-diaz-arm/an/snprintf-alt

mbedtls: Don't use tf_snprintf if option not defined

7 years agoMerge pull request #967 from rockchip-linux/rockchip-cleanup-20170606
davidcunado-arm [Thu, 8 Jun 2017 16:34:44 +0000 (17:34 +0100)]
Merge pull request #967 from rockchip-linux/rockchip-cleanup-20170606

 RK3399: Shrink M0 SRAM code to fit in PMUSRAM

7 years agotegra: Fix build errors
Soren Brinkmann [Wed, 7 Jun 2017 16:51:26 +0000 (09:51 -0700)]
tegra: Fix build errors

The 'impl' variable is guarded by the symbol DEBUG, but used in an INFO
level print statement. INFO is defined based on LOG_LEVEL. Hence, builds
would fail when
 - DEBUG=0 && LOG_LEVEL>=LOG_LEVEL_INFO with a variable used but not defined
 - DEBUG=1 && LOG_LEVEL<LOG_LEVEL_INFO with a variable defined but not used

Fixing this by guarding impl with the same condition that guards INFO.

Fixes ARM-software/tf-issues#490
Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
7 years agoDocs: Clarify copyright requirements
Dan Handley [Tue, 6 Jun 2017 16:26:37 +0000 (17:26 +0100)]
Docs: Clarify copyright requirements

Clarify copyright requirements in contributing.md.

Also clarify maintainership structure by adding a new maintainers.md. This
imports individual maintainer details from the GitHub wiki.

Fixes ARM-software/tf-issues#488

Change-Id: I7135d3f77ea45533f667de7e1dcdf65697486a91
Signed-off-by: Dan Handley <dan.handley@arm.com>
7 years agoMerge pull request #970 from vingu-linaro/enable-pmf-rt-instr-hikey
danh-arm [Thu, 8 Jun 2017 10:46:34 +0000 (11:46 +0100)]
Merge pull request #970 from vingu-linaro/enable-pmf-rt-instr-hikey

Enable pmf rt instr hikey

7 years agoMerge pull request #959 from hzhuang1/hikey960_v1
danh-arm [Thu, 8 Jun 2017 08:50:03 +0000 (09:50 +0100)]
Merge pull request #959 from hzhuang1/hikey960_v1

Hikey960 v1

7 years agorockchip: check wakeup cpu when resume
Lin Huang [Fri, 12 May 2017 02:26:32 +0000 (10:26 +0800)]
rockchip: check wakeup cpu when resume

unlike rk3399 and rk3368, there are some rockchip 64bit SOC
do not have CPUPD, and pmu_cpuson_entrypoint() is common
function for rockchip platform, so we need to check wakeup
cpu when resume.

Change-Id: I6313e8a9d7c16b03e033414f0cb281646c2159ff
Signed-off-by: Lin Huang <hl@rock-chips.com>
7 years agorockchip/rk3399: enable PMU_PERILP_PD_EN bit when suspend
Lin Huang [Tue, 16 May 2017 08:40:46 +0000 (16:40 +0800)]
rockchip/rk3399: enable PMU_PERILP_PD_EN bit when suspend

with PMU_PERILP_PD_EN bit enable, the soc will shutdown
cm0, crypto, dcf, imem(normal SRAM), dmac, bootrom, efuse_con,
spi, i2c, uart, saradc, tsadc when suspend, we have M0 code
need to run when suspend in normal SRAM, so we need to take
care of that.

Change-Id: I8c066637e5b81d4b1d53197450b9d592cbe00793
Signed-off-by: Lin Huang <hl@rock-chips.com>
Signed-off-by: Derek Basehore <dbasehore@chromium.org>
Signed-off-by: Caesar Wang <wxt@rock-chips.com>
7 years agorockchip/rk3399: Move DRAM restore to PMUSRAM
Derek Basehore [Tue, 16 May 2017 04:18:28 +0000 (21:18 -0700)]
rockchip/rk3399: Move DRAM restore to PMUSRAM

This moves the DRAM restore code to PMUSRAM. This is so that the
voltage domain that contains the SRAM that it was stored in before may
be turned off during system suspend.

Change-Id: Id761181a30caadd12f1ce061d1034f3159a76d28
Signed-off-by: Derek Basehore <dbasehore@chromium.org>
7 years agorockchip/rk3399: convert to for-loops to save code space
Derek Basehore [Sat, 13 May 2017 04:29:13 +0000 (21:29 -0700)]
rockchip/rk3399: convert to for-loops to save code space

This converts two functions to use for-loops. This saves a bit of
space to help moving DRAM resume code to PMUSRAM.

Change-Id: Ie6ca490cf50c2ec83335cf1845b337c3e8a47496
Signed-off-by: Derek Basehore <dbasehore@chromium.org>
7 years agorockchip/rk3399: Remove unneeded if statement
Derek Basehore [Thu, 11 May 2017 06:22:02 +0000 (23:22 -0700)]
rockchip/rk3399: Remove unneeded if statement

The removed if statement would make the same check that the for loop
it is in does to break out of the for loop, so it doesn't make any
sense to keep it there.

Change-Id: I819c29f9182e6de1fc47e418aed15ad38e8f9fa9
Signed-off-by: Derek Basehore <dbasehore@chromium.org>
7 years agorockchip/rk3399: Remove unneeded register sets
Derek Basehore [Thu, 11 May 2017 04:59:31 +0000 (21:59 -0700)]
rockchip/rk3399: Remove unneeded register sets

This removes the mmio_... function calls to set the multicast bit for
the PHY registers when overriding the write leveling values. These are
not needed since multicast is set by default when calling the
function, and it's also better not to leave the side effect of
disabling multicast when exiting the function.

Change-Id: I83e089a2a2d55268b3832f36724c3b2c4be81082
Signed-off-by: Derek Basehore <dbasehore@chromium.org>
7 years agorockchip/rk3399: remove unneeded DDR restore function
Derek Basehore [Sun, 7 May 2017 06:22:23 +0000 (23:22 -0700)]
rockchip/rk3399: remove unneeded DDR restore function

This removes the phy_dll_bypass_set function as it is unneeded. The
values that function sets are saved during suspend, so the proper
values will be restored on resume.

Change-Id: I17542206c56e639ce8cb6375233145167441d4e2
Signed-off-by: Derek Basehore <dbasehore@chromium.org>
7 years agorockchip/rk3399: Save space for DRAM suspend data
Derek Basehore [Sat, 6 May 2017 00:53:33 +0000 (17:53 -0700)]
rockchip/rk3399: Save space for DRAM suspend data

This removes the space allocation for the unused PHY register space.
For instance in PHY registers 0-127, only 0-90 are used, so don't save
the 91-127 registers. This saves about 1.6KB of space.

Change-Id: I0c9f6d9bed8f0c1f3b8b805dfb10cf0c06208919
Signed-off-by: Derek Basehore <dbasehore@chromium.org>
7 years agorockchip: add pmusram section
Lin Huang [Thu, 4 May 2017 08:02:45 +0000 (16:02 +0800)]
rockchip: add pmusram section

the function pmu_cpuon_entrypoint() need to run in the pmusram,
we just copy bin file to pmusram before, now we add pmusram section
and link pmu_cpuon_entrypoint() to pmusram directly

Change-Id: Iae31e4c01c480c8e6f565a8f588332b478efdb16
Signed-off-by: Lin Huang <hl@rock-chips.com>
Signed-off-by: Caesar Wang <wxt@rock-chips.com>
7 years agorockchip/rk3399: fix DRAM gate training issue
Lin Huang [Wed, 22 Feb 2017 10:24:55 +0000 (18:24 +0800)]
rockchip/rk3399: fix DRAM gate training issue

The differential signal of DQS need keep low level
before gate training. It need enable RPULL and disable
PHY side ODT to ensure it when do gate training.
But it can not access the PHY registers to do it when
perform DFS.So the workaroud as below: It is ensure that
the PHY's read gate is landing somewhere in the incoming
DQS's pulses before it starts searching for pre-amble window.
It need get the rddqs_delay_ps to calculate the start point
of gate training for DFS.

Change-Id: I79eabcf4ec9a9c8f4539f68a51f22afba49c72fe
Signed-off-by: Lin Huang <hl@rock-chips.com>
7 years agohikey960: add document
Haojian Zhuang [Thu, 1 Jun 2017 08:46:41 +0000 (16:46 +0800)]
hikey960: add document

Add document on HiKey960 platform and how to build.

Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
7 years agohikey960: support BL31
Haojian Zhuang [Thu, 1 Jun 2017 07:20:46 +0000 (15:20 +0800)]
hikey960: support BL31

Support BL31 on HiKey960 platform. Implement PSCI.

Signed-off-by: Leo Yan <leo.yan@linaro.org>
Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
7 years agohikey960: support BL2
Haojian Zhuang [Thu, 1 Jun 2017 06:03:22 +0000 (14:03 +0800)]
hikey960: support BL2

BL2 loads MCU firmware & BL31 on hikey960 platform. The MCU firmware
is used to implement low power feature.

Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
7 years agohikey960: support BL1 on hikey960 platform
Haojian Zhuang [Thu, 1 Jun 2017 04:15:14 +0000 (12:15 +0800)]
hikey960: support BL1 on hikey960 platform

Support BL1 on HiKey960 platform. When recovery mode is detected,
BL1 loads NS BL1U that flushs images into UFS. When normal boot
mode is detected, BL1 loads BL2.

Fix for https://github.com/ARM-software/tf-issues/issues/486

Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
7 years agohikey: enable PMF and instrumentations
Vincent Guittot [Wed, 7 Jun 2017 08:12:05 +0000 (10:12 +0200)]
hikey: enable PMF and instrumentations

enable PMF service call and instrumetion for hikey platform

Signed-off-by: Vincent Guittot <vincent.guittot@linaro.org>
7 years agostdlib: support AARCH32 in endian head file
Haojian Zhuang [Fri, 2 Jun 2017 00:51:17 +0000 (08:51 +0800)]
stdlib: support AARCH32 in endian head file

Add the support of AARCH32 in endian head file. The code is also
imported from FreeBSD 11.0. It's based on commit in below.

commit 4e3a5b429989b4ff621682ff1462f801237bd551
Author: mmel <mmel@FreeBSD.org>
Date:   Tue Nov 10 12:02:41 2015 +0000

    ARM: Remove trailing whitespace from sys/arm/include
    No functional changes.

    Approved by:    kib (mentor)

Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
7 years agostdlib: import endian head file from freebsd
Haojian Zhuang [Thu, 1 Jun 2017 13:55:53 +0000 (21:55 +0800)]
stdlib: import endian head file from freebsd

Import endian head files from FreeBSD 11.0. The link of FreeBSD source code
is https://github.com/freebsd/freebsd

Import machine/endian.h from sys/arm64/include/endian.h in FreeBSD.
commit d09ff72cef8e35dbf62f7363dcbf07b453f06243
Author: andrew <andrew@FreeBSD.org>
Date:   Mon Mar 23 11:54:56 2015 +0000

    Add the start of the arm64 machine headers. This is the subset needed to
    start getting userland libraries building.

    Reviewed by:        imp
    Sponsored by:       The FreeBSD Foundation

Import sys/endian.h from sys/sys/endian.h in FreeBSD.
commit 3c3fa2f5b0c7640373fcbcc3f667bf7794e8e609
Author: phk <phk@FreeBSD.org>
Date:   Thu May 20 06:16:13 2010 +0000

    Fix some way-past-brucification complaints from FlexeLint.

Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
7 years agoMerge pull request #969 from Summer-ARM/sq/update-doc
danh-arm [Tue, 6 Jun 2017 12:39:58 +0000 (13:39 +0100)]
Merge pull request #969 from Summer-ARM/sq/update-doc

Update the path for firmware_image_package.h in firmware-design.md

7 years agombedtls: Don't use tf_snprintf if option not defined
Antonio Nino Diaz [Tue, 6 Jun 2017 09:54:39 +0000 (10:54 +0100)]
mbedtls: Don't use tf_snprintf if option not defined

If `MBEDTLS_PLATFORM_SNPRINTF_ALT` isn't used, the function
`mbedtls_platform_set_snprintf()` isn't defined.

In case a platform uses a different mbed TLS configuration file than
the one provided by the Trusted Firmware, and it doesn't define the
mentioned build option, this will result in a build error.

This patch modifies the initialization code so that
`mbedtls_platform_set_snprintf()` is only used if
`MBEDTLS_PLATFORM_SNPRINTF_ALT` is defined, allowing platforms to use
it or not depending on their needs.

Change-Id: I1d5c86d57e9b2871ba463030bf89210ebec5178e
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
7 years agoMerge pull request #964 from soby-mathew/sm/rsapss_sup
danh-arm [Mon, 5 Jun 2017 13:45:10 +0000 (14:45 +0100)]
Merge pull request #964 from soby-mathew/sm/rsapss_sup

Add support for RSASSAPSS algorithm

7 years agoMerge pull request #963 from soby-mathew/sm/scmi_dev
danh-arm [Mon, 5 Jun 2017 13:42:59 +0000 (14:42 +0100)]
Merge pull request #963 from soby-mathew/sm/scmi_dev

Add SCMI power domain and system power protocol support

7 years agoMerge pull request #961 from jeenu-arm/gic-600
danh-arm [Mon, 5 Jun 2017 13:41:31 +0000 (14:41 +0100)]
Merge pull request #961 from jeenu-arm/gic-600

Introduce ARM GIC-600 driver

7 years agoMerge pull request #960 from jeenu-arm/cpu-libs
danh-arm [Mon, 5 Jun 2017 13:41:20 +0000 (14:41 +0100)]
Merge pull request #960 from jeenu-arm/cpu-libs

Add support for Cortex-A75 and Cortex-A55 CPUs

7 years agoMerge pull request #962 from antonio-nino-diaz-arm/an/fwu-checks
danh-arm [Mon, 5 Jun 2017 13:09:41 +0000 (14:09 +0100)]
Merge pull request #962 from antonio-nino-diaz-arm/an/fwu-checks

FWU: Check for overlaps when loading images, introduce `FWU_SMC_IMAGE_RESET`

7 years agoAdd SCMI support for Juno platform
Soby Mathew [Mon, 14 Nov 2016 12:44:32 +0000 (12:44 +0000)]
Add SCMI support for Juno platform

This patch adds the memory map region for the SCMI payload memory
and maps the Juno core indices to SCMI power domains via the
`plat_css_core_pos_to_scmi_dmn_id_map` array.

Change-Id: I0d2bb2a719ff5b6a9d8e22e91e1625ab14453665
Signed-off-by: Soby Mathew <soby.mathew@arm.com>
7 years agoCSS: Add SCMI driver for SCP
Soby Mathew [Mon, 14 Nov 2016 12:25:45 +0000 (12:25 +0000)]
CSS: Add SCMI driver for SCP

This patch adds the SCMI driver for communicating with SCP. The power
domain management and system power management protocol of the SCMI
specification[1] is implemented in the driver. The SCP power management
abstraction layer for SCMI for CSS power management is also added.

A new buid option `CSS_USE_SCMI_DRIVER` is introduced to select SCMI
driver over SCPI.

[1] ARM System Control and Management Interface v1.0 (SCMI)
Document number: ARM DEN 0056A

Change-Id: I67265615a17e679a2afe810b9b0043711ba09dbb
Signed-off-by: Soby Mathew <soby.mathew@arm.com>
7 years agocert_create: Use RSASSA-PSS signature scheme for certificates
Soby Mathew [Mon, 22 May 2017 15:12:33 +0000 (16:12 +0100)]
cert_create: Use RSASSA-PSS signature scheme for certificates

This patch modifies the `cert_create` tool to use RSASSA-PSS scheme for
signing the certificates. This is compliant with RSA PKCS_2_1 standard as
mandated by TBBR.

Note that the certificates generated by using cert_create tool after this
patch can be authenticated during TBB only if the corresponding mbedtls
driver in ARM Trusted Firmware has the corresponding support.

Change-Id: If224f41c76b3c4765ae2af5259e67f73602818a4
Signed-off-by: Soby Mathew <soby.mathew@arm.com>
7 years agoAdd support for RSASSAPSS algorithm in mbedtls crypto driver
Soby Mathew [Wed, 31 May 2017 09:35:27 +0000 (10:35 +0100)]
Add support for RSASSAPSS algorithm in mbedtls crypto driver

This patch adds support for RSASSA-PSS Signature Algorithm for
X509 certificates in mbedtls crypto driver. Now the driver supports
RSA PKCS2_1 standard as mandated by TBBR.

NOTE: With this patch, the PKCS1_5 standard compliant RSA signature
is deprecated.

Change-Id: I9cf6d073370b710cc36a7b374a55ec96c0496461
Signed-off-by: Soby Mathew <soby.mathew@arm.com>
7 years agoIncrease heapsize for mbedtls library
Soby Mathew [Mon, 5 Jun 2017 11:18:04 +0000 (12:18 +0100)]
Increase heapsize for mbedtls library

The mbedTLS library requires larger heap memory for verification of RSASSA-PSS
signature in certificates during Trusted Board Boot. This patch increases the
heap memory for the same.

Change-Id: I3c3123d7142b7b7b01463516ec436734895da159
Signed-off-by: Soby Mathew <soby.mathew@arm.com>
7 years agoUpdate the path for firmware_image_package.h in firmware-design.md
Summer Qin [Mon, 10 Apr 2017 16:14:38 +0000 (17:14 +0100)]
Update the path for firmware_image_package.h in firmware-design.md

Change-Id: Ic0a9b3c6d212e7171b37f944e11f079282dcce87
Signed-off-by: Summer Qin <summer.qin@arm.com>
7 years agoDevice tree changes to boot FreeBSD on FVPs
Achin Gupta [Mon, 26 Sep 2016 09:22:56 +0000 (10:22 +0100)]
Device tree changes to boot FreeBSD on FVPs

FreeBSD does not understand #interrupt-map in a device tree. This prevents the
GIC from being set up correctly. This patch removes the #interrupt-map in the
device trees for the Base and Foundation FVPs. This enables correct boot of
FreeBSD on these platforms.

These changes have been tested with FreeBSD and an Ubuntu cloud image
(ubuntu-16.04-server-cloudimg-arm64-uefi1.img) to ensure compatibility with
Linux.

Change-Id: I1347acdcf994ec4b1dd843ba32af9951aa54db73
Signed-off-by: Achin Gupta <achin.gupta@arm.com>
7 years agoFWU: Introduce FWU_SMC_IMAGE_RESET
Antonio Nino Diaz [Fri, 12 May 2017 15:51:59 +0000 (16:51 +0100)]
FWU: Introduce FWU_SMC_IMAGE_RESET

This SMC is as a means for the image loading state machine to go from
COPYING, COPIED or AUTHENTICATED states to RESET state. Previously, this
was only done when the authentication of an image failed or when the
execution of the image finished.

Documentation updated.

Change-Id: Ida6d4c65017f83ae5e27465ec36f54499c6534d9
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
7 years agoFWU: Check for overlaps when loading images
Antonio Nino Diaz [Thu, 1 Jun 2017 12:40:17 +0000 (13:40 +0100)]
FWU: Check for overlaps when loading images

Added checks to FWU_SMC_IMAGE_COPY to prevent loading data into a
memory region where another image data is already loaded.

Without this check, if two images are configured to be loaded in
overlapping memory regions, one of them can be loaded and
authenticated and the copy function is still able to load data from
the second image on top of the first one. Since the first image is
still in authenticated state, it can be executed, which could lead to
the execution of unauthenticated arbitrary code of the second image.

Firmware update documentation updated.

Change-Id: Ib6871e569794c8e610a5ea59fe162ff5dcec526c
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
7 years agoRemove `DISABLE_PEDANTIC` build option
Antonio Nino Diaz [Fri, 12 May 2017 15:14:51 +0000 (16:14 +0100)]
Remove `DISABLE_PEDANTIC` build option

It doesn't make sense to use the `-pedantic` flag when building the
Trusted Firmware as we use GNU extensions and so our code is not
fully ISO C compliant. This flag only makes sense if the code intends to
be ISO C compliant.

Change-Id: I6273564112759ff57f03b273f5349733a5f38aef
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
7 years agoIntroduce ARM GIC-600 driver
Jeenu Viswambharan [Tue, 6 Dec 2016 16:15:22 +0000 (16:15 +0000)]
Introduce ARM GIC-600 driver

ARM GIC-600 IP complies with ARM GICv3 architecture, but among others,
implements a power control register in the Redistributor frame. This
register must be programmed to mark the frame as powered on, before
accessing other registers in the frame. Rest of initialization sequence
remains the same.

The driver provides APIs for Redistributor power management, and
overrides those in the generic GICv3 driver. The driver data is shared
between generic GICv3 driver and that of GIC-600.

For FVP platform, the GIC-600 driver is chosen when FVP_USE_GIC_DRIVER
is set to FVP_GIC600. Also update user guide.

Change-Id: I321b2360728d69f6d4b0a747b2cfcc3fe5a20d67
Signed-off-by: Jeenu Viswambharan <jeenu.viswambharan@arm.com>
7 years agoAdd support for Cortex-A75 and Cortex-A55 CPUs
David Wang [Wed, 9 Nov 2016 16:29:02 +0000 (16:29 +0000)]
Add support for Cortex-A75 and Cortex-A55 CPUs

Both Cortex-A75 and Cortex-A55 CPUs use the ARM DynamIQ Shared Unit
(DSU). The power-down and power-up sequences are therefore mostly
managed in hardware, and required software operations are considerably
simpler.

Change-Id: I68b30e6e1ebe7c041d5e67f39c59f08575fc7ecc
Co-authored-by: Sandrine Bailleux <sandrine.bailleux@arm.com>
Signed-off-by: Jeenu Viswambharan <jeenu.viswambharan@arm.com>
7 years agoMerge pull request #957 from hzhuang1/finish_hikey_psci
danh-arm [Thu, 1 Jun 2017 10:04:48 +0000 (11:04 +0100)]
Merge pull request #957 from hzhuang1/finish_hikey_psci

Finish hikey psci

7 years agoMerge pull request #958 from antonio-nino-diaz-arm/an/mbedtls-heap-size
danh-arm [Wed, 31 May 2017 15:40:56 +0000 (16:40 +0100)]
Merge pull request #958 from antonio-nino-diaz-arm/an/mbedtls-heap-size

mbedtls: Define optimized mbed TLS heap size

7 years agombedtls: Define optimized mbed TLS heap size
Antonio Nino Diaz [Fri, 19 May 2017 15:57:54 +0000 (16:57 +0100)]
mbedtls: Define optimized mbed TLS heap size

mbed TLS provides the debug API `mbedtls_memory_buffer_alloc_status()`
to analyse the RAM usage of the library.

When RSA is selected as algorithm, the maximum heap usage in FVP and
Juno has been determined empirically to be approximately 5.5 KiB.
However, The default heap size used when RSA is selected is 8 KiB.

This patch reduces the buffer from 8 KiB to 6 KiB so that the BSS
sections of both BL1 and BL2 are 2 KiB smaller when the firmware is
compiled with TBB support.

Change-Id: I43878a4e7af50c97be9c8d027c728c8483f24fbf
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
7 years agoMerge pull request #955 from hzhuang1/ufs
danh-arm [Wed, 31 May 2017 13:25:36 +0000 (14:25 +0100)]
Merge pull request #955 from hzhuang1/ufs

Add ufs stack and designware phy

7 years agoMerge pull request #956 from hzhuang1/fix_var_in_ddr
danh-arm [Wed, 31 May 2017 13:23:41 +0000 (14:23 +0100)]
Merge pull request #956 from hzhuang1/fix_var_in_ddr

hikey: fix uninitialized variable in ddr code

7 years agohikey: pm: finish PSCI hook functions
Leo Yan [Sat, 27 May 2017 05:17:45 +0000 (13:17 +0800)]
hikey: pm: finish PSCI hook functions

This patch is to enable CPU suspend/resume and system level's
suspend/resume; also enable system power off state.

Signed-off-by: Leo Yan <leo.yan@linaro.org>
Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
7 years agohikey: bl31: enable CCI port for cluster 0
Leo Yan [Sat, 27 May 2017 05:15:40 +0000 (13:15 +0800)]
hikey: bl31: enable CCI port for cluster 0

The cluster 0 doesn't rely on PSCI to enable it; so enable CCI port
for cluster 0 in BL31 platform setup flow.

Signed-off-by: Leo Yan <leo.yan@linaro.org>
Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
7 years agohikey: fix for CPU topology
Leo Yan [Sat, 27 May 2017 05:12:40 +0000 (13:12 +0800)]
hikey: fix for CPU topology

Fix for CPU topology so present the CPU core numbers for two clusters;
Base on this fixing, the PSCI can maintain correct power states.

Signed-off-by: Leo Yan <leo.yan@linaro.org>
Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
7 years agohikey: fix uninitialized variable in ddr code
Haojian Zhuang [Wed, 31 May 2017 04:42:10 +0000 (12:42 +0800)]
hikey: fix uninitialized variable in ddr code

Fix uninitliazed variable in ddr driver code.

Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
7 years agodrivers: add designware ufs driver
Haojian Zhuang [Wed, 31 May 2017 17:00:46 +0000 (11:00 -0600)]
drivers: add designware ufs driver

Initialized the designware UFS PHY.

Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
7 years agodrivers: add ufs stack
Haojian Zhuang [Wed, 31 May 2017 03:00:15 +0000 (11:00 +0800)]
drivers: add ufs stack

If UFS device is initialized, we could just make it out of
hibernation by UFS_FLAGS_SKIPINIT. And vendor's dirver is always
focus on PHY setting. We could use UFS driver directly if it
exits from hibernation.

There're eight LUNs in UFS device. The UFS driver only provides
the read/write API with LUN. User could define his own read/write
since user may want to access different LUNs.

Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
7 years agoMerge pull request #949 from antonio-nino-diaz-arm/an/printf-memory
davidcunado-arm [Tue, 30 May 2017 09:56:47 +0000 (10:56 +0100)]
Merge pull request #949 from antonio-nino-diaz-arm/an/printf-memory

Reduce code size when building with Trusted Board Boot enabled

7 years agoMerge pull request #950 from danh-arm/hz/hikey
davidcunado-arm [Thu, 25 May 2017 10:26:22 +0000 (11:26 +0100)]
Merge pull request #950 from danh-arm/hz/hikey

HiKey v3

7 years agoMerge pull request #951 from dp-arm/dp/compiler-rt-cleanup
danh-arm [Wed, 24 May 2017 16:37:50 +0000 (17:37 +0100)]
Merge pull request #951 from dp-arm/dp/compiler-rt-cleanup

compiler-rt: Remove unused int_util.[ch] files

7 years agohikey: add hikey support
Haojian Zhuang [Wed, 24 May 2017 01:36:49 +0000 (09:36 +0800)]
hikey: add hikey support

Add the description on hikey and how to build.

Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
7 years agohikey: support BL31
Haojian Zhuang [Wed, 24 May 2017 00:49:26 +0000 (08:49 +0800)]
hikey: support BL31

Support BL31 and PSCI. Enable multiple cores in PSCI.

Change-Id: I66c39e1e9c4c45ac41a0142ed2070d79a3ac5ba3
Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
Signed-off-by: Dan Handley <dan.handley@arm.com>
7 years agoCortex-A53: add some bit definitions
Haojian Zhuang [Wed, 24 May 2017 00:48:57 +0000 (08:48 +0800)]
Cortex-A53: add some bit definitions

Add some bit definitions of CPUACTLR register in Cortex-A53
CPU library.

Change-Id: I142fd8ac4b06dd651a32e22951e71cdebbea123a
Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
Signed-off-by: Dan Handley <dan.handley@arm.com>
7 years agohikey: support BL2
Haojian Zhuang [Wed, 24 May 2017 00:47:49 +0000 (08:47 +0800)]
hikey: support BL2

BL2 is used to load BL31 and SCP_BL2. In HiKey platform, SCP_BL2
is the mcu firmware that is used to scale cpu frequency and switch
low power mode.

Change-Id: I1621aa65bea989fd125ee8502fd56ef72362bf97
Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
Signed-off-by: Dan Handley <dan.handley@arm.com>
7 years agohikey: support BL1
Haojian Zhuang [Wed, 24 May 2017 00:45:05 +0000 (08:45 +0800)]
hikey: support BL1

Initialize regulators, pins and eMMC in BL1. Only SRAM could be used in BL1.
So BL2 will be loaded from eMMC into SRAM later.

Change-Id: I8e7ef82ffa29a3c647c9d2d2981e8759ee85d833
Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
Signed-off-by: Dan Handley <dan.handley@arm.com>
7 years agocompiler-rt: Remove unused int_util.[ch] files
dp-arm [Wed, 24 May 2017 14:23:02 +0000 (15:23 +0100)]
compiler-rt: Remove unused int_util.[ch] files

Change-Id: I32fc523e3178b7e50191682241904d52499ff708
Signed-off-by: dp-arm <dimitris.papastamos@arm.com>
7 years agoMerge pull request #941 from dp-arm/dp/clang
danh-arm [Wed, 24 May 2017 13:56:59 +0000 (14:56 +0100)]
Merge pull request #941 from dp-arm/dp/clang

Allow TF to be built using clang or ARM Compiler 6

7 years agodocs: Add note on how to build TF using clang or armclang
dp-arm [Mon, 15 May 2017 12:50:51 +0000 (13:50 +0100)]
docs: Add note on how to build TF using clang or armclang

Change-Id: I92fd2fb920fcfc31bfcdadae787d8c84c5ca463b
Signed-off-by: dp-arm <dimitris.papastamos@arm.com>
7 years agobuild: Introduce ARM Compiler 6 support
dp-arm [Wed, 3 May 2017 15:30:32 +0000 (16:30 +0100)]
build: Introduce ARM Compiler 6 support

Only the compiler is switched to ARM Compiler 6.  The assembler and linker
are provided by the GCC toolchain.

ARM Compiler 6 is used to build TF when the base name of the path assigned
to `CC` matches the string 'armclang'.

`CROSS_COMPILE` is still needed and should point to the appropriate
GCC toolchain.

Tested with ARM CC 6.7.

Change-Id: Ib359bf9c1e8aeed3f662668e44830864f3fe7b4a
Signed-off-by: dp-arm <dimitris.papastamos@arm.com>
7 years agobuild: Introduce clang support
dp-arm [Tue, 2 May 2017 11:00:08 +0000 (12:00 +0100)]
build: Introduce clang support

Only the compiler is switched to clang.  The assembler and linker are
provided by the GCC toolchain.

clang is used to build TF when the base name of the path assigned to
`CC` contains the string 'clang'.

`CROSS_COMPILE` is still needed and should point to the appropriate
GCC toolchain.

Tested with clang 3.9.x and 4.0.x.

Change-Id: I53236d64e3c83ad27fc843bae5fcdae30f2e325e
Signed-off-by: dp-arm <dimitris.papastamos@arm.com>
7 years agobuild: Introduce HOSTCC flag
dp-arm [Tue, 2 May 2017 10:09:11 +0000 (11:09 +0100)]
build: Introduce HOSTCC flag

Tools are built using the compiler specified in `HOSTCC` instead of
reusing the `CC` variable.  By default, gcc is used.

Change-Id: I83636a375c61f4804b4e80784db9d061fe20af87
Signed-off-by: dp-arm <dimitris.papastamos@arm.com>
7 years agoSwitch default C environment from c99 to gnu99
dp-arm [Wed, 3 May 2017 15:30:54 +0000 (16:30 +0100)]
Switch default C environment from c99 to gnu99

Since TF uses GCC extensions, switch the C environment
from c99 to gnu99.

This change allows armclang to build TF.

Change-Id: Iaacb2726ba1458af59faf607ae9405d6eedb9962
Signed-off-by: dp-arm <dimitris.papastamos@arm.com>
7 years agoplat/arm: Compile out impossible conditional for AArch32
dp-arm [Wed, 3 May 2017 11:14:10 +0000 (12:14 +0100)]
plat/arm: Compile out impossible conditional for AArch32

Since ARM_DRAM2_BASE is above the 32-bit limit, the condition
is always false.  Wrap this condition in an ifndef to avoid
warnings during compilation.

Change-Id: Ideabb6c65de6c62474ed03eb29df4b049d5316be
Signed-off-by: dp-arm <dimitris.papastamos@arm.com>
7 years agoRemove plat_match_rotpk reference
dp-arm [Tue, 2 May 2017 11:39:19 +0000 (12:39 +0100)]
Remove plat_match_rotpk reference

This function was removed long ago.  Remove remaining
pragma reference.

Change-Id: I66c556863d47dc17d2ffdc6c23aa524df6aade80
Signed-off-by: dp-arm <dimitris.papastamos@arm.com>
7 years agofvp: Remove unnecessary default case
dp-arm [Tue, 2 May 2017 11:35:24 +0000 (12:35 +0100)]
fvp: Remove unnecessary default case

The default case is impossible to hit as the `power_level`
is already checked earlier.  Avoids a clang warning.

Change-Id: I707463c843adc748ee9aa1d2313f9ab7dab3a8ab
Signed-off-by: dp-arm <dimitris.papastamos@arm.com>
7 years agoInclude missing header in arm_bl2_setup.c
dp-arm [Tue, 2 May 2017 10:49:33 +0000 (11:49 +0100)]
Include missing header in arm_bl2_setup.c

Change-Id: I4108ce8d1fe7d3fd51a5a96d43b9134c23b8399b
Signed-off-by: dp-arm <dimitris.papastamos@arm.com>
7 years agoUse a callee-saved register to be AAPCS-compliant
dp-arm [Fri, 5 May 2017 11:21:03 +0000 (12:21 +0100)]
Use a callee-saved register to be AAPCS-compliant

x8 is not a callee-saved register and can be corrupted.
Use x19 instead to be AAPCS-compliant.

Fixes ARM-software/tf-issues#478

Change-Id: Ib4f114c36f4c11351ae856f953c45dca92b27c3b
Signed-off-by: dp-arm <dimitris.papastamos@arm.com>
7 years agoMerge pull request #938 from masahir0y/tools_share
danh-arm [Wed, 24 May 2017 13:20:20 +0000 (14:20 +0100)]
Merge pull request #938 from masahir0y/tools_share

Collect headers shared between TF and host-tools into include/tools_share

7 years agombedtls: Use `MBEDTLS_SHA256_SMALLER` in ARM platforms
Antonio Nino Diaz [Wed, 24 May 2017 13:11:07 +0000 (14:11 +0100)]
mbedtls: Use `MBEDTLS_SHA256_SMALLER` in ARM platforms

This options enables an implementation of SHA-256 that has a smaller
code footprint (~1.6 KB less) but is also ~30% slower. For ARM
platforms, code size is currently considered more important than
execution speed in the mbed TLS crypto module.

Added a small note about this option to the documentation of the
authentication framework.

Change-Id: I4c0b221ea5d3466465261316ba07b627fa01b233
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
7 years agombedtls: Use `tf_snprintf` instead of `snprintf`
Antonio Nino Diaz [Fri, 19 May 2017 10:37:22 +0000 (11:37 +0100)]
mbedtls: Use `tf_snprintf` instead of `snprintf`

The Trusted Firmware uses a subset of the APIs provided by mbed TLS.
This subset internally uses `snprintf`, but the only format specifier
used is '%d', which is supported by `tf_snprintf`.

This patch makes mbed TLS use `tf_snprintf` instead of `snprintf`,
saving 3 KB in both debug and release builds when TBBR is enabled.

Change-Id: I7f992a21015930d7c0f4660e7a28ceefd60b9597
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
7 years agoIntroduce `tf_snprintf`
Antonio Nino Diaz [Wed, 17 May 2017 14:34:22 +0000 (15:34 +0100)]
Introduce `tf_snprintf`

This is a reduced version of `snprintf` that only supports formats '%d',
'%i' and '%u'. It can be used when the full `snprintf` is not needed in
order to save memory. If it finds an unknown format specifier, it
prints an error message and panics.

Change-Id: I2cb06fcdf74cda2c43caf73ae0762a91499fc04e
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
7 years agoFVP,Juno: switch FVP and Juno to use generic TBBR OID header
Masahiro Yamada [Tue, 23 May 2017 10:41:36 +0000 (19:41 +0900)]
FVP,Juno: switch FVP and Juno to use generic TBBR OID header

The header tbbr_oid.h contains OIDs obtained by ARM Ltd.
so there is no good reason to use platform_oid.h

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>