Commit Graph

2496 Commits

Author SHA1 Message Date
Qixiang Xu 76580f3d69 Filter out invalid configure for EL3_PAYLOAD_BASE
TRUSTED_BOARD_BOOT and GENERATE_COT is not
compatible with EL3_PAYLOAD_BASE

Change-Id: I538c77e1f6c7da400d30ae4d633b8fcc55742202
Signed-off-by: Qixiang Xu <qixiang.xu@arm.com>
2017-09-08 10:47:25 +08:00
davidcunado-arm 5457874575 Merge pull request #1080 from soby-mathew/eb/RSA-PKCS1-5_support_1
Support legacy RSA PKCS#1 v1.5 in cert create
2017-09-07 01:14:24 +01:00
davidcunado-arm 2867ca3707 Merge pull request #1078 from douglas-raillard-arm/dr/add_cfi_vector_entry
Add CFI debug info to vector entries
2017-09-07 00:45:59 +01:00
davidcunado-arm 413115e152 Merge pull request #1019 from etienne-lms/log-size
CPU_DATA_LOG2SIZE depends on cache line size
2017-09-07 00:40:59 +01:00
davidcunado-arm e524d78f9f Merge pull request #1076 from masahir0y/asm_macro
asm_macros: set the default assembly code alignment to 4 byte
2017-09-06 09:16:17 +01:00
davidcunado-arm 942ee0d8cf Merge pull request #1083 from soby-mathew/sm/fix_optee_map
Fix BL2 memory map when OP-TEE is the Secure Payload
2017-09-05 21:32:50 +01:00
Soby Mathew b3ba6fda44 Fix BL2 memory map when OP-TEE is the Secure Payload
The commit 3eb2d67 optimizes the memory map for BL2 when TSP
is not present. But this also broke OP-TEE as it was reusing
the TSP mapping. This patch fixes this problem by adding a
separate mapping for OP-TEE in the BL2 memory map table.

Change-Id: I130a2ea552b7b62d8478081feb1f4ddf5292a118
Signed-off-by: Soby Mathew <soby.mathew@arm.com>
2017-09-05 15:03:16 +01:00
davidcunado-arm 827cd9f13d Merge pull request #1081 from masahir0y/uniphier
uniphier: fix-up for PXs3 SoC
2017-09-04 09:35:13 +01:00
Etienne Carriere 86606eb51e cpu log buffer size depends on cache line size
Platform may use specific cache line sizes. Since CACHE_WRITEBACK_GRANULE
defines the platform specific cache line size, it is used to define the
size of the cpu data structure CPU_DATA_SIZE aligned on cache line size.

Introduce assembly macro 'mov_imm' for AArch32 to simplify implementation
of function '_cpu_data_by_index'.

Change-Id: Ic2d49ffe0c3e51649425fd9c8c99559c582ac5a1
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
2017-09-01 10:22:20 +02:00
Masahiro Yamada 9bdccff462 uniphier: work around Boot ROM bug for USB boot mode of PXs3 SoC
Due to a bug in the Boot ROM, the USB load API turned out not working
as expected.  It is unfixable because the Boot ROM is hard-wired.

Add work around code in TF to bypass the problematic Boot ROM code.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2017-09-01 11:11:30 +09:00
Masahiro Yamada 91be512846 uniphier: fix code indent for conditional statement
checkpatch.pl from Linux reports tons of coding style errors and
warnings.  I am just fixing under plat/socionext/uniphier/.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2017-09-01 11:11:30 +09:00
danh-arm 085bac2b75 Merge pull request #1072 from sandrine-bailleux-arm/sb/tsp-mapping
ARM platforms: Map TSP only when TSPD is included
2017-08-31 18:55:21 +01:00
Soby Mathew a8eb286ada cert_tool: Support for legacy RSA PKCS#1 v1.5
This patch enables choice of RSA version at run time to be used for
generating signatures by the cert_tool. The RSA PSS as defined in
PKCS#1 v2.1 becomes the default version and this patch enables to specify
the RSA PKCS#1 v1.5 algorithm to `cert_create` through the command line
-a option. Also, the build option `KEY_ALG` can be used to pass this
option from the build system. Please note that RSA PSS is mandated
by Trusted Board Boot requirements (TBBR) and legacy RSA support is
being added for compatibility reasons.

