project/bcm63xx/atf.git
7 years agoTegra: uninit and re-init console across System Suspend
Varun Wadekar [Tue, 2 Aug 2016 05:16:21 +0000 (22:16 -0700)]
Tegra: uninit and re-init console across System Suspend

This patch removes the console_init() from runtime_setup() as we already
initialize it earlier and disables/enables it across "System Suspend".

Change-Id: I992d3ca56ff4797faf83e8d7fa52c0ef3e1c3367
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
7 years agoTegra: support for silicon/simulation platforms
Varun Wadekar [Wed, 20 Jul 2016 17:28:51 +0000 (10:28 -0700)]
Tegra: support for silicon/simulation platforms

This patch adds support to identify the underlying platform
on which we are running. The currently supported platforms
are actual silicon and simulation platforms.

Change-Id: Iadf96e79ec663b3dbd1a18e9bb95ffcdb82fc8af
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
7 years agoMerge pull request #859 from Summer-ARM/sq/update-doc
danh-arm [Thu, 2 Mar 2017 17:03:12 +0000 (17:03 +0000)]
Merge pull request #859 from Summer-ARM/sq/update-doc

Update LOAD_IMAGE_V2 user guide documentation

7 years agoMerge pull request #853 from vwadekar/tegra-changes-from-downstream-v3
davidcunado-arm [Thu, 2 Mar 2017 15:27:33 +0000 (15:27 +0000)]
Merge pull request #853 from vwadekar/tegra-changes-from-downstream-v3

Tegra changes from downstream v3

7 years agoUpdate LOAD_IMAGE_V2 user guide documentation
Summer Qin [Wed, 22 Feb 2017 14:04:15 +0000 (14:04 +0000)]
Update LOAD_IMAGE_V2 user guide documentation

Now the TRUSTED_BOARD_BOOT is supported for AArch64 when LOAD_IMAGE_V2
is enabled. This patch updates the user-guide.md documentation for the
same.

Change-Id: I97de07435c81258c2a5f41a30a69736863a10bd1
Signed-off-by: Summer Qin <summer.qin@arm.com>
7 years agoTegra: per-soc `get_target_pwr_state` handler
Varun Wadekar [Tue, 7 Jun 2016 19:00:06 +0000 (12:00 -0700)]
Tegra: per-soc `get_target_pwr_state` handler

This patch implements a per-soc handler to calculate the target
power state for the cluster/system. A weak implementation of the
handler is provided for platforms to use by default.

For SoCs with multiple CPU clusters, this handler would provide
the individual cluster/system state, allowing the PSCI service to
flush caches during cluster/system power down.

Change-Id: I568cdb42204f9841a8430bd9105bd694f71cf91d
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
7 years agoTegra: relocate BL32 image to TZDRAM memory
Varun Wadekar [Mon, 23 May 2016 22:56:14 +0000 (15:56 -0700)]
Tegra: relocate BL32 image to TZDRAM memory

This patch adds support to relocate the BL32 image from the NS
memory to TZDRAM during cold boot. The NS memory buffer is
cleared out after the process completes.

Change-Id: I1a033ffe73b8c309449f874d5187708d0a8846d2
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
7 years agostdlib: add memcpy16() to string.h
Varun Wadekar [Mon, 21 Mar 2016 17:22:12 +0000 (10:22 -0700)]
stdlib: add memcpy16() to string.h

This patch exports memcpy16() for platforms, as an option to
memcpy().

Change-Id: I5d4e1cfb4608ec3674224b1447fdd740de549b1f
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
7 years agoTegra: get BL31 arguments from previous bootloader
Varun Wadekar [Mon, 23 May 2016 18:41:07 +0000 (11:41 -0700)]
Tegra: get BL31 arguments from previous bootloader

This patch implements handlers which platforms can override to
get the BL31 arguments passed by the previous bootloader.

Change-Id: I6b9628a984644ce1b5de5aa6d7cd890e57241d89
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
7 years agoTegra: return BL32 entry point info if it is valid
Varun Wadekar [Mon, 6 Jun 2016 17:46:28 +0000 (10:46 -0700)]
Tegra: return BL32 entry point info if it is valid

This patch returns pointer to the BL32 entrypoint info only if
it is valid.

Change-Id: I71ce3c4626681753c94f3a7bbaa50c26c74874cb
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
7 years agoTegra: configure TZDRAM fence during early setup
Varun Wadekar [Sun, 5 Jun 2016 05:08:50 +0000 (22:08 -0700)]
Tegra: configure TZDRAM fence during early setup

This patch configures the TZDRAM fence during early platform
setup to allow the memory controller to enable DRAM encryption
before the TZDRAM actually gets used.

Change-Id: I0169ef9dda75699527b4e30c9e617a9036ba1d76
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
7 years agoTegra: restore TZRAM settings on "System Resume"
Varun Wadekar [Thu, 2 Jun 2016 02:34:37 +0000 (19:34 -0700)]
Tegra: restore TZRAM settings on "System Resume"

This patch restores the TZRAM fence and the access permissions
on exiting the "System Suspend" state.

Change-Id: Ie313fca5a861c73f80df9639b01115780fb6e217
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
7 years agoTegra: enable ECC/Parity protection for Cortex-A57 CPUs
Varun Wadekar [Thu, 12 May 2016 20:43:33 +0000 (13:43 -0700)]
Tegra: enable ECC/Parity protection for Cortex-A57 CPUs

This patch enables L2 ECC and Parity Protection for ARM Cortex-A57 CPUs
for Tegra SoCs.

Change-Id: I038fcd529991d0201a4951ce2730ab71b1c980f9
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
7 years agoTegra: GIC: differentiate between FIQs targeted towards EL3/S-EL1
Varun Wadekar [Fri, 20 May 2016 23:21:22 +0000 (16:21 -0700)]
Tegra: GIC: differentiate between FIQs targeted towards EL3/S-EL1

This patch modifies the secure IRQ registration process to allow platforms
to specify the target CPUs as well as the owner of the IRQ. IRQs "owned"
by the EL3 would return INTR_TYPE_EL3 whereas those owned by the Trusted
OS would return INTR_TYPE_S_EL1 as a result.

