project/bcm63xx/atf.git
8 years agoIntroduce utils.h header file
Sandrine Bailleux [Tue, 5 Jul 2016 08:55:03 +0000 (09:55 +0100)]
Introduce utils.h header file

This patch introduces a new header file: include/lib/utils.h.
Its purpose is to provide generic macros and helper functions that
are independent of any BL image, architecture, platform and even
not specific to Trusted Firmware.

For now, it contains only 2 macros: ARRAY_SIZE() and
IS_POWER_OF_TWO(). These were previously defined in bl_common.h and
xlat_tables.c respectively.

bl_common.h includes utils.h to retain compatibility for platforms
that relied on bl_common.h for the ARRAY_SIZE() macro. Upstream
platform ports that use this macro have been updated to include
utils.h.

Change-Id: I960450f54134f25d1710bfbdc4184f12c049a9a9

8 years agoBL1: Add linker symbol identifying end of ROM content
Sandrine Bailleux [Wed, 15 Jun 2016 12:53:50 +0000 (13:53 +0100)]
BL1: Add linker symbol identifying end of ROM content

This patch adds a new linker symbol in BL1's linker script named
'__BL1_ROM_END__', which marks the end of BL1's ROM content. This
covers BL1's code, read-only data and read-write data to relocate
in Trusted SRAM. The address of this new linker symbol is exported
to C code through the 'BL1_ROM_END' macro.

The section related to linker symbols in the Firmware Design guide
has been updated and improved.

Change-Id: I5c442ff497c78d865ffba1d7d044511c134e11c7

8 years agoxlat lib: Introduce MT_EXECUTE/MT_EXECUTE_NEVER attributes
Sandrine Bailleux [Tue, 14 Jun 2016 15:31:09 +0000 (16:31 +0100)]
xlat lib: Introduce MT_EXECUTE/MT_EXECUTE_NEVER attributes

This patch introduces the MT_EXECUTE/MT_EXECUTE_NEVER memory mapping
attributes in the translation table library to specify the
access permissions for instruction execution of a memory region.
These new attributes should be used only for normal, read-only
memory regions. For other types of memory, the translation table
library still enforces the following rules, regardless of the
MT_EXECUTE/MT_EXECUTE_NEVER attribute:

 - Device memory is always marked as execute-never.
 - Read-write normal memory is always marked as execute-never.

Change-Id: I8bd27800a8c1d8ac1559910caf4a4840cf25b8b0

8 years agoxlat lib: Refactor mmap_desc() function
Sandrine Bailleux [Tue, 14 Jun 2016 15:29:04 +0000 (16:29 +0100)]
xlat lib: Refactor mmap_desc() function

This patch clarifies the mmap_desc() function by adding some comments
and reorganising its code. No functional change has been introduced.

Change-Id: I873493be17b4e60a89c1dc087dd908b425065401

8 years agoIntroduce arm_setup_page_tables() function
Sandrine Bailleux [Wed, 18 May 2016 15:11:47 +0000 (16:11 +0100)]
Introduce arm_setup_page_tables() function

This patch introduces the arm_setup_page_tables() function to
set up page tables on ARM platforms. It replaces the
arm_configure_mmu_elx() functions and does the same thing except
that it doesn't enable the MMU at the end. The idea is to reduce
the amount of per-EL code that is generated by the C preprocessor
by splitting the memory regions definitions and page tables creation
(which is generic) from the MMU enablement (which is the only per-EL
configuration).

As a consequence, the call to the enable_mmu_elx() function has been
moved up into the plat_arch_setup() hook. Any other ARM standard
platforms that use the functions `arm_configure_mmu_elx()` must be
updated.

Change-Id: I6f12a20ce4e5187b3849a8574aac841a136de83d

8 years agoMerge pull request #651 from Xilinx/zynqmp_uart
danh-arm [Mon, 4 Jul 2016 17:05:15 +0000 (18:05 +0100)]
Merge pull request #651 from Xilinx/zynqmp_uart

zynqmp: Make UART selectable

8 years agoMerge pull request #652 from soby-mathew/sm/pmf_psci_stat
danh-arm [Mon, 4 Jul 2016 15:32:24 +0000 (16:32 +0100)]
Merge pull request #652 from soby-mathew/sm/pmf_psci_stat

Introduce PMF and implement PSCI STAT APIs

8 years agoEnable PSCI_STAT_COUNT/RESIDENCY for ARM standard platforms
Soby Mathew [Mon, 23 May 2016 15:07:53 +0000 (16:07 +0100)]
Enable PSCI_STAT_COUNT/RESIDENCY for ARM standard platforms

This patch enables optional PSCI functions `PSCI_STAT_COUNT` and
`PSCI_STAT_RESIDENCY` for ARM standard platforms. The optional platform
API 'translate_power_state_by_mpidr()' is implemented for the Juno
platform. 'validate_power_state()' on Juno downgrades PSCI CPU_SUSPEND
requests for the system power level to the cluster power level.
Hence, it is not suitable for validating the 'power_state' parameter
passed in a PSCI_STAT_COUNT/RESIDENCY call.

Change-Id: I9548322676fa468d22912392f2325c2a9f96e4d2

8 years agoAdd optional PSCI STAT residency & count functions
Yatharth Kochar [Mon, 9 May 2016 17:26:35 +0000 (18:26 +0100)]
Add optional PSCI STAT residency & count functions

This patch adds following optional PSCI STAT functions:

- PSCI_STAT_RESIDENCY: This call returns the amount of time spent
  in power_state in microseconds, by the node represented by the
  `target_cpu` and the highest level of `power_state`.

- PSCI_STAT_COUNT: This call returns the number of times a
  `power_state` has been used by the node represented by the
  `target_cpu` and the highest power level of `power_state`.

These APIs provides residency statistics for power states that has
been used by the platform. They are implemented according to v1.0
of the PSCI specification.

By default this optional feature is disabled in the PSCI
implementation. To enable it, set the boolean flag
`ENABLE_PSCI_STAT` to 1. This also sets `ENABLE_PMF` to 1.