Fixes ARM-Software/tf-issues#499
Change-Id: Ifaa3f2f7c9b43f3d7b3effe2cde76bf6745a5d73
Co-Authored-By: Eleanor Bonnici <Eleanor.bonnici@arm.com>
Signed-off-by: Soby Mathew <soby.mathew@arm.com>
2017-08-31 16:42:11 +01:00
Soby Mathew 2091755c5e Export KEY_ALG as a user build option
The `KEY_ALG` variable is used to select the algorithm for key
generation by `cert_create` tool for signing the certificates. This
variable was previously undocumented and did not have a global default
value. This patch corrects this and also adds changes to derive the
value of `TF_MBEDTLS_KEY_ALG` based on `KEY_ALG` if it not set by the
platform. The corresponding assignment of these variables are also now
removed from the `arm_common.mk` makefile.

Signed-off-by: Soby Mathew <soby.mathew@arm.com>
Change-Id: I78e2d6f4fc04ed5ad35ce2266118afb63127a5a4
2017-08-31 16:42:11 +01:00
Sandrine Bailleux 3eb2d672fc ARM platforms: Map TSP only when TSPD is included
This patch ensures that the ARM_MAP_TSP_SEC_MEM memory region is mapped
in BL2 only if the TSPD has been included in the build. This saves one
entry in the plat_arm_mmap[] array and avoids to map extra memory when
it's not needed.

Change-Id: I6ae60822ff8f0de198145925b0b0d45355179a94
Signed-off-by: Achin Gupta <achin.gupta@arm.com>
Signed-off-by: Sandrine Bailleux <sandrine.bailleux@arm.com>
2017-08-31 16:18:00 +01:00
danh-arm 9a5d18ea1e Merge pull request #1079 from douglas-raillard-arm/dr/doc_fix_typo
porting-guide.rst: Fix some sections' level
2017-08-31 14:21:21 +01:00
danh-arm 2737d0f36e Merge pull request #1077 from soby-mathew/sm/fix_juno_assert_lvl
Juno: Define PLAT_LOG_LEVEL_ASSERT to LOG_LEVEL_INFO
2017-08-31 14:20:31 +01:00
Douglas Raillard b0c61f9403 porting-guide.rst: Fix some sections' level
Fix the level of the section
"13.   Function : plat_setup_psci_ops() [mandatory]",
including all the subsections.

Fix the level of the section
"12.7.   plat_psci_ops.pwr_domain_suspend_pwrdown_early() [optional]"
to lower it like the surrounding functions.

Change-Id: I781823bc96ece669f8fde4bd39c4e333c7bf4d1a
Signed-off-by: Douglas Raillard <douglas.raillard@arm.com>
2017-08-31 13:39:09 +01:00
Douglas Raillard 31823b6961 Add CFI debug info to vector entries
Add Call Frame Information assembler directives to vector entries so
that debuggers display the backtrace of functions that triggered a
synchronous exception. For example, a function triggering a data abort
will be easier to debug if the backtrace can be displayed from a
breakpoint at the beginning of the synchronous exception vector.

DS-5 needs CFI otherwise it will not attempt to display the backtrace.
Other debuggers might have other needs. These debug information are
stored in the ELF file but not in the final binary.

Change-Id: I32dc4e4b7af02546c93c1a45c71a1f6d710d36b1
Signed-off-by: Douglas Raillard <douglas.raillard@arm.com>
2017-08-31 13:33:37 +01:00
Soby Mathew bea363ade1 Juno: Define PLAT_LOG_LEVEL_ASSERT to LOG_LEVEL_INFO
This patch fixes the PLAT_LOG_LEVEL_ASSERT to 40 which corresponds
to LOG_LEVEL_INFO. Having this level of log for assertions means that the
`assert()` will not generate the strings implied in the expression taken
as parameter. This allows to save some memory when Juno is built for
LOG_LEVEL = LOG_LEVEL_VERBOSE and DEBUG = 1.

Fixes ARM-software/tf-issues#511

Change-Id: Id84a40f803ab07a5a8f6e587167af96694a07d04
Signed-off-by: Soby Mathew <soby.mathew@arm.com>
2017-08-31 12:21:16 +01:00
Masahiro Yamada fed18b3aec asm_macros: set the default assembly code alignment to 4 byte
Assembly routines are usually defined by using "func" and "endfunc":

    func foo
      ...
    endfunc foo