Change-Id: I528f7c8220d0ae0c0f354e78d69e188abb666ef6
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
7 years agoTegra: implement FIQ interrupt handler
Varun Wadekar [Tue, 29 Dec 2015 00:36:42 +0000 (16:36 -0800)]
Tegra: implement FIQ interrupt handler

This patch adds a handler for FIQ interrupts triggered when
the CPU is in the NS world. The handler stores the NS world's
context along with ELR_EL3/SPSR_EL3.

The NS world driver issues an SMC initially to register it's
handler. The monitor firmware stores this handler address and
jumps to it when the FIQ interrupt fires. Upon entry into the
NS world the driver then issues another SMC to get the CPU
context when the FIQ fired. This allows the NS world driver to
determine the CPU state and call stack when the interrupt
fired. Generally, systems register watchdog interrupts as FIQs
which are then used to get the CPU state during hangs/crashes.

Change-Id: I733af61a08d1318c75acedbe9569a758744edd0c
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
7 years agoTegra: GIC: enable FIQ interrupt handling
Varun Wadekar [Mon, 28 Dec 2015 22:55:41 +0000 (14:55 -0800)]
Tegra: GIC: enable FIQ interrupt handling

Tegra chips support multiple FIQ interrupt sources. These interrupts
are enabled in the GICD/GICC interfaces by the tegra_gic driver. A
new FIQ handler would be added in a subsequent change which can be
registered by the platform code.

This patch adds the GIC programming as part of the tegra_gic_setup()
which now takes an array of all the FIQ interrupts to be enabled for
the platform. The Tegra132 and Tegra210 platforms right now do not
register for any FIQ interrupts themselves, but will definitely use
this support in the future.

Change-Id: I0ea164be901cd6681167028fea0567399f18d4b8
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
7 years agocpus: denver: remove barrier from denver_enable_dco()
Varun Wadekar [Fri, 6 May 2016 23:35:30 +0000 (16:35 -0700)]
cpus: denver: remove barrier from denver_enable_dco()

This patch removes unnecessary `isb` from the enable DCO sequence as
there is no need to synchronize this operation.

Change-Id: I0191e684bbc7fdba635c3afbc4e4ecd793b6f06f
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
7 years agoTegra: implement common handler `plat_get_target_pwr_state()`
Varun Wadekar [Thu, 5 May 2016 21:13:30 +0000 (14:13 -0700)]
Tegra: implement common handler `plat_get_target_pwr_state()`

This patch adds a platform handler to calculate the proper target power
level at the specified affinity level.

Tegra platforms assign a local state value in order of decreasing depth
of the power state i.e. for two power states X & Y, if X < Y then X
represents a shallower power state than Y. As a result, the coordinated
target local power state for a power domain will be the maximum of the
requested local power state values.

Change-Id: I67360684b7f5b783fcfdd605b96da5375fa05417
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
7 years agoTegra: include platform_def.h to access UART macros
Varun Wadekar [Tue, 26 Apr 2016 18:38:38 +0000 (11:38 -0700)]
Tegra: include platform_def.h to access UART macros

This patch includes platform_def.h required to access UART macros -
"TEGRA_BOOT_UART_CLK_IN_HZ" and "TEGRA_CONSOLE_BAUDRATE" from
tegra_helpers.S.

Change-Id: Ieb63968a48dc299d03e81ddeb1ccc871cf3397a1
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
7 years agoTegra: allow SiP smc calls from Secure World
Wayne Lin [Thu, 31 Mar 2016 20:49:09 +0000 (13:49 -0700)]
Tegra: allow SiP smc calls from Secure World

This patch removes the restriction of allowing SiP calls only from the
non-secure world. The secure world can issue SiP calls as a result of
this patch now.

Change-Id: Idd64e893ae8e114bba0196872d3ec544cac150bf
Signed-off-by: Wayne Lin <wlin@nvidia.com>
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
7 years agoTegra: handler for per-soc early setup
Varun Wadekar [Mon, 28 Mar 2016 22:56:47 +0000 (15:56 -0700)]
Tegra: handler for per-soc early setup

This patch adds a weak handler for early platform setup which
can be overriden by the soc-specific handlers to perform any
early setup tasks.

Change-Id: I1a7a98d59b2332a3030c6dca5a9b7be977177326
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
7 years agoTegra: relocate code to BL31_BASE during cold boot
Varun Wadekar [Thu, 24 Mar 2016 22:34:24 +0000 (15:34 -0700)]
Tegra: relocate code to BL31_BASE during cold boot

This patch adds support to relocate BL3-1 code to BL31_BASE in case
we cold boot to a different address. This is particularly useful to
maintain compatibility with legacy BL2 code.

This patch also checks to see if the image base address matches either
the TZDRAM or TZSRAM base.

Change-Id: I72c96d7f89076701a6ac2537d4c06565c54dab9c
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
7 years agoMerge pull request #851 from jeenu-arm/assert-fix
danh-arm [Tue, 28 Feb 2017 12:07:55 +0000 (12:07 +0000)]
Merge pull request #851 from jeenu-arm/assert-fix

Remove redundant assert

7 years agoMerge pull request #848 from douglas-raillard-arm/dr/improve_errata_doc
danh-arm [Tue, 28 Feb 2017 12:07:32 +0000 (12:07 +0000)]
Merge pull request #848 from douglas-raillard-arm/dr/improve_errata_doc

Clarify errata ERRATA_A53_836870 documentation

7 years agoMerge pull request #847 from douglas-raillard-arm/dr/fix_abort_smc
danh-arm [Tue, 28 Feb 2017 12:06:54 +0000 (12:06 +0000)]
Merge pull request #847 from douglas-raillard-arm/dr/fix_abort_smc

Fix TSPD implementation of STD SMC ABORT

7 years agoMerge pull request #837 from douglas-raillard-arm/dr/fix_tools_cflags
danh-arm [Tue, 28 Feb 2017 11:58:12 +0000 (11:58 +0000)]
Merge pull request #837 from douglas-raillard-arm/dr/fix_tools_cflags

build: Use separate CFLAGS for tools

7 years agoTegra: Disable A57/A53 cache non-temporal hints
Varun Wadekar [Mon, 21 Mar 2016 18:18:40 +0000 (11:18 -0700)]
Tegra: Disable A57/A53 cache non-temporal hints