Change-Id: Ie62e9d37d6d416ccb1813acd7f616d1ddd3e8aff

8 years agoAdd Performance Measurement Framework(PMF)
Yatharth Kochar [Fri, 11 Mar 2016 14:20:19 +0000 (14:20 +0000)]
Add Performance Measurement Framework(PMF)

This patch adds Performance Measurement Framework(PMF) in the
ARM Trusted Firmware. PMF is implemented as a library and the
SMC interface is provided through ARM SiP service.

The PMF provides capturing, storing, dumping and retrieving the
time-stamps, by enabling the development of services by different
providers, that can be easily integrated into ARM Trusted Firmware.
The PMF capture and retrieval APIs can also do appropriate cache
maintenance operations to the timestamp memory when the caller
indicates so.

`pmf_main.c` consists of core functions that implement service
registration, initialization, storing, dumping and retrieving
the time-stamp.
`pmf_smc.c` consists SMC handling for registered PMF services.
`pmf.h` consists of the macros that can be used by the PMF service
providers to register service and declare time-stamp functions.
`pmf_helpers.h` consists of internal macros that are used by `pmf.h`

By default this feature is disabled in the ARM trusted firmware.
To enable it set the boolean flag `ENABLE_PMF` to 1.

NOTE: The caller is responsible for specifying the appropriate cache
maintenance flags and for acquiring/releasing appropriate locks
before/after capturing/retrieving the time-stamps.

Change-Id: Ib45219ac07c2a81b9726ef6bd9c190cc55e81854

8 years agozynqmp: Add option to select between Cadence UARTs
Soren Brinkmann [Fri, 10 Jun 2016 16:57:14 +0000 (09:57 -0700)]
zynqmp: Add option to select between Cadence UARTs

Add build time option 'cadence1' for ZYNQMP_CONSOLE to select the 2nd
UART available in the SoC.

Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
Acked-by: Michal Simek <michal.simek@xilinx.com>
8 years agoMerge pull request #650 from Xilinx/zynqmp-updates
danh-arm [Wed, 15 Jun 2016 14:57:02 +0000 (15:57 +0100)]
Merge pull request #650 from Xilinx/zynqmp-updates

Zynqmp updates

8 years agobuild_macros: Add 'add_define_val' macro
Soren Brinkmann [Thu, 9 Jun 2016 20:36:27 +0000 (13:36 -0700)]
build_macros: Add 'add_define_val' macro

Add a convenience macro to add a build definition with a value.

Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
8 years agoMerge pull request #629 from ljerry/tf_issue_398
danh-arm [Mon, 13 Jun 2016 12:50:58 +0000 (13:50 +0100)]
Merge pull request #629 from ljerry/tf_issue_398

Bring IO storage dummy driver

8 years agoMerge pull request #648 from ashutoshksingh/integration
danh-arm [Mon, 13 Jun 2016 10:27:31 +0000 (11:27 +0100)]
Merge pull request #648 from ashutoshksingh/integration

opteed: assume aarch64 for optee

8 years agoMerge pull request #646 from davwan01/dw/gicv3-wakeup
danh-arm [Mon, 13 Jun 2016 10:09:08 +0000 (11:09 +0100)]
Merge pull request #646 from davwan01/dw/gicv3-wakeup

CSS: Add support to wake up the core from wfi in GICv3

8 years agoMerge pull request #635 from jenswi-linaro/qemu
danh-arm [Mon, 13 Jun 2016 10:08:19 +0000 (11:08 +0100)]
Merge pull request #635 from jenswi-linaro/qemu

Add support for QEMU virt ARMv8-A

8 years agoopteed: assume aarch64 for optee
Ashutosh Singh [Fri, 27 May 2016 14:51:17 +0000 (15:51 +0100)]
opteed: assume aarch64 for optee

OPTEE to execute in aarch64 bit mode, set it accordingly
when execution transitions from EL3 to EL1

Change-Id: I59f2f940bdc1aac10543045b006a137d107ec95f
Signed-off-by: Ashutosh Singh <ashutosh.singh@arm.com>
8 years agoAdd support for QEMU virt ARMv8-A target
Jens Wiklander [Mon, 7 Dec 2015 13:37:10 +0000 (14:37 +0100)]
Add support for QEMU virt ARMv8-A target

This patch adds support for the QEMU virt ARMv8-A target.

Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
8 years agoMerge pull request #642 from soby-mathew/sm/override_rotpk
danh-arm [Wed, 8 Jun 2016 15:06:43 +0000 (16:06 +0100)]
Merge pull request #642 from soby-mathew/sm/override_rotpk

Allow dynamic overriding of ROTPK verification

8 years agoMerge pull request #643 from sandrine-bailleux-arm/sb/checkpatch-conf-file
danh-arm [Wed, 8 Jun 2016 12:30:03 +0000 (13:30 +0100)]
Merge pull request #643 from sandrine-bailleux-arm/sb/checkpatch-conf-file

Move checkpatch options in a configuration file

8 years agoMerge pull request #639 from danh-arm/dh/import-libfdt
danh-arm [Wed, 8 Jun 2016 12:20:35 +0000 (13:20 +0100)]
Merge pull request #639 from danh-arm/dh/import-libfdt

Import libfdt v1.4.1 and related changes

8 years agoCSS: Add support to wake up the core from wfi in GICv3
David Wang [Tue, 7 Jun 2016 01:22:40 +0000 (09:22 +0800)]
CSS: Add support to wake up the core from wfi in GICv3

In GICv3 mode, the non secure group1 interrupts are signalled via the
FIQ line in EL3. To support waking up from CPU_SUSPEND to standby on
these systems, EL3 should route FIQ to EL3 temporarily before wfi and
restore the original setting after resume. This patch makes this change
for the CSS platforms in the `css_cpu_standby` psci pm ops hook.

Change-Id: Ibf3295d16e2f08da490847c1457bc839e1bac144

