Commit Graph

1828 Commits

Author SHA1 Message Date
Antonio Nino Diaz 4c72c3fefa layerscape: stm32mp1: Migrate to enable_mmu_svc_mon()
Change-Id: I3d16b247a0fa457e6293e2d2c4503dfde1e51c1d
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
2018-08-10 13:47:37 +01:00
Antonio Nino Diaz 1e54cbb8f5 plat/arm: Migrate to enable_mmu_svc_mon()
Change-Id: I1bb310e1b05968d30b28913c4011c0601e1ae64e
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
2018-08-10 13:47:37 +01:00
Antonio Nino Diaz 1a92a0e00a xlat v2: Support the EL2 translation regime
The translation library is useful elsewhere. Even though this repository
doesn't exercise the EL2 support of the library, it is better to have it
here as well to make it easier to maintain.

enable_mmu_secure() and enable_mmu_direct() have been deprecated. The
functions are still present, but they are behind ERROR_DEPRECATED and
they call the new functions enable_mmu_svc_mon() and
enable_mmu_direct_svc_mon().

Change-Id: I13ad10cd048d9cc2d55e0fff9a5133671b67dcba
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
2018-08-10 13:47:11 +01:00
Haojian Zhuang eba1b6b3c7 plat/poplar: migrate to mmc framework
Migrate from emmc framework to mmc framework.

Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
2018-08-10 17:11:12 +08:00
Haojian Zhuang 261e43b78f plat/hikey: migrate to mmc framework
Migrate to mmc framework.

Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
2018-08-10 17:11:12 +08:00
Antonio Nino Diaz 6a23356c4f Replace stdio.h functions by TF functions
Functions provided by stdio.h such as printf and sprintf are available
in the codebase, but they add a lot of code to the final image if they
are used:

- AArch64: ~4KB
- AArch32: ~2KB in T32, ~3KB in A32

tf_printf and tf_snprintf are a lot more simple, but it is preferable
to use them when possible because they are also used in common code.

Change-Id: Id09fd2b486198fe3d79276e2c27931595b7ba60e
Acked-by: Haojian Zhuang <haojian.zhuang@linaro.org>
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
2018-08-10 09:36:18 +01:00
Roberto Vargas 1eb735d753 Add librom support in FVP
Change-Id: Idb9ba3864d6de3053260724f07172fd32c1523e0
Signed-off-by: Roberto Vargas <roberto.vargas@arm.com>
2018-08-06 13:08:51 +01:00
Nariman Poushin 354596f683 plat/arm: Add support for SGM775
Add support for System Guidance for Mobile platform SGM775

Change-Id: I2442a50caae8f597e5e5949cd48f695cf75d9653
Signed-off-by: Nariman Poushin <nariman.poushin@linaro.org>
2018-08-03 17:42:54 +01:00
Deepak Pandey 5b2a7813a8 css_pm_scmi: optimise cpu suspend to remove redundant scmi call
In css platforms where the cpu/cluster management is done by the hardware,
software does need to issue certain scmi requests.

This patch wraps those scmi calls around the HW_ASSISTED_COHERENCY
build option to remove them on platforms that have this hardware support.

Change-Id: Ie818e234484ef18549aa7f977aef5c3f0fc26c27
Signed-off-by: Deepak Pandey <Deepak.Pandey@arm.com>
Signed-off-by: Amit Daniel Kachhap <amit.kachhap@arm.com>
Signed-off-by: Nariman Poushin <nariman.poushin@linaro.org>
2018-08-03 17:42:54 +01:00
Nariman Poushin eb5e1be431 plat/arm: tzc_dmc500: Add missing plat_arm.h include
This omission causes a build error as the definition for
arm_tzc_regions_info_t is needed from plat_arm.h

Change-Id: I26935ee90d3e36ab6a016ff2c4eee4413df3e4e8
Signed-off-by: Nariman Poushin <nariman.poushin@linaro.org>
2018-08-03 17:42:54 +01:00
Nariman Poushin 58192800e0 plat/arm: css: Set MT bit in incoming mpidr arugments
Change-Id: I278d6876508800abff7aa2480910306a24de5378
Signed-off-by: Nariman Poushin <nariman.poushin@linaro.org>
2018-08-03 17:42:53 +01:00
Chandni Cherukuri a41d1b2ce3 plat/sgi: switch to using scmi
The Arm SGI platforms can switch to using SCMI. So enable support for
SCMI and remove portions of code that would be unused after switching
to SCMI.

Change-Id: Ifd9e1c944745f703da5f970b5daf1be2b07ed14e
Signed-off-by: Chandni Cherukuri <chandni.cherukuri@arm.com>
2018-08-03 16:17:33 +05:30
Chandni Cherukuri 8e1cc44900 sgi: disable CPU power down bit in reset handler
On SGI platforms, the 'CORE_PWRDN_EN' bit of 'CPUPWRCTLR_EL1'
register requires an explicit write to clear it for hotplug and
idle to function correctly. The reset value of this bit is zero
but it still requires this explicit clear to zero. This indicates
that this could be a model related issue but for now this issue can
be fixed be clearing the CORE_PWRDN_EN in the platform specific
reset handler function.

Change-Id: I4222930daa9a3abacdace6b7c3f4a5472ac0cb19
Signed-off-by: Chandni Cherukuri <chandni.cherukuri@arm.com>
2018-08-03 16:17:33 +05:30
Roberto Vargas fec3648478 Create a library file for libfdt
TF Makefile was linking all the objects files generated for the
fdt library instead of creating a static library that could be
used in the linking stage.

Change-Id: If3705bba188ec39e1fbf2322a7f2a9a941e1b90d
Signed-off-by: Roberto Vargas <roberto.vargas@arm.com>
2018-08-03 11:31:26 +01:00
Dimitris Papastamos f68bc8a1c2
Merge pull request #1506 from danielboulby-arm/db/SeparateCodeAndROData
Fix build for SEPARATE_CODE_AND_RODATA=0
2018-08-03 10:56:47 +01:00
Daniel Boulby 2ecaafd2e8 Fix build for SEPARATE_CODE_AND_RODATA=0
TF won't build since no memory region is specified
for when SEPARATE_CODE_AND_RODATA=0 it still relies on
the ARM_MAP_BL_RO_DATA region which is never defined for
this case. Create memory region combining code and RO data for
when the build flag SEPARATE_CODE_AND_RODATA=0 to fix this

Change-Id: I6c129eb0833497710cce55e76b8908ce03e0a638
Signed-off-by: Daniel Boulby <daniel.boulby@arm.com>
2018-08-01 16:26:26 +01:00
Dimitris Papastamos 72bc63185c
Merge pull request #1498 from glneo/cache-early-fixes
Early cache enable and coherency fixes
2018-07-30 16:53:34 +01:00
Dimitris Papastamos 2ee596c498
Merge pull request #1493 from antonio-nino-diaz-arm/an/xlat-misra
Fix MISRA defects in xlat tables lib and SP805 driver
2018-07-30 16:44:43 +01:00
Antonio Nino Diaz e7b9886c7c xlat: Fix MISRA defects
Fix defects of MISRA C-2012 rules 8.13, 10.1, 10.3, 10.4, 10.8, 11.6,
14.4, 15.7, 17.8, 20.10, 20.12, 21.1 and Directive 4.9.

Change-Id: I7ff61e71733908596dbafe2e99d99b4fce9765bd
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
2018-07-30 09:30:15 +01:00
Soby Mathew eef90a772d
Merge pull request #1497 from SNG-ARM/master
RAS changes for SGI575 platform
2018-07-27 11:03:13 +01:00
Soby Mathew 128dad9a20
Merge pull request #1494 from hzhuang1/pcie_pin
Hikey960: configure pins for PCIe controller
2018-07-27 11:02:36 +01:00
Kaihua Zhong 16bec9c25b Hikey960: configure pins for PCIe controller
GPIO_089 connects to PCIE_PERST_N. It needs to be configured as
output low.

Signed-off-by: Kaihua Zhong <zhongkaihua@huawei.com>
Signed-off-by: Xiaowei Song <songxiaowei@hisilicon.com>
Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
2018-07-27 16:24:23 +08:00
Andrew F. Davis 903f13d312 ti: k3: common: Only enable caches early
We can enter and exit coherency without any software operations,
but HW_ASSISTED_COHERENCY has stronger implications that are
causing issues. Until these can be resolved, only use the weaker
WARMBOOT_ENABLE_DCACHE_EARLY flag.

Signed-off-by: Andrew F. Davis <afd@ti.com>
2018-07-26 14:31:06 -05:00
Sughosh Ganu f29d18289a RAS: SGI: Add flags needed to build components for RAS feature
Add the various flags that are required to build the components needed
to enable the RAS feature on SGI575 platform. By default, all flags
are set to 0, disabling building of all corresponding components.

Change-Id: I7f8536fba895043ef6e397cc33ac9126cb572132
Signed-off-by: Sughosh Ganu <sughosh.ganu@arm.com>
2018-07-26 22:13:44 +05:30
Sughosh Ganu 167dae4dc6 RAS: SGI575: Add platform specific RAS changes
Add platform specific changes needed to add support for the RAS
feature on SGI575 platform, including adding a mapping for the
CPER buffer being used on SGI575 platform.

Change-Id: I01a982e283609b5c48661307906346fa2738a43b
Signed-off-by: Sughosh Ganu <sughosh.ganu@arm.com>
2018-07-26 22:10:27 +05:30
Sughosh Ganu 485fc95443 RAS: SGI: Add platform handler for RAS interrupts
Add a platform specific handler for RAS interrupts and configure the
platform RAS interrupts for EL3 handling. The interrupt handler passes
control to StandaloneMM code executing in S-EL0, which populates the
CPER buffer with relevant error information. The handler subsequently
invokes the SDEI client which processes the information in the error
information in the CPER buffer. The helper functions
plat_sgi_get_ras_ev_map and plat_sgi_get_ras_ev_map_size would be
defined for sgi platforms in the subsequent patch, which adds sgi575
specific RAS changes.