This change disables the cache non-temporal hints for A57 and
A53 CPUs on Tegra.

Change-Id: I279d95aec5afbc3ca3cc4b34aa16de3f2c83a4fc
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
7 years agoMerge pull request #835 from rockchip-linux/rk3399-atf-cleanup-20170210
davidcunado-arm [Mon, 27 Feb 2017 15:25:45 +0000 (15:25 +0000)]
Merge pull request #835 from rockchip-linux/rk3399-atf-cleanup-20170210

RK3399 ARM TF clean up 20170210

7 years agoMerge pull request #849 from vwadekar/tegra-changes-from-downstream-v2
davidcunado-arm [Mon, 27 Feb 2017 14:41:24 +0000 (14:41 +0000)]
Merge pull request #849 from vwadekar/tegra-changes-from-downstream-v2

Tegra changes from downstream v2

7 years agorockchip: rk3399: enable secure accessing for SRAM
Xing Zheng [Tue, 14 Feb 2017 10:03:20 +0000 (18:03 +0800)]
rockchip: rk3399: enable secure accessing for SRAM

Sorry to miss the security configuration for SRAM, if we don't support
it, somebody may modify the comment of SRAM in the non-secure space.
Let's fix this issue.

Signed-off-by: Xing Zheng <zhengxing@rock-chips.com>
7 years agorockchip: rk3399: Use tFC value instead of tRFC value
Derek Basehore [Fri, 10 Feb 2017 06:08:48 +0000 (22:08 -0800)]
rockchip: rk3399: Use tFC value instead of tRFC value

This fixes code that set a tFC value in a register using the tRFC
value instead.

Signed-off-by: Derek Basehore <dbasehore@chromium.org>
7 years agorockchip: rk3399: Fix CAS latency setting
Derek Basehore [Fri, 10 Feb 2017 06:02:42 +0000 (22:02 -0800)]
rockchip: rk3399: Fix CAS latency setting

The F1 CAS latency setting was not bit shifted, which resulted in
setting the DRAM additive latency value instead.

Signed-off-by: Derek Basehore <dbasehore@chromium.org>
7 years agorockchip: rk3399: disable training modules after DDR DFS
Xing Zheng [Thu, 9 Feb 2017 06:51:38 +0000 (14:51 +0800)]
rockchip: rk3399: disable training modules after DDR DFS

On resume, we use the DFS hardware to switch frequency index,
followed by a full training sequence on that index. Leaving
the DFS training modules enabled causes issues with the full
training done at resume. We also only needs these enabled
during a call to ddr_set_rate during runtime, so there's no
issue disabling them at the end of ddr_set_rate.

Signed-off-by: Derek Basehore <dbasehore@chromium.org>
Signed-off-by: Xing Zheng <zhengxing@rock-chips.com>
7 years agorockchip: rk3399: Move DQS drive strength setting to M0
Derek Basehore [Thu, 2 Feb 2017 02:09:13 +0000 (18:09 -0800)]
rockchip: rk3399: Move DQS drive strength setting to M0

This moves the setting of the DQS drive strength to the M0 to minimize
the impact on DDR transactions. We need to have the DQS drive strength
changed for data training, which is triggered by the M0, but it also
needs to be changed back when data training is finished.

Signed-off-by: Derek Basehore <dbasehore@chromium.org>
7 years agorockchip: rk3399: Remove dram dfs optimization
Derek Basehore [Wed, 1 Feb 2017 00:37:01 +0000 (16:37 -0800)]
rockchip: rk3399: Remove dram dfs optimization

This removes an optimization to not recalculate parameters if the
frequency index being switched to hold the next frequency. This is
because some registers do not have a copy per frequency index, so this
optimization might be causing problems.

Signed-off-by: Derek Basehore <dbasehore@chromium.org>
7 years agorockchip: rk3399: Save and restore RX_CAL_DQS values
Derek Basehore [Tue, 31 Jan 2017 08:20:19 +0000 (00:20 -0800)]
rockchip: rk3399: Save and restore RX_CAL_DQS values

We were getting far off values on resume for the RX_CAL_DQS values.
This saves and restores the values for suspend/resume until the root
of the problem is figured out

Signed-off-by: Derek Basehore <dbasehore@chromium.org>
7 years agorockchip: Add MIN() and MAX() macros back to M0 code
Julius Werner [Tue, 31 Jan 2017 02:26:07 +0000 (18:26 -0800)]
rockchip: Add MIN() and MAX() macros back to M0 code

These macros were accidentally deleted in a previous cleanup. This
slipped through because the code using them is currently unused, but
that may change in the future.

Signed-off-by: Julius Werner <jwerner@chromium.org>
7 years agorockchip: Clean up M0 Makefile, clarify float-abi
Julius Werner [Tue, 31 Jan 2017 00:13:21 +0000 (16:13 -0800)]
rockchip: Clean up M0 Makefile, clarify float-abi

This patch shuffles the M0 Makefile flags around a bit trying to make
their purpose clearer and remove duplication. Since all three build
steps (compiling, assembling, linking) actually call GCC, remove the
misleading aliases $(AS) and $(LD) to avoid confusion that those tools
might be called directly. Split flags into a common group that has
meaning for all three steps and separate variables specific to each
step. Remove -nostartfiles which is a strict subset of -nostdlib.

Also add explicit parameters for -mfloat-abi=soft, -fomit-frame-pointer
and -fno-common. If omitted these settings depend on the toolchain's
built-in default and cause various problems if they resolve to
unexpected values.

Signed-off-by: Julius Werner <jwerner@chromium.org>
7 years agorockchip: rk3399: Clean up and seprate secure parts from SoC codes
Xing Zheng [Fri, 24 Feb 2017 06:56:41 +0000 (14:56 +0800)]
rockchip: rk3399: Clean up and seprate secure parts from SoC codes

The goal is that make clear the secure and SoC codes. Now cleaning them
will help secure code extensions for RK3399 in the future.

Signed-off-by: Xing Zheng <zhengxing@rock-chips.com>
7 years agorockchip: rk3399: sperate the BL31 parameters for sharing
Xing Zheng [Thu, 22 Dec 2016 10:34:14 +0000 (18:34 +0800)]
rockchip: rk3399: sperate the BL31 parameters for sharing