8 years agozynqmp: pm: Added NODE_IPI_APU slave node ID in pm_defs.h
Mirela Simonovic [Tue, 7 Jun 2016 16:15:40 +0000 (18:15 +0200)]
zynqmp: pm: Added NODE_IPI_APU slave node ID in pm_defs.h

NODE_IPI_APU is the node ID of APU's IPI device. If APU should be
woken-up on an IPI from FPD power down, this node shall be set as
the wake-up source upon suspend.

Signed-off-by: Mirela Simonovic <mirela.simonovic@aggios.com>
8 years agoMerge pull request #645 from sandrine-bailleux-arm/sb/improve-load-image-comments
danh-arm [Tue, 7 Jun 2016 08:35:02 +0000 (09:35 +0100)]
Merge pull request #645 from sandrine-bailleux-arm/sb/improve-load-image-comments

Update comments in load_image()

8 years agoUpdate comments in load_image()
Sandrine Bailleux [Fri, 27 May 2016 13:08:10 +0000 (14:08 +0100)]
Update comments in load_image()

- Fix the function documentation.
  Since commit 16948ae1, load_image() uses image IDs rather than image
  names.

- Clarify the consequences of a null entry point argument.

- Slightly reorganize the code to remove an unnecessary 'if' statement.

Change-Id: Iebea3149a37f23d3b847a37a206ed23f7e8ec717

8 years agoMerge pull request #644 from sandrine-bailleux-arm/sb/rm-outdated-comment
danh-arm [Mon, 6 Jun 2016 09:54:28 +0000 (10:54 +0100)]
Merge pull request #644 from sandrine-bailleux-arm/sb/rm-outdated-comment

xlat lib: Remove out-dated comment

8 years agoMove checkpatch options in a configuration file
Sandrine Bailleux [Thu, 2 Jun 2016 10:19:59 +0000 (11:19 +0100)]
Move checkpatch options in a configuration file

At the moment, the top Makefile specifies the options to pass to the
checkpatch script in order to check the coding style. The checkpatch
script also supports reading its options from a configuration file
rather than from the command line.

This patch makes use of this feature and moves the checkpatch options
out of the Makefile. This simplifies the Makefile and makes things
clearer.

This patch also adds some more checkpatch options:
  --showfile
  --ignore FILE_PATH_CHANGES
  --ignore AVOID_EXTERNS
  --ignore NEW_TYPEDEFS
  --ignore VOLATILE
The rationale behind each of these options has been documented
in the configuration file.

Change-Id: I423e1abe5670c0f57046cbf705f89a8463898676

8 years agoAllow dynamic overriding of ROTPK verification
Soby Mathew [Tue, 24 May 2016 14:05:15 +0000 (15:05 +0100)]
Allow dynamic overriding of ROTPK verification

A production ROM with TBB enabled must have the ability to boot test software
before a real ROTPK is deployed (e.g. manufacturing mode). Previously the
function plat_get_rotpk_info() must return a valid ROTPK for TBB to succeed.
This patch adds an additional bit `ROTPK_NOT_DEPLOYED` in the output `flags`
parameter from plat_get_rotpk_info(). If this bit is set, then the ROTPK
in certificate is used without verifying against the platform value.

Fixes ARM-software/tf-issues#381

Change-Id: Icbbffab6bff8ed76b72431ee21337f550d8fdbbb

8 years agoMerge pull request #641 from antonio-nino-diaz-arm/an/fvp-set-nv-ctr
danh-arm [Fri, 3 Jun 2016 16:27:45 +0000 (17:27 +0100)]
Merge pull request #641 from antonio-nino-diaz-arm/an/fvp-set-nv-ctr

Implement plat_set_nv_ctr for FVP platforms

8 years agoMerge pull request #640 from sandrine-bailleux-arm/sb/fix-syntax-error
danh-arm [Fri, 3 Jun 2016 16:26:59 +0000 (17:26 +0100)]
Merge pull request #640 from sandrine-bailleux-arm/sb/fix-syntax-error

Fix a syntax error in plat/arm/common/aarch64/arm_common.c

8 years agoMerge pull request #637 from yatharth-arm/yk/genfw-1134
danh-arm [Fri, 3 Jun 2016 14:12:51 +0000 (15:12 +0100)]
Merge pull request #637 from yatharth-arm/yk/genfw-1134

Add support for ARM Cortex-A73 MPCore Processor

8 years agoMerge pull request #636 from soby-mathew/sm/cpu_ctx_rem_aarch32_regs
danh-arm [Fri, 3 Jun 2016 14:12:37 +0000 (15:12 +0100)]
Merge pull request #636 from soby-mathew/sm/cpu_ctx_rem_aarch32_regs

Build option to include AArch32 registers in cpu context

8 years agoFix a syntax error
Sandrine Bailleux [Fri, 3 Jun 2016 14:00:46 +0000 (15:00 +0100)]
Fix a syntax error

Building TF with ERROR_DEPRECATED=1 fails because of a missing
semi-column. This patch fixes this syntax error.

Change-Id: I98515840ce74245b0a0215805f85c8e399094f68

8 years agoMinor libfdt changes to enable TF integration
Dan Handley [Thu, 2 Jun 2016 14:28:23 +0000 (15:28 +0100)]
Minor libfdt changes to enable TF integration

* Move libfdt API headers to include/lib/libfdt
* Add libfdt.mk helper makefile
* Remove unused libfdt files
* Minor changes to fdt.h and libfdt.h to make them C99 compliant

Co-Authored-By: Jens Wiklander <jens.wiklander@linaro.org>
Change-Id: I425842c2b111dcd5fb6908cc698064de4f77220e

8 years agoImport libfdt v1.4.1
Dan Handley [Thu, 2 Jun 2016 13:23:40 +0000 (14:23 +0100)]
Import libfdt v1.4.1

Imports libfdt code from https://git.kernel.org/cgit/utils/dtc/dtc.git
tag "v1.4.1" commit 302fca9f4c283e1994cf0a5a9ce1cf43ca15e6d2.

