summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2016-03-11Merge pull request #542 from sandrine-bailleux-arm/km/pt-zerodanh-arm
Initialize all translation table entries
2016-03-11Merge pull request #538 from sandrine-bailleux-arm/sb/extend-memory-typesdanh-arm
Extend memory attributes to map non-cacheable memory
2016-03-09Merge pull request #541 from antonio-nino-diaz-arm/an/secondary-cpu-initdanh-arm
Initialize secondary CPUs during cold boot
2016-03-09Merge pull request #540 from antonio-nino-diaz-arm/an/porting_guidedanh-arm
Porting guide: Clarify API that don't follow AAPCS
2016-03-09Merge pull request #539 from antonio-nino-diaz-arm/an/fix-std-compilationdanh-arm
Compile stdlib C files individually
2016-03-07Initialize secondary CPUs during cold bootAntonio Nino Diaz
The previous reset code in BL1 performed the following steps in order: 1. Warm/Cold boot detection. If it's a warm boot, jump to warm boot entrypoint. 2. Primary/Secondary CPU detection. If it's a secondary CPU, jump to plat_secondary_cold_boot_setup(), which doesn't return. 3. CPU initialisations (cache, TLB...). 4. Memory and C runtime initialization. For a secondary CPU, steps 3 and 4 are never reached. This shouldn't be a problem in most cases, since current implementations of plat_secondary_cold_boot_setup() either panic or power down the secondary CPUs. The main concern is the lack of secondary CPU initialization when bare metal EL3 payloads are used in case they don't take care of this initialisation themselves. This patch moves the detection of primary/secondary CPU after step 3 so that the CPU initialisations are performed per-CPU, while the memory and the C runtime initialisation are only performed on the primary CPU. The diagrams used in the ARM Trusted Firmware Reset Design documentation file have been updated to reflect the new boot flow. Platforms ports might be affected by this patch depending on the behaviour of plat_secondary_cold_boot_setup(), as the state of the platform when entering this function will be different. Fixes ARM-software/tf-issues#342 Change-Id: Icbf4a0ee2a3e5b856030064472f9fa6696f2eb9e
2016-03-07Porting guide: Clarify API that don't follow AAPCSAntonio Nino Diaz
This patch clarifies a porting API in the Porting Guide that do not follow the ARM Architecture Program Calling Standards (AAPCS). The list of registers that are allowed to be clobbered by this API has been updated in the Porting Guide. Fixes ARM-software/tf-issues#259 Change-Id: Ibf2adda2e1fb3e9b8f53d8a918d5998356eb8fce
2016-03-07Initialize all translation table entriesKristina Martsenko
The current translation table code maps in a series of regions, zeroing the unmapped table entries before and in between the mapped regions. It doesn't, however, zero the unmapped entries after the last mapped region, leaving those entries at whatever value that memory has initially. This is bad because those values can look like valid translation table entries, pointing to valid physical addresses. The CPU is allowed to do speculative reads from any such addresses. If the addresses point to device memory, the results can be unpredictable. This patch zeroes the translation table entries following the last mapped region, ensuring all table entries are either valid or zero (invalid). In addition, it limits the value of ADDR_SPACE_SIZE to those allowed by the architecture and supported by the current code (see D4.2.5 in the Architecture Reference Manual). This simplifies this patch a lot and ensures existing code doesn't do unexpected things. Change-Id: Ic28b6c3f89d73ef58fa80319a9466bb2c7131c21
2016-03-03Extend memory attributes to map non-cacheable memorySandrine Bailleux
At the moment, the memory translation library allows to create memory mappings of 2 types: - Device nGnRE memory (named MT_DEVICE in the library); - Normal, Inner Write-back non-transient, Outer Write-back non-transient memory (named MT_MEMORY in the library). As a consequence, the library code treats the memory type field as a boolean: everything that is not device memory is normal memory and vice-versa. In reality, the ARMv8 architecture allows up to 8 types of memory to be used at a single time for a given exception level. This patch reworks the memory attributes such that the memory type is now defined as an integer ranging from 0 to 7 instead of a boolean. This makes it possible to extend the list of memory types supported by the memory translation library. The priority system dictating memory attributes for overlapping memory regions has been extended to cope with these changes but the algorithm at its core has been preserved. When a memory region is re-mapped with different memory attributes, the memory translation library examines the former attributes and updates them only if the new attributes create a more restrictive mapping. This behaviour is unchanged, only the manipulation of the value has been modified to cope with the new format. This patch also introduces a new type of memory mapping in the memory translation library: MT_NON_CACHEABLE, meaning Normal, Inner Non-cacheable, Outer Non-cacheable memory. This can be useful to map a non-cacheable memory region, such as a DMA buffer for example. The rules around the Execute-Never (XN) bit in a translation table for an MT_NON_CACHEABLE memory mapping have been aligned on the rules used for MT_MEMORY mappings: - If the memory is read-only then it is also executable (XN = 0); - If the memory is read-write then it is not executable (XN = 1). The shareability field for MT_NON_CACHEABLE mappings is always set as 'Outer-Shareable'. Note that this is not strictly needed since shareability is only relevant if the memory is a Normal Cacheable memory type, but this is to align with the existing device memory mappings setup. All Device and Normal Non-cacheable memory regions are always treated as Outer Shareable, regardless of the translation table shareability attributes. This patch also removes the 'ATTR_SO' and 'ATTR_SO_INDEX' #defines. They were introduced to map memory as Device nGnRnE (formerly called "Strongly-Ordered" memory in the ARMv7 architecture) but were not used anywhere in the code base. Removing them avoids any confusion about the memory types supported by the library. Upstream platforms do not currently use the MT_NON_CACHEABLE memory type. NOTE: THIS CHANGE IS SOURCE COMPATIBLE BUT PLATFORMS THAT RELY ON THE BINARY VALUES OF `mmap_attr_t` or the `attr` argument of `mmap_add_region()` MAY BE BROKEN. Change-Id: I717d6ed79b4c845a04e34132432f98b93d661d79
2016-02-26Compile stdlib C files individuallyAntonio Nino Diaz
All C files of stdlib were included into std.c, which was the file that the Makefile actually compiled. This is a poor way of compiling all the files and, while it may work fine most times, it's discouraged. In this particular case, each C file included its own headers, which were later included into std.c. For example, this caused problems because a duplicated typedef of u_short in both subr_prf.c and types.h. While that may require an issue on its own, this kind of problems are avoided if all C files are as independent as possible. Change-Id: I9a7833fd2933003f19a5d7db921ed8542ea2d04a
2016-02-26Merge pull request #533 from yatharth-arm/yk/genfw-1292danh-arm
Fix the inconsistencies in bl1_tbbr_image_descs[]
2016-02-26Merge pull request #534 from jcastillo-arm/jc/fix_pl011danh-arm
Fix potential deadlock in PL011 init function
2016-02-24Fix potential deadlock in PL011 init functionJuan Castillo
The PL011 initialization function disables the UART, flushes the FIFO and waits for the current character to be transmitted before applying the configuration and enabling the UART. This waiting might result in a deadlock if the FIFO is disabled while another CPU is printing a message since the flush of FIFO will never finish. This patch fixes the problem by removing the flush operation and the loop for last character completion from the initialization function. The UART is disabled, configured and enabled again. Change-Id: I1ca0b6bd9f352c12856f10f174a9f6eaca3ab4ea
2016-02-22Fix the inconsistencies in bl1_tbbr_image_descs[]Yatharth Kochar
This patch fixes inconsistencies in bl1_tbbr_image_descs[] and miscellaneous fixes in Firmware Update code. Following are the changes: * As part of the original FWU changes, a `copied_size` field was added to `image_info_t`. This was a subtle binary compatibility break because it changed the size of the `bl31_params_t` struct, which could cause problems if somebody used different versions of BL2 or BL31, one with the old `image_info_t` and one with the new version. This patch put the `copied_size` within the `image_desc_t`. * EXECUTABLE flag is now stored in `ep_info.h.attr` in place of `image_info.h.attr`, associating it to an entrypoint. * The `image_info.image_base` is only relevant for secure images that are copied from non-secure memory into secure memory. This patch removes initializing `image_base` for non secure images in the bl1_tbbr_image_descs[]. * A new macro `SET_STATIC_PARAM_HEAD` is added for populating bl1_tbbr_image_descs[].ep_info/image_info.h members statically. The version, image_type and image attributes are now populated using this new macro. * Added PLAT_ARM_NVM_BASE and PLAT_ARM_NVM_SIZE to avoid direct usage of V2M_FLASH0_XXX in plat/arm/common/arm_bl1_fwu.c. * Refactoring of code/macros related to SECURE and EXECUTABLE flags. NOTE: PLATFORM PORTS THAT RELY ON THE SIZE OF `image_info_t` OR USE the "EXECUTABLE" BIT WITHIN `image_info_t.h.attr` OR USE THEIR OWN `image_desc_t` ARRAY IN BL1, MAY BE BROKEN BY THIS CHANGE. THIS IS CONSIDERED UNLIKELY. Change-Id: Id4e5989af7bf0ed263d19d3751939da1169b561d
2016-02-22Merge pull request #532 from soby-mathew/vk/configure_mmap_macrosdanh-arm
Rationalise MMU and Page table related constants on ARM platforms
2016-02-22Rationalise MMU and Page table related constants on ARM platformsVikram Kanigiri
`board_arm_def.h` contains multiple definitions of `PLAT_ARM_MMAP_ENTRIES` and `MAX_XLAT_TABLES` that are optimised for memory usage depending upon the chosen build configuration. To ease maintenance of these constants, this patch replaces their multiple definitions with a single set of definitions that will work on all ARM platforms. Platforms can override the defaults with optimal values by enabling the `ARM_BOARD_OPTIMISE_MMAP` build option. An example has been provided in the Juno ADP port. Additionally, `PLAT_ARM_MMAP_ENTRIES` is increased by one to accomodate future ARM platforms. Change-Id: I5ba6490fdd1e118cc9cc2d988ad7e9c38492b6f0
2016-02-22Merge pull request #518 from hzhuang1/pl061_gpio_v5danh-arm
Pl061 gpio v5
2016-02-19Merge pull request #525 from antonio-nino-diaz-arm/an/fix-gpio-includesdanh-arm
Fix gpio includes of mt8173 platform to avoid collision.
2016-02-19Merge pull request #531 from soby-mathew/sm/multicluster_fvpdanh-arm
Allow multi cluster topology definitions for ARM platforms
2016-02-19Allow multi cluster topology definitions for ARM platformsSoby Mathew
The common topology description helper funtions and macros for ARM Standard platforms assumed a dual cluster system. This is not flexible enough to scale to multi cluster platforms. This patch does the following changes for more flexibility in defining topology: 1. The `plat_get_power_domain_tree_desc()` definition is moved from `arm_topology.c` to platform specific files, that is `fvp_topology.c` and `juno_topology.c`. Similarly the common definition of the porting macro `PLATFORM_CORE_COUNT` in `arm_def.h` is moved to platform specific `platform_def.h` header. 2. The ARM common layer porting macros which were dual cluster specific are now removed and a new macro PLAT_ARM_CLUSTER_COUNT is introduced which must be defined by each ARM standard platform. 3. A new mandatory ARM common layer porting API `plat_arm_get_cluster_core_count()` is introduced to enable the common implementation of `arm_check_mpidr()` to validate MPIDR. 4. For the FVP platforms, a new build option `FVP_NUM_CLUSTERS` has been introduced which allows the user to specify the cluster count to be used to build the topology tree within Trusted Firmare. This enables Trusted Firmware to be built for multi cluster FVP models. Change-Id: Ie7a2e38e5661fe2fdb2c8fdf5641d2b2614c2b6b
2016-02-18Merge pull request #523 from jcastillo-arm/jc/genfw-791danh-arm
ARM platforms: rationalise memory attributes of shared memory
2016-02-18Merge pull request #530 from antonio-nino-diaz-arm/an/p_printfdanh-arm
Add support for %p in tf_printf()
2016-02-18Merge pull request #529 from sandrine-bailleux/sb/a57-sw-optim-refdanh-arm
Cortex-A57: Add link to software optimization guide
2016-02-18Merge pull request #528 from antonio-nino-diaz-arm/an/user_guidedanh-arm
Move up FVP versions in the user guide
2016-02-18Merge pull request #527 from antonio-nino-diaz-arm/an/non_asciidanh-arm
Remove non-ASCII character from comment
2016-02-18Merge pull request #526 from antonio-nino-diaz-arm/an/missing_docdanh-arm
Add missing build options to the User Guide
2016-02-18Merge pull request #524 from jcastillo-arm/jc/tf-issues/319danh-arm
Improve memory layout documentation
2016-02-18Cortex-A57: Add link to software optimization guideSandrine Bailleux
This patch adds a link to the Cortex-A57 Software Optimization Guide in the ARM CPU Specific Build Macros document to justify the default value of the A57_DISABLE_NON_TEMPORAL_HINT build flag. Change-Id: I9779e42a4bb118442b2b64717ce143314ec9dd16
2016-02-18Add support for %p in tf_printf()Antonio Nino Diaz
This patch adds support for the `%p` format specifier in tf_printf() following the example of the printf implementation of the stdlib used in the trusted firmware. Fixes ARM-software/tf-issues#292 Change-Id: I0b3230c783f735d3e039be25a9405f00023420da
2016-02-18ARM platforms: rationalise memory attributes of shared memoryJuan Castillo
The shared memory region on ARM platforms contains the mailboxes and, on Juno, the payload area for communication with the SCP. This shared memory may be configured as normal memory or device memory at build time by setting the platform flag 'PLAT_ARM_SHARED_RAM_CACHED' (on Juno, the value of this flag is defined by 'MHU_PAYLOAD_CACHED'). When set as normal memory, the platform port performs the corresponding cache maintenance operations. From a functional point of view, this is the equivalent of setting the shared memory as device memory, so there is no need to maintain both options. This patch removes the option to specify the shared memory as normal memory on ARM platforms. Shared memory is always treated as device memory. Cache maintenance operations are no longer needed and have been replaced by data memory barriers to guarantee that payload and MHU are accessed in the right order. Change-Id: I7f958621d6a536dd4f0fa8768385eedc4295e79f
2016-02-17Fix gpio includes of mt8173 platform to avoid collision.Antonio Nino Diaz
All files including plat/mediatek/mt8173/drivers/gpio/gpio.h were using system includes instead of user includes, which may cause the wrong version of the header to be included. Said includes have been changed to user includes to make sure that the included file is the wanted one. Change-Id: I29bdfe96fbd9a7900875e2357bbb43f3ea431fa5
2016-02-17Add missing build options to the User GuideAntonio Nino Diaz
The folowing build options were missing from the User Guide and have been documented: - CTX_INCLUDE_FPREGS - DISABLE_PEDANTIC - BUILD_STRING - VERSION_STRING - BUILD_MESSAGE_TIMESTAMP Change-Id: I6a9c39ff52cad8ff04deff3ac197af84d437b8b7
2016-02-17Merge pull request #522 from danh-arm/vk/rework-interconnect-driversdanh-arm
Rework use of interconnect drivers
2016-02-16Rework use of interconnect driversVikram Kanigiri
ARM Trusted Firmware supports 2 different interconnect peripheral drivers: CCI and CCN. ARM platforms are implemented using either of the interconnect peripherals. This patch adds a layer of abstraction to help ARM platform ports to choose the right interconnect driver and corresponding platform support. This is as described below: 1. A set of ARM common functions have been implemented to initialise an interconnect and for entering/exiting a cluster from coherency. These functions are prefixed as "plat_arm_interconnect_". Weak definitions of these functions have been provided for each type of driver. 2.`plat_print_interconnect_regs` macro used for printing CCI registers is moved from a common arm_macros.S to cci_macros.S. 3. The `ARM_CONFIG_HAS_CCI` flag used in `arm_config_flags` structure is renamed to `ARM_CONFIG_HAS_INTERCONNECT`. Change-Id: I02f31184fbf79b784175892d5ce1161b65a0066c
2016-02-16Merge pull request #521 from vikramkanigiri/vk/rearchitect_securitydanh-arm
Perform security setup separately for each ARM platform
2016-02-16Merge pull request #520 from vikramkanigiri/vk/scp_flexibilitydanh-arm
Vk/scp flexibility
2016-02-16Merge pull request #519 from vikramkanigiri/vk/misc_plat_reorgdanh-arm
Vk/misc plat reorg
2016-02-16Make SCP_BL2(U) image loading configurable on CSS platformsVikram Kanigiri
Current code mandates loading of SCP_BL2/SCP_BL2U images for all CSS platforms. On future ARM CSS platforms, the Application Processor (AP) might not need to load these images. So, these items can be removed from the FIP on those platforms. BL2 tries to load SCP_BL2/SCP_BL2U images if their base addresses are defined causing boot error if the images are not found in FIP. This change adds a make flag `CSS_LOAD_SCP_IMAGES` which if set to `1` does: 1. Adds SCP_BL2, SCP_BL2U images to FIP. 2. Defines the base addresses of these images so that AP loads them. And vice-versa if it is set to `0`. The default value is set to `1`. Change-Id: I5abfe22d5dc1e9d80d7809acefc87b42a462204a
2016-02-15Perform security setup separately for each ARM platformVikram Kanigiri
Prior to this patch, it was assumed that on all ARM platforms the bare minimal security setup required is to program TrustZone protection. This would always be done by programming the TZC-400 which was assumed to be present in all ARM platforms. The weak definition of platform_arm_security_setup() in plat/arm/common/arm_security.c reflected these assumptions. In reality, each ARM platform either decides at runtime whether TrustZone protection needs to be programmed (e.g. FVPs) or performs some security setup in addition to programming TrustZone protection (e.g. NIC setup on Juno). As a result, the weak definition of plat_arm_security_setup() is always overridden. When a platform needs to program TrustZone protection and implements the TZC-400 peripheral, it uses the arm_tzc_setup() function to do so. It is also possible to program TrustZone protection through other peripherals that include a TrustZone controller e.g. DMC-500. The programmer's interface is slightly different across these various peripherals. In order to satisfy the above requirements, this patch makes the following changes to the way security setup is done on ARM platforms. 1. arm_security.c retains the definition of arm_tzc_setup() and has been renamed to arm_tzc400.c. This is to reflect the reliance on the TZC-400 peripheral to perform TrustZone programming. The new file is not automatically included in all platform ports through arm_common.mk. Each platform must include it explicitly in a platform specific makefile if needed. This approach enables introduction of similar library code to program TrustZone protection using a different peripheral. This code would be used by the subset of ARM platforms that implement this peripheral. 2. Due to #1 above, existing platforms which implements the TZC-400 have been updated to include the necessary files for both BL2, BL2U and BL31 images. Change-Id: I513c58f7a19fff2e9e9c3b95721592095bcb2735
2016-02-15Support for varying BOM/SCPI protocol base addresses in ARM platformsVikram Kanigiri
Current code assumes `SCP_COM_SHARED_MEM_BASE` as the base address for BOM/SCPI protocol between AP<->SCP on all CSS platforms. To cater for future ARM platforms this is made platform specific. Similarly, the bit shifts of `SCP_BOOT_CONFIG_ADDR` are also made platform specific. Change-Id: Ie8866c167abf0229a37b3c72576917f085c142e8
2016-02-15Add API to return memory map on ARM platformsVikram Kanigiri
Functions to configure the MMU in S-EL1 and EL3 on ARM platforms expect each platform to export its memory map in the `plat_arm_mmap` data structure. This approach does not scale well in case the memory map cannot be determined until runtime. To cater for this possibility, this patch introduces the plat_arm_get_mmap() API. It returns a reference to the `plat_arm_mmap` by default but can be overridden by a platform if required. Change-Id: Idae6ad8fdf40cdddcd8b992abc188455fa047c74
2016-02-12Document: add PLAT_PL061_MAX_GPIOS defineHaojian Zhuang
ARM PL061 GPIO driver requires the "PLAT_PL061_MAX_GPIOS" definition. By default, it's defined to 32 in PL061 GPIO driver. If user wants more PL061 controllers in platform, user should define the build flag in platform.mk instead. Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
2016-02-12arm: gpio: add pl061 driverHaojian Zhuang
Add PL061 GPIO driver that is depend on gpio framework. Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
2016-02-12gpio: add gpio frameworkHaojian Zhuang
Define the gpio ops in gpio driver. Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
2016-02-11Add support for SSC_VERSION register on CSS platformsVikram Kanigiri
Each ARM Compute Subsystem based platform implements a System Security Control (SSC) Registers Unit. The SSC_VERSION register inside it carries information to identify the platform. This enables ARM Trusted Firmware to compile in support for multiple ARM platforms and choose one at runtime. This patch adds macros to enable access to this register. Each platform is expected to export its PART_NUMBER separately. Additionally, it also adds juno part number. Change-Id: I2b1d5f5b65a9c7b76c6f64480cc7cf0aef019422
2016-02-11Re-factor definition of some macros on ARM platformsVikram Kanigiri
This patch moves the definition of some macros used only on ARM platforms from common headers to platform specific headers. It also forces all ARM standard platforms to have distinct definitions (even if they are usually the same). 1. `PLAT_ARM_TZC_BASE` and `PLAT_ARM_NSTIMER_FRAME_ID` have been moved from `css_def.h` to `platform_def.h`. 2. `MHU_BASE` used in CSS platforms is moved from common css_def.h to platform specific header `platform_def.h` on Juno and renamed as `PLAT_ARM_MHU_BASE`. 3. To cater for different sizes of BL images, new macros like `PLAT_ARM_MAX_BL31_SIZE` have been created for each BL image. All ARM platforms need to define them for each image. Change-Id: I9255448bddfad734b387922aa9e68d2117338c3f
2016-02-11Merge pull request #517 from soby-mathew/sm/gic_set_prio_fixdanh-arm
Fix IPRIORITY and ITARGET accessors in GIC drivers
2016-02-11Merge pull request #513 from pgeorgi/configurable-timestampdanh-arm
build system: allow overriding the build's timestamp
2016-02-09Move private APIs in gic_common.h to a private headerSoby Mathew
This patch moves the private GIC common accessors from `gic_common.h` to a new private header file `gic_common_private.h`. This patch also adds additional comments to GIC register accessors to highlight the fact that some of them access register values that correspond to multiple interrupt IDs. The convention used is that the `set`, `get` and `clr` accessors access and modify the values corresponding to a single interrupt ID whereas the `read` and `write` GIC register accessors access the raw GIC registers and it could correspond to multiple interrupt IDs depending on the register accessed. Change-Id: I2643ecb2533f01e3d3219fcedfb5f80c120622f9
2016-02-09Fix GIC_IPRIORITYR setting in new driversSoby Mathew
The code to set the interrupt priority for secure interrupts in the new GICv2 and GICv3 drivers is incorrect. The setup code to configure interrupt priorities of secure interrupts, one interrupt at a time, used gicd_write_ipriorityr()/gicr_write_ipriority() function affecting 4 interrupts at a time. This bug did not manifest itself because all the secure interrupts were configured to the highest secure priority(0) during cold boot and the adjacent non secure interrupt priority would be configured later by the normal world. This patch introduces new accessors, gicd_set_ipriorityr() and gicr_set_ipriorityr(), for configuring priority one interrupt at a time and fixes the the setup code to use the new accessors. Fixes ARM-software/tf-issues#344 Change-Id: I470fd74d2b7fce7058b55d83f604be05a27e1341