Maybe the coreboot will reference the BL31 parameters (e.g the TZRAM_BASE
and TZRAM_SIZE for DDR secure regions), we can split them and don't have
to hardcode the range in two places.

Signed-off-by: Xing Zheng <zhengxing@rock-chips.com>
7 years agorockchip: rk3399: configure the DDR secure region for BL31 image
Xing Zheng [Fri, 24 Feb 2017 06:47:51 +0000 (14:47 +0800)]
rockchip: rk3399: configure the DDR secure region for BL31 image

Move the BL31 loaded base address 0x10000 to 0x1000, and configure
the the memory range 0~1MB is secure, the goal is that make sure
the BL31 image will be not modified.

Signed-off-by: Xing Zheng <zhengxing@rock-chips.com>
7 years agorockchip: Clean up header and referenced files
Xing Zheng [Fri, 24 Feb 2017 08:26:11 +0000 (16:26 +0800)]
rockchip: Clean up header and referenced files

So far, there are more and more features are supported on the RK3399,
meanwhile, these features are increasingly being defined and intertwined.
It's time to clean up and make them clearer.

Signed-off-by: Xing Zheng <zhengxing@rock-chips.com>
7 years agorockchip: rk3399: Don't wait for vblank in M0 for ddrfreq
Derek Basehore [Mon, 9 Jan 2017 23:38:57 +0000 (15:38 -0800)]
rockchip: rk3399: Don't wait for vblank in M0 for ddrfreq

This removes waiting for vblank on the M0 during ddrfreq transitions.
That will now be done in the kernel to allow scheduling to be done on
the CPU core that changes the ddr frequency. Waiting for vblank in
the M0 would have the CPU core that waits on the M0 spin looping for
up to 16ms (1 frame for the display).

Signed-off-by: Derek Basehore <dbasehore@chromium.org>
7 years agorockchip: rk3399: restore PMU_CRU_GATEDIS_CON0 value after ddr dvfs
Lin Huang [Fri, 30 Dec 2016 03:50:01 +0000 (11:50 +0800)]
rockchip: rk3399: restore PMU_CRU_GATEDIS_CON0 value after ddr dvfs

we will set PMU_CRU_GATEDIS_CON0 when idle port, it will enable
all clock, for save power consumption, we need to restore old value
when finish it.

Signed-off-by: Lin Huang <hl@rock-chips.com>
7 years agorockchip: rk3399: fix PMU_CRU_GATEDIS_CON0 setting error
Lin Huang [Fri, 30 Dec 2016 05:53:25 +0000 (13:53 +0800)]
rockchip: rk3399: fix PMU_CRU_GATEDIS_CON0 setting error

As rk3399 TRM1.1 document show, when set PMU_CRU_GATEDIS_CON0/1
register, it need set the write_mask bit (bit16 ~ bit31), but as
we test, it not need it. So need to correct the setting way, otherwise
it will set wrong value to this register.

Signed-off-by: Lin Huang <hl@rock-chips.com>
7 years agoFIXUP: rockchip: rk3399: fix the incorrect bit during m0_init
Xing Zheng [Tue, 20 Dec 2016 12:44:41 +0000 (20:44 +0800)]
FIXUP: rockchip: rk3399: fix the incorrect bit during m0_init

We found that the DUT will be hanged if we don't set the bit_1 of the
PMUCRU_GATEDIS_CON0. But, from the TRM, there is weird that the bit_1
is set the clk_center1_gating_dis, not clk_pmum0_gating_dis. Is the
TRM incorrect? We need to check it with the IC team and re-clean the
commit message and explain it tomorrow.

Signed-off-by: Xing Zheng <zhengxing@rock-chips.com>
7 years agorockchip: rk3399: improve the m0 enable flow
Lin Huang [Mon, 12 Dec 2016 07:18:08 +0000 (15:18 +0800)]
rockchip: rk3399: improve the m0 enable flow

This patch do following things:
1. Request hresetn_cm0s_pmu_req first then request
   poresetn_cm0s_pmu_req during M0 enable.
2. Do not diable M0 clock for ddr dvfs.
3. Correct the clk_pmum0_gating_dis bit, it is BIT0 not BIT1
4. do not set/clear hclk_noc_pmu_en in M0 code, it does not relate
   to the M0 clock.

Signed-off-by: Lin Huang <hl@rock-chips.com>
Signed-off-by: Derek Basehore <dbasehore@chromium.org>
7 years agorockchip: rk3399: check vop status when we wait dma finish flag
Lin Huang [Thu, 1 Dec 2016 08:55:05 +0000 (16:55 +0800)]
rockchip: rk3399: check vop status when we wait dma finish flag

When vop is disabled and we read the vop register the system will
hang, so check vop status when we wait for the DMA finish flag to
avoid this sitiuation. This is done by checking for standby, DMA stop
mode, and disabled window states. Any one of these will prevent the
DMA finish flag from triggering.

Signed-off-by: Lin Huang <hl@rock-chips.com>
Signed-off-by: Derek Basehore <dbasehore@chromium.org>
7 years agorockchip: rk3399: add stopwatch functions to m0
Lin Huang [Wed, 30 Nov 2016 08:57:08 +0000 (16:57 +0800)]
rockchip: rk3399: add stopwatch functions to m0

There is system timer in m0, we can use it to implement a set of
stopwatch functions for measuring timeouts.

Signed-off-by: Lin Huang <hl@rock-chips.com>
Signed-off-by: Derek Basehore <dbasehore@chromium.org>
7 years agorockchip: rk3399: dram: set all ddr frequency pll_postdiv values to 0
Lin Huang [Thu, 15 Dec 2016 07:08:47 +0000 (15:08 +0800)]
rockchip: rk3399: dram: set all ddr frequency pll_postdiv values to 0

The phy pll needs to get 2X frequency to the DDR, so set the
pll_postdiv to 0.

Signed-off-by: Lin Huang <hl@rock-chips.com>
Signed-off-by: Derek Basehore <dbasehore@chromium.org>
7 years agorockchip: rk3399: enable CA training when do ddr dfs
Lin Huang [Fri, 16 Dec 2016 05:59:07 +0000 (13:59 +0800)]
rockchip: rk3399: enable CA training when do ddr dfs

For ddr dfs stable, We need to enable ddr CA training
when do ddr dfs.