Change-Id: Ia0d966058beee55a9047e80d8a05bbe4f71d8446

8 years agoExclude more files from checkpatch and checkcodebase
Dan Handley [Thu, 2 Jun 2016 17:21:02 +0000 (18:21 +0100)]
Exclude more files from checkpatch and checkcodebase

Exclude documentation files from the `make checkcodebase` target
(these files were already excluded from checkpatch).

Also exclude libfdt files to prepare for import of this library.

Change-Id: Iee597ed66494de2b11cf84096f771f1f04472d5b

8 years agoMove stdlib header files to include/lib/stdlib
Dan Handley [Thu, 2 Jun 2016 16:15:13 +0000 (17:15 +0100)]
Move stdlib header files to include/lib/stdlib

* Move stdlib header files from include/stdlib to include/lib/stdlib for
  consistency with other library headers.
* Fix checkpatch paths to continue excluding stdlib files.
* Create stdlib.mk to define the stdlib source files and include directories.
* Include stdlib.mk from the top level Makefile.
* Update stdlib header path in the fip_create Makefile.
* Update porting-guide.md with the new paths.

Change-Id: Ia92c2dc572e9efb54a783e306b5ceb2ce24d27fa

8 years agoImplement plat_set_nv_ctr for FVP platforms
Antonio Nino Diaz [Fri, 20 May 2016 13:14:16 +0000 (14:14 +0100)]
Implement plat_set_nv_ctr for FVP platforms

Replaced placeholder implementation of plat_set_nv_ctr for FVP
platforms by a working one.

On FVP, the mapping of region DEVICE2 has been changed from RO to RW
to prevent exceptions when writing to the NV counter, which is
contained in this region.

Change-Id: I56a49631432ce13905572378cbdf106f69c82f57

8 years agoBuild option to include AArch32 registers in cpu context
Soby Mathew [Tue, 17 May 2016 13:01:32 +0000 (14:01 +0100)]
Build option to include AArch32 registers in cpu context

The system registers that are saved and restored in CPU context include
AArch32 systems registers like SPSR_ABT, SPSR_UND, SPSR_IRQ, SPSR_FIQ,
DACR32_EL2, IFSR32_EL2 and FPEXC32_EL2. Accessing these registers on an
AArch64-only (i.e. on hardware that does not implement AArch32, or at
least not at EL1 and higher ELs) platform leads to an exception. This patch
introduces the build option `CTX_INCLUDE_AARCH32_REGS` to specify whether to
include these AArch32 systems registers in the cpu context or not. By default
this build option is set to 1 to ensure compatibility. AArch64-only platforms
must set it to 0. A runtime check is added in BL1 and BL31 cold boot path to
verify this.

Fixes ARM-software/tf-issues#386

Change-Id: I720cdbd7ed7f7d8516635a2ec80d025f478b95ee

8 years agoxlat lib: Remove out-dated comment
Sandrine Bailleux [Tue, 31 May 2016 15:47:29 +0000 (16:47 +0100)]
xlat lib: Remove out-dated comment

As of commit e1ea9290bb, if the attributes of an inner memory region
are different than the outer region, new page tables are generated
regardless of how "restrictive" they are. This patch removes an
out-dated comment still referring to the old priority system based
on which attributes were more restrictive.

Change-Id: Ie7fc1629c90ea91fe50315145f6de2f3995e5e00

8 years agoAdd support for ARM Cortex-A73 MPCore Processor
Yatharth Kochar [Tue, 9 Feb 2016 12:00:03 +0000 (12:00 +0000)]
Add support for ARM Cortex-A73 MPCore Processor

This patch adds ARM Cortex-A73 MPCore Processor support
in the CPU specific operations framework. It also includes
this support for the Base FVP port.

Change-Id: I0e26b594f2ec1d28eb815db9810c682e3885716d

8 years agozynqmp: Remove double ';'
Soren Brinkmann [Sun, 29 May 2016 16:48:44 +0000 (09:48 -0700)]
zynqmp: Remove double ';'

Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
8 years agozynqmp: Fix spelling of endianness
Soren Brinkmann [Sun, 29 May 2016 16:48:26 +0000 (09:48 -0700)]
zynqmp: Fix spelling of endianness

Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
8 years agoMerge pull request #632 from rockchip-linux/support-for-gpio-driver-v2
danh-arm [Fri, 27 May 2016 13:10:42 +0000 (14:10 +0100)]
Merge pull request #632 from rockchip-linux/support-for-gpio-driver-v2

rockchip/rk3399: Support the gpio driver and configure

8 years agoMerge pull request #634 from sandrine-bailleux-arm/sb/exception-vectors
danh-arm [Fri, 27 May 2016 10:11:47 +0000 (11:11 +0100)]
Merge pull request #634 from sandrine-bailleux-arm/sb/exception-vectors

Improve robustness and readability of exception code

8 years agoMerge pull request #633 from soby-mathew/sm/psci_wfi_hook
danh-arm [Fri, 27 May 2016 10:08:45 +0000 (11:08 +0100)]
Merge pull request #633 from soby-mathew/sm/psci_wfi_hook

PSCI: Add pwr_domain_pwr_down_wfi() hook in plat_psci_ops

8 years agoMerge pull request #627 from soby-mathew/sm/fvp_ccn502_sup_1
danh-arm [Fri, 27 May 2016 10:07:20 +0000 (11:07 +0100)]
Merge pull request #627 from soby-mathew/sm/fvp_ccn502_sup_1

Add CCN support to FVP

8 years agorockchip: support system off function for rk3399
Caesar Wang [Wed, 25 May 2016 11:05:19 +0000 (19:05 +0800)]
rockchip: support system off function for rk3399

if define power off gpio, BL31 will do system power off through
gpio control.

8 years agorockchip: support reset SoC through gpio for rk3399
Caesar Wang [Wed, 25 May 2016 11:04:47 +0000 (19:04 +0800)]
rockchip: support reset SoC through gpio for rk3399