Change-Id: I490f16c15d9917ac40bdc0441659b92380108d63
Signed-off-by: Sughosh Ganu <sughosh.ganu@arm.com>
2018-07-26 22:03:32 +05:30
Sughosh Ganu d952391914 SPM: SGI: Map memory allocated for secure partitions
The secure partition manager reserves chunks of memory which are used
for the S-EL0 StandaloneMM image and the buffers required for
communication between the Non-Secure world with the StandaloneMM
image. Add the memory chunks to relevant arrays for mapping the
regions of memory with corresponding attributes.

Change-Id: If371d1afee0a50ca7cacd55e16aeaca949d5062b
Signed-off-by: Sughosh Ganu <sughosh.ganu@arm.com>
2018-07-26 22:02:39 +05:30
Sughosh Ganu 2e4a509dde ARM platforms: Allow board specific definition of SP stack base
The SGI platforms need to allocate memory for CPER buffers. These
platform buffers would be placed between the shared reserved memory
and the per cpu stack memory, thus the need to redefine stack base
pointer for these platforms. This patch allows each board in ARM
platform to define the PLAT_SP_IMAGE_STACK_BASE.

Change-Id: Ib5465448b860ab7ab0f645f7cb278a67acce7be9
Signed-off-by: Sughosh Ganu <sughosh.ganu@arm.com>
2018-07-26 22:01:29 +05:30
Sughosh Ganu d9cc9372e1 SGI: Include arm_spm_def.h in platform_def.h
Include arm_spm_def.h in the platform_def.h file. Without this
inclusion, we get build errors like

In file included from services/std_svc/spm/sp_setup.c:12:0:
services/std_svc/spm/sp_setup.c: In function 'spm_sp_setup':
services/std_svc/spm/sp_setup.c:61:57: error: 'PLAT_SPM_BUF_BASE'
  undeclared (first use in this function)
  write_ctx_reg(get_gpregs_ctx(ctx), CTX_GPREG_X0, PLAT_SPM_BUF_BASE);

Now that the platform_def.h includes arm_spm_def.h, remove inclusion
of platform_def.h in arm_spm_def.h to remove the circular dependency.

Change-Id: I5225c8ca33fd8d288849524395e436c3d56daf17
Signed-off-by: Sughosh Ganu <sughosh.ganu@arm.com>
2018-07-26 22:00:26 +05:30
Sughosh Ganu 46b69e3de1 Include board_arm_def.h through the platform's header
The board_arm_def.h header file needs to be included via the platform
definition header. Not doing so, results in a redefinition error of
PLAT_ARM_MAX_BL31_SIZE macro, if defined in the platform definition
file.

Change-Id: I1d178f6e8a6a41461e7fbcab9f6813a2faa2d82b
Signed-off-by: Sughosh Ganu <sughosh.ganu@arm.com>
2018-07-26 21:52:38 +05:30
danh-arm 60e062fb0e
Merge pull request #1486 from antonio-nino-diaz-arm/an/psci-misra
Fix several MISRA defects in PSCI library
2018-07-25 16:09:54 +01:00
danh-arm d87d524ee4
Merge pull request #1466 from Yann-lms/stm32mp1
Add STMicroelectronics STM32MP1 platform support
2018-07-25 16:05:35 +01:00
danh-arm cad25f1484
Merge pull request #1491 from jeenu-arm/misra-fix
Arm platforms: Fix type mismatch for arm_pm_idle_states
2018-07-25 15:23:25 +01:00
danh-arm f94523ed9e
Merge pull request #1472 from danielboulby-arm/db/Reclaim
Rework page table setup for varying number of mem regions
2018-07-25 15:16:24 +01:00
Yann Gautier f74cbc93a8 stm32mp1: Link BL2, BL32 and DTB in one binary
platform.mk is updated to have compilation rules for DTB, stm32image tool,
and the concatenation of the 3 binaries.
A new linker script and an assembly file are added to manage this.

Signed-off-by: Yann Gautier <yann.gautier@st.com>
Signed-off-by: Mathieu Belou <mathieu.belou@st.com>
Signed-off-by: Lionel Debieve <lionel.debieve@st.com>
2018-07-24 17:18:41 +02:00
Yann Gautier 964dfee1a2 stm32mp1: Add BL32 SP_min secure monitor
Signed-off-by: Yann Gautier <yann.gautier@st.com>
Signed-off-by: Mathieu Belou <mathieu.belou@st.com>
Signed-off-by: Lionel Debieve <lionel.debieve@st.com>
Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
Signed-off-by: Nicolas Le Bayon <nicolas.le.bayon@st.com>
2018-07-24 17:18:32 +02:00
Yann Gautier 10a511ceaa stm32mp1: Add DDR support and its security with TZC400
The DDR driver is under dual license, BSD and GPLv2.
The configuration parameters are taken from device tree.

Signed-off-by: Yann Gautier <yann.gautier@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Signed-off-by: Nicolas Le Bayon <nicolas.le.bayon@st.com>
Signed-off-by: Lionel Debieve <lionel.debieve@st.com>
2018-07-24 17:18:19 +02:00
Yann Gautier e4f559ff54 stm32mp1: Add PMIC support
If a PMIC companion chip is present on board, it has to be configured
for regulators supplies.
This check is done with board DT configuration.

Signed-off-by: Yann Gautier <yann.gautier@st.com>
Signed-off-by: Pascal Paillet <p.paillet@st.com>
2018-07-24 17:15:13 +02:00
Yann Gautier 278c34df06 stm32mp1: Add console support
Signed-off-by: Yann Gautier <yann.gautier@st.com>
Signed-off-by: Nicolas Le Bayon <nicolas.le.bayon@st.com>
Signed-off-by: Lionel Debieve <lionel.debieve@st.com>
2018-07-24 17:14:39 +02:00
Yann Gautier e58a53fb72 stm32mp1: save boot information in backup registers
This will be used by BL33 to get boot device and instance.

Signed-off-by: Yann Gautier <yann.gautier@st.com>
Signed-off-by: Mathieu Belou <mathieu.belou@st.com>
Signed-off-by: Lionel Debieve <lionel.debieve@st.com>
2018-07-24 17:14:22 +02:00
Yann Gautier 6a339a4952 stm32mp1: Add GPIO support
The management of pinctrl nodes of device tree is also added.

Signed-off-by: Yann Gautier <yann.gautier@st.com>
Signed-off-by: Mathieu Belou <mathieu.belou@st.com>
Signed-off-by: Nicolas Le Bayon <nicolas.le.bayon@st.com>
2018-07-24 17:14:08 +02:00
Yann Gautier 7839a05090 stm32mp1: Add clock and reset support
The clock driver is under dual license, BSD and GPLv2.
The clock driver uses device tree, so a minimal support for this is added.
The required files for driver and DTS files are in include/dt-bindings/.

Signed-off-by: Yann Gautier <yann.gautier@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Signed-off-by: Nicolas Le Bayon <nicolas.le.bayon@st.com>
Signed-off-by: Lionel Debieve <lionel.debieve@st.com>
2018-07-24 17:13:36 +02:00
Yann Gautier 4353bb20cc Introduce STMicroelectronics STM32MP1 platform
STM32MP1 is a microprocessor designed by STMicroelectronics,
based on a dual Arm Cortex-A7.
It is an Armv7-A platform, using dedicated code from TF-A.

STM32MP1 uses BL2 compiled with BL2_AT_EL3.

Signed-off-by: Yann Gautier <yann.gautier@st.com>
Signed-off-by: Mathieu Belou <mathieu.belou@st.com>
Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
Signed-off-by: Lionel Debieve <lionel.debieve@st.com>
Signed-off-by: Nicolas Le Bayon <nicolas.le.bayon@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Signed-off-by: Pascal Paillet <p.paillet@st.com>
2018-07-24 17:11:43 +02:00
Daniel Boulby d323af9e3d Rework page table setup for varying number of mem regions
Change arm_setup_page_tables() to take a variable number of memory
regions. Remove coherent memory region from BL1, BL2 and BL2U as
their coherent memory region doesn't contain anything and
therefore has a size of 0. Add check to ensure this
doesn't change without us knowing.

Change-Id: I790054e3b20b056dda1043a4a67bd7ac2d6a3bc0
Signed-off-by: Daniel Boulby <daniel.boulby@arm.com>
2018-07-24 15:01:57 +01:00
danh-arm cffb003428
Merge pull request #1488 from b49020/integration
synquacer: Enable optional OP-TEE support
2018-07-24 14:37:23 +01:00
danh-arm 790e6c5b96
Merge pull request #1485 from jeenu-arm/ras
Double-fault and fatal error handling support
2018-07-24 14:36:43 +01:00
Sumit Garg 6cb2a39703 synquacer: Enable optional OP-TEE support
OP-TEE loading is optional on Developerbox controlled via SCP
firmware. To check if OP-TEE is loaded or not, we use DRAM1 region
info passed by SCP firmware.

Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org>
2018-07-24 17:12:22 +05:30
Jeenu Viswambharan ecd62429af Arm platforms: Fix type mismatch for arm_pm_idle_states
This also gets rid of MISRA violations for Rule 8.3 and 8.4.

Change-Id: I45bba011b16f90953dd4b260fcd58381f978eedc
Signed-off-by: Jeenu Viswambharan <jeenu.viswambharan@arm.com>
2018-07-24 10:28:50 +01:00
Antonio Nino Diaz 2bc3dba924 PSCI: Fix MISRA defects in platform code
Fix violations of MISRA C-2012 Rules 10.1, 10.3, 13.3, 14.4, 17.7 and
17.8.

Change-Id: I6c9725e428b5752f1d80684ec29cb6c52a5c0c2d
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
2018-07-24 09:12:16 +01:00
Haojian Zhuang 99eb5ae86d hikey: include TBB in BL1
BL1 is used in recovery mode on HiKey. The TBB implementation
on HiKey is in BL2. It means that user need to build ATF BL2
with TBB and ATF BL1 with non-TBB. It's inconvenient.

So include TBB in BL1, too.

Signed-off-by: Teddy Reed <teddy@prosauce.org>
Signed-off-by: Victor Chong <victor.chong@linaro.org>
Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
2018-07-22 09:35:44 +08:00
Antonio Nino Diaz 1083b2b315 PSCI: Fix types of definitions
Also change header guards to fix defects of MISRA C-2012 Rule 21.1.

Change-Id: Ied0d4b0e557ef6119ab669d106d2ac5d99620c57
Acked-by: Sumit Garg <sumit.garg@linaro.org>
Acked-by: Anson Huang <Anson.Huang@nxp.com>
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
2018-07-20 13:49:22 +01:00
danh-arm ba0248b52d
Merge pull request #1450 from MISL-EBU-System-SW/marvell-support-v6
Marvell support for Armada 8K SoC family
2018-07-19 17:11:32 +01:00
danh-arm 992a353613
Merge pull request #1483 from antonio-nino-diaz-arm/an/rpi3-psci
rpi3: PSCI and Linux boot improvements
2018-07-19 15:37:54 +01:00
danh-arm e4686fd860
Merge pull request #1449 from theopolis/hikey-tbb
hikey: Add experimental TBB support
2018-07-19 11:49:56 +01:00
danh-arm 8ff0dfa79c
Merge pull request #1482 from sandrine-bailleux-arm/sb/fix-hcptr
Misc arch.h fixes and cleanup
2018-07-19 11:36:58 +01:00
Jeenu Viswambharan eaeaa4d048 RAS: Introduce handler for EL3 EAs
External Aborts while executing in EL3 is fatal in nature. This patch
allows for the platform to define a handler for External Aborts received
while executing in EL3. A default implementation is added which falls
back to platform unhandled exception.

Change-Id: I466f2c8113a33870f2c7d2d8f2bf20437d9fd354
Signed-off-by: Jeenu Viswambharan <jeenu.viswambharan@arm.com>
2018-07-19 10:13:18 +01:00
Jeenu Viswambharan d5a23af50f RAS: Introduce handler for Double Faults
Double fault is when the PE receives another error whilst one is being
handled. To detect double fault condition, a per-CPU flag is introduced
to track the status of error handling. The flag is checked/modified
while temporarily masking external aborts on the PE.

This patch routes double faults to a separate platform-defined handler.

Change-Id: I70e9b7ba4c817273c55a0af978d9755ff32cc702
Signed-off-by: Jeenu Viswambharan <jeenu.viswambharan@arm.com>
2018-07-19 10:13:18 +01:00
Jeenu Viswambharan b56dc2a98c RAS: Introduce handler for Uncontainable errors
Uncontainable errors are the most severe form of errors, which typically
mean that the system state can't be trusted any more. This further means
that normal error recovery process can't be followed, and an orderly
shutdown of the system is often desirable.

This patch allows for the platform to define a handler for Uncontainable
errors received. Due to the nature of Uncontainable error, the handler
is expected to initiate an orderly shutdown of the system, and therefore
is not expected to return. A default implementation is added which falls
back to platform unhandled exception.

Also fix ras_arch.h header guards.

Change-Id: I072e336a391a0b382e77e627eb9e40729d488b55
Signed-off-by: Jeenu Viswambharan <jeenu.viswambharan@arm.com>
2018-07-19 10:13:17 +01:00
Konstantin Porotchkin 34ec7ec310 plat: marvell: Add board support for A8K platform
Add support for A8K platform boards

Change-Id: Ife025d930d2ab6cabbc13bbe19b2273cc1c938c8
Signed-off-by: Hanna Hawa <hannah@marvell.com>
Signed-off-by: Konstantin Porotchkin <kostap@marvell.com>
2018-07-18 18:48:30 +03:00
Konstantin Porotchkin 486f868bab plat: marvell: Add common ARMADA platform components
Add common Marvell ARMADA platform components.
This patch also includes common components for Marvell
ARMADA 8K platforms.

Change-Id: I42192fdc6525a42e46b3ac2ad63c83db9bcbfeaf
Signed-off-by: Hanna Hawa <hannah@marvell.com>
Signed-off-by: Konstantin Porotchkin <kostap@marvell.com>
2018-07-18 18:48:30 +03:00
Soby Mathew 2e4eea1b11
Merge pull request #1471 from Anson-Huang/master
Add i.MX8QX/i.MX8QM power management feature
2018-07-18 13:35:29 +01:00
Antonio Nino Diaz 30399885f5 Fix types of arch.h definitions
Define the values as unsigned int or unsigned long long based on the
actual size of the register. This prevents subtle issues caused by
having a type that is too small. For example:

    #define OPTION_ENABLE 0x3
    #define OPTION_SHIFT  32

    uint64_t mask = OPTION_ENABLE << OPTION_SHIFT;

Because OPTION_ENABLE fits in an int, the value is considered an int.
This means that, after shifting it 32 places to the left, the final
result is 0. The correct way to define the values is:

    #define OPTION_ENABLE ULL(0x3)
    #define OPTION_SHIFT  U(32)

In this case, the compiler is forced to use a 64 bit value from the
start, so shifting it 32 places to the left results in the expected
value.

Change-Id: Ieaf2ffc2d8caa48c622db011f2aef549e713e019
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
2018-07-18 11:09:54 +01:00
Soby Mathew 344e40379c
Merge pull request #1480 from sandrine-bailleux-arm/topics/sb/debug-macros
Always compile debug macros
2018-07-18 10:48:03 +01:00
Antonio Nino Diaz aa49bde8a3 rpi3: Move NS-DRAM out of the protected region
The Non-secure DRAM region shouldn't be protected in the range specified
in the Linux command line with memmap.

This change also increases the size of the Secure DRAM region.

Change-Id: I306e9e443a84b834c99739f54a534a3ca3be2424
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
2018-07-16 15:56:42 +01:00
Antonio Nino Diaz 76c944a48d rpi3: Add support for direct Linux kernel boot
This option allows the Trusted Firmware to pass the correct arguments to
a 32 or 64-bit Linux kernel without the need of an intermediate loader
such as U-Boot.

Change-Id: I2b22e8933fad6a614588ace559f893e97329801f
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
2018-07-16 15:56:42 +01:00
Antonio Nino Diaz 6d924ca91b rpi3: Don't wire mailbox 3 to FIQ line
FIQs shouldn't be used at all as long as the interrupt routing doesn't
support them properly.

Change-Id: Ib1db7b523a62de2035d41197bc791048337cf791
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
2018-07-16 15:56:42 +01:00
Antonio Nino Diaz 6297d6feb0 rpi3: Fix warm entrypoint setup for PSCI_CPU_ON
Remove unused variable and set the secure entrypoint correctly.

Change-Id: I7447ea62771092de6be35704077ae28c519d6993
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
2018-07-16 15:56:42 +01:00
Antonio Nino Diaz 1aad932ce6 rpi3: Add support for the stack protector
It uses the hardware RNG in a similar way as Juno (it gets 128 bits of
entropy and does xor on them).

It is disabled by default.

Change-Id: I8b3adb61f5a5623716e0e8b6799404c68dd94c60
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
2018-07-16 15:56:42 +01:00
Antonio Nino Diaz 4ad2696d88 rpi3: Introduce hardware RNG driver
Note that this is a non-secure RNG. This is only useful for educational
purposes.

Change-Id: If359c8d0f755ef8e416986de7fbca34679a523e1
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
2018-07-16 15:56:42 +01:00
Antonio Nino Diaz 98967fb14a rpi3: Remove broken support of RESET_TO_BL31
There is no way to boot BL31 at the addresses specified in the platform
memory map unless an extra loader is used at address 0x00000000. It is
better to remove it to prevent confusion. Having it enabled was a bug.

Change-Id: I3229fbc080f5996cff47efce8e799bae94e0d5cb
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
2018-07-16 15:56:42 +01:00
Soby Mathew f9d2808a1c
Merge pull request #1478 from antonio-nino-diaz-arm/an/rpi3-improvements
rpi3: A few improvements
2018-07-16 14:22:10 +01:00
Antonio Nino Diaz 4f2f66a280 rpi3: Detect board revision
Implement VideoCore mailbox interface driver and use it to get the board
revision identifier.

For now it is only used to print the model for debug purposes.

This wiki contains the documentation of the mailbox interface:

https://github.com/raspberrypi/firmware/wiki

Change-Id: I11943b99b52cc1409f4a195ebe58eb44ae5b1d6c
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
2018-07-14 02:15:55 +01:00
Antonio Nino Diaz 42ba8f747b rpi3: Implement PSCI_SYSTEM_OFF
This implementation doesn't actually turn the system off, it simply
reboots it and prevents it from booting while keeping it in a low power
mode.

Change-Id: I7f72c9f43f25ba0341db052bc2be4774c88a7ea3
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
2018-07-14 02:15:51 +01:00
Antonio Nino Diaz 64fe343c03 rpi3: Concatenate BL1 and FIP automatically
Add a new default makefile target to concatenate BL1 and the FIP and
generate armstub8.bin. This way it isn't needed to do it manually.

Documentation updated to reflect the changes.

Change-Id: Id5b5b1b7b9f87767db63fd01180ddfea855a7207
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
2018-07-13 15:27:01 +01:00
Dimitris Papastamos 9ceda8b907
Merge pull request #1477 from dp-arm/dp/css-ap-core
CSS: Add support for SCMI AP core config protocol
2018-07-13 15:23:29 +01:00
Sandrine Bailleux c426fd709f Tegra: Fix up INFO() message
With commit cf24229e6e ("Run compiler on debug macros for type
checking"), the compiler will now always evaluate INFO() macro
calls, no matter the LOG_LEVEL value. Therefore, any variable
referenced in the macro has to be be defined.

Address this issue by removing the local variable and using the
expression it was assigned directly in the INFO() call.

Change-Id: Iedc23b3538c1e162372e85390881e50718e50bf3
Signed-off-by: Sandrine Bailleux <sandrine.bailleux@arm.com>
2018-07-13 11:31:17 +02:00
Dimitris Papastamos 6e779ace0a
Merge pull request #1476 from grandpaul/paulliu-rpi3-modify-size
rpi3: enlarge SEC_DRAM0_SIZE for optee_test to pass
2018-07-12 11:53:37 +01:00
Dimitris Papastamos 1be2f666dd
Merge pull request #1464 from antonio-nino-diaz-arm/an/rpi3-ints
rpi3: Implement simple interrupt routing
2018-07-12 11:52:53 +01:00
Dimitris Papastamos 2a246d2e32 CSS: Use SCMI AP core protocol to set the warm boot entrypoint
Change-Id: Iaebbeac1a1d6fbd531e5694b95ed068b7a193e62
Signed-off-by: Dimitris Papastamos <dimitris.papastamos@arm.com>
2018-07-12 10:09:12 +01:00
Dimitris Papastamos bfe3c449a7 Add support for SCMI AP core configuration protocol v1.0
Change-Id: If07000b6b19011e960336a305a784dd643301b97
Signed-off-by: Dimitris Papastamos <dimitris.papastamos@arm.com>
2018-07-12 10:09:12 +01:00
Anson Huang 8ef9f860c0 imx: imx8qm: add domain suspend/resume support
Add domain suspend/resume support, Linux kernel
can "echo mem > /sys/power/state" to put system
into suspend mode, all CPUs and cluster will be
powered off and can be waked up if irq pending
in GIC, tested on i.MX8QM MEK board.

Since the power state has been implemented, switch
to use standard power state for CCI operations
instead of private cpu use count in i.MX8QM.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2018-07-12 16:16:55 +08:00
Anson Huang 0f53bca05c imx: imx8qm: add domain off support
Add domain off support for Linux kernel's cpu
hot-plug feature, when there are cpu off request
from Linux kernel, TF-A will send command to
system controller to do CPU power gate accordingly,
tested on i.MX8QM MEK board.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2018-07-12 16:15:56 +08:00
Anson Huang d31ffcf0f7 imx: imx8qm: add system reset support
Add system reset support for i.MX8QM,
when Linux kernel issues "reboot" command,
TF-A will send command to inform system
controller to reset whole board according
to board design, tested on i.MX8QM MEK board.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2018-07-12 16:15:51 +08:00
Anson Huang db81c59252 imx: imx8qm: add system off support
Add system power off support for i.MX8QM,
when Linux kernel issues "poweroff" command,
TF-A will send command to inform system
controller to power off whole board according
to board design, tested on i.MX8QM MEK board.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2018-07-12 16:15:39 +08:00
Anson Huang 762688bff2 imx: imx8qx: add domain suspend/resume support
Add domain suspend/resume support, Linux kernel
can "echo mem > /sys/power/state" to put system
into suspend mode, all CPUs and cluster will be
powered off and can be waked up if irq pending
in GIC, tested on i.MX8QX MEK board.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2018-07-12 16:15:32 +08:00
Ying-Chun Liu (PaulLiu) 8ebf806fc5 rpi3: enlarge SEC_DRAM0_SIZE for optee_test to pass
Running optee_test failed because SEC_DRAM0_SIZE is too small. Previous
is 2 MB. We enlarge it to 11 MB for passing the test. Also we reduce
the NS_DRAM0_SIZE from 13MB to 4MB so that the whole section is still
fit in 16MB.

This commit also modified the document to reflect the changes we've
made in code.

Tested-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
Signed-off-by: Ying-Chun Liu (PaulLiu) <paulliu@debian.org>
2018-07-12 13:51:35 +08:00
Anson Huang 3260f5c7c8 imx: imx8qx: add domain off support
Add domain off support for Linux kernel's cpu
hot-plug feature, when there are cpu off request
from Linux kernel, TF-A will send command to
system controller to do CPU power gate accordingly.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2018-07-12 11:12:39 +08:00
Anson Huang 351e3731ca imx: imx8qx: add system reset support
Add system reset support for i.MX8QX,
when Linux kernel issues "reboot" command,
TF-A will send command to inform system
controller to reset whole board according
to board design, tested on i.MX8QX MEK board.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2018-07-12 11:05:21 +08:00
Anson Huang 8972694e93 imx: imx8qx: add system off support
Add system power off support for i.MX8QX,
when Linux kernel issues "poweroff" command,
TF-A will send command to inform system
controller to power off whole board according
to board design, tested on i.MX8QX MEK board.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2018-07-12 11:00:41 +08:00
Antonio Nino Diaz d35de55e55 rpi3: Implement simple interrupt routing
Implement minimal interrupt routing functions. All interrupts are
treated as non-secure interrupts to be handled by the non-secure world.

Add note to the documentation about disabling FIQs qhen using OP-TEE
with Linux.

Change-Id: I937096542d973925e43ae946c5d0b306d0d95a94
Tested-by: Ying-Chun Liu (PaulLiu) <paul.liu@linaro.org>
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
2018-07-11 21:00:32 +01:00
Sandrine Bailleux ed8c3743ef ARM platforms: Remove some duplicate declarations
The plat_arm_mmap variable is already declared in plat_arm.h, which is
included from plat/arm/common/arm_common.c.

Similarly, plat_arm.h declares the 'plat_arm_psci_pm_ops' variable, which
does not need to be declared again in plat/arm/common/arm_pm.c.

The duplication was not compliant with MISRA rule 8.5.

Change-Id: Icc42547cc025023226b1078a7ec4f06d093364b7
Signed-off-by: Sandrine Bailleux <sandrine.bailleux@arm.com>
2018-07-11 17:33:29 +02:00
Sandrine Bailleux 6c77e74915 Fix some violations to MISRA rule 8.3
Wherever we use 'struct foo' and 'foo_t' interchangeably in a
function's declaration and definition, use 'struct foo' consistently
for both, as per the TF-A coding guidelines [1].

[1] https://github.com/ARM-software/arm-trusted-firmware/wiki/ARM-Trusted-Firmware-Coding-Guidelines#avoid-anonymous-typedefs-of-structsenums-in-header-files

Change-Id: I7998eb24a26746e87e9b6425529926406745b721
Signed-off-by: Sandrine Bailleux <sandrine.bailleux@arm.com>
2018-07-11 17:33:29 +02:00
Joel Hutton c84b6cb1aa Add initial CPU support for Cortex-Deimos
Change-Id: I2c4b06423fcd96af9351b88a5e2818059f981f1b
Signed-off-by: Joel Hutton <Joel.Hutton@Arm.com>
Signed-off-by: Dimitris Papastamos <dimitris.papastamos@arm.com>
2018-07-11 13:26:48 +01:00
Dimitris Papastamos 6cbf17d114
Merge pull request #1473 from robertovargas-arm/misra
Misra
2018-07-11 13:15:52 +01:00
Roberto Vargas b2805dabaa Remove .func and .endfunc assembler directives
These directives are only used when stabs debugging information
is used, but we use ELF which uses DWARF debugging information.
Clang assembler doesn't support these directives, and removing
them makes the code more compatible with clang.

Change-Id: I2803f22ebd24c0fe248e04ef1b17de9cec5f89c4
Signed-off-by: Roberto Vargas <roberto.vargas@arm.com>
2018-07-11 09:22:56 +01:00
Roberto Vargas 5629b2b11c Use ALIGN instead of NEXT in linker scripts
Clang linker doesn't support NEXT. As we are not using the MEMORY command
to define discontinuous memory for the output file in any of the linker
scripts, ALIGN and NEXT are equivalent.

Change-Id: I867ffb9c9a76d4e81c9ca7998280b2edf10efea0
Signed-off-by: Roberto Vargas <roberto.vargas@arm.com>
2018-07-11 09:21:02 +01:00
Roberto Vargas 311a1a8ee8 Fix MISRA rule 8.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=juno SPD=tspd CSS_USE_SCMI_SDS_DRIVER=1 all

Change-Id: Id732c8df12ef3e20903c41b7ab9a9b55341d68ac
Signed-off-by: Roberto Vargas <roberto.vargas@arm.com>
2018-07-10 13:54:48 +01:00
Roberto Vargas 0fbb7a4afe Fix MISRA rule 8.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=juno SPD=tspd CSS_USE_SCMI_SDS_DRIVER=1 all

Change-Id: Id9dcc6238b39fac6046abc28141e3ef5e7aa998d
Signed-off-by: Roberto Vargas <roberto.vargas@arm.com>
2018-07-10 13:33:05 +01:00
Roberto Vargas a9b5b4aea1 Fix MISRA rule 8.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=juno ARCH=aarch32 AARCH32_SP=sp_min RESET_TO_SP_MIN=1 JUNO_AARCH32_EL3_RUNTIME=1 bl32

Change-Id: I3ac25096b55774689112ae37bdf1222f9a9ecffb
Signed-off-by: Roberto Vargas <roberto.vargas@arm.com>
2018-07-10 11:17:53 +01:00
Roberto Vargas c96f297f8d Fix MISRA rule 8.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=juno ARCH=aarch32 AARCH32_SP=sp_min RESET_TO_SP_MIN=1 JUNO_AARCH32_EL3_RUNTIME=1 bl32

Change-Id: Ia34f5155e1cdb67161191f69e8d1248cbaa39e1a
Signed-off-by: Roberto Vargas <roberto.vargas@arm.com>
2018-07-10 11:17:51 +01:00
Dimitris Papastamos b6c07bbb2e
Merge pull request #1463 from grandpaul/paulliu-rpi3-tbb0
rpi3: Add support for Trusted Board Boot
2018-07-06 13:03:57 +01:00
Teddy Reed e59a3bffe4 hikey: Add development TBB support
This patch adds experimental support for TRUSTED_BOARD_BOOT to the
Hikey. This is adapted from the RPi3 and QEMU implementations.

Since the Hikey starts from BL2 the TRUSTED_BOARD_BOOT ROT begins there
too. When TRUSTED_BOARD_BOOT is defined, the BL1 build is skipped.

See the following example:

make \
 PLAT=hikey \
 BL33=u-boot.bin \
 SCP_BL2=mcuimage.bin \
 TRUSTED_BOARD_BOOT=1 \
 MBEDTLS_DIR=../../mbedtls \
 GENERATE_COT=1 \
 all fip

Signed-off-by: Teddy Reed <teddy.reed@gmail.com>
2018-07-06 07:54:38 -04:00
Ying-Chun Liu (PaulLiu) 14368498da rpi3: Add support for Trusted Board Boot
This patch adds support for TBB to rpi3. The ROTPK is generated at build
time and is included into BL1/BL2. The key and content certificates are
read over semihosting.

Tested-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
Signed-off-by: Ying-Chun Liu (PaulLiu) <paul.liu@linaro.org>
2018-07-05 14:58:51 +08:00
Andre Przywara bed42a5d28 allwinner: Add Allwinner H6 SoC support
The H6 is Allwinner's most recent SoC. It shares most peripherals with the
other ARMv8 Allwinner SoCs (A64/H5), but has a completely different memory
map.

Introduce a separate platform target, which includes a different header
file to cater for the address differences. Also add the new build target
to the documentation.

The new ATF platform name is "sun50i_h6".

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2018-07-03 17:06:30 +01:00
Dimitris Papastamos c2f27cedb3
Merge pull request #1458 from Andre-ARM/allwinner/fixes
allwinner: various smaller fixes
2018-07-03 14:36:55 +01:00
Dimitris Papastamos 73b1a02fba
Merge pull request #1447 from Amit-Radur/bl32_v1
allwinner: Add BL32 (corresponds to Trusted OS) support
2018-07-03 14:36:46 +01:00
Andrew F. Davis deed2b8398 ti: k3: common: Enable interrupts before entering standby state
To wake a core from wfi interrupts must be enabled, in some cases they
may not be and so we can lock up here. Unconditionally enable interrupts
before wfi and then restore interrupt state.

Signed-off-by: Andrew F. Davis <afd@ti.com>
2018-06-29 16:49:21 -05:00
Andrew F. Davis 79a1a84957 ti: k3: common: Add root domain node to platform topology
Actions may need to be taken by the last core when all clusters
have been shutdown. Add a top level root domain node to coordinate
this between clusters.

Signed-off-by: Andrew F. Davis <afd@ti.com>
2018-06-29 16:49:21 -05:00
Andre Przywara c4143b74e9 allwinner: Detect and output current SoC
So far we already support booting on two different SoCs, and we will
shortly add a third, so add some code to determine the current SoC type.
This can be later used to runtime detect certain properties.

Also print the SoC name to the console, to give valuable debug information.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2018-06-28 23:51:36 +01:00
Andre Przywara ae903c56c1 allwinner: Don't map boot ROM
There is nothing we need from the BootROM area, so we also don't need
to map it in EL3.

Remove the mapping and reduce the number of MMAP regions by one.

Reported-by: Samuel Holland <samuel@sholland.org>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2018-06-28 23:47:30 +01:00
Andre Przywara c520be4b3a allwinner: Relax PSCI entry point check
The DRAM controller supports up to 4GB of DRAM, and there are actually
boards out there where we can use at least 3GB of this.

Relax the PSCI entry point check, to be not restricted to 2GB of DRAM.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2018-06-28 23:47:30 +01:00
Andre Przywara 88aa5c4393 allwinner: security: Fix SPC guard
The "#ifdef SUNXI_SPC_BASE" guard was meant to allow the build on SoCs
without a Secure Peripherals Controller, so that we skip that part of
the security setup. But in the current position this will trigger a
warning about an unused variable.

Simply move the guard one line up to cover the variable as well.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2018-06-28 23:47:30 +01:00
Andre Przywara 27f9616fd7 allwinner: cpu-ops: avoid PSCI on/off output
The "INFO" output in sunxi_cpu_ops.c is quite verbose, so make this more
obvious by changing the log level to "VERBOSE" and so avoiding it to
be printed in a normal (even debug) build.

Reported-by: Samuel Holland <samuel@sholland.org>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2018-06-28 23:47:30 +01:00
Andre Przywara 1f4b638a38 allwinner: sun50i_a64: remove unneeded VER_REG offset
The relative VER_REG *offset* is the same across all known SoCs, so we
can define this offset near it's user.

Remove it from the memory map.

Reported-by: Samuel Holland <samuel@sholland.org>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2018-06-28 23:47:30 +01:00
Andre Przywara 6daab88fc2 allwinner: common: add missing header
Some code in sunxi_common.c requires symbols defined in sunxi_private.h,
so add the header to that file.
It was included via another header before, but let's make this explicit.

Reported-by: Samuel Holland <samuel@sholland.org>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2018-06-28 23:47:30 +01:00
Amit Singh Tomar dab901f83a allwinner: Add BL32 (corresponds to Trusted OS) support
This patch is an attempt to run Trusted OS (OP-TEE OS being one of them) along
side BL31 image.

ATF supports multiple SPD's that can take dispatcher name (opteed for OP-TEE OS)
as an input using the 'SPD=<dispatcher name>' option during bl31 build.

Signed-off-by: Amit Singh Tomar <amittomer25@gmail.com>
2018-06-28 23:47:30 +01:00
Dimitris Papastamos d48f193d11
Merge pull request #1429 from jeenu-arm/mmu-direct
Enable MMU without stack for xlat v2/DynamIQ
2018-06-27 12:59:47 +01:00
Jeenu Viswambharan 64ee263e20 DynamIQ: Enable MMU without using stack
Having an active stack while enabling MMU has shown coherency problems.
This patch builds on top of translation library changes that introduces
MMU-enabling without using stacks.

Previously, with HW_ASSISTED_COHERENCY, data caches were disabled while
enabling MMU only because of active stack. Now that we can enable MMU
without using stack, we can enable both MMU and data caches at the same
time.

NOTE: Since this feature depends on using translation table library v2,
disallow using translation table library v1 with HW_ASSISTED_COHERENCY.

Fixes ARM-software/tf-issues#566

Change-Id: Ie55aba0c23ee9c5109eb3454cb8fa45d74f8bbb2
Signed-off-by: Jeenu Viswambharan <jeenu.viswambharan@arm.com>
2018-06-27 11:31:30 +01:00
Soby Mathew 3208edcdfe ARM platforms: Initialize cntfrq for BL1 Firmware update
Currenly the CNTFRQ register and system timer is initialized in BL31 for
use by the normal world. During firmware update, the NS-BL1 or NS-BL2U
may need to access the system timer. Hence this patch duplicates the
CNTFRQ and system timer initialization in BL1 as well.

Signed-off-by: Soby Mathew <soby.mathew@arm.com>
Change-Id: I1ede78b4ae64080fb418cb93f3e48b26d7b724dc
2018-06-26 15:55:46 +01:00
Dimitris Papastamos f790cc0a9c
Merge pull request #1445 from danielboulby-arm/db/DynamicAuthentication
Set FVP DYN_DISABLE_AUTH authentication default to 0
2018-06-25 15:12:47 +01:00
Daniel Boulby 5470a3ccae Set FVP DYN_DISABLE_AUTH authentication default to 0
Set the ability to dynamically disable Trusted Boot Board
authentication to be off by default

Change-Id: Ibd2aa179179f7d9b0e7731c6e450f200a8c67529
Signed-off-by: Daniel Boulby <daniel.boulby@arm.com>
2018-06-25 13:42:19 +01:00
Dimitris Papastamos a455173969
Merge pull request #1448 from npoushin/npoushin/sgi575-coverity-fixes
npoushin/sgi575 coverity fixes
2018-06-25 13:38:29 +01:00
Nariman Poushin 8e26307db6 plat/arm: css: Sanitize the input to css_validate_power_state
In the case of the platform max power level being less than the system
power level, make sure to not overrun the array of power states.

This fixes Coverity Scan OVERRUN defect CID 267021.

Change-Id: I52646ab9be2fceeb5c331b5dad7a6267991f4197
Signed-off-by: Nariman Poushin <nariman.poushin@linaro.org>
2018-06-23 17:25:40 +01:00
Nariman Poushin 9b4c611c4b plat/arm: css: Convert CSS_SYSTEM_PWR_STATE from macro to inline function
This is to fix a number of Coverity Scan DEADCODE defects, CID numbers
listed below, as reported from
https://scan.coverity.com/projects/arm-software-arm-trusted-firmware

CID 267023
CID 267022
CID 267020

Change-Id: I2963a799b210149e84ccab5c5b9082267ddfe337
Signed-off-by: Nariman Poushin <nariman.poushin@linaro.org>
2018-06-23 17:22:08 +01:00
Amit Singh Tomar 30fb0d67c3 allwinner: Add BL32 (corresponds to Trusted OS) support
This patch is an attempt to run Trusted OS (OP-TEE OS being one of them) along
side BL31 image.

ATF supports multiple SPD's that can take dispatcher name (opteed for OP-TEE OS)
as an input using the 'SPD=<dispatcher name>' option during bl31 build.

Signed-off-by: Amit Singh Tomar <amittomer25@gmail.com>
2018-06-23 12:20:05 +05:30
Dimitris Papastamos c125a14eea
Merge pull request #1441 from robertovargas-arm/mem_protect_board
Move mem-protect definitions to board specific files
2018-06-22 15:58:11 +01:00
Dimitris Papastamos ebce735dac
Merge pull request #1406 from robertovargas-arm/uuid
Make TF UUID RFC 4122 compliant
2018-06-22 15:56:42 +01:00
Dimitris Papastamos 9dfd755303
Merge pull request #1437 from jeenu-arm/ras-remaining
SDEI dispatch changes to enable RAS use cases
2018-06-22 09:36:59 +01:00
Dimitris Papastamos 520c9dd4a8
Merge pull request #1427 from b49020/integration
Add support for Socionext Synquacer SC2A11 SoC based Developerbox platform.
2018-06-22 09:36:15 +01:00
Jeenu Viswambharan a7055c5828 Arm platforms: Remove common RAS configuration source
The file arm_ras.c intended to provide common platform-specific RAS
configuration for Arm platforms. Because this file has symbol
definitions, it's proving difficult to provide a common definition.

This patch therefore renames and makes the file specific to FVP. Other
platforms shall provide their own configuration in similar fashion.

Change-Id: I766fd238946e3e49cdb659680e1b45f41b237901
Signed-off-by: Jeenu Viswambharan <jeenu.viswambharan@arm.com>
2018-06-21 16:15:23 +01:00
Dimitris Papastamos ec942295d2
Merge pull request #1434 from soby-mathew/sm/fix_cntfrq
ARM Platforms: Update CNTFRQ register in CNTCTLBase frame
2018-06-21 13:42:45 +01:00
Dimitris Papastamos 01460492fc
Merge pull request #1433 from sivadur/integration
xilinx: fix zynqmp build when tsp is enabled
2018-06-21 12:55:27 +01:00
Sumit Garg 150c38e84d synquacer: Add platform makefile and documentation
Add Makefile and plaform definations file.
My thanks to Daniel Thompson and Ard Biesheuvel for the bits and pieces
I've taken from their earlier work regarding build and deploy steps for
Developerbox based on Synquacer SoCs. They deserve much of the credit
for this work although, since I assembled and tested things, any blame
is probably mine.

Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
Tested-by: Daniel Thompson <daniel.thompson@linaro.org>
Tested-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
2018-06-21 14:18:37 +05:30
Sumit Garg 753701ccb0 synquacer: Enable PSCI framework
PSCI framework uses SCPI driver to communicate to SCP firmware for
various power management operations. Following PSCI operations are
supported:
- CPU ON
- CPU OFF
- CPU STANDBY
- SYSTEM RESET
- SYSTEM OFF

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
2018-06-21 11:32:54 +05:30
Ard Biesheuvel cfe19f85c9 synquacer: Retrieve DRAM info from SCP firmware
Retrieve DRAM info from SCP firmware using SCPI driver. Board supports
multiple DRAM slots so its required to fetch DRAM info from SCP firmware
and pass this info to UEFI via non-secure SRAM.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
2018-06-21 11:32:34 +05:30
Sumit Garg b7ad044493 synquacer: Add SCPI driver
Add System Control and Power Interface (SCPI) driver which provides APIs
for PSCI framework to work. SCPI driver uses MHU driver APIs to communicate
with SCP firmware for various system control and power operations.

Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
2018-06-21 11:23:13 +05:30
Sumit Garg 0537710040 synquacer: Add MHU driver
Add Message Handling Unit (MHU) driver used to communicate among
Application Processors (AP) and System Control Processor (SCP).

Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
2018-06-21 11:23:09 +05:30
Sumit Garg 8cd37d7ba1 synquacer: Enable MMU using xlat_tables_v2 library
BL31 runs from SRAM which is a non-coherent memory on synquacer. So
enable MMU with SRAM memory marked as Non-Cacheable and mark page tables
kept on SRAM as Non-Cacheable via XLAT_TABLE_NC flag. Also add page tables
for Device address space.

Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
2018-06-21 11:23:03 +05:30
Sumit Garg 5931fdac63 synquacer: Enable System level Generic timer
Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
2018-06-21 11:22:57 +05:30
Sumit Garg b529799ff1 synquacer: Enable GICv3 support
synquacer uses GICv3 compliant GIC500. So enable proper GICv3 driver
initialization.

Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
2018-06-21 11:22:52 +05:30
Sumit Garg 0eb275c9a2 synquacer: Enable CCN driver support
synquacer has CCN-512 interconnect. So enable proper CCN driver
initialization.

Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
2018-06-21 11:22:48 +05:30
Sumit Garg 007a7a3358 synquacer: Implement topology functions
These functions describe the layout of the cores and clusters in order
to support the PSCI framework.

Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
2018-06-21 11:22:42 +05:30
Sumit Garg 5e5cfc21f0 synquacer: Populate BL32 and BL33 entrypoints
As this platform supports direct entry to BL31 and no BL2, so
populate BL32 and BL33 entrypoints with static memory load info.

Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
2018-06-21 11:22:36 +05:30
Sumit Garg 67b400705f synquacer: Enable PL011 UART Console
Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
2018-06-21 11:22:32 +05:30
Sumit Garg 85427debb1 synquacer: Add platform core management helpers
Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
2018-06-21 11:22:27 +05:30
Sumit Garg c35d59a3d8 synquacer: Introduce basic platform support
synquacer supports direct entry to BL31 without BL1 and BL2 as
SCP firmware does similar work. So this patch adds BL31 stub APIs.

Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
2018-06-21 11:22:23 +05:30
Siva Durga Prasad Paladugu 0435ba642d plat: xilinx: zynqmp: Get chipid from registers for BL32
This patch reads the chipid registers directly instead of making
pm call when running at BL32. User should ensure that these registers
should always be accessed from APU in their system configuration.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
2018-06-21 10:23:21 +05:30
Siva Durga Prasad Paladugu d37442f769 plat: xilinx: zynqmp: Build for DDR if SPD is enabled
This patch builds ATF to DDR if SPD is enabled as it cant fit in
On chip memory(OCM) with SPD enabled. This solves the issue
of build failure with SPD enabled for ZynqMP platform.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
2018-06-21 10:18:48 +05:30
Dimitris Papastamos 3caa841d9c
Merge pull request #1403 from glneo/for-upstream-k3
TI K3 platform support
2018-06-20 16:37:01 +01:00
Dimitris Papastamos a125014bdb
Merge pull request #1413 from grandpaul/paulliu-rpi3-0
rpi3: BL32 optee support
2018-06-20 16:34:10 +01:00
Soby Mathew 342d6220e6 ARM Platforms: Update CNTFRQ register in CNTCTLBase frame
Currently TF-A doesn't initialise CNTFRQ register in CNTCTLBase
frame of the system timer. ARM ARM states that "The instance of
the register in the CNTCTLBase frame must be programmed with this
value as part of system initialization."

The psci_arch_setup() updates the CNTFRQ system register but
according to the ARM ARM, this instance of the register is
independent of the memory mapped instance. This is only an issue
for Normal world software which relies on the memory mapped
instance rather than the system register one.

This patch resolves the issue for ARM platforms.

The patch also solves a related issue on Juno, wherein
CNTBaseN.CNTFRQ can be written and does not reflect the value of
the register in CNTCTLBase frame. Hence this patch additionally
updates CNTFRQ register in the Non Secure frame of the CNTBaseN.

Fixes ARM-Software/tf-issues#593

Change-Id: I09cebb6633688b34d5b1bc349fbde4751025b350
Signed-off-by: Soby Mathew <soby.mathew@arm.com>
2018-06-20 13:09:30 +01:00
Dimitris Papastamos 0a665ed5d1
Merge pull request #1423 from chandnich/sgi-575/dyncfg
Sgi 575/dyncfg
2018-06-20 09:50:56 +01:00
Nishanth Menon 8d67515335 ti: k3: Introduce basic generic board support
While it would be useful to have a device tree based build, the
required components are not in place yet, so support just a simple
statically defined configuration to begin with.

Signed-off-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Andrew F. Davis <afd@ti.com>
2018-06-19 12:42:37 -05:00
Benjamin Fair 2e9c9e8299 ti: k3: common: Add PSCI stubs
These functions are used for the PSCI implementation and are needed to
build BL31, but we cannot implement them until we add several more drivers
related to ti-sci so these are only stubs for now.

Signed-off-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Benjamin Fair <b-fair@ti.com>
Signed-off-by: Andrew F. Davis <afd@ti.com>
2018-06-19 12:42:37 -05:00
Nishanth Menon 74e8cf48e1 ti: k3: common: Enable GICv3 support
Do proper initialization of GIC V3. This will allow CP15 access to GIC
from "normal world" (aka HLOS) via mrc/mcr calls.

K3 SoC family uses GICv3 compliant GIC500 without compatibility for
legacy GICv2.

Signed-off-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Benjamin Fair <b-fair@ti.com>
Signed-off-by: Andrew F. Davis <afd@ti.com>
2018-06-19 12:42:37 -05:00
Nishanth Menon e9cb89cfca ti: k3: common: Program A53 arch timer frequency
Provide K3_TIMER_FREQUENCY for the platform configuration if the GTC
clock is selected statically and override option if the platform has a
different configuration.

Signed-off-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Benjamin Fair <b-fair@ti.com>
2018-06-19 12:42:37 -05:00
Nishanth Menon fff6ffca5b ti: k3: common: Add console initialization base
Signed-off-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Benjamin Fair <b-fair@ti.com>
Signed-off-by: Andrew F. Davis <afd@ti.com>
2018-06-19 12:42:35 -05:00
Nishanth Menon e67bfcf344 ti: k3: common: Enable MMU using xlat_tables_v2 library
This library will be used to properly set up mappings from different
bootloaders at different exception levels. It ensures that memory mapped
devices such as UARTs are still accessible and memory regions have the
correct access permissions.

Signed-off-by: Benjamin Fair <b-fair@ti.com>
Signed-off-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Andrew F. Davis <afd@ti.com>
2018-06-19 11:51:05 -05:00
Benjamin Fair 878bd5cebf ti: k3: common: Implement topology functions
These functions describe the layout of the cores and clusters in order to
support the PSCI framework.

Signed-off-by: Benjamin Fair <b-fair@ti.com>
Signed-off-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Andrew F. Davis <afd@ti.com>
2018-06-19 11:50:32 -05:00
Benjamin Fair a546d25b1e ti: k3: common: Populate BL32 and BL33 entrypoint
Because there is no BL2, BL31 must determine the entrypoint and memory
location of BL32 and BL33 on its own.

BL32_BASE and PRELOADED_BL33_BASE will be set in the corresponding board
makefile. We also allow a DTB address to be specified for cases when BL33
is a Linux image.

NOTE: It is possible to pull in this information from device tree as
well, however libfdt does not contain the required hooks to make this
happen at this point in time.

Signed-off-by: Benjamin Fair <b-fair@ti.com>
Signed-off-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Andrew F. Davis <afd@ti.com>
2018-06-19 11:48:42 -05:00
Benjamin Fair 8957471572 ti: k3: common: Add platform core management helpers
The K3 family of SoCs has multiple interconnects. The key interconnect
for high performance processors is the MSMC3 interconnect. This is
an io-coherent interconnect which exports multiple ports for each
processor cluster.

Sometimes, port 0 of the MSMC may not have an ARM cluster OR is isolated
such that the instance of ATF does not manage it. Define macros
in platform_def.h to help handle this.

Signed-off-by: Benjamin Fair <b-fair@ti.com>
Signed-off-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Andrew F. Davis <afd@ti.com>
2018-06-19 11:45:31 -05:00
Nishanth Menon 1841c533c9 ti: k3: Setup initial files for platform
Create the baseline Makefile, platform definitions file and platform
specific assembly macros file. This includes first set of constants
for the platform including cache sizes and linker format and a stub for
BL31 and the basic memory layout

K3 SoC family of processors do not use require a BL1 or BL2 binary,
since such functions are provided by an system controller on the SoC.
This lowers the burden of ATF to purely managing the local ARM cores
themselves.

Signed-off-by: Benjamin Fair <b-fair@ti.com>
Signed-off-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Andrew F. Davis <afd@ti.com>
2018-06-19 11:41:25 -05:00
Dimitris Papastamos d135ad7884
Merge pull request #1410 from Anson-Huang/master
Add NXP's i.MX8QX and i.MX8QM SoC support
2018-06-19 15:10:23 +01:00
Dimitris Papastamos 73b4214bf5
Merge pull request #1425 from jts-arm/panic
Panic in BL1 when TB_FW_CONFIG is invalid
2018-06-19 15:09:43 +01:00
Dimitris Papastamos 7fb3a70bff
Merge pull request #1418 from antonio-nino-diaz-arm/an/arm-multi-console
plat/arm: Migrate AArch64 port to the multi console driver
2018-06-19 14:00:07 +01:00
Ying-Chun Liu (PaulLiu) 7812abac86 rpi3: add OPTEE support
Support for loading optee images as BL32 secure payload.

Signed-off-by: Ying-Chun Liu (PaulLiu) <paul.liu@linaro.org>
2018-06-19 16:40:22 +08:00
Antonio Nino Diaz 88a0523e91 plat/arm: Migrate AArch64 port to the multi console driver
The old API is deprecated and will eventually be removed.

Arm platforms now use the multi console driver for boot and runtime
consoles. However, the crash console uses the direct console API because
it doesn't need any memory access to work. This makes it more robust
during crashes.

The AArch32 port of the Trusted Firmware doesn't support this new API
yet, so it is only enabled in AArch64 builds. Because of this, the
common code must maintain compatibility with both systems. SP_MIN
doesn't have to be updated because it's only used in AArch32 builds.
The TSP is only used in AArch64, so it only needs to support the new
API without keeping support for the old one.

Special care must be taken because of PSCI_SYSTEM_SUSPEND. In Juno, this
causes the UARTs to reset (except for the one used by the TSP). This
means that they must be unregistered when suspending and re-registered
when resuming. This wasn't a problem with the old driver because it just
restarted the UART, and there were no problems associated with
registering and unregistering consoles.

The size reserved for BL2 has been increased.

Change-Id: Icefd117dd1eb9c498921181a21318c2d2435c441
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
2018-06-19 09:29:36 +01:00
Anson Huang baa7650bf8 Support for NXP's i.MX8QM SoC
NXP's i.MX8QM is an ARMv8 SoC with 2 clusters, 2 Cortex-A72
cores in one cluster and 4 Cortex-A53 in the other cluster,
and also has system controller (Cortex-M4) inside, documentation
can be found in below link:

https://www.nxp.com/products/processors-and-microcontrollers/
applications-processors/i.mx-applications-processors/i.mx-8-processors:IMX8-SERIES

This patch adds support for booting up SMP linux kernel (v4.9).

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2018-06-19 10:24:32 +08:00
Anson Huang 0bc1830928 Support for NXP's i.MX8QX SoC
NXP's i.MX8QX is an ARMv8 SoC with 4 Cortex-A35 cores and
system controller (Cortex-M4) inside, documentation can
be found in below link:

https://www.nxp.com/products/processors-and-microcontrollers/
applications-processors/i.mx-applications-processors/i.mx-8-processors:IMX8-SERIES

This patch adds support for booting up SMP linux kernel (v4.9).

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2018-06-19 10:24:32 +08:00
Anson Huang bd08def3c9 Support for NXP's imx SoC common function
This patch adds support for NXP's imx SoC common
function support like topology, gic implementation.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2018-06-19 10:24:32 +08:00
Anson Huang 27b9d5ead8 Support for NXP's imx SoC debug uart
Add NXP's imx SoC debug uart driver.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2018-06-19 10:24:32 +08:00
Anson Huang ff2743e544 Support for NXP's i.MX8 SoCs IPC
NXP's i.MX8 SoCs have system controller (M4 core)
which takes control of clock management, power management,
partition management, PAD management etc., other
clusters like Cortex-A35 can send out command via MU
(Message Unit) to system controller for clock/power
management etc..

This patch adds basic IPC(inter-processor communication) support.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2018-06-19 10:24:28 +08:00
Roberto Vargas e237c1ba80 Move mem-protect definitions to board specific files
Having these definitions in board_arm_def.h forces to
all the arm platforms to use the same definition for
PLAT_ARM_MEM_PROT_ADDR.

This macro also enables the mem-protect mechanism,
which means that all the arm platform has enabled
mem-protect and they cannot get rid of it.

Change-Id: Id29d2c51cbe6edc15f010a9f5a20c42266c48a08
Signed-off-by: Roberto Vargas <roberto.vargas@arm.com>
2018-06-18 13:51:21 +01:00
John Tsichritzis 355e096715 Panic in BL1 when TB_FW_CONFIG is invalid
In Arm platforms, when using dynamic configuration, the necessary
parameters are made available as a DTB. The DTB is loaded by BL1 and,
later on, is parsed by BL1, BL2 or even both, depending on when
information from the DTB is needed.

When the DTB is going to be parsed, it must be validated first, to
ensure that it is properly structured. If an invalid DTB is detected
then:
  - BL1 prints a diagnostic but allows execution to continue,
  - BL2 prints a diagnostic and panics.

Now the behaviour of BL1 is changed so for it also to panic. Thus, the
behaviour of BL1 and BL2 is now similar.

Keep in mind that if BL1 only loads the DTB but it doesn't need to
read/write it, then it doesn't validate it. The validation is done only
when the DTB is actually going to be accessed.

Change-Id: Idcae6092e6dbeab7248dd5e041d6cbb7784fe410
Signed-off-by: John Tsichritzis <john.tsichritzis@arm.com>
2018-06-15 16:01:35 +01:00
Andre Przywara acb8b3cabb allwinner: Add security setup
Some peripherals are TrustZone aware, so they need to be configured to
be accessible from non-secure world, as we don't need any of them being
exclusive to the secure world.
This affects some clocks, DMA channels and the Secure Peripheral
Controller (SPC). The latter controls access to most devices, but is not
active unless booting with the secure boot fuse burnt.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2018-06-15 11:45:24 +01:00
Samuel Holland 560581eceb allwinner: Add platform PSCI functions required for SMP
The reset vector entry point is preserved across CPU resets, so it only
needs to be set once at boot.

Hotplugged CPUs are not actually powered down, but are put in a wfi with
the GIC disconnected.

With this commit, Linux is able to enable, hotplug and use all four CPUs.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2018-06-15 11:45:24 +01:00
Samuel Holland 333d66cf4e allwinner: Add functions to control CPU power/reset
sun50i_cpu_on will be used by the PSCI implementation to initialize
secondary cores for SMP. Unfortunately, sun50i_cpu_off is not usable by
PSCI directly, because it is not possible for a CPU to use this function
to power itself down. Power cannot be shut off until the outputs are
clamped, and MMIO does not work once the outputs are clamped.

But at least CPU0 can shutdown the other cores early in the BL31 boot
process and before shutting down the system.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2018-06-15 11:45:24 +01:00
Samuel Holland 64b3d9d88e allwinner: Add Allwinner A64 support
The Allwinner A64 SoC is quite popular on single board computers.
It comes with four Cortex-A53 cores in a singe cluster and the usual
peripherals for set-top box/tablet SoC.

The ATF platform target is called "sun50i_a64".

[Andre: adapted to amended directory layout, removed unneeded definitions ]

Signed-off-by: Samuel Holland <samuel@sholland.org>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2018-06-15 11:45:24 +01:00
Samuel Holland 58032586f8 allwinner: Introduce basic platform support
This platform supports Allwinner's SoCs with ARMv8 cores. So far they
all sport a single cluster of Cortex-A53 cores.

"sunxi" is the original code name used for this platform, and since it
appears in the Linux kernel and in U-Boot as well, we use it here as a
short file name prefix and for identifiers.

This port includes BL31 support only. U-Boot's SPL takes the role of the
primary loader, also doing the DRAM initialization. It then loads the
rest of the firmware, namely ATF and U-Boot (BL33), then hands execution
over to ATF.

This commit includes the basic platform code shared across all SoCs.
There is no platform.mk yet.

[Andre: moved files into proper directories, supported RESET_TO_BL31,
	various clean ups and simplifications ]

Signed-off-by: Samuel Holland <samuel@sholland.org>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2018-06-15 11:45:24 +01:00
Chandni Cherukuri 649b43f82d sgi/mmap: Remove SGI specific MMAP functions
Remove the redundant SGI functions which map memory
for BL1 and BL2.

Change-Id: I651a06d0eb6d28263a56f59701bb3815f1ba93dc
Signed-off-by: Chandni Cherukuri <chandni.cherukuri@arm.com>
2018-06-15 10:17:36 +05:30
Chandni Cherukuri ea3f1be5bd sgi/dyncfg: add system-id node in hw-config dtb
Append a node to hw-config dtb which will include a property to hold
the value of the SSC_VERSION register. This will be used by the BL33
stage to determine the platform-id and the config-id of the platform
it is executing on.

Change-Id: Ie7b1e5d8c1bbe0efdb7ef0714f14b7794ec6058e
Signed-off-by: Amit Daniel Kachhap <amit.kachhap@arm.com>
Signed-off-by: Chandni Cherukuri <chandni.cherukuri@arm.com>
2018-06-15 10:17:24 +05:30
Chandni Cherukuri 39b66f68d8 sgi/dyncfg: add dts files to enable support for dynamic config
Remove the existing method of populating the platform id in arg2 of
BL33 which is no longer needed with dynamic configuration feature
enabled as the BL33 will get this information directly via the config
files. Add the tb_fw_config and hw_config dts files.

Change-Id: I3c93fec2aedf9ef1f774a5f0969d2d024e47ed2c
Signed-off-by: Chandni Cherukuri <chandni.cherukuri@arm.com>
2018-06-15 10:17:11 +05:30
Roberto Vargas 033648652f Make TF UUID RFC 4122 compliant
RFC4122 defines that fields are stored in network order (big endian),
but TF-A stores them in machine order (little endian by default in TF-A).
We cannot change the future UUIDs that are already generated, but we can store
all the bytes using arrays and modify fiptool to generate the UUIDs with
the correct byte order.

Change-Id: I97be2d3168d91f4dee7ccfafc533ea55ff33e46f
Signed-off-by: Roberto Vargas <roberto.vargas@arm.com>
2018-06-14 14:41:00 +01:00
Dimitris Papastamos 4a410a3ba3
Merge pull request #1417 from paulkocialkowski/integration
rockchip: Move stdint header to the offending header file
2018-06-14 14:34:46 +01:00
Dimitris Papastamos 59c4346383
Merge pull request #1415 from antonio-nino-diaz-arm/an/spm-fixes
Minor fixes to SPM
2018-06-14 14:33:13 +01:00
Dimitris Papastamos f3a5e3d6ec
Merge pull request #1412 from masahir0y/uniphier
uniphier: fix CCI-500 connection for LD20
2018-06-14 14:32:41 +01:00
Paul Kocialkowski fb83888b61 rockchip: Move stdint header to the offending header file
The stdint header was introduced to rk3399's plat_sip_calls.c in order
to fix missing stdint definitions. However, ordering headers
alphabetically caused the fix to be ineffective, as stint was then
included after the offending header file (dfs.h).

Move the stdint include to that header to properly fix the issue.

Change-Id: Ieaad37a7932786971488ab58fc5b169bfa79e197
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
2018-06-13 20:37:50 +02:00
Sandrine Bailleux d801a1d035 SPM: Treat SP xlat tables the same as others
The translation tables allocated for the Secure Partition do not need
to be treated as a special case. They can be put amongst the other
tables mapping BL31's general purpose memory. They will be mapped with
the same attributes as them, which is fine.

The explicit alignment constraint in BL31's linker script to pad the
last page of memory allocated to the Secure Partition's translation
tables is useless too, as page tables are per se pages, thus their
end address is naturally aligned on a page-boundary.

In fact, this patch does not change the existing behaviour. Since
patch 22282bb68a ("SPM: Move all SP-related info to SP context
struct"), the secure_partition.c file has been renamed into sp_xlat.c
but the linker script has not been properly updated. As a result, the
SP translation tables are not specifically put at the start of the
xlat_table linker section, the __SP_IMAGE_XLAT_TABLES_START__/_END__
symbols have the same value, the size of the resulting mmap_region
covering these xlat tables is 0 and so it is ignored.

Change-Id: I4cf0a4cc090298811cca53fc9cee74df0f2b1512
Signed-off-by: Sandrine Bailleux <sandrine.bailleux@arm.com>
2018-06-13 09:19:41 +01:00
Antonio Nino Diaz f13cb561f0 LOAD_IMAGE_V1: Align BL2 memory layout struct to 8 bytes
In LOAD_IMAGE_V1 (i.e when LOAD_IMAGE_V2=0) the bl2_tzram_layout is,
by default, assigned to the bl1_tzram_layout->free_base which is
dynamically calculated based on the images loaded in memory. There is a
chance that the bl2_tzram_layout will be assigned a value not aligned to
8 bytes. This patch rounds up the free_base value for the required
alignment.

This doesn't happen in LOAD_IMAGE_V2 because the bl2_tzram_layout is
assigned by default to the bl1_tzram_layout->total_base, which is
aligned.

Change-Id: Idc583e7dad993d02ac6791797406118c96f83fa1
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
2018-06-12 14:08:48 +01:00
Daniel Boulby a138f76871 Fix MISRA Rule 5.7 Part 2
Follow convention of shorter names for smaller scope to fix
violations of MISRA rule 5.7

To prevent violation of directive 4.5 having variable name channel
in css_pm_scmi.c not being typographically ambiguous change macro
argument CHANNEL in css_mhu_doorbell.h change argument to _channel
to fit with our convention which is a permitted exception of
directive 4.5 for this project

Rule 5.7: A tag name shall be a unique identifier

Fixed for:
    make LOG_LEVEL=50 PLAT=juno

Change-Id: I147cdb13553e83ed7df19149b282706db115d612
Signed-off-by: Daniel Boulby <daniel.boulby@arm.com>
2018-06-12 13:21:36 +01:00
Daniel Boulby ff4e86f90e Fix MISRA Rule 5.3 Part 5
Use a _ prefix for macro arguments to prevent that argument from
hiding variables of the same name in the outer scope

Rule 5.3: An identifier declared in an inner scope shall not
          hide an identifier declared in an outer scope

Fixed For:
    make LOG_LEVEL=50 PLAT=juno

Change-Id: I575fbc96e8267f2b075e88def1f6e3185394613a
Signed-off-by: Daniel Boulby <daniel.boulby@arm.com>
2018-06-12 13:21:36 +01:00
Satoshi Ikawa 4fc1a38185 uniphier: fix CCI-500 connection for LD20
The slave ports of LD20 CCI-500 are connected as follows:

  S0: CA53
  S1: CA72

Be careful because the slave interface is not arranged in the
cluster number order (CA72: cluster 0, CA53: cluster 1).

Root-caused-by: Tetsuya Yoshizaki <yoshizaki.tetsuya@socionext.com>
Signed-off-by: Satoshi Ikawa <ikawa.satoshi@socionext.com>
2018-06-12 10:38:20 +09:00
Dimitris Papastamos 608529aa24
Merge pull request #1397 from dp-arm/dp/cortex-a76
Add support for Cortex-A76 and Cortex-Ares
2018-06-08 14:01:38 +01:00
Dimitris Papastamos 4a581b061c
Revert "Code change to fix small bugs" 2018-06-08 13:17:26 +01:00
Dimitris Papastamos ee7cda31c7 Set DYNAMIC_WORKAROUND_CVE_2018_3639=1 on FVP by default
The upcoming patch that adds dynamic mitigation for Cortex-A76
requires that DYNAMIC_WORKAROUND_CVE_2018_3639=1.  On FVP, we pull in
all the CPU files into the build which means there will be a build
failure if DYNAMIC_WORKAROUND_CVE_2018_3639=0.

Change-Id: I2e781cbeafbf5d16eaabf76a1677e0c9f81269d2
Signed-off-by: Dimitris Papastamos <dimitris.papastamos@arm.com>
2018-06-08 11:46:31 +01:00
Dimitris Papastamos 08268e27ab Add AMU support for Cortex-Ares
Change-Id: Ia170c12d3929a616ba80eb7645c301066641f5cc
Signed-off-by: Dimitris Papastamos <dimitris.papastamos@arm.com>
2018-06-08 11:46:31 +01:00
Isla Mitchell abbffe98ed Add support for Cortex-Ares and Cortex-A76 CPUs
Both Cortex-Ares and Cortex-A76 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 simple.

Change-Id: I3a9447b5bdbdbc5ed845b20f6564d086516fa161
Signed-off-by: Isla Mitchell <isla.mitchell@arm.com>
2018-06-08 11:46:31 +01:00
Dimitris Papastamos 83685de911
Merge pull request #1389 from danielboulby-arm/db/bugfix
Code change to fix small bugs
2018-06-08 11:45:06 +01:00
Soby Mathew 2013d8f05a Juno: Bump up the BL1-RW size
This patch bumps up the BL1-RW size for Juno and at the same time reduces
the BL2 size when TBB is enabled, TF_MBEDTLS_KEY_ALG=rsa+ecdsa. The BL2
size for this config is reduced as it was observed that the peak memory
usage is only reached when SPD=opteed and the dual rsa+ecdsa support is
not needed for this case.

Change-Id: Ia9009771b5cfd805e9cc75410aabb7db99fc2fbc
Signed-off-by: Soby Mathew <soby.mathew@arm.com>
2018-06-07 16:09:13 +01:00
Soby Mathew c099cd3942 ARM platforms: Move BL31 below BL2 to enable BL2 overlay
The patch changes the layout of BL images in memory to enable
more efficient use of available space. Previously BL31 was loaded
with the expectation that BL2 memory would be reclaimed by BL32
loaded in SRAM. But with increasing memory requirements in the
firmware, we can no longer fit BL32 in SRAM anymore which means the
BL2 memory is not reclaimed by any runtime image. Positioning BL2
below BL1-RW and above BL31 means that the BL31 NOBITS can be
overlaid on BL2 and BL1-RW.

This patch also propogates the same memory layout to BL32 for AArch32
mode. The reset addresses for the following configurations are also
changed :
   * When RESET_TO_SP_MIN=1 for BL32 in AArch32 mode
   * When BL2_AT_EL3=1 for BL2

The restriction on BL31 to be only in DRAM when SPM is enabled
is now removed with this change. The update to the firmware design
guide for the BL memory layout is done in the following patch.

Change-Id: Icca438e257abe3e4f5a8215f945b9c3f9fbf29c9
Signed-off-by: Soby Mathew <soby.mathew@arm.com>
2018-06-07 12:26:19 +01:00