Signed-off-by: Lin Huang <hl@rock-chips.com>
7 years agorockchip: rk3399: fix hang in ddr set rate
Derek Basehore [Fri, 24 Feb 2017 06:33:03 +0000 (14:33 +0800)]
rockchip: rk3399: fix hang in ddr set rate

This fixes a hang with setting the DRAM rate based on a race condition
with the M0 which sets the DRAM rate. The AP can also starve the M0,
so this also delays the AP reads to the DONE parameter for the M0.

Signed-off-by: Derek Basehore <dbasehore@chromium.org>
7 years agorockchip: rk3399: Enable per CS training at 666MHz
Derek Basehore [Thu, 10 Nov 2016 02:28:19 +0000 (18:28 -0800)]
rockchip: rk3399: Enable per CS training at 666MHz

This enables per CS training at 666MHz and above for ddrfreq per
vendor recommendation. Since the threshold was used for latency was
the same value, this also adds a new value for that.

Signed-off-by: Derek Basehore <dbasehore@chromium.org>
7 years agorockchip: rk3399: add support for ddrfreq suspend/resume
Derek Basehore [Fri, 24 Feb 2017 06:31:36 +0000 (14:31 +0800)]
rockchip: rk3399: add support for ddrfreq suspend/resume

This patch sets the frequency configuration of the next DRAM DFS index
to the configuration of the current index. This does not perform a
frequency transition. It just configures registers so the training on
resume for both indices will be correct.

Signed-off-by: Derek Basehore <dbasehore@chromium.org>
Signed-off-by: Xing Zheng <zhengxing@rock-chips.com>
7 years agork3399: dram: use PMU M0 to do ddr frequency scaling
Xing Zheng [Wed, 26 Oct 2016 13:25:26 +0000 (21:25 +0800)]
rk3399: dram: use PMU M0 to do ddr frequency scaling

We used dcf do ddr frequency scaling, but we just include a dcf
binary, it hard to maintain later, we have M0 compile flow in ATF,
and M0 can also work for ddr frequency scaling, so let's use it.

Signed-off-by: Lin Huang <hl@rock-chips.com>
Signed-off-by: Xing Zheng <zhengxing@rock-chips.com>
7 years agorockchip/rk3399: Cleanup platform.mk file
Derek Basehore [Thu, 20 Oct 2016 23:19:22 +0000 (16:19 -0700)]
rockchip/rk3399: Cleanup platform.mk file

This makes the file consistently use tabs instead of mixing in spaces.

Signed-off-by: Derek Basehore <dbasehore@chromium.org>
7 years agorockchip: update the raw read/write APIs for M0
Xing Zheng [Mon, 24 Oct 2016 13:06:25 +0000 (21:06 +0800)]
rockchip: update the raw read/write APIs for M0

Since the ATF project, we usually use the mmio_read_32 and
mmio_write_32. And the mmio_write_32, the firse parameter
is ADDR, the second is VALUE. In order to style consistency:

1/ rename readl/writel to mmio_read_32/mmio_write_32
2/ for keeping the same with mmio_write_32 in the ATF project,
   swap the order of the parameters for M0 mmio_write_32

Signed-off-by: Xing Zheng <zhengxing@rock-chips.com>
Signed-off-by: Lin Huang <hl@rock-chips.com>
7 years agork3399: dram: making phy into dll bypass mode at low frequency
Derek Basehore [Fri, 21 Oct 2016 05:09:22 +0000 (22:09 -0700)]
rk3399: dram: making phy into dll bypass mode at low frequency

when dram frequency below 260MHz, phy master dll may unlock, so
let phy master dll working at dll bypass mode when frequency is
below 260MHz.

Signed-off-by: Lin Huang <hl@rock-chips.com>
7 years agorockchip: rk3399: dram: remove dram_init and dts_timing_receive function
Derek Basehore [Fri, 21 Oct 2016 03:46:43 +0000 (20:46 -0700)]
rockchip: rk3399: dram: remove dram_init and dts_timing_receive function

we can reuse the dram config from loader, so we can remove dram_init()
and dts_timing_receive() funciton in dram.c, add the dram_set_odt_pd()
function to get the odt and auto power down parameter from kernel.

This also removes the dcf_code_init function to allow the system to
actually boot.

Signed-off-by: Lin Huang <hl@rock-chips.com>
Signed-off-by: Derek Basehore <dbasehore@chromium.org>
Signed-off-by: Xing Zheng <zhengxing@rock-chips.com>
7 years agoTegra: implement pwr_domain_pwr_down_wfi() handler
Varun Wadekar [Fri, 18 Mar 2016 21:35:28 +0000 (14:35 -0700)]
Tegra: implement pwr_domain_pwr_down_wfi() handler

This patch adds the pwr_domain_power_down_wfi() handler for Tegra
platforms which in turn executes the soc specific `power_down_wfi`
handler.

Change-Id: I5deecc09959db3c3d73f928f5c871966331cfd95
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
7 years agoTegra: memmap BL31's TZDRAM carveout
Varun Wadekar [Fri, 18 Mar 2016 20:01:12 +0000 (13:01 -0700)]
Tegra: memmap BL31's TZDRAM carveout

This patch maps the TZDRAM carveout used by the BL31. In the near
future BL31 would be running from the TZRAM for security and
performance reasons. The only downside to this solution is that
the TZRAM loses its state in System Suspend. So, we map the TZDRAM
carveout that the BL31 would use to save its state before entering
System Suspend.

Change-Id: Id5bda7e9864afd270cf86418c703fa61c2cb095f
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
7 years agoTegra: increase BL31 image size to 256KB
Varun Wadekar [Fri, 4 Mar 2016 02:27:28 +0000 (18:27 -0800)]
Tegra: increase BL31 image size to 256KB

This patch increases the BL31 image size for all Tegra platforms to
256KB, so that we can relocate BL31 to TZSRAM on supported chips.

Change-Id: I467063c68632b53b5d4ef8ff1f76f5988096bd9c
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
7 years agoTegra: allow individual SoCs to restore their settings
Varun Wadekar [Thu, 3 Mar 2016 21:28:10 +0000 (13:28 -0800)]
Tegra: allow individual SoCs to restore their settings