If define a reset gpio, BL31 will use gpio to reset SOC,
otherwise use CRU reset.

8 years agorockchip: add reset or power off gpio configuration for rk3399
Caesar Wang [Wed, 25 May 2016 11:03:04 +0000 (19:03 +0800)]
rockchip: add reset or power off gpio configuration for rk3399

We add plat parameter structs to support BL2 to pass variable-length,
variable-type parameters to BL31. The parameters are structured as a
link list. During bl31 setup time, we travse the list to process each
parameter. throuth this way, we can get the reset or power off gpio
parameter, and do hardware control in BL31. This structure also can
pass other parameter to BL31 in future.

8 years agorockchip: support rk3399 gpio driver
Caesar Wang [Wed, 25 May 2016 11:21:43 +0000 (19:21 +0800)]
rockchip: support rk3399 gpio driver

There are 5 groups of GPIO (GPIO0~GPIO4), totally have 122 GPIOs
on rk3399 platform.
The pull direction(pullup or pulldown) for all of GPIOs are
software-programmable.
At the moment, we add the gpio basic driver since reset or power off
the devices from gpio configuration for BL31.

8 years agogpio: support gpio set/get pull status
Caesar Wang [Wed, 25 May 2016 10:48:45 +0000 (18:48 +0800)]
gpio: support gpio set/get pull status

On some platform gpio can set/get pull status when input, add these
function so we can set/get gpio pull status when need it. And they are
optional function.

8 years agoFill exception vectors with zero bytes
Sandrine Bailleux [Tue, 24 May 2016 15:22:59 +0000 (16:22 +0100)]
Fill exception vectors with zero bytes

The documentation of the GNU assembler specifies the following about
the .align assembler directive:
 "the padding bytes are normally zero. However, on some systems, if
 the section is marked as containing code and the fill value is
 omitted, the space is filled with no-op instructions."