Currently, the "func" macro does not specify ".align" directive
by default.  It causes unaligned instruction under some circumstances.

As far as I tested, this problem happens for GCC 5 or older.  It did
not happen for GCC 6 or newer.  Taking into account that GCC 4.x / 5.x
is still used, make sure that assembly code is at least 4 byte aligned.

[ How to reproduce the problem ]

For example, use GCC 5.3 downloaded from Linaro:
http://releases.linaro.org/components/toolchain/binaries/5.3-2016.05/
aarch64-linux-gnu/gcc-linaro-5.3.1-2016.05-x86_64_aarch64-linux-gnu.tar.xz

Expand mbedtls-2.4.2 to the current directory.

Try the following:

  $ git log --oneline -1
  77544ef Merge pull request #1071 from jeenu-arm/syntax-fix
  $ aarch64-linux-gnu-gcc --version | head -1
  aarch64-linux-gnu-gcc (Linaro GCC 5.3-2016.05) 5.3.1 20160412
  $ make CROSS_COMPILE=aarch64-linux-gnu- PLAT=uniphier \
    TRUSTED_BOARD_BOOT=1 MBEDTLS_DIR=mbedtls-2.4.2
    ( snip build log )
  $ aarch64-linux-gnu-nm build/uniphier/release/bl1/bl1.elf | grep handler
  00000000800088f4 T bl1_fwu_smc_handler
  00000000800084c8 T bl1_smc_handler
  000000008000a6e0 t _panic_handler
  000000008000a8e0 W plat_error_handler
  000000008000a8e8 W plat_panic_handler
  000000008000a8d8 W plat_reset_handler
  000000008000a39f T reset_handler
  000000008000a367 t smc_handler
  000000008000a2ef t smc_handler64

You will notice "smc_handler64", "reset_handler", etc. are not properly
aligned.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2017-08-31 18:45:19 +09:00
danh-arm 137c8f01e4 Merge pull request #1069 from Leo-Yan/hikey_enable_watchdog_reset
Hikey: enable watchdog reset
2017-08-31 09:37:47 +01:00
davidcunado-arm d818a02cb4 Merge pull request #1074 from EvanLloyd/ejll/62_file_mode
fiptool: Update file open modes with 'b' (for Windows)
2017-08-30 18:12:28 +01:00
danh-arm 615cd166bd Merge pull request #1075 from robertovargas-arm/fix_el3_payload
Don't use zero_normalmem in bl2_platform_setup
2017-08-30 18:04:02 +01:00
Roberto Vargas a1f5a9e5f2 Don't use zero_normalmem in bl2_platform_setup
zero_normalmem only can zero memory when caches are enabled
and the target memory is a normal memory, otherwise an abort is
generated. In the case of EL3_PAYLOAD_BASE bl2_platform_setup was
calling zero_normalmem with device memory and it generated an abort.

Change-Id: If013603f209a12af488a9c54481f97a8f395b26a
Signed-off-by: Roberto Vargas <roberto.vargas@arm.com>
2017-08-30 16:09:00 +01:00
Evan Lloyd 55745deaf4 fiptool: Update file open modes with 'b' (for Windows)
Unix does not distinguish binary and text modes.
On Windows the 'b' flag (e.g. "rb" instead of "r") is used to
indicate that files should be opened in binary mode.
This has no impact on Unix, but is needed on Windows to avoid
end-of-line issues.

Change-Id: I69424c55735d5d563d36c50bedd6357b8e05137e
Signed-off-by: Evan Lloyd <evan.lloyd@arm.com>
2017-08-30 14:56:17 +01:00
danh-arm bd35923466 Merge pull request #1073 from davidcunado-arm/dc/update_docs
Add usage note for FVP model versions 11.0 and 8.5
2017-08-30 14:37:15 +01:00
danh-arm b15bab6bbc Merge pull request #1066 from islmit01/im/enable_cnp_bit
Enable CnP bit for ARMv8.2 CPUs
2017-08-30 14:34:57 +01:00
danh-arm 1b05282abf Merge pull request #1062 from jeenu-arm/cpu-fixes
Cpu macro fixes
2017-08-30 14:34:17 +01:00
David Cunado 279fedc1f8 Add usage note for FVP model versions 11.0 and 8.5
The internal synchronisation timings of the FVP model version
11.0 build 11.0.34 and version 8.5 build 0.8.5202 has been
changed compared to older version of the models.