This patch uses the Memory controller driver's handler to restore
its settings and moves the other chip specific code to their own
'pwr_domain_on_finish' handlers.

Change-Id: I3c9d23bdab9e2e3c05034ff6812cf941ccd7a75e
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
7 years agocpus: denver: disable DCO operations from platform code
Varun Wadekar [Mon, 22 Feb 2016 19:09:41 +0000 (11:09 -0800)]
cpus: denver: disable DCO operations from platform code

This patch moves the code to disable DCO operations out from common
CPU files. This allows the platform code to call thsi API as and
when required. There are certain CPU power down states which require
the DCO to be kept ON and platforms can decide selectively now.

Change-Id: Icb946fe2545a7d8c5903c420d1ee169c4921a2d1
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
7 years agoTegra: enable PSCI extended state ID processing
Varun Wadekar [Wed, 27 Jan 2016 19:31:06 +0000 (11:31 -0800)]
Tegra: enable PSCI extended state ID processing

This patch enables the PSCI_EXTENDED_STATE_ID macro. Tegra platforms
have moved on to using the extended state ID for CPU_SUSPEND, where
the NS world passes the state ID and wakeup time as part of the
state ID field.

Change-Id: Ie8b0fec285d8b2330bc26ff239a4f628425c9fcf
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
7 years agoTegra: define platform power states
Varun Wadekar [Tue, 19 Jan 2016 21:55:19 +0000 (13:55 -0800)]
Tegra: define platform power states

The platform power states, PLAT_MAX_RET_STATE and PLAT_MAX_OFF_STATE,
can change on Tegra SoCs and so should be defined per-soc.

This patch moves these macro definitions to individual SoC's tegra_def.h
files.

Change-Id: Ib9b2752bc4d79cef6f79bee49882d340f71977a2
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
7 years agoTegra: drivers: memctrl: introduce function to secure on-chip TZRAM
Varun Wadekar [Wed, 30 Dec 2015 23:06:41 +0000 (15:06 -0800)]
Tegra: drivers: memctrl: introduce function to secure on-chip TZRAM

This patch introduces a function to secure the on-chip TZRAM memory. The
Tegra132 and Tegra210 chips do not have a compelling use case to lock the
TZRAM. The trusted OS owns the TZRAM aperture on these chips and so it
can take care of locking the aperture. This might not be true for future
chips and this patch makes the TZRAM programming flexible.

Change-Id: I3ac9f1de1b792ccd23d4ded274784bbab2ea224a
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
7 years agoTegra: enable runtime console
Varun Wadekar [Sat, 9 Jan 2016 01:48:42 +0000 (17:48 -0800)]
Tegra: enable runtime console

This patch enables the runtime console for all Tegra platforms
before exiting BL31. This would enable debug/error prints to be
always displayed on the UART console.

Change-Id: Ic48d61d05b0ab07973d6fc2dc6b68733a42a3f63
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
7 years agoTegra: PM: soc-specific system off handler
Varun Wadekar [Thu, 7 Jan 2016 22:04:21 +0000 (14:04 -0800)]
Tegra: PM: soc-specific system off handler

This patch introduces a power down handler which can be overriden
by SoCs to customise the power down process. The current SoCs do
not have a way of powering down the entire system as external PMIC
chips are involved in the process.

But future SoCs will have a way to power off the entire system
without talking to an external PMIC.

Change-Id: Ie7750714141a29cb0a1a616fafc531c4f11d0985
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
7 years agoTegra: handlers for common and SoC-specific SiP calls
Varun Wadekar [Thu, 10 Dec 2015 02:18:53 +0000 (18:18 -0800)]
Tegra: handlers for common and SoC-specific SiP calls

This patch implements a handler for common SiP calls. A weak
implementation for the SoC-specific handler has been provided
which can be overridden by SoCs to implement any custom SiP
calls.

Change-Id: I45122892a84ea35d7b44be0f35dc15f6bb95193e
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
7 years agospd: trusty: OEN_TAP_START aperture for standard calls
Amith [Thu, 20 Aug 2015 03:13:12 +0000 (20:13 -0700)]
spd: trusty: OEN_TAP_START aperture for standard calls

This patch uses the OEN_TAP_START aperture for all the standard
calls being passed to Trusty.

Change-Id: Id78d01c7f48e4f54855600d7c789ffbfb898c541
Signed-off-by: Amith <aramachan@nvidia.com>
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
7 years agoMerge pull request #845 from vwadekar/tegra-changes-from-downstream-v1
davidcunado-arm [Thu, 23 Feb 2017 17:30:54 +0000 (17:30 +0000)]
Merge pull request #845 from vwadekar/tegra-changes-from-downstream-v1

Tegra changes from downstream v1

7 years agoClarify errata ERRATA_A53_836870 documentation
Douglas Raillard [Wed, 15 Feb 2017 17:38:43 +0000 (17:38 +0000)]
Clarify errata ERRATA_A53_836870 documentation

The errata is enabled by default on r0p4, which is confusing given that
we state we do not enable errata by default.

This patch clarifies this sentence by saying it is enabled in hardware
by default.

Change-Id: I70a062d93e1da2416d5f6d5776a77a659da737aa
Signed-off-by: Douglas Raillard <douglas.raillard@arm.com>
7 years agoFix TSPD implementation of STD SMC ABORT
Douglas Raillard [Fri, 3 Feb 2017 18:01:51 +0000 (18:01 +0000)]
Fix TSPD implementation of STD SMC ABORT

ABORT SMC used to return to the previously executing world, which
happened to be S-EL1 as it calls a TSP handler using synchronous entry
into the TSP.

Now properly save and restore the non-secure context (including system
registers) and return to non-secure world as it should.

fixes ARM-Software/tf-issues#453

Change-Id: Ie40c79ca2636ab8b6b2ab3106e8f49e0f9117f5f
Signed-off-by: Douglas Raillard <douglas.raillard@arm.com>
7 years agoTegra: init normal/crash console for platforms
Varun Wadekar [Thu, 29 Oct 2015 05:07:28 +0000 (10:37 +0530)]
Tegra: init normal/crash console for platforms

The BL2 fills in the UART controller ID to be used as the normal as
well as the crash console on Tegra platforms. The controller ID to
UART controller base address mapping is handled by each Tegra SoC
the base addresses might change across Tegra chips.