(see https://sourceware.org/binutils/docs/as/Align.html)

When building Trusted Firmware, the AArch64 GNU assembler uses a
mix of zero bytes and no-op instructions as the padding bytes to
align exception vectors.

This patch mandates to use zero bytes to be stored in the padding
bytes in the exception vectors. In the AArch64 instruction set, no
valid instruction encodes as zero so this effectively inserts
illegal instructions. Should this code end up being executed for
any reason, it would crash immediately. This gives us an extra
protection against misbehaving code at no extra cost.

Change-Id: I4f2abb39d0320ca0f9d467fc5af0cb92ae297351

8 years agoIntroduce some helper macros for exception vectors
Sandrine Bailleux [Tue, 24 May 2016 15:56:03 +0000 (16:56 +0100)]
Introduce some helper macros for exception vectors

This patch introduces some assembler macros to simplify the
declaration of the exception vectors. It abstracts the section
the exception code is put into as well as the alignments
constraints mandated by the ARMv8 architecture. For all TF images,
the exception code has been updated to make use of these macros.

This patch also updates some invalid comments in the exception
vector code.

Change-Id: I35737b8f1c8c24b6da89b0a954c8152a4096fa95

8 years agozynqmp: PSCI: Wait for FW completing wake requests
Soren Brinkmann [Thu, 19 May 2016 14:20:14 +0000 (07:20 -0700)]
zynqmp: PSCI: Wait for FW completing wake requests

Powering up cores didn't wait for the PMUFW to complete the request,
which could result in cores failing to power up in Linux.

Reported-by: Koteswararao Nayudu <kotin@xilinx.com>
Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
8 years agoPSCI: Add pwr_domain_pwr_down_wfi() hook in plat_psci_ops
Soby Mathew [Wed, 27 Apr 2016 13:46:28 +0000 (14:46 +0100)]
PSCI: Add pwr_domain_pwr_down_wfi() hook in plat_psci_ops

This patch adds a new optional platform hook `pwr_domain_pwr_down_wfi()` in
the plat_psci_ops structure. This hook allows the platform to perform platform
specific actions including the wfi invocation to enter powerdown. This hook
is invoked by both psci_do_cpu_off() and psci_cpu_suspend_start() functions.
The porting-guide.md is also updated for the same.

This patch also modifies the `psci_power_down_wfi()` function to invoke
`plat_panic_handler` incase of panic instead of the busy while loop.

Fixes ARM-Software/tf-issues#375

Change-Id: Iba104469a1445ee8d59fb3a6fdd0a98e7f24dfa3

8 years agoAdd CCN support to FVP platform port
Soby Mathew [Thu, 24 Mar 2016 10:12:42 +0000 (10:12 +0000)]
Add CCN support to FVP platform port

This patch adds support to select CCN driver for FVP during build.
A new build option `FVP_INTERCONNECT_DRIVER` is added to allow
selection between the CCI and CCN driver. Currently only the CCN-502
variant is supported on FVP.

The common ARM CCN platform helper file now verifies the cluster
count declared by platform is equal to the number of root node
masters exported by the ARM Standard platform.

Change-Id: I71d7b4785f8925ed499c153b2e9b9925fcefd57a

8 years agoCCN: Add API to query the PART0 ID from CCN
Soby Mathew [Wed, 23 Mar 2016 17:14:57 +0000 (17:14 +0000)]
CCN: Add API to query the PART0 ID from CCN

This patch adds the API `ccn_get_part0_id` to query the PART0 ID from the
PERIPHERAL_ID 0 register in the CCN driver. This ID allows to distinguish
the variant of CCN present on the system and possibly enable dynamic
configuration of the IP based on the variant. Also added an assert in
`ccn_master_to_rn_id_map()` to ensure that the master map bitfield provided
by the platform is within the expected interface id.

Change-Id: I92d2db7bd93a9be8a7fbe72a522cbcba0aba2d0e

8 years agozynqmp: Ignore the revision field of the IDCODE
Soren Brinkmann [Fri, 20 May 2016 14:05:00 +0000 (07:05 -0700)]
zynqmp: Ignore the revision field of the IDCODE

The revision field may change between silicon revisions without changing
the mapping to a part. This avoids errors like:
  ERROR: Incorrect XILINX IDCODE 0x14738093, maskid 0x4600093
  NOTICE: ATF running on XCZUUNKN/EP108 v3/RTL5.1 at 0xfffe5000
on parts with a newer revision.

Reported-by: Love Kumar <love.kumar@xilinx.com>
Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
Acked-by: Alistair Francis <alistair.francis@xilinx.com>
Tested-by: Love Kumar <love.kumar@xilinx.com>
8 years agozynqmp: Add bakery_lock to protect APU_PWRCTRL register access
Stefan Krsmanovic [Fri, 20 May 2016 13:51:09 +0000 (15:51 +0200)]
zynqmp: Add bakery_lock to protect APU_PWRCTRL register access

Access to APU_PWRCTRL register is protected during suspend/wakeup pocedure
in order to save valid state. If more than one CPU is accessing this register
it can be left in corrupted state during read-modify-write process.

Signed-off-by: Stefan Krsmanovic <stefan.krsmanovic@aggios.com>
Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
8 years agozynqmp: Put pm_secure_lock in coherent memory region
Stefan Krsmanovic [Fri, 20 May 2016 13:51:08 +0000 (15:51 +0200)]
zynqmp: Put pm_secure_lock in coherent memory region

DEFINE_BAKERY_LOCK() macro is used to put lock in coherent memory region.
ARM Trusted Firmware design guide, chapter 11 states that bakery_lock data
structures should be allocated in coherent memory region because it is
accessed by multiple CPUs with mismatched shareability, cacheability and
memory attributes.

Signed-off-by: Stefan Krsmanovic <stefan.krsmanovic@aggios.com>
Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
8 years agozynqmp: pm: Implement pm_register_notifier PM API function
Anes Hadziahmetagic [Thu, 12 May 2016 14:17:34 +0000 (16:17 +0200)]
zynqmp: pm: Implement pm_register_notifier PM API function

Signed-off-by: Anes Hadziahmetagic <anes.hadziahmetagic@aggios.com>
Signed-off-by: Filip Drazic <filip.drazic@aggios.com>
Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
8 years agozynqmp: pm: Implemented 'get_op_characteristic' PM API call
Anes Hadziahmetagic [Thu, 12 May 2016 14:17:30 +0000 (16:17 +0200)]
zynqmp: pm: Implemented 'get_op_characteristic' PM API call

Signed-off-by: Anes Hadziahmetagic <anes.hadziahmetagic@aggios.com>
Signed-off-by: Filip Drazic <filip.drazic@aggios.com>
Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
8 years agozynqmp: pm: Removed double declaration of pm_ipi_send functions
Filip Drazic [Thu, 12 May 2016 14:17:31 +0000 (16:17 +0200)]
zynqmp: pm: Removed double declaration of pm_ipi_send functions

Functions pm_ipi_send and pm_ipi_send_sync are declared in pm_ipi.h

Signed-off-by: Filip Drazic <filip.drazic@aggios.com>
Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
8 years agozynqmp: Reduce mapped memory area
Soren Brinkmann [Fri, 22 Apr 2016 17:02:46 +0000 (10:02 -0700)]
zynqmp: Reduce mapped memory area

The GIC area is specified larger than it needs to be and can be reduced.
Which allows reducing the structures required for the translation tables
as well.
This results in a reduction of memory footprint of ca. 4k.

Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
Acked-by: Michal Simek <michal.simek@xilinx.com>
8 years agoMerge pull request #625 from antonio-nino-diaz-arm/an/delay-timer-v2
danh-arm [Tue, 24 May 2016 15:12:08 +0000 (16:12 +0100)]
Merge pull request #625 from antonio-nino-diaz-arm/an/delay-timer-v2

Implement generic delay timer and use it on platforms

8 years agoReplace Rockchip delay timer by generic one
Antonio Nino Diaz [Thu, 5 May 2016 14:25:02 +0000 (15:25 +0100)]
Replace Rockchip delay timer by generic one

Use the generic delay timer instead of having a specific platform
file for configuring it.

Change-Id: Ifa68b9c97cd96ae1190cee74d22d729af95e4537

8 years agoReplace MediaTek delay timer by generic one
Antonio Nino Diaz [Thu, 5 May 2016 14:23:56 +0000 (15:23 +0100)]
Replace MediaTek delay timer by generic one

Use the generic delay timer instead of having a specific platform
file for configuring it.

Change-Id: If6b8f60bc04230f4b85b2bcc1b670fc65461214e

8 years agoReplace SP804 timer by generic delay timer on FVP
Antonio Nino Diaz [Tue, 17 May 2016 08:48:10 +0000 (09:48 +0100)]
Replace SP804 timer by generic delay timer on FVP

Added a build flag to select the generic delay timer on FVP instead
of the SP804 timer. By default, the generic one will be selected. The
user guide has been updated.

Change-Id: Ica34425c6d4ed95a187b529c612f6d3b26b78bc6

8 years agoImplement generic delay timer
Antonio Nino Diaz [Wed, 18 May 2016 09:37:25 +0000 (10:37 +0100)]
Implement generic delay timer

Add delay timer implementation based on the system generic counter.
This either uses the platform's implementation of
`plat_get_syscnt_freq()` or explicit clock multiplier/divider values
provided by the platform.

The current implementation of udelay has been modified to avoid
unnecessary calculations while waiting on the loop and to make it
easier to check for overflows.

Change-Id: I9062e1d506dc2f68367fd9289250b93444721732

8 years agoImplement plat_get_syscnt_freq2 on platforms
Antonio Nino Diaz [Thu, 19 May 2016 09:00:28 +0000 (10:00 +0100)]
Implement plat_get_syscnt_freq2 on platforms

Replaced plat_get_syscnt_freq by plat_get_syscnt_freq2 on all
upstream platforms.

Change-Id: I3248f3f65a16dc5e9720012a05c35b9e3ba6abbe

8 years agoAdd 32 bit version of plat_get_syscnt_freq
Antonio Nino Diaz [Wed, 18 May 2016 15:53:31 +0000 (16:53 +0100)]
Add 32 bit version of plat_get_syscnt_freq

Added plat_get_syscnt_freq2, which is a 32 bit variant of the 64 bit
plat_get_syscnt_freq. The old one has been flagged as deprecated.
Common code has been updated to use this new version. Porting guide
has been updated.

Change-Id: I9e913544926c418970972bfe7d81ee88b4da837e

8 years agoBring IO storage dummy driver
Gerald Lejeune [Tue, 21 Jul 2015 12:15:12 +0000 (14:15 +0200)]
Bring IO storage dummy driver

Allow to handle cases where some images are pre-loaded (by debugger for
instance) without introducing many switches in files calling load_* functions.

Fixes: arm-software/tf-issues#398
Signed-off-by: Gerald Lejeune <gerald.lejeune@st.com>
8 years agoMerge pull request #622 from mtk09422/hw-crypt-v3
danh-arm [Thu, 12 May 2016 14:04:44 +0000 (15:04 +0100)]
Merge pull request #622 from mtk09422/hw-crypt-v3

Hw crypt v3

8 years agoMT8173: Add Sip function for MTK HW crypt driver
Yi Zheng [Wed, 11 May 2016 10:45:20 +0000 (18:45 +0800)]
MT8173: Add Sip function for MTK HW crypt driver

Change-Id: Idc40cc6243e532567ec4334ae37d97c003c90bfa
Signed-off-by: Yi Zheng <yi.zheng@mediatek.com>
8 years agomt8173: Reorganize plat SiP functions
Jimmy Huang [Wed, 11 May 2016 10:04:09 +0000 (18:04 +0800)]
mt8173: Reorganize plat SiP functions

Due to the changes in Mediatek platform common code, we need to move
plat related SiP functions to plat folder.

Change-Id: I6b14b988235205a5858b4bf49043bc79d0512b06
Signed-off-by: Jimmy Huang <jimmy.huang@mediatek.com>
8 years agoMerge pull request #619 from sandrine-bailleux-arm/sb/rockchip-assertions
danh-arm [Wed, 11 May 2016 09:56:25 +0000 (10:56 +0100)]
Merge pull request #619 from sandrine-bailleux-arm/sb/rockchip-assertions

Rockchip: Add some debug assertions in the PMU driver

8 years agoRockchip: Add some debug assertions in the PMU driver
Sandrine Bailleux [Thu, 5 May 2016 09:04:15 +0000 (10:04 +0100)]
Rockchip: Add some debug assertions in the PMU driver

This patch adds some debug assertions ensuring that array indices
are within the bounds of the array.

Change-Id: I96ee81d14834c1e92cdfb7e60b49995cdacfd93a

8 years agoMerge pull request #618 from rockchip-linux/fixes-for-suspend/resume
danh-arm [Wed, 4 May 2016 16:10:31 +0000 (17:10 +0100)]
Merge pull request #618 from rockchip-linux/fixes-for-suspend/resume

rockchip: support the suspend/resume for rk3399

8 years agoMerge pull request #617 from leon-chen-mtk/refactor_common_1
danh-arm [Wed, 4 May 2016 12:47:49 +0000 (13:47 +0100)]
Merge pull request #617 from leon-chen-mtk/refactor_common_1

Refactor MediaTek platform common code

8 years agorockchip: support the suspend/resume for rk3399
Caesar Wang [Sun, 10 Apr 2016 06:11:07 +0000 (14:11 +0800)]
rockchip: support the suspend/resume for rk3399

This patch adds to support the suspend/resume for rk3399 SoCs.

Signed-off-by: Shengfei xu <xsf@rock-chips.com>
Signed-off-by: Caesar Wang <wxt@rock-chips.com>
8 years agoMerge pull request #614 from soby-mathew/sm/rem_fvp_ve_memmap
danh-arm [Wed, 4 May 2016 09:32:41 +0000 (10:32 +0100)]
Merge pull request #614 from soby-mathew/sm/rem_fvp_ve_memmap

FVP: Remove VE memory map support and change default GIC driver

8 years agoRefactor MediaTek platform common code
Leon Chen [Thu, 28 Apr 2016 06:07:42 +0000 (14:07 +0800)]
Refactor MediaTek platform common code

Refactor MediaTek platform common code for further mt6795 upstream.

8 years agoChange the default driver to GICv3 in FVP
Soby Mathew [Thu, 7 Apr 2016 16:40:04 +0000 (17:40 +0100)]
Change the default driver to GICv3 in FVP

This patch changes the default driver for FVP platform from the deprecated
GICv3 legacy to the GICv3 only driver. This means that the default build of
Trusted Firmware will not be able boot Linux kernel with GICv2 FDT blob. The
user guide is also updated to reflect this change of default GIC driver for
FVP.

Change-Id: Id6fc8c1ac16ad633dabb3cd189b690415a047764

8 years agoRemove support for legacy VE memory map in FVP
Soby Mathew [Wed, 13 Jan 2016 17:06:00 +0000 (17:06 +0000)]
Remove support for legacy VE memory map in FVP

This patch removes support for legacy Versatile Express memory map for the
GIC peripheral in the FVP platform. The user guide is also updated for the
same.

Change-Id: Ib8cfb819083aca359e5b46b5757cb56cb0ea6533

8 years agoMerge pull request #597 from hzhuang1/emmc_v3.2
danh-arm [Wed, 27 Apr 2016 11:31:23 +0000 (12:31 +0100)]
Merge pull request #597 from hzhuang1/emmc_v3.2

Emmc v3

8 years agodrivers: add emmc stack
Haojian Zhuang [Fri, 18 Mar 2016 14:08:26 +0000 (22:08 +0800)]
drivers: add emmc stack

In a lot of embedded platforms, eMMC device is the only one storage
device. So loading content from eMMC device is required in ATF.

Create the emmc stack that could co-work with IO block driver.
Support to read/write/erase eMMC blocks on both rpmb and normal
user area. Support to change the IO speed and bus width.

Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
8 years agoDocument: add MAX_IO_BLOCK_DEVICES platform macro
Haojian Zhuang [Thu, 21 Apr 2016 02:52:52 +0000 (10:52 +0800)]
Document: add MAX_IO_BLOCK_DEVICES platform macro

Add MAX_IO_BLOCK_DEVICES in porting guide. It's necessary to define
this macro to support io block device. With this macro, multiple
block devices could be opened at the same time. Each block device
stores its own state.

Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
8 years agoIO: support block device type
Haojian Zhuang [Fri, 18 Mar 2016 07:14:19 +0000 (15:14 +0800)]
IO: support block device type

FIP is accessed as memory-mapped type. eMMC is block device type.
In order to support FIP based on eMMC, add the new io_block layer.

io_block always access eMMC device as block size. And it'll only
copy the required data into buffer in io_block driver. So preparing
an temporary buffer is required.

When use io_block device, MAX_IO_BLOCK_DEVICES should be declared
in platform_def.h. It's used to support multiple block devices.

Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
8 years agoMerge pull request #612 from sandrine-bailleux-arm/sb/fix-xlat-lib-path
danh-arm [Wed, 27 Apr 2016 08:58:56 +0000 (09:58 +0100)]
Merge pull request #612 from sandrine-bailleux-arm/sb/fix-xlat-lib-path

Doc: Fix the path to the xlat lib

8 years agoMerge pull request #610 from bjackman/bj/fip-create-exit-code
danh-arm [Wed, 27 Apr 2016 08:40:05 +0000 (09:40 +0100)]
Merge pull request #610 from bjackman/bj/fip-create-exit-code

fip_create: Fix exit status for missing output filename (2)

8 years agoMerge pull request #611 from sandrine-bailleux-arm/sb/fix-init_xlation_table_inner
danh-arm [Wed, 27 Apr 2016 08:38:40 +0000 (09:38 +0100)]
Merge pull request #611 from sandrine-bailleux-arm/sb/fix-init_xlation_table_inner

Fix computation of L1 bitmask in the translation table lib

8 years agoDoc: Fix the path to the xlat lib
Sandrine Bailleux [Tue, 26 Apr 2016 13:49:57 +0000 (14:49 +0100)]
Doc: Fix the path to the xlat lib

The translation table library code has moved from lib/aarch64/ to
lib/xlat_tables/ since commit 3ca9928df but the Porting Guide still
points to the old location. This patch fixes this issue.

Change-Id: I983a9a100d70eacf6bac71725ffbb4bb5f3732b0

8 years agofip_create: Fix exit status for missing output filename
Brendan Jackman [Mon, 25 Apr 2016 07:35:35 +0000 (15:35 +0800)]
fip_create: Fix exit status for missing output filename

Change-Id: I0d298eea9eaf47121c87637c7395e5d9868aa272

8 years agoFix computation of L1 bitmask in the translation table lib
Sandrine Bailleux [Fri, 22 Apr 2016 09:47:33 +0000 (10:47 +0100)]
Fix computation of L1 bitmask in the translation table lib

This patch fixes the computation of the bitmask used to isolate
the level 1 field of a virtual address. The whole computation needs
to work on 64-bit values to produce the correct bitmask value.
XLAT_TABLE_ENTRIES_MASK being a C constant, it is a 32-bit value
so it needs to be extended to a 64-bit value before it takes part
in any other computation.

This patch fixes this bug by casting XLAT_TABLE_ENTRIES_MASK as
an unsigned long long.

Note that this bug doesn't manifest itself in practice because
address spaces larger than 39 bits are not yet supported in the
Trusted Firmware.

Change-Id: I955fd263ecb691ca94b29b9c9f576008ce1d87ee

8 years agoMerge pull request #605 from yatharth-arm/yk/sys_counter_fix
danh-arm [Tue, 26 Apr 2016 13:58:57 +0000 (14:58 +0100)]
Merge pull request #605 from yatharth-arm/yk/sys_counter_fix

Conditionally compile `plat_get_syscnt_freq()` in ARM standard platforms

8 years agoConditionally compile `plat_get_syscnt_freq()` in ARM standard platforms
Yatharth Kochar [Tue, 26 Apr 2016 09:36:29 +0000 (10:36 +0100)]
Conditionally compile `plat_get_syscnt_freq()` in ARM standard platforms

This patch puts the definition of `plat_get_syscnt_freq()`
under `#ifdef ARM_SYS_CNTCTL_BASE` in arm_common.c file.
This is the fix for compilation error introduced by commit-id
`749ade4`, for platforms that use arm_common.c but do not
provide a memory mapped interface to the generic counter.

Fixes ARM-software/tf-issues#395

Change-Id: I2f2b10bd9500fa15308541ccb15829306a76a745

8 years agozynqmp: FSBL->ATF handover
Michal Simek [Mon, 15 Jun 2015 12:22:50 +0000 (14:22 +0200)]
zynqmp: FSBL->ATF handover

Parse the parameter structure the FSBL populates, to populate the bl32
and bl33 image structures.

Cc: Sarat Chand Savitala <saratcha@xilinx.com>
Cc: petalinux-dev@xilinx.com
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
[ SB
 - pass pointers to structs instead of structs
 - handle execution state parameter
 - populate bl32 SPSR
 - add documentation
 - query bootmode and consider missing handoff parameters an error when
   not in JTAG boot mode
]
Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
8 years agozynqmp: Introduce zynqmp_get_bootmode
Soren Brinkmann [Mon, 18 Apr 2016 18:49:42 +0000 (11:49 -0700)]
zynqmp: Introduce zynqmp_get_bootmode

Provide a function to retrieve the bootmode.

Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
Acked-by: Michal Simek <michal.simek@xilinx.com>