davidcunado-arm [Thu, 15 Sep 2016 10:17:41 +0000 (11:17 +0100)]
Merge pull request #707 from sandrine-bailleux-arm/sb/restore-xlat-defines
Restore some defines in xlat_tables.h
davidcunado-arm [Thu, 15 Sep 2016 10:17:27 +0000 (11:17 +0100)]
Merge pull request #708 from sandrine-bailleux-arm/sb/forward-decs
Add some missing forward declarations in plat_arm.h
Sandrine Bailleux [Thu, 15 Sep 2016 09:09:53 +0000 (10:09 +0100)]
Add some missing forward declarations in plat_arm.h
This patch adds a couple of missing forward declarations in plat_arm.h
so that all types it references are known within this header file,
without relying on previous header inclusions. This concerns the
meminfo and bl31_params structures, which are defined in bl_common.h.
Other external types referenced from plat_arm.h (e.g. mmap_region_t)
get declared through header files included by arm_plat.h so they
don't need forward declarations.
Change-Id: I471d5aa487919aff3fa979fc65e053f4f5b0ef32
Sandrine Bailleux [Thu, 15 Sep 2016 08:24:54 +0000 (09:24 +0100)]
Restore some defines in xlat_tables.h
Commit
e8719552a24 removed some definitions related to translation
tables from the xlat_tables.h header file, based on the assumption
that they weren't used by any platform. These are actually used by
some partners so this patch restores them.
Fixes ARM-software/tf-issues#425
Change-Id: Idafa5f00bb0bd9c2847b5ae6541cf8db93c7b89a
davidcunado-arm [Wed, 14 Sep 2016 17:09:38 +0000 (18:09 +0100)]
Merge pull request #663 from leon-chen-mtk/mt6795_2
mediatek: Support for Mediatek MT6795 SoC
davidcunado-arm [Wed, 14 Sep 2016 16:06:19 +0000 (17:06 +0100)]
Merge pull request #700 from rockchip-linux/fixes-typo-and-warnings
rockchip: Fixes typo and warnings
davidcunado-arm [Tue, 13 Sep 2016 16:13:45 +0000 (17:13 +0100)]
Merge pull request #703 from rockchip-linux/fixes-gic-panic
rockchip: fixes the gic panic for rk3399 resume
Caesar Wang [Tue, 13 Sep 2016 03:15:00 +0000 (11:15 +0800)]
rockchip: fixes the gic panic for rk3399 resume
We make sure the resuming of gic need to be enabled.
Otherwise, The resume will hit the below panic.
...
[ 24.230541] CPU0: update max cpu_capacity 451
[ 24.236029] CPU5: update max cpu_capacity 1024
[ 24.236046] CPU4: shutdown
[ 24.243205] psci: CPU4 killed.
[ 24.258730] CPU5: shutdown
[ 24.261472] psci: CPU5 killed.
[ 24.270417] GIC: unable to set SRE (disabled at EL2), panic ahead
[ 24.270417] cat[7801]: undefined instruction: pc=
ffffffc0004e65d0
[ 24.270417] Code:
b0003940 91274400 97f871af d2801e00 (
d5184600)
[ 24.270417] Internal error: Oops - undefined instruction: 0 [#1] PREEMPT
Change-Id: Ie9542c8d5768ba0accfa073453da8bfe06d4f921
davidcunado-arm [Mon, 12 Sep 2016 16:58:41 +0000 (17:58 +0100)]
Merge pull request #698 from rockchip-linux/set-APIO-for-rk3399
Set apio for rk3399
Leon Chen [Mon, 11 Jul 2016 08:05:23 +0000 (16:05 +0800)]
Support for Mediatek MT6795 SoC
This patch support single core to boot to Linux kernel
through Trusted Firmware.
It also support 32 bit kernel and 64 bit kernel booting.
danh-arm [Mon, 12 Sep 2016 08:58:44 +0000 (09:58 +0100)]
Merge pull request #699 from soby-mathew/sm/flush_plat_psci_ops
Flush `psci_plat_pm_ops` after initialization
Caesar Wang [Fri, 9 Sep 2016 22:26:11 +0000 (06:26 +0800)]
rockchip: fixes some typo
As the checkpatch reports the warning or error.
plat/rockchip/common/plat_pm.c:96:
ERROR: do not set execute permissions for source files
plat/rockchip/rk3399/drivers/pmu/pmu.c:294:
ERROR: do not set execute permissions for source files
plat/rockchip/common/plat_pm.c:286: WARNING: line over 80 characters
plat/rockchip/common/plat_pm.c:287: WARNING: line over 80 characters
Change-Id: Ib347da21c56551c31df3f90f03777b13c75d5c26
Caesar Wang [Fri, 9 Sep 2016 22:25:29 +0000 (06:25 +0800)]
rockchip: SIP call use 32 bit return value for rk3399
for compatible 32bit and 64bit, we use 0x82xxxxxx as function ID,
we modify SIP call function return value to 32 bit.
Change-Id: Ib99b03a9ea423853aaa296dcc634ee82c622a552
Caesar Wang [Fri, 9 Sep 2016 18:47:53 +0000 (02:47 +0800)]
rockchip: set gpio2 ~ gpio4 to input and pull none mode
For save power cosumption, if gpio power supply shut down, we need to
set gpio2 ~ gpio4 to input and HiZ status when suspend, and recovery
they status when rusume. we do it base on apio pass from loader.
Change-Id: I59fd2395e5e37e63425472a39f519822c9197e4c
Caesar Wang [Fri, 9 Sep 2016 18:43:15 +0000 (02:43 +0800)]
rockchip: support disable/enable specific gpio when suspend/resume
some specific board need to disable/enable specific gpio when
suspend/resume, so we add this function, bootloader can pass the
specific gpio, and we can handle these gpios in bl31 suspend/resuem
function.
Change-Id: I373b03ef9202ee4a05a2b9caacdfa01b47ee2177
Caesar Wang [Fri, 9 Sep 2016 18:42:32 +0000 (02:42 +0800)]
rockchip/rk3399: improve gpio driver and support get pull mode function
We may need gpio pull mode later, so add this function.
Besides fix a set pull mode bug, and save gpio clock gate,
when operate the gpio, we will enable gpio clock, when
finish gpio operate, restore gpio clock gate status.
Change-Id: Ia1d602804f571a17f5ddc499908663b968b02974
Soby Mathew [Fri, 9 Sep 2016 10:33:58 +0000 (11:33 +0100)]
Flush `psci_plat_pm_ops` after initialization
The `psci_plat_pm_ops` global pointer is initialized during cold boot by the
primary CPU and will be accessed by the secondary CPUs before enabling data
cache during warm boot. This patch adds a missing data cache flush of
`psci_plat_psci_ops` after initialization during psci_setup() so that
secondaries can see the updated `psci_plat_psci_ops` pointer.
Fixes ARM-software/tf-issues#424
Change-Id: Id4554800b5646302b944115a33be69507d53cedb
davidcunado-arm [Thu, 8 Sep 2016 13:42:45 +0000 (14:42 +0100)]
Merge pull request #697 from rockchip-linux/fixes-scu-idle
rockchip: fix the scu idle for rk3399
Tony Xie [Fri, 2 Sep 2016 18:13:38 +0000 (11:13 -0700)]
rockchip: fix the scu idle for rk3399
As rk3399 reported the d8/octane scores drop 10% with cpu idle.
The root cause is thc cpu cluster enter the slow mode.
We don't need switch the clock to 24MHz if cpu cluster enter the
retention mode. In order to improve performance, it just needs for
cluster enter powering off mode.
Also, we shouldn't do anything for hlvl if the system is off.
Change-Id: I2a02962a01343abd0cba47ed63192c1cdf88b119
davidcunado-arm [Thu, 1 Sep 2016 08:43:32 +0000 (09:43 +0100)]
Merge pull request #695 from soby-mathew/sm/AArch32_fixes
Fixes for AArch32 port of TF
Soby Mathew [Wed, 31 Aug 2016 11:34:33 +0000 (12:34 +0100)]
AArch32: Fix SCTLR context initialization
This patch fixes a bug in context management library when writing
SCTLR register during context initialization. The write happened
prior to initialization of the register context pointer. This
resulted in the compiler optimizing the write sequence from the
final binary and hence SCTLR remains uninitialized when
entering normal world. The bug is fixed by doing the
initialization of the register context pointer earlier in the
sequence.
Change-Id: Ic7465593a74534046b79f40446ffa1165c52ed76
Soby Mathew [Tue, 30 Aug 2016 12:07:31 +0000 (13:07 +0100)]
AArch32: resolve build error when LOG_LEVEL=50
This patch resolves a build error in Trusted Firmware when `ARCH=aarch32`
and LOG_LEVEL >= 50.
Change-Id: I62a23ded4a25304533cdcc5ff11442aee041709b
davidcunado-arm [Wed, 31 Aug 2016 13:36:20 +0000 (14:36 +0100)]
Merge pull request #689 from yatharth-arm/yk/plat_report_expn
Remove looping around `plat_report_exception`
davidcunado-arm [Wed, 31 Aug 2016 11:44:21 +0000 (12:44 +0100)]
Merge pull request #690 from soby-mathew/sm/level_sel_xlat
Automatically select initial xlation lookup level
davidcunado-arm [Wed, 31 Aug 2016 10:26:24 +0000 (11:26 +0100)]
Merge pull request #693 from dp-arm/pmf-asm
Move pmf headers to include/lib/pmf and add assembler helper
davidcunado-arm [Fri, 26 Aug 2016 15:52:51 +0000 (16:52 +0100)]
Merge pull request #692 from dp-arm/master
fiptool: Fix typo in create and update usage functions
davidcunado-arm [Fri, 26 Aug 2016 10:59:42 +0000 (11:59 +0100)]
Merge pull request #691 from rockchip-linux/fixes-suspend/resume-bugs
Fixes suspend/resume bugs
dp-arm [Mon, 15 Aug 2016 09:35:54 +0000 (10:35 +0100)]
Add assembler helper to calculate PMF timestamp offset
Given the service name and timestamp id, this assembler macro
calculates the offset into a memory region where the per-cpu timestamp
value is located.
Change-Id: I47f6dfa2a17be182675e2ca0489d6eed42433209
dp-arm [Mon, 15 Aug 2016 09:33:08 +0000 (10:33 +0100)]
Move pmf headers to include/lib/pmf
More headers will be needed soon so better to move these to their own
directory to avoid cluttering include/lib.
Change-Id: I6a72dc5b602d6f51954cf60aadd1beb52a268670
davidcunado-arm [Thu, 25 Aug 2016 12:56:25 +0000 (13:56 +0100)]
Merge pull request #684 from rockchip-linux/add-sdram-for-rk3399
rockchip: add dram driver for rk3399
dp-arm [Tue, 23 Aug 2016 13:31:41 +0000 (14:31 +0100)]
fiptool: Fix typo in create and update usage functions
It should be 'fiptool' instead of 'fiptfool'.
Change-Id: I84ce1b6aaae5b8b33e5781bfe4f9e9cf462edb03
Caesar Wang [Thu, 18 Aug 2016 00:22:10 +0000 (17:22 -0700)]
rockchip: handle some interrupt before enter power mode for rk3399
For the PMU design, we don't expect to get the interrupts before enter
the power mode. Since that will cause the confusion for the state
machine in the power mode.
Change-Id: Id8dee79ae617a66271b5caf92caf35f520f45099
Caesar Wang [Tue, 23 Aug 2016 19:52:59 +0000 (12:52 -0700)]
rockchip: remove the unused code for rk3399
Change-Id: I986d64df9dc62354d50ccea0468b90f090a44160
Signed-off-by: Caesar Wang <wxt@rock-chips.com>
Caesar Wang [Wed, 24 Aug 2016 22:31:32 +0000 (06:31 +0800)]
rockchip: on rk3399 enable Schmitt trigger on 32 kHz clock
If we don't enable the Schmitt trigger on the 32 kHz clock then systems
won't always resume from suspend properly. Presumably anything else in
the system that relies on the 32 kHz clock also will have problems
without the Schmitt trigger enabled.
Enable it always since having the 32 kHz clock on GPIO0_A0 isn't
exactly an optional feature, so all boards using rk3399 will need this.
Change-Id: Idc18c6cd1adc5be5f60efd9cb805d83d5cd40129
Caesar Wang [Thu, 25 Aug 2016 00:38:23 +0000 (08:38 +0800)]
rockchip: enable or disable auto power down base on frequency
add auto_pd_dis_freq parameter, we can pass a frequency from kernel
to disable or enable ddr auto power down function.
Change-Id: Ie30914701336c59047c380381c6b75dd76a89562
Caesar Wang [Thu, 25 Aug 2016 00:37:42 +0000 (08:37 +0800)]
rockchip: rk3399: add dram driver
add dram driver, and kernel can through sip function talk to bl31 to
do ddr frequency scaling. and ddr auto powerdown.
Change-Id: I0d0f2869aed95e336c6e23ba96a9310985c84840
Caesar Wang [Wed, 24 Aug 2016 22:29:46 +0000 (06:29 +0800)]
rockchip: on rk3399 init the PMU counts at boot; set 24M/32k properly
In a previous change we mistakenly thought that PMU_24M_EN_CFG directly
controlled whether the PMU counts ran off the 32k vs. 24M clock.
Apparently that's not true. Real logic is now documented in code.
Also in the previous change we mistaknely though that PMU_24M_EN_CFG was
normally supposed to be 1 and we should "restore" it at resume time.
This is a terrible idea and made the system totally unreliable after
resume. Apparently PMU_24M_EN_CFG should always be 0 with all the
current code and settings.
Let's fix the above two problems. While we're changing all of this,
let's also:
1. Init at boot time. Many of these counts are used when the system is
running normally. We want the behavior at boot to match the behavior
after suspend/resume.
2. Init CPU counts to be 1 us. Although old code was trying to set this
to 1 ms (1000x slower) at suspend/resume time, we've been testing the
kernel with 1 us for a long time now. That's because the kernel (at
boot time) set these values to 24. Let's keep at 24 until we know
that's wrong.
3. Init GPU counts to be 1 us. Old code wasn't touching the GPU, but as
documented in comments it makes sense to init here. Do it.
4. Document the crap out of this code, since the SoC's behavior is
confusing and poorly documented in the TRM.
5. Increase some stabilization times to 30 ms (from 3 ms). It's unclear
that a full 30 ms is needed, but let's be safe for now.
This also inits the counts for the GPU.
(Thanks to Doug's patch that come from https://crosreview.com/372381)
Change-Id: Id1bc159a5a99916aeab043895e5c4585c4adab22
Antonio Nino Diaz [Tue, 2 Aug 2016 08:21:41 +0000 (09:21 +0100)]
Automatically select initial xlation lookup level
Instead of hardcoding a level 1 table as the base translation level
table, let the code decide which level is the most appropriate given
the virtual address space size.
As the table granularity is 4 KB, this allows the code to select
level 0, 1 or 2 as base level for AArch64. This way, instead of
limiting the virtual address space width to 39-31 bits, widths of
48-25 bit can be used.
For AArch32, this change allows the code to select level 1 or 2
as the base translation level table and use virtual address space
width of 32-25 bits.
Also removed some unused definitions related to translation tables.
Fixes ARM-software/tf-issues#362
Change-Id: Ie3bb5d6d1a4730a26700b09827c79f37ca3cdb65
Yatharth Kochar [Wed, 17 Aug 2016 10:10:16 +0000 (11:10 +0100)]
Remove looping around `plat_report_exception`
This patch removes the tight loop that calls `plat_report_exception`
in unhandled exceptions in AArch64 state.
The new behaviour is to call the `plat_report_exception` only
once followed by call to `plat_panic_handler`.
This allows platforms to take platform-specific action when
there is an unhandled exception, instead of always spinning
in a tight loop.
Note: This is a subtle break in behaviour for platforms that
expect `plat_report_exception` to be continuously executed
when there is an unhandled exception.
Change-Id: Ie2453804b9b7caf9b010ee73e1a90eeb8384e4e8
danh-arm [Fri, 19 Aug 2016 14:31:36 +0000 (15:31 +0100)]
Merge pull request #687 from sandrine-bailleux-arm/sb/panic-handler
Add WFI in platform's unexpected error handlers
Sandrine Bailleux [Thu, 18 Aug 2016 08:24:40 +0000 (09:24 +0100)]
Add WFI in platform's unexpected error handlers
This patch adds a WFI instruction in the default implementations of
plat_error_handler() and plat_panic_handler(). This potentially reduces
power consumption by allowing the hardware to enter a low-power state.
The same change has been made to the FVP and Juno platform ports.
Change-Id: Ia4e6e1e5bf1ed42efbba7d0ebbad7be8d5f9f173
danh-arm [Thu, 18 Aug 2016 10:38:48 +0000 (11:38 +0100)]
Merge pull request #686 from danh-arm/dh/remove-inv-dcache-after-auth
Remove dcache invalidation after image authentication
danh-arm [Thu, 18 Aug 2016 10:38:19 +0000 (11:38 +0100)]
Merge pull request #678 from soby-mathew/sm/PSCI_AArch32
Introduce AArch32 support for PSCI library
Dan Handley [Thu, 28 Jul 2016 13:38:03 +0000 (14:38 +0100)]
Remove dcache invalidation after image authentication
At the end of successful image authentication in load_auth_image(),
the data cache for the virtual address range corresponding to the
image is invalidated (by a call to inv_dcache_range()). The intent
seems to be to ensure the data caches do not contain any sensitive
data used during authentication, which subsequent code can read.
However, this same address range is already flushed (cleaned and
invalidated by a call to flush_dcache_range()) at the end of
load_image(), and the subsequent invalidate has no functional
effect.
This patch removes the redundant call to inv_dcache_range(). It
also moves the flush_dcache_range() call from the end of load_image()
to the end of load_auth_image(), so the image data will remain in
the caches during authentication, improving performance.
This also improves the comments that explain the rationale for
calling flush_dcache_range() after image loading/authentication.
Change-Id: I14f17ad2935075ef6f3d1327361c5088bfb2d284
danh-arm [Wed, 17 Aug 2016 15:09:31 +0000 (16:09 +0100)]
Merge pull request #685 from sandrine-bailleux-arm/sb/base-fvp-7.6
Move up to Base FVP version 7.6
danh-arm [Wed, 17 Aug 2016 11:55:01 +0000 (12:55 +0100)]
Merge pull request #683 from dp-arm/dp/fiptool
fiptool: Suppress verbose messages during normal build
danh-arm [Wed, 17 Aug 2016 11:54:38 +0000 (12:54 +0100)]
Merge pull request #682 from sudeep-holla/gicv3_ns_intr
gicv3: disable Group1 NonSecure interrupts during core powerdown
danh-arm [Wed, 17 Aug 2016 11:54:14 +0000 (12:54 +0100)]
Merge pull request #680 from hzhuang1/emmc_cmd23_v2
emmc: support CMD23
Sandrine Bailleux [Tue, 16 Aug 2016 09:58:15 +0000 (10:58 +0100)]
Move up to Base FVP version 7.6
This patch updates the User Guide to move up from version 7.2 to 7.6
of the Base FVP.
Change-Id: I792b2250deb4836266e14b40992ae59a5ab5f729
dp-arm [Wed, 10 Aug 2016 12:39:42 +0000 (13:39 +0100)]
fiptool: Suppress verbose messages during normal build
The output is shown only when built with V=1.
Change-Id: I17fef10df6f127f07956a78b478ff3cadba4bd61
Soby Mathew [Thu, 5 May 2016 13:33:33 +0000 (14:33 +0100)]
AArch32: Enable build at top level Makefile for FVP
This patch enables the AArch32 build including SP_MIN in the
top level Makefile. The build flag `ARCH` now can specify either
`aarch64`(default) or `aarch32`. Currently only FVP AEM model is
supported for AArch32 build. Another new build flag `AARCH32_SP`
is introduced to specify the AArch32 secure payload to be built.
Change-Id: Ie1198cb9e52d7da1b79b93243338fc3868b08faa
danh-arm [Fri, 12 Aug 2016 11:19:43 +0000 (12:19 +0100)]
Merge pull request #679 from rockchip-linux/support-pwm-for-rk3399
Support pwm for rk3399
Haojian Zhuang [Tue, 2 Aug 2016 12:51:27 +0000 (20:51 +0800)]
emmc: support CMD23
Support CMD23. When CMD23 is used, CMD12 could be avoided.
Two scenarios:
1. CMD17 for single block, CMD18 + CMD12 for multiple blocks.
2. CMD23 + CMD18 for both single block and multiple blocks.
The emmc_init() should initialize whether CMD23 is supported
or not.
Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
Sudeep Holla [Thu, 4 Aug 2016 15:14:50 +0000 (16:14 +0100)]
gicv3: disable Group1 NonSecure interrupts during core powerdown
As per the GICv3 specification, to power down a processor using GICv3
and allow automatic power-on if an interrupt must be sent to a processor,
software must set Enable to zero for all interrupt groups(by writing to
GICC_CTLR or ICC_IGRPEN{0,1}_EL1/3 as appropriate.
Also, NonSecure EL1 software may not be aware of the CPU power state
details and fail to choose right states that require quiescing the CPU
interface. So it's preferred that the PSCI implementation handles it as
it is fully aware of the CPU power states.
This patch adds disabling of Group1 NonSecure interrupts during processor
power down along with Group0 and Group1 Secure interrupts so that all the
interrupt groups are handled at once as per specification.
Change-Id: Ib564d773c9c4c41f2ca9471451c030e3de75e641
Caesar Wang [Mon, 8 Aug 2016 23:53:41 +0000 (07:53 +0800)]
rockchip: fix the reset-hold release for rk3399 resume
The pmusgrf reset-hold bits needs to be released, since the
pmusgrf reset-hold bits needs to be held.
Change-Id: Ia1eccc8fba18294f26b4cc07d47bc5e513dd9a1f
Caesar Wang [Tue, 9 Aug 2016 00:15:44 +0000 (08:15 +0800)]
rockchip: fix the power up/dowm cnt for rk3399
Sometimes this will cause the long delay for suspend/resume.
Since the 24M OCS will be turned off in power mode.
Also, remove the ERROR_DEPRECATED config define.
Change-Id: I78f21c35912c2250972e551695cdacc7bc4c020a
Caesar Wang [Wed, 10 Aug 2016 18:11:45 +0000 (02:11 +0800)]
rockchip: update to handle PWMs for rk3399
This patch updates some things for rk3399, as following:
1) Add the new file to handle the pwm. (e.g. the pwm regulator)
Make sure that good deal with the pwm related things.
Also, remove some pwm setting for pmu.c.
2) Set the plls slow mode and bypass in suspend, and restore them.
Change-Id: I112806700bf433c87763aac23d22fa7e6a7f5264
Soby Mathew [Mon, 11 Jul 2016 13:15:27 +0000 (14:15 +0100)]
AArch32: Add FVP support for SP_MIN
This patch implements the support for SP_MIN in FVP. The SP_MIN platform
APIs are implemented and the required makefile support is added for FVP.
Change-Id: Id50bd6093eccbd5e38894e3fd2b20d5baeac5452
Soby Mathew [Mon, 11 Jul 2016 13:13:56 +0000 (14:13 +0100)]
AArch32: Add essential ARM platform and FVP support
This patch adds AArch32 support for FVP and implements common platform APIs
like `plat_get_my_stack`, `plat_set_my_stack`, `plat_my_core_cos` for AArch32.
Only Multi Processor(MP) implementations of these functions are considered in
this patch. The ARM Standard platform layer helpers are implemented for
AArch32 and the common makefiles are modified to cater for both AArch64 and
AArch32 builds. Compatibility with the deprecated platform API is not
supported for AArch32.
Change-Id: Iad228400613eec91abf731b49e21a15bcf2833ea
Soby Mathew [Thu, 5 May 2016 13:32:05 +0000 (14:32 +0100)]
AArch32: add a minimal secure payload (SP_MIN)
This patch adds a minimal AArch32 secure payload SP_MIN. It relies on PSCI
library to initialize the normal world context. It runs in Monitor mode
and uses the runtime service framework to handle SMCs. It is added as
a BL32 component in the Trusted Firmware source tree.
Change-Id: Icc04fa6b242025a769c1f6c7022fde19459c43e9
Soby Mathew [Thu, 5 May 2016 13:11:23 +0000 (14:11 +0100)]
AArch32: Add support to PSCI lib
This patch adds AArch32 support to PSCI library, as follows :
* The `psci_helpers.S` is implemented for AArch32.
* AArch32 version of internal helper function `psci_get_ns_ep_info()` is
defined.
* The PSCI Library is responsible for the Non Secure context initialization.
Hence a library interface `psci_prepare_next_non_secure_ctx()` is introduced
to enable EL3 runtime firmware to initialize the non secure context without
invoking context management library APIs.
Change-Id: I25595b0cc2dbfdf39dbf7c589b875cba33317b9d
Soby Mathew [Thu, 5 May 2016 13:10:46 +0000 (14:10 +0100)]
AArch32: Add support in TF libraries
This patch adds AArch32 support to cpu ops, context management,
per-cpu data and spinlock libraries. The `entrypoint_info`
structure is modified to add support for AArch32 register
arguments. The CPU operations for AEM generic cpu in AArch32
mode is also added.
Change-Id: I1e52e79f498661d8f31f1e7b3a29e222bc7a4483
Soby Mathew [Thu, 24 Mar 2016 16:52:40 +0000 (16:52 +0000)]
AArch32: Add console driver
This patch adds console drivers including the pl011 driver
for the AArch32 mode.
Change-Id: Ifd22520d370fca3e73dbbf6f2d97d6aee65b67dd
Soby Mathew [Thu, 5 May 2016 12:59:07 +0000 (13:59 +0100)]
AArch32: Enable GIC and TZC support
This patch modifies GICv3 and TZC drivers to add AArch32 support.
No modifications are required for the GICv2 driver for AArch32 support.
The TZC driver assumes that the secure world is running in Little-Endian
mode to do 64 bit manipulations. Assertions are present to validate the
assumption.
Note: The legacy GICv3 driver is not supported for AArch32.
Change-Id: Id1bc75a9f5dafb9715c9500ca77b4606eb1e2458
Soby Mathew [Thu, 5 May 2016 11:53:53 +0000 (12:53 +0100)]
AArch32: Add SMCC context
This patch defines a SMCC context to save and restore
registers during a SMC call. It also adds appropriate helpers
to save and restore from this context for use by AArch32
secure payload and BL stages.
Change-Id: I64c8d6fe1d6cac22e1f1f39ea1b54ee1b1b72248
Soby Mathew [Thu, 5 May 2016 11:49:09 +0000 (12:49 +0100)]
AArch32: Add API to invoke runtime service handler
This patch adds an API in runtime service framework to
invoke the registered handler corresponding to the SMC function
identifier. This is helpful for AArch32 because the number of
arguments required by the handler is more than registers
available as per AArch32 program calling conventions and
requires the use of stack. Hence this new API will do the
necessary argument setup and invoke the appropriate
handler. Although this API is primarily intended for AArch32,
it can be used for AArch64 as well.
Change-Id: Iefa15947fe5a1df55b0859886e677446a0fd7241
Soby Mathew [Thu, 5 May 2016 11:34:41 +0000 (12:34 +0100)]
AArch32: Add tf_printf support
The tf_printf library uses 64 bit division to print numbers
in appropriate formats but AArch32 mode cannot do 64 bit division
natively. Hence this patch adds additional number printing routines
to handle AArch32 mode in tf_printf library. The decimal format
printing capability is limited to 32 bit integers whereas 64 bits
are supported in hexadecimal format. The library assumes that
secure world is running in Little-Endian mode to do bit
manipulations on 64 bit. Suitable assertions are present to
enforce this assumption.
Change-Id: I55a21e448cef4915d1834d76e48a84ccf0bec36d
Soby Mathew [Thu, 30 Jun 2016 14:11:07 +0000 (15:11 +0100)]
AArch32: Add translation table library support
This patch adds translation library supports for AArch32 platforms.
The library only supports long descriptor formats for AArch32.
The `enable_mmu_secure()` enables the MMU for secure world with
`TTBR0` pointing to the populated translation tables.
Change-Id: I061345b1779391d098e35e7fe0c76e3ebf850e08
Soby Mathew [Thu, 5 May 2016 11:31:57 +0000 (12:31 +0100)]
AArch32: Add assembly helpers
This patch adds various assembly helpers for AArch32 like :
* cache management : Functions to flush, invalidate and clean
cache by MVA. Also helpers to do cache operations by set-way
are also added.
* stack management: Macros to declare stack and get the current
stack corresponding to current CPU.
* Misc: Macros to access co processor registers in AArch32,
macros to define functions in assembly, assert macros, generic
`do_panic()` implementation and function to zero block of memory.
Change-Id: I7b78ca3f922c0eda39beb9786b7150e9193425be
Soby Mathew [Mon, 9 May 2016 16:49:55 +0000 (17:49 +0100)]
AArch32: Add essential Arch helpers
This patch adds the essential AArch32 architecture helpers
arch.h and arch_helpers.h and modifies `_types.h` to add AArch32
support.
A new build option `ARCH` is defined in the top level makefile to
enable the component makefiles to choose the right files based on the
Architecture it is being build for. Depending on this flag, either
`AARCH32` or `AARCH64` flag is defined by the Makefile. The default
value of `ARCH` flag is `aarch64`. The AArch32 build support will be
added in a later patch.
Change-Id: I405e5fac02db828a55cd25989b572b64cb005241
Soby Mathew [Wed, 20 Jul 2016 13:38:36 +0000 (14:38 +0100)]
Move SIZE_FROM_LOG2_WORDS macro to utils.h
This patch moves the macro SIZE_FROM_LOG2_WORDS() defined in
`arch.h` to `utils.h` as it is utility macro.
Change-Id: Ia8171a226978f053a1ee4037f80142c0a4d21430
Soby Mathew [Mon, 8 Aug 2016 11:42:53 +0000 (12:42 +0100)]
Move spinlock library code to AArch64 folder
This patch moves the assembly exclusive lock library code
`spinlock.S` into architecture specific folder `aarch64`.
A stub file which includes the file from new location is
retained at the original location for compatibility. The BL
makefiles are also modified to include the file from the new
location.
Change-Id: Ide0b601b79c439e390c3a017d93220a66be73543
Soby Mathew [Mon, 8 Aug 2016 11:33:06 +0000 (12:33 +0100)]
Migrate platform makefile to new console driver location
This patch migrates the upstream platform makefiles to include the
console drivers from the new location in ARM Trusted Firmware code
base.
Change-Id: I866d6c4951e475de1f836ce8a8c1d5e6da9577e3
Soby Mathew [Mon, 8 Aug 2016 11:38:52 +0000 (12:38 +0100)]
Move console drivers to AArch64 folder
This patch moves the various assembly console drivers
into `aarch64` architecture specific folder. Stub files,
which include files from new location, are retained at the
original location for platform compatibility reasons.
Change-Id: I0069b6c1c0489ca47f5204d4e26e3bc3def533a8
Soby Mathew [Wed, 13 Jul 2016 14:45:15 +0000 (15:45 +0100)]
Fix the translation table library for wraparound cases
This patch fixes the translation table library for wraparound cases. These
cases are not expected to occur on AArch64 platforms because only the
48 bits of the 64 bit address space are used. But it is a possibility for
AArch32 platforms.
Change-Id: Ie7735f7ba2977019381e1c124800381471381499
danh-arm [Tue, 9 Aug 2016 11:20:37 +0000 (12:20 +0100)]
Merge pull request #676 from hzhuang1/fix_io_unaligned
io: block: fix unaligned buffer
danh-arm [Tue, 9 Aug 2016 09:16:36 +0000 (10:16 +0100)]
Merge pull request #661 from dp-arm/master
Replace fip_create with fiptool
Haojian Zhuang [Thu, 28 Jul 2016 02:15:32 +0000 (10:15 +0800)]
io: block: fix unaligned buffer
If buffer address parameter isn't aligned, it may cause
DMA issue in block device driver, as eMMC. Now check the buffer
address. If it's not aligned, use temporary buffer in io block
driver instead.
Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
dp-arm [Wed, 25 May 2016 15:20:20 +0000 (16:20 +0100)]
Replace fip_create with fiptool
fiptool provides a more consistent and intuitive interface compared to
the fip_create program. It serves as a better base to build on more
features in the future.
fiptool supports various subcommands. Below are the currently
supported subcommands:
1) info - List the images contained in a FIP file.
2) create - Create a new FIP file with the given images.
3) update - Update an existing FIP with the given images.
4) unpack - Extract a selected set or all the images from a FIP file.
5) remove - Remove images from a FIP file. This is a new command that
was not present in fip_create.
To create a new FIP file, replace "fip_create" with "fiptool create".
To update a FIP file, replace "fip_create" with "fiptool update".
To dump the contents of a FIP file, replace "fip_create --dump" with
"fiptool info".
A compatibility script that emulates the basic functionality of
fip_create is provided. Existing scripts might or might not work with
the compatibility script. Users are strongly encouraged to migrate to
fiptool.
Fixes ARM-Software/tf-issues#87
Fixes ARM-Software/tf-issues#108
Fixes ARM-Software/tf-issues#361
Change-Id: I7ee4da7ac60179cc83cf46af890fd8bc61a53330
danh-arm [Thu, 28 Jul 2016 16:35:46 +0000 (17:35 +0100)]
Merge pull request #668 from sandrine-bailleux-arm/sb/rodata-xn-doc
Documentation for SEPARATE_CODE_AND_RODATA build flag
Sandrine Bailleux [Thu, 7 Jul 2016 13:23:04 +0000 (14:23 +0100)]
Documentation for SEPARATE_CODE_AND_RODATA build flag
This patch documents the effect, cost and benefits of the
SEPARATE_CODE_AND_RODATA build flag.
Change-Id: Ic8daf0563fa6335930ad6c70b9c35f678e84d39d
danh-arm [Thu, 28 Jul 2016 08:53:25 +0000 (09:53 +0100)]
Merge pull request #674 from rockchip-linux/Support-PWMs-for-rk3399-suspend/resume
rockchip: fixes typo and some bugs for suspend/resume tests
danh-arm [Thu, 28 Jul 2016 08:25:40 +0000 (09:25 +0100)]
Merge pull request #673 from soby-mathew/sm/coverity_issue
Improve debug assertion for runtime svc number
danh-arm [Thu, 28 Jul 2016 08:25:28 +0000 (09:25 +0100)]
Merge pull request #672 from soby-mathew/sm/irouter_offset
GICv3: Fix the GICD_IROUTER offset
danh-arm [Thu, 28 Jul 2016 08:23:10 +0000 (09:23 +0100)]
Merge pull request #671 from antonio-nino-diaz-arm/an/unoptimised-mem
ARM platforms: Define common image sizes
Caesar Wang [Thu, 21 Jul 2016 02:36:22 +0000 (10:36 +0800)]
rockchip: fixes typo and some bugs for suspend/resume tests
1. Remove the AP_PWROFF in ATF, should configure it in kernel.
2. Save and restore the PWMs pin/regs for suspend/resume.
3. The pmusgrf reset-hold bits needs to be released. since the
pmusgrf reset-hold bits needs to be held.
4. Configure the PMU power up/down cycles about delay 3ms.
5. With the MMIO register block as one big mapping.
6. Fix the build error with psci_entrypoint since PSCI lib updated.
Fixes the commit
9ec78bd ("rockchip: support the suspend/resume for rk3399").
Change-Id: I112806700bf433c87763aac23d22fa7e6a7f5264
Soby Mathew [Tue, 26 Jul 2016 16:46:56 +0000 (17:46 +0100)]
GICv3: Fix the GICD_IROUTER offset
This patch fixes the offset of GICD_IROUTER register defined in gicv3.h.
Although the GICv3 documention mentions that the offset for this register
is 0x6100-0x7FD8, the offset calculation for an interrupt id `n` is :
0x6000 + 8n, where n >= 32
This requires the offset for GICD_IROUTER to be defined as 0x6000.
Fixes ARM-software/tf-issues#410
Change-Id: If9e91e30d946afe7f1f60fea4f065c7567093fa8
Soby Mathew [Tue, 26 Jul 2016 15:09:44 +0000 (16:09 +0100)]
Improve debug assertion for runtime svc number
This patch improves the debug assertion for runtime svc number
- Remove useless comparison ensuring that the number of descriptors
is a positive number. The variable is an unsigned integer so can't
be negative.
- Check that the end address of the descriptors is sane relative
to the start address.
Change-Id: Iea7be6b34e33b8b1cbd394eb923cc834ea964831
danh-arm [Tue, 26 Jul 2016 13:35:07 +0000 (14:35 +0100)]
Merge pull request #670 from achingupta/ag/psci_retention_fix
Fix use of stale power states in PSCI standby finisher
danh-arm [Tue, 26 Jul 2016 13:34:13 +0000 (14:34 +0100)]
Merge pull request #669 from sandrine-bailleux-arm/sb/tf-hardening
Minor improvements to harden TF code
Achin Gupta [Tue, 28 Jun 2016 15:46:15 +0000 (16:46 +0100)]
Fix use of stale power states in PSCI standby finisher
A PSCI CPU_SUSPEND request to place a CPU in retention states at power levels
higher than the CPU power level is subject to the same state coordination as a
power down state. A CPU could implement multiple retention states at a
particular power level. When exiting WFI, the non-CPU power levels may be in a
different retention state to what was initially requested, therefore each CPU
should refresh its view of the states of all power levels.
Previously, a CPU re-used the state of the power levels when it entered the
retention state. This patch fixes this issue by ensuring that a CPU upon exit
from retention reads the state of each power level afresh.
Change-Id: I93b5f5065c63400c6fd2598dbaafac385748f989
Sandrine Bailleux [Tue, 12 Jul 2016 08:12:24 +0000 (09:12 +0100)]
Ensure addresses in is_mem_free() don't overflow
This patch adds some runtime checks to prevent some potential
pointer overflow issues in the is_mem_free() function. The overflow
could happen in the case where the end addresses, computed as the
sum of a base address and a size, results in a value large enough
to wrap around. This, in turn, could lead to unpredictable behaviour.
If such an overflow is detected, the is_mem_free() function will now
declare the memory region as not free. The overflow is detected using
a new macro, called check_uptr_overflow().
This patch also modifies all other places in the 'bl_common.c' file
where an end address was computed as the sum of a base address and a
size and instead keeps the two values separate. This avoids the need
to handle pointer overflows everywhere. The code doesn't actually need
to compute any end address before the is_mem_free() function is called
other than to print information message to the serial output.
This patch also introduces 2 slight changes to the reserve_mem()
function:
- It fixes the end addresses passed to choose_mem_pos(). It was
incorrectly passing (base + size) instead of (base + size - 1).
- When the requested allocation size is 0, the function now exits
straight away and says so using a warning message.
Previously, it used to actually reserve some memory. A zero-byte
allocation was not considered as a special case so the function
was using the same top/bottom allocation mechanism as for any
other allocation. As a result, the smallest area of memory starting
from the requested base address within the free region was
reserved.
Change-Id: I0e695f961e24e56ffe000718014e0496dc6e1ec6
Sandrine Bailleux [Tue, 28 Jun 2016 15:48:30 +0000 (16:48 +0100)]
Make runtime_svc_init() function more robust
- Added some debug assertions checking that the runtime services
indexes computed by get_unique_oen() are sane.
- Do not print the name of the service when its descriptor is
invalid. If the descriptor is corrupted then its name field
could be corrupted as well and we would end up reading an
arbitrary amount of invalid memory.
Change-Id: I16f61065277d01fe1555d5a9cf743f7b52ccaa60
Sandrine Bailleux [Tue, 28 Jun 2016 15:44:28 +0000 (16:44 +0100)]
Improvements to runtime service init code
Light refactoring of the code in runtime_svc.c file.
- Declare validate_rt_svc_desc()'s argument as const.
- Remove 'goto' path in runtime_svc_init(). It was used in one
place only.
- Improve code readability by declaring a local variable holding the
service pointer.
Change-Id: I3b15c5adb9f37b786b5b993a9be70ea9dd017a83
Sandrine Bailleux [Wed, 22 Jun 2016 15:35:01 +0000 (16:35 +0100)]
Validate psci_find_target_suspend_lvl() result
This patch adds a runtime check that psci_find_target_suspend_lvl()
returns a valid value back to psci_cpu_suspend() and psci_get_stat().
If it is invalid, BL31 will now panic.
Note that on the PSCI CPU suspend path there is already a debug
assertion checking the validity of the target composite power state,
which effectively also checks the validity of the target suspend level.
Therefore, the error condition would already be caught in debug builds,
but in a release build this assertion would be compiled out.
On the PSCI stat path, there is currently no debug assertion checking
the validity of the power state before using it as an index into
the power domain state array.
Although BL31 platforms ports are responsible for validating the
power state parameter, the security impact (i.e. an out-of-bounds
array access) of a potential platform port bug in this code would
be quite high, given that this parameter comes from an untrusted
source. The cost of checking this in runtime generic code is low.
Change-Id: Icea85b8020e39928ac03ec0cd49805b5857b3906
danh-arm [Mon, 25 Jul 2016 11:29:52 +0000 (12:29 +0100)]
Merge pull request #667 from soby-mathew/sm/PSCI_lib
Introduce PSCI library
Antonio Nino Diaz [Mon, 25 Jul 2016 11:04:31 +0000 (12:04 +0100)]
ARM platforms: Define common image sizes
Compile option `ARM_BOARD_OPTIMISE_MMAP` has been renamed to
`ARM_BOARD_OPTIMISE_MEM` because it now applies not only to defines
related to the translation tables but to the image size as well.
The defines `PLAT_ARM_MAX_BL1_RW_SIZE`, `PLAT_ARM_MAX_BL2_SIZE` and
`PLAT_ARM_MAX_BL31_SIZE` have been moved to the file board_arm_def.h.
This way, ARM platforms no longer have to set their own values if
`ARM_BOARD_OPTIMISE_MEM=0` and they can specify optimized values
otherwise. The common sizes have been set to the highest values used
for any of the current build configurations.
This is needed because in some build configurations some images are
running out of space. This way there is a common set of values known
to work for all of them and it can be optimized for each particular
platform if needed.
The space reserved for BL2 when `TRUSTED_BOARD_BOOT=0` has been
increased. This is needed because when memory optimisations are
disabled the values for Juno of `PLAT_ARM_MMAP_ENTRIES` and
`MAX_XLAT_TABLES` are higher. If in this situation the code is
compiled in debug mode and with "-O0", the code won't fit.
Change-Id: I70a3d8d3a0b0cad1d6b602c01a7ea334776e718e
Soby Mathew [Fri, 8 Jul 2016 14:26:35 +0000 (15:26 +0100)]
Rearrange assembly helper macros
This patch moves assembler macros which are not architecture specific
to a new file `asm_macros_common.S` and moves the `el3_common_macros.S`
into `aarch64` specific folder.
Change-Id: I444a1ee3346597bf26a8b827480cd9640b38c826
Soby Mathew [Thu, 7 Jul 2016 09:03:21 +0000 (10:03 +0100)]
Define `plat_get_syscnt_freq2()` unconditionally for ARM platforms
Previously the definition of `plat_get_syscnt_freq2()` in `arm_common.c` was
conditionally defined based on the ERROR_DEPRECATED flag. This patch makes
this function available irrespective of the flag and removes the deprecated
`plat_get_syscnt_freq()` definition.
Change-Id: I250ca787ca1b5e867096c6ba8f2bb444db44c97b
Soby Mathew [Mon, 9 May 2016 16:20:10 +0000 (17:20 +0100)]
Cater for preloaded BL33 within plat_get_ns_image_entrypoint()
The PRELOADED_BL33_BASE build option allows to preload a BL33 and bypass its
loading by BL2. In ARM standard platforms, the conditional behaviour of
PRELOADED_BL33_BASE is moved within the implementation of
`plat_get_ns_image_entrypoint()` so that all callers may benefit from this
feature.
Change-Id: Iea060e204ec72f8081087837854535c4e320da4e