This patch adds the handler to parse the platform params to get the
UART ID for the per-soc handlers.

Change-Id: I4d167b20a59aaf52a31e2a8edf94d8d6f89598fa
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
7 years agoTegra: add tzdram_base to plat_params_from_bl2 struct
Varun Wadekar [Tue, 6 Oct 2015 07:19:31 +0000 (12:49 +0530)]
Tegra: add tzdram_base to plat_params_from_bl2 struct

This patch adds another member, tzdram_base, to the plat_params_from_bl2 struct
in order to store the TZDRAM carveout base address used to load the Trusted OS.
The monitor programs the memory controller with the TZDRAM base and size in order
to deny any accesses from the NS world.

Change-Id: If39b8674d548175d7ccb6525c18d196ae8a8506c
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
7 years agoTegra: Memory Controller Driver (v1)
Varun Wadekar [Fri, 18 Sep 2015 05:51:22 +0000 (11:21 +0530)]
Tegra: Memory Controller Driver (v1)

This patch renames the current Memory Controller driver files to
"_v1". This is done to add a driver for the new Memory Controller
hardware (v2).

Change-Id: I668dbba42f6ee0db2f59a7103f0ae7e1d4684ecf
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
7 years agoTegra: sanity check members of the "from_bl2" struct
Varun Wadekar [Tue, 22 Sep 2015 09:30:06 +0000 (15:00 +0530)]
Tegra: sanity check members of the "from_bl2" struct

This patch checks that the pointers to BL3-3 and BL3-2 ep_info
structs are valid before accessing them. Add some INFO prints
in the BL3-1 setup path for early debugging purposes.

Change-Id: I62b23fa870f1b2fb783c8de69aab819f1749d15a
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
7 years agocpus: Add support for all Denver variants
Varun Wadekar [Thu, 3 Sep 2015 11:45:06 +0000 (17:15 +0530)]
cpus: Add support for all Denver variants

This patch adds support for all variants of the Denver CPUs. The
variants export their cpu_ops to allow all Denver platforms to run
the Trusted Firmware stack.

Change-Id: I1488813ddfd506ffe363d8a32cda1b575e437035
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
7 years agoRemove redundant assert
Jeenu Viswambharan [Tue, 21 Feb 2017 16:01:31 +0000 (16:01 +0000)]
Remove redundant assert

Static checks flag an assert added in commit 1f786b0 that compares
unsigned value to 0, which will never fail.

Change-Id: I4b02031c2cfbd9a25255d12156919dda7d4805a0
Signed-off-by: Jeenu Viswambharan <jeenu.viswambharan@arm.com>
7 years agoTegra: use ClusterId for calculating core position
Varun Wadekar [Tue, 22 Sep 2015 08:15:07 +0000 (13:45 +0530)]
Tegra: use ClusterId for calculating core position

This patch modifies platform_get_core_pos() to use the Cluster ID
field as well to calculate the final index value. This helps the
system to store CPU data for multi-cluster configurations.

Change-Id: I76e35f723f741e995c6c9156e9d61b0b2cdd2709
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
7 years agoTegra: enable processor retention and L2/CPUECTLR access
Varun Wadekar [Tue, 22 Sep 2015 08:03:56 +0000 (13:33 +0530)]
Tegra: enable processor retention and L2/CPUECTLR access

This patch enables the processor retention and L2/CPUECTLR read/write
access from the NS world only for Cortex-A57 CPUs on the Tegra SoCs.

Change-Id: I9941a67686ea149cb95d80716fa1d03645325445
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
7 years agoTegra: define MAX_XLAT_TABLES and MAX_MMAP_REGIONS per-platform
Varun Wadekar [Wed, 9 Sep 2015 05:59:24 +0000 (11:29 +0530)]
Tegra: define MAX_XLAT_TABLES and MAX_MMAP_REGIONS per-platform

This patch moves these address translation helper macros to individual
Tegra SoC makefiles to provide more control.

Change-Id: Ieab53c457c73747bd0deb250459befb5b7b9363f
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
7 years agoTegra: SoC specific SiP handlers
Varun Wadekar [Thu, 3 Sep 2015 09:02:44 +0000 (14:32 +0530)]
Tegra: SoC specific SiP handlers

This patch converts the common SiP handler to SoC specific SiP
handler. T210 and T132 have different SiP SMCs and so it makes
sense to move the SiP handler to soc/t132 and soc/t210 folders.

Change-Id: Idfe48384d63641137d74a095432df4724986b241
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
7 years agoTegra: include flowctlr driver from SoC specific makefiles
Varun Wadekar [Tue, 25 Aug 2015 11:31:06 +0000 (17:01 +0530)]
Tegra: include flowctlr driver from SoC specific makefiles

The Flow Controller hardware block is not present across all Tegra
SoCs, hence include the driver files from SoC specific makefiles.

T132/T210 are the SoCs which include this hardware block while future
SoCs have removed it.

Change-Id: Iaca25766a4fa51567293d10cf14dae968b0fae80
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
7 years agoMerge pull request #844 from antonio-nino-diaz-arm/an/no-timingsafe
danh-arm [Mon, 20 Feb 2017 14:00:05 +0000 (14:00 +0000)]
Merge pull request #844 from antonio-nino-diaz-arm/an/no-timingsafe

Revert "tbbr: Use constant-time bcmp() to compare hashes"

7 years agoMerge pull request #843 from jeenu-arm/cas-lock
danh-arm [Mon, 20 Feb 2017 13:59:50 +0000 (13:59 +0000)]
Merge pull request #843 from jeenu-arm/cas-lock

Introduce locking primitives using CAS instruction

7 years agoMerge pull request #842 from jeenu-arm/io-memmap-asserts
danh-arm [Mon, 20 Feb 2017 13:59:12 +0000 (13:59 +0000)]
Merge pull request #842 from jeenu-arm/io-memmap-asserts

Add bounds checking asserts to memmap IO driver

7 years agoMerge pull request #841 from dp-arm/dp/debug-regs
danh-arm [Mon, 20 Feb 2017 13:58:48 +0000 (13:58 +0000)]
Merge pull request #841 from dp-arm/dp/debug-regs

Disable secure self-hosted debug

7 years agoRevert "tbbr: Use constant-time bcmp() to compare hashes"
Antonio Nino Diaz [Thu, 9 Feb 2017 10:26:54 +0000 (10:26 +0000)]
Revert "tbbr: Use constant-time bcmp() to compare hashes"

This reverts commit b621fb503c76f3bdf06ed5ed1d3a995df8da9c50.

Because of the Trusted Firmware design, timing-safe functions are not
needed. Using them may be misleading as it could be interpreted as being
a protection against private data leakage, which isn't the case here.

For each image, the SHA-256 hash is calculated. Some padding is appended
and the result is encrypted with a private key using RSA-2048. This is
the signature of the image. The public key is stored along with BL1 in
read-only memory and the encrypted hash is stored in the FIP.

When authenticating an image, the TF decrypts the hash stored in the FIP
and recalculates the hash of the image. If they don't match, the boot
sequence won't continue.

A constant-time comparison does not provide additional security as all
the data involved in this process is already known to any attacker.
There is no private data that can leaked through a timing attack when
authenticating an image.

`timingsafe_bcmp()` is kept in the codebase because it could be useful
in the future.

Change-Id: I44bdcd58faa586a050cc89447e38c142508c9888
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
7 years agoMerge pull request #834 from douglas-raillard-arm/dr/use_dc_zva_zeroing
davidcunado-arm [Thu, 16 Feb 2017 14:49:37 +0000 (14:49 +0000)]
Merge pull request #834 from douglas-raillard-arm/dr/use_dc_zva_zeroing

Use DC ZVA instruction to zero memory

7 years agoMerge pull request #840 from dp-arm/dp/cppcheck-fixes
davidcunado-arm [Thu, 16 Feb 2017 09:57:56 +0000 (09:57 +0000)]
Merge pull request #840 from dp-arm/dp/cppcheck-fixes

Fix minor issues found by cppcheck

7 years agoMerge pull request #838 from davidcunado-arm/dc/update_userguide
davidcunado-arm [Thu, 16 Feb 2017 09:56:45 +0000 (09:56 +0000)]
Merge pull request #838 from davidcunado-arm/dc/update_userguide

Migrate to Linaro Release 16.12

7 years agoMerge pull request #829 from masahir0y/build
davidcunado-arm [Thu, 16 Feb 2017 09:56:17 +0000 (09:56 +0000)]
Merge pull request #829 from masahir0y/build

Makefile: use git describe for BUILD_STRING

7 years agoJuno: Disable SPIDEN in release builds
dp-arm [Wed, 8 Feb 2017 12:16:42 +0000 (12:16 +0000)]
Juno: Disable SPIDEN in release builds

On Juno, the secure privileged invasive debug authentication signal
(SPIDEN) is controlled by board SCC registers, which by default enable
SPIDEN.  Disable secure privileged external debug in release builds by
programming the appropriate Juno SoC registers.

Change-Id: I61045f09a47dc647bbe95e1b7a60e768f5499f49
Signed-off-by: dp-arm <dimitris.papastamos@arm.com>
7 years agoDisable secure self-hosted debug via MDCR_EL3/SDCR
dp-arm [Wed, 8 Feb 2017 11:51:50 +0000 (11:51 +0000)]
Disable secure self-hosted debug via MDCR_EL3/SDCR

Trusted Firmware currently has no support for secure self-hosted
debug.  To avoid unexpected exceptions, disable software debug
exceptions, other than software breakpoint instruction exceptions,
from all exception levels in secure state.  This applies to both
AArch32 and AArch64 EL3 initialization.

Change-Id: Id097e54a6bbcd0ca6a2be930df5d860d8d09e777
Signed-off-by: dp-arm <dimitris.papastamos@arm.com>
7 years agoFix minor issues found by cppcheck
dp-arm [Thu, 9 Feb 2017 10:25:29 +0000 (10:25 +0000)]
Fix minor issues found by cppcheck

cppcheck highlighted variables that were initialized but then later
reassigned.

Change-Id: Ie12742c01fd3bf48b2d6c05a3b448da91d57a2e4
Signed-off-by: dp-arm <dimitris.papastamos@arm.com>
7 years agoAdd bounds checking asserts to memmap IO driver
Jeenu Viswambharan [Mon, 13 Feb 2017 13:06:18 +0000 (13:06 +0000)]
Add bounds checking asserts to memmap IO driver

The memmap IO driver doesn't perform bounds check when reading, writing,
or seeking. The onus to vet parameters is on the caller, and this patch
asserts that:

  - non-negative size is specified for for backing memory;

  - valid parameters are passed into the driver for read, write and seek
    operations.

Change-Id: I6518c4065817e640e9e7e39a8a4577655f2680f7
Signed-off-by: Jeenu Viswambharan <jeenu.viswambharan@arm.com>
7 years agoIntroduce locking primitives using CAS instruction
Jeenu Viswambharan [Mon, 16 Jan 2017 16:52:35 +0000 (16:52 +0000)]
Introduce locking primitives using CAS instruction

The ARMv8v.1 architecture extension has introduced support for far
atomics, which includes compare-and-swap. Compare and Swap instruction
is only available for AArch64.

Introduce build options to choose the architecture versions to target
ARM Trusted Firmware:

  - ARM_ARCH_MAJOR: selects the major version of target ARM
    Architecture. Default value is 8.

  - ARM_ARCH_MINOR: selects the minor version of target ARM
    Architecture. Default value is 0.

When:

  (ARM_ARCH_MAJOR > 8) || ((ARM_ARCH_MAJOR == 8) && (ARM_ARCH_MINOR >= 1)),

for AArch64, Compare and Swap instruction is used to implement spin
locks. Otherwise, the implementation falls back to using
load-/store-exclusive instructions.

Update user guide, and introduce a section in Firmware Design guide to
summarize support for features introduced in ARMv8 Architecture
Extensions.

Change-Id: I73096a0039502f7aef9ec6ab3ae36680da033f16
Signed-off-by: Jeenu Viswambharan <jeenu.viswambharan@arm.com>
7 years agoMerge pull request #833 from masahir0y/cert_create
davidcunado-arm [Tue, 14 Feb 2017 08:56:44 +0000 (08:56 +0000)]
Merge pull request #833 from masahir0y/cert_create

Bug fix and cleanup of cert_create tool