This change may have an impact on how the model behaves depending
on the workload being run on the model. For example test failures
have been seen where the primary core has powered on a secondary
core but was then starved of host CPU time and so was not able to
update power status, resulting a test failure due to an incorrect
status. This, or similar behaviour, is not to be expected from
real hardware platforms.

This patch adds a usage note on how to launch these models so
that internal synchronisation timing matches that of the older
version of the models, specifically adding the -Q 100 option.

Change-Id: If922afddba1581b7246ec889b3f1598533ea1b7e
Signed-off-by: David Cunado <david.cunado@arm.com>
2017-08-30 14:09:36 +01:00
danh-arm 77544efbf4 Merge pull request #1071 from jeenu-arm/syntax-fix
plat/arm: Fix ARM_INSTANTIATE_LOCK syntax anomaly
2017-08-29 15:25:36 +01:00
Eleanor Bonnici d0e1094ea0 Tegra: Rename CORTEX_A57_ACTLR_EL1 to *CPUACTLR*
CORTEX_A57_ACTLR_EL1 macro refers to the CPUACTLR_EL1 register. Since
ACTLR_EL1 is a different register (not implemented in Cortex-A57) this
patch renames this macro for clarity.

Change-Id: I94d7d564cd2423ae032bbdd59a99d2dc535cdff6
Signed-off-by: Eleanor Bonnici <Eleanor.bonnici@arm.com>
2017-08-29 13:52:48 +01:00
Eleanor Bonnici f9a856ba9f HiKey: Rename CPUACTRL reg constants
Constants named as *ACTLR* refer in fact to the CPUACTRL_EL1 register.
Since ACTLR and ACTRL_EL1 are different registers this patch renames
these constants for clarity.

Change-Id: I2a9e402dab7b0fcb6e481ee0d8a11eda943ed299
Signed-off-by: Eleanor Bonnici <Eleanor.bonnici@arm.com>
2017-08-29 13:52:48 +01:00
Eleanor Bonnici 80bcf98151 CPU: Correct names of implementation-defined aux regs
At present, various CPU register macros that refer to CPUACTLR are named
ACTLR. This patch fixes that.

The previous register names are retained, but guarded by the
ERROR_DEPRECATED macro, so as not to break platforms that continue using
the old names.

Change-Id: Ia872196d81803f8f390b887d149e0fd054df519b
Signed-off-by: Eleanor Bonnici <Eleanor.bonnici@arm.com>
2017-08-29 13:52:48 +01:00
Eleanor Bonnici e4e6c4be6f CPU: Make shifted constants unsigned
In order to avoid Undefined behavior, left operand in left-shift
expressions needs to be unsigned, and of sufficient size. The safest and
most consistent approach is to use unsigned long long type.

Change-Id: I9612f16a6e6ea4c7df62a02497d862abf19b8e1b
Signed-off-by: Eleanor Bonnici <Eleanor.bonnici@arm.com>
2017-08-29 13:52:48 +01:00
Jeenu Viswambharan 19583169e2 plat/arm: Fix ARM_INSTANTIATE_LOCK syntax anomaly
The current definition of ARM_INSTANTIATE_LOCK macro includes a
semicolon, which means it's omitted where it's used. This is anomalous
for a C statement in global scope.

Fix this by removing semicolon from the definition; and where it's a
NOP, declare a file-scoped variable explicitly tagged as unused to avoid
compiler warning.

No functional changes.

Change-Id: I2c1d92ece4777e272a025011e03b8003f3543335
Signed-off-by: Jeenu Viswambharan <jeenu.viswambharan@arm.com>
2017-08-29 12:02:18 +01:00
danh-arm 6328f76b0c Merge pull request #1070 from rockchip-linux/rk3399-fixes-logic
rockchip/rk3399: Support Turning off VD_LOGIC during suspend-to-ram
2017-08-29 11:52:04 +01:00
danh-arm 48f4bcd2ec Merge pull request #1068 from jenswi-linaro/optee_arm_plat
Optee arm platform common
2017-08-29 11:51:32 +01:00
danh-arm 913c38424e Merge pull request #1056 from geesun/qx/interrupt-diags
update the interrupt diagrams
2017-08-29 11:49:59 +01:00
Lin Huang dbc0f2dcc0 rockchip/rk3399: reinitilize secure sgrf when resume
when shutdown logic power rail, the some sgrf register
value will reset, so need to reinitilize secure.

Change-Id: I8ad0570432e54441fe1c60dd2960a81fd58f7163
Signed-off-by: Lin Huang <hl@rock-chips.com>
2017-08-29 15:35:41 +08:00
Lin Huang a7bb3388b1 rockchip/rk3399: do secure timer init in pmusram
we will use timer in pmusarm, when logic power rail shutdown,
the secure timer will gone, so need to initial it in pmusram.

Change-Id: I472e7eec3fc197f56223e6fff9167556c1c5e3bc
Signed-off-by: Lin Huang <hl@rock-chips.com>
2017-08-29 15:35:29 +08:00
Lin Huang 4c3770d9cf rockchip/rk3399: use slice1 to restore ddr slice1 ~ slice4
we do not have enough pmusram space now, so use slice1 to restore
ddr slice1 ~ slice4, that's will save more pmusram space.

Change-Id: Id54a7944f33d01a8f244cee6a8a0707bfe4d42da
Signed-off-by: Lin Huang <hl@rock-chips.com>
2017-08-29 15:22:21 +08:00
Lin Huang a109ec9234 rockchip/rk3399: disable more powerdomain prepare for shutdown logic rail
Change-Id: Ia59adf48cf14eb627721264765bce50cb31065ef
Signed-off-by: Lin Huang <hl@rock-chips.com>
2017-08-29 15:13:12 +08:00
Lin Huang 2adcad64dc rockchip/rk3399: save and restore pd_alive register
pd_alive control cru, grf, timer, gpio and wdt, when
turn off logic power rail, these register value will
back to reset value, we need to save them value in suspend
and restore them when resuem, since timer will reinitial
in kernel, so it not need to save/restore.

Change-Id: I0fc2a011d3cdc04b66ffbf728e769eb28b51ee38
Signed-off-by: Lin Huang <hl@rock-chips.com>
2017-08-29 15:00:40 +08:00
Leo Yan 3506ff110c Hikey: enable watchdog reset
At the system boot time we need enable watchdog reset, otherwise after
the watchdog is timeout it cannot reset the SoC. We need set the bit 0
and bit 16 together, the bit 16 is mask bit so after set bit 16 we have
permission to operate bit 0 and bit 0 is watchdog reset enabling bit.

Signed-off-by: Leo Yan <leo.yan@linaro.org>
2017-08-29 14:38:06 +08:00
Lin Huang 9aadf25c22 rockchip/rk3399: set ddr clock source back to dpll when ddr resume
when logic power rail shutdown, CRU register will back to reset
value, ddr use abpll as clock source when do suspend, we need to save
and dpll value in pmusram, then set back these ddr clock back to dpll
when dddr resume.

Change-Id: I95dc0173649e8515859cfa46b40a606e0cc2fe3f
Signed-off-by: Lin Huang <hl@rock-chips.com>
2017-08-29 11:53:29 +08:00
Lin Huang 74c3d79dc2 rockchip/rk3399: reinitilize debug uart when resume
when shutdown logic power rail, the uart register value will reset,
so need to reinitilize debug uart.

Change-Id: I48d3535c0068fd671dea6ea32e908612992faf62
Signed-off-by: Lin Huang <hl@rock-chips.com>
Signed-off-by: Caesar Wang <wxt@rock-chips.com>
2017-08-29 10:35:03 +08:00
davidcunado-arm afb33432df Merge pull request #1064 from islmit01/im/shifted_afinity
FVP: Always assume shifted affinity with MT bit
2017-08-25 17:26:22 +01:00
davidcunado-arm 01ebe3d2c6 Merge pull request #1059 from kenkuang/intergration
fix a typo abort sctlr_el2
2017-08-25 17:25:39 +01:00
davidcunado-arm f91e8d1af6 Merge pull request #1067 from jeenu-arm/rst-fix
firmware-design.rst: Fix formatting
2017-08-25 13:37:45 +01:00