Andrew Thoelke [Mon, 28 Apr 2014 11:06:18 +0000 (12:06 +0100)]
Replace disable_mmu with assembler version
disable_mmu() cannot work as a C function as there is no control
over data accesses generated by the compiler between disabling and
cleaning the data cache. This results in reading stale data from
main memory.
As assembler version is provided for EL3, and a variant that also
disables the instruction cache which is now used by the BL1
exception handling function.
Fixes ARM-software/tf-issues#147
Change-Id: I0cf394d2579a125a23c2f2989c2e92ace6ddb1a6
Andrew Thoelke [Mon, 28 Apr 2014 11:28:39 +0000 (12:28 +0100)]
Correct usage of data and instruction barriers
The current code does not always use data and instruction
barriers as required by the architecture and frequently uses
barriers excessively due to their inclusion in all of the
write_*() helper functions.
Barriers should be used explicitly in assembler or C code
when modifying processor state that requires the barriers in
order to enable review of correctness of the code.
This patch removes the barriers from the helper functions and
introduces them as necessary elsewhere in the code.
PORTING NOTE: check any port of Trusted Firmware for use of
system register helper functions for reliance on the previous
barrier behaviour and add explicit barriers as necessary.
Fixes ARM-software/tf-issues#92
Change-Id: Ie63e187404ff10e0bdcb39292dd9066cb84c53bf
danh-arm [Tue, 6 May 2014 16:57:34 +0000 (17:57 +0100)]
Merge pull request #49 from danh-arm/dh/remove-non-const-data
Remove variables from .data section
Dan Handley [Wed, 23 Apr 2014 12:47:06 +0000 (13:47 +0100)]
Remove variables from .data section
Update code base to remove variables from the .data section,
mainly by using const static data where possible and adding
the const specifier as required. Most changes are to the IO
subsystem, including the framework APIs. The FVP power
management code is also affected.
Delay initialization of the global static variable,
next_image_type in bl31_main.c, until it is realy needed.
Doing this moves the variable from the .data to the .bss
section.
Also review the IO interface for inconsistencies, using
uintptr_t where possible instead of void *. Remove the
io_handle and io_dev_handle typedefs, which were
unnecessary, replacing instances with uintptr_t.
Fixes ARM-software/tf-issues#107.
Change-Id: I085a62197c82410b566e4698e5590063563ed304
danh-arm [Tue, 6 May 2014 16:54:03 +0000 (17:54 +0100)]
Merge pull request #48 from danh-arm/dh/major-refactoring
dh/major refactoring
Dan Handley [Wed, 9 Apr 2014 12:14:54 +0000 (13:14 +0100)]
Reduce deep nesting of header files
Reduce the number of header files included from other header
files as much as possible without splitting the files. Use forward
declarations where possible. This allows removal of some unnecessary
"#ifndef __ASSEMBLY__" statements.
Also, review the .c and .S files for which header files really need
including and reorder the #include statements alphabetically.
Fixes ARM-software/tf-issues#31
Change-Id: Iec92fb976334c77453e010b60bcf56f3be72bd3e
Dan Handley [Thu, 10 Apr 2014 14:37:22 +0000 (15:37 +0100)]
Always use named structs in header files
Add tag names to all unnamed structs in header files. This
allows forward declaration of structs, which is necessary to
reduce header file nesting (to be implemented in a subsequent
commit).
Also change the typedef names across the codebase to use the _t
suffix to be more conformant with the Linux coding style. The
coding style actually prefers us not to use typedefs at all but
this is considered a step too far for Trusted Firmware.
Also change the IO framework structs defintions to use typedef'd
structs to be consistent with the rest of the codebase.
Change-Id: I722b2c86fc0d92e4da3b15e5cab20373dd26786f
Dan Handley [Wed, 23 Apr 2014 14:22:18 +0000 (15:22 +0100)]
Move PSCI global functions out of private header
Move the PSCI global functions out of psci_private.h and into
psci.h to allow the standard service to only depend on psci.h.
Change-Id: I8306924a3814b46e70c1dcc12524c7aefe06eed1
Dan Handley [Thu, 17 Apr 2014 17:53:42 +0000 (18:53 +0100)]
Separate BL functions out of arch.h
Move the BL function prototypes out of arch.h and into the
appropriate header files to allow more efficient header file
inclusion. Create new BL private header files where there is no
sensible existing header file.
Change-Id: I45f3e10b72b5d835254a6f25a5e47cf4cfb274c3
Dan Handley [Thu, 17 Apr 2014 16:48:52 +0000 (17:48 +0100)]
Refactor GIC header files
Move the function prototypes from gic.h into either gic_v2.h or
gic_v3.h as appropriate. Update the source files to include the
correct headers.
Change-Id: I368cfda175cdcbd3a68f46e2332738ec49048e19
Dan Handley [Thu, 17 Apr 2014 16:29:58 +0000 (17:29 +0100)]
Separate out CASSERT macro into own header
Separate out the CASSERT macro out of bl_common.h into its own
header to allow more efficient header inclusion.
Change-Id: I291be0b6b8f9879645e839a8f0dd1ec9b3db9639
Dan Handley [Tue, 15 Apr 2014 17:20:09 +0000 (18:20 +0100)]
Remove vpath usage in makefiles
Remove all usage of the vpath keyword in makefiles as it was prone
to mistakes. Specify the relative paths to source files instead.
Also reorder source files in makefiles alphabetically.
Fixes ARM-software/tf-issues#121
Change-Id: Id15f60655444bae60e0e2165259efac71a50928b
Dan Handley [Wed, 9 Apr 2014 12:13:04 +0000 (13:13 +0100)]
Make use of user/system includes more consistent
Make codebase consistent in its use of #include "" syntax for
user includes and #include <> syntax for system includes.
Fixes ARM-software/tf-issues#65
Change-Id: If2f7c4885173b1fd05ac2cde5f1c8a07000c7a33
Dan Handley [Fri, 11 Apr 2014 10:52:12 +0000 (11:52 +0100)]
Move FVP power driver to FVP platform
Move the FVP power driver to a directory under the FVP platform
port as this is not a generically usable driver.
Change-Id: Ibc78bd88752eb3e3964336741488349ac345f4f0
Dan Handley [Wed, 9 Apr 2014 11:48:25 +0000 (12:48 +0100)]
Move include and source files to logical locations
Move almost all system include files to a logical sub-directory
under ./include. The only remaining system include directories
not under ./include are specific to the platform. Move the
corresponding source files to match the include directory
structure.
Also remove pm.h as it is no longer used.
Change-Id: Ie5ea6368ec5fad459f3e8a802ad129135527f0b3
achingupta [Thu, 1 May 2014 12:16:33 +0000 (13:16 +0100)]
Merge pull request #50 from vikramkanigiri/vk/tf-issues#26
Preserve PSCI cpu_suspend 'power_state' parameter.
Vikram Kanigiri [Tue, 1 Apr 2014 18:26:26 +0000 (19:26 +0100)]
Preserve PSCI cpu_suspend 'power_state' parameter.
This patch saves the 'power_state' parameter prior to suspending
a cpu and invalidates it upon its resumption. The 'affinity level'
and 'state id' fields of this parameter can be read using a set of
public and private apis. Validation of power state parameter is
introduced which checks for SBZ bits are zero.
This change also takes care of flushing the parameter from the cache
to main memory. This ensures that it is available after cpu reset
when the caches and mmu are turned off. The earlier support for
saving only the 'affinity level' field of the 'power_state' parameter
has also been reworked.
Fixes ARM-Software/tf-issues#26
Fixes ARM-Software/tf-issues#130
Change-Id: Ic007ccb5e39bf01e0b67390565d3b4be33f5960a
danh-arm [Thu, 24 Apr 2014 18:38:28 +0000 (19:38 +0100)]
Merge pull request #33 from hliebel/hl/secure-memory
Hl/secure memory
Harry Liebel [Tue, 1 Apr 2014 18:28:07 +0000 (19:28 +0100)]
FVP secure memory support documentation
Fixes ARM-software/tf-issues#64
Change-Id: I4e56c25f9dc7f486fbf6fa2f7d8253874119b989
Harry Liebel [Tue, 1 Apr 2014 18:27:38 +0000 (19:27 +0100)]
Enable secure memory support for FVPs
- Use the TrustZone controller on Base FVP to program DRAM access
permissions. By default no access to DRAM is allowed if
'secure memory' is enabled on the Base FVP.
- The Foundation FVP does not have a TrustZone controller but instead
has fixed access permissions.
- Update FDTs for Linux to use timers at the correct security level.
- Starting the FVPs with 'secure memory' disabled is also supported.
Limitations:
Virtio currently uses a reserved NSAID. This will be corrected in
future FVP releases.
Change-Id: I0b6c003a7b5982267815f62bcf6eb82aa4c50a31
Harry Liebel [Tue, 1 Apr 2014 18:19:22 +0000 (19:19 +0100)]
Add TrustZone (TZC-400) driver
The TZC-400 performs security checks on transactions to memory or
peripherals. Separate regions can be created in the address space each
with individual security settings.
Limitations:
This driver does not currently support raising an interrupt on access
violation.
Change-Id: Idf8ed64b4d8d218fc9b6f9d75acdb2cd441d2449
danh-arm [Tue, 22 Apr 2014 10:02:13 +0000 (11:02 +0100)]
Merge pull request #43 from danh-arm/dh/tf-issues#129
Move console.c to pl011 specific driver location
danh-arm [Tue, 22 Apr 2014 10:01:58 +0000 (11:01 +0100)]
Merge pull request #44 from danh-arm/dh/tf-issues#136
Remove redundant code from bl1_plat_helpers.S
danh-arm [Wed, 16 Apr 2014 16:20:11 +0000 (17:20 +0100)]
Merge pull request #45 from danh-arm/dh/tf-issues#114
Rename FVP "mmap" array to avoid name confusion
Dan Handley [Tue, 15 Apr 2014 11:25:28 +0000 (12:25 +0100)]
Remove redundant code from bl1_plat_helpers.S
Remove redundant code in plat_secondary_cold_boot_setup() in
plat/fvp/aarch64/bl1_plat_helpers.S.
Fixes ARM-software/tf-issues#136
Change-Id: I98c0a46d95cfea33125e34e609c83dc2c97cd86e
danh-arm [Wed, 16 Apr 2014 14:29:03 +0000 (15:29 +0100)]
Merge pull request #40 from athoelke/at/up-stacks-76-v2
Allocate single stacks for BL1 and BL2 (v2)
Andrew Thoelke [Thu, 20 Mar 2014 10:48:23 +0000 (10:48 +0000)]
Allocate single stacks for BL1 and BL2
The BL images share common stack management code which provides
one coherent and one cacheable stack for every CPU. BL1 and BL2
just execute on the primary CPU during boot and do not require
the additional CPU stacks. This patch provides separate stack
support code for UP and MP images, substantially reducing the
RAM usage for BL1 and BL2 for the FVP platform.
This patch also provides macros for declaring stacks and
calculating stack base addresses to improve consistency where
this has to be done in the firmware.
The stack allocation source files are now included via
platform.mk rather than the common BLx makefiles. This allows
each platform to select the appropriate MP/UP stack support
for each BL image.
Each platform makefile must be updated when including this
commit.
Fixes ARM-software/tf-issues#76
Change-Id: Ia251f61b8148ffa73eae3f3711f57b1ffebfa632
Dan Handley [Tue, 15 Apr 2014 09:38:02 +0000 (10:38 +0100)]
Rename FVP "mmap" array to avoid name confusion
Rename the array "mmap" in plat/fvp/aarch64/plat_common.c to
"fvp_mmap", to avoid confusion with the array of the same name
in lib/arch/aarch64/xlat_tables.c
Fixes ARM-software/tf-issues#114
Change-Id: I61478c0070aa52d5dcf5d85af2f353f56c060cfb
danh-arm [Tue, 15 Apr 2014 08:39:47 +0000 (09:39 +0100)]
Merge pull request #36 from athoelke/at/gc-sections-80
Using GCC --gc-sections to eliminate unused code and data
Dan Handley [Mon, 14 Apr 2014 16:03:01 +0000 (17:03 +0100)]
Move console.c to pl011 specific driver location
Rename drivers/console/console.c to
drivers/arm/peripherals/pl011/pl011_console.c. This makes it clear
that this is a pl011 specific console implementation.
Fixes ARM-software/tf-issues#129
Change-Id: Ie2f8109602134c5b86993e32452c70734c45a3ed
danh-arm [Fri, 11 Apr 2014 17:39:01 +0000 (18:39 +0100)]
Merge pull request #38 from sandrine-bailleux/sb/tf-issue-125
Fix system counter initialisation
Sandrine Bailleux [Mon, 31 Mar 2014 10:25:18 +0000 (11:25 +0100)]
Define frequency of system counter in platform code
BL3-1 architecture setup code programs the system counter frequency
into the CNTFRQ_EL0 register. This frequency is defined by the
platform, though. This patch introduces a new platform hook that
the architecture setup code can call to retrieve this information.
In the ARM FVP port, this returns the first entry of the frequency
modes table from the memory mapped generic timer.
All system counter setup code has been removed from BL1 as some
platforms may not have initialized the system counters at this stage.
The platform specific settings done exclusively in BL1 have been moved
to BL3-1. In the ARM FVP port, this consists in enabling and
initializing the System level generic timer. Also, the frequency change
request in the counter control register has been set to 0 to make it
explicit it's using the base frequency. The CNTCR_FCREQ() macro has been
fixed in this context to give an entry number rather than a bitmask.
In future, when support for firmware update is implemented, there
is a case where BL1 platform specific code will need to program
the counter frequency. This should be implemented at that time.
This patch also updates the relevant documentation.
It properly fixes ARM-software/tf-issues#24
Change-Id: If95639b279f75d66ac0576c48a6614b5ccb0e84b
Sandrine Bailleux [Mon, 31 Mar 2014 09:44:09 +0000 (10:44 +0100)]
Revert "Move architecture timer setup to platform-specific code"
This reverts commit
1c297bf015226c182b66498d5a64b8b51c7624f5
because it introduced a bug: the CNTFRQ_EL0 register was no
longer programmed by all CPUs. bl31_platform_setup() function
is invoked only in the cold boot path and consequently only
on the primary cpu.
A subsequent commit will correctly implement the necessary changes
to the counter frequency setup code.
Fixes ARM-software/tf-issues#125
Conflicts:
docs/firmware-design.md
plat/fvp/bl31_plat_setup.c
Change-Id: Ib584ad7ed069707ac04cf86717f836136ad3ab54
danh-arm [Mon, 7 Apr 2014 15:49:37 +0000 (16:49 +0100)]
Merge pull request #35 from sandrine-bailleux/sb/add-missing-include-guard
Add missing #include guard in xlat_tables.h
danh-arm [Fri, 4 Apr 2014 16:15:20 +0000 (17:15 +0100)]
Merge pull request #34 from danh-arm/dh/new-integration-process
Update contributing.md with new integration process
Sandrine Bailleux [Thu, 3 Apr 2014 12:48:04 +0000 (13:48 +0100)]
Add missing #include guard in xlat_tables.h
Change-Id: I7272a800accb7de71cbbf6b715a43061bbf79f8c
Dan Handley [Fri, 28 Mar 2014 10:49:39 +0000 (10:49 +0000)]
Update contributing.md with new integration process
Contributions will now be merged into an ARM Trusted Firmware
integration branch on GitHub instead of via an ARM internal
branch.
Andrew Thoelke [Tue, 18 Mar 2014 13:46:55 +0000 (13:46 +0000)]
Place assembler functions in separate sections
This extends the --gc-sections behaviour to the many assembler
support functions in the firmware images by placing each function
into its own code section. This is achieved by creating a 'func'
macro used to declare each function label.
Fixes ARM-software/tf-issues#80
Change-Id: I301937b630add292d2dec6d2561a7fcfa6fec690
Andrew Thoelke [Tue, 18 Mar 2014 07:13:52 +0000 (07:13 +0000)]
Use --gc-sections during link
All common functions are being built into all binary images,
whether or not they are actually used. This change enables the
use of -ffunction-sections, -fdata-sections and --gc-sections
in the compiler and linker to remove unused code and data from
the images.
Change-Id: Ia9f78c01054ac4fa15d145af38b88a0d6fb7d409
Achin Gupta [Wed, 26 Mar 2014 18:44:15 +0000 (18:44 +0000)]
Fix build failure due to a typo in TSPD code
This patch fixes a build failure when TSPD support is included. The failure was
due to a missing semi-colon at the end of a C statement in tspd_common.c
Change-Id: I8fbd0d500bd9145b15f862b8686e570b80fcce8c
Sandrine Bailleux [Fri, 21 Mar 2014 14:17:51 +0000 (14:17 +0000)]
Build system: Trigger dependency checking only for build targets
The Makefile used to specify a blacklist of rules for which
dependency checking must not be triggered. This list included
cleaning rules only, whereas all other non-build targets (e.g.
help, checkpatch, etc.) should also be included.
This approach seems a bit fragile because it is easy to forget
some non-building rules in the blacklist, as the experience
showed us. It is more robust to specify a whitelist of rules
for which dependency checking is required.
Fixes ARM-software/tf-issues#112
Change-Id: I030c405abb35972a726a5200396430316d18f963
Vikram Kanigiri [Tue, 25 Mar 2014 17:35:26 +0000 (17:35 +0000)]
Initialise UART console in all bootloader stages
This patch reworks the console driver to ensure that each bootloader stage
initializes it independently. As a result, both BL3-1 and BL2 platform code
now calls console_init() instead of relying on BL1 to perform console setup
Fixes ARM-software/tf-issues#120
Change-Id: Ic4d66e0375e40a2fc7434afcabc8bbb4715c14ab
Soby Mathew [Wed, 12 Mar 2014 14:52:51 +0000 (14:52 +0000)]
Move console functions out of pl011.c
This commit isolates the accessor functions in pl011.c and builds
a wrapper layer for console functions.
This also modifies the console driver to use the pl011 FIFO.
Fixes ARM-software/tf-issues#63
Change-Id: I3b402171cd14a927831bf5e5d4bb310b6da0e9a8
Sandrine Bailleux [Fri, 21 Mar 2014 13:16:35 +0000 (13:16 +0000)]
Build system: Remove last traces of 'PLAT=all'
It used to be possible to build all bootloader binaries for all platforms
using 'PLAT=all'. This feature has been removed but there are still some
traces of its existence. This patch removes them.
Change-Id: Ic671a5c20c5b64acbd0a912d2e4db8f9d9574610
Vikram Kanigiri [Mon, 24 Mar 2014 11:21:35 +0000 (11:21 +0000)]
Fix build by correcting asm helper function usage in TSPD
This patch fixes a regression failure due to the use of functions by the
TSPD code which access system registers with partially qualified names.
These functions had been removed in an earlier patch. The relevant code
has been updated to access these registers with their fully qualified
names.
Fixes ARM-software/tf-issues#119
Change-Id: Ide1bc5036e1b8164a42f7b7fe86186ad860e0ef9
Sandrine Bailleux [Mon, 24 Mar 2014 10:24:08 +0000 (10:24 +0000)]
Separate out BL2, BL3-1 and BL3-2 early exception vectors from BL1
bl1/aarch64/early_exceptions.S used to be re-used by BL2, BL3-1 and
BL3-2. There was some early SMC handling code in there that was not
required by the other bootloader stages. Therefore this patch
introduces an even simpler exception vector source file for BL2,
BL3-1 and BL3-2.
Fixes ARM-software/tf-issues#38
Change-Id: I0244b80e9930b0f8035156a0bf91cc3e9a8f995d
Vikram Kanigiri [Thu, 20 Mar 2014 16:27:01 +0000 (16:27 +0000)]
Move per cpu exception stack in BL31 to tzfw_normal_stacks
Fixes ARM-software/tf-issues#70
Change-Id: I7f024f173fbdecd315076f528b05d6295aff7276
Vikram Kanigiri [Fri, 21 Mar 2014 11:57:10 +0000 (11:57 +0000)]
Add standby state support in PSCI cpu_suspend api
This patch adds support in the generic PSCI implementation to call a
platform specific function to enter a standby state using an example
implementation in ARM FVP port
Fixes ARM-software/tf-issues#94
Change-Id: Ic1263fcf25f28e09162ad29dca954125f9aa8cc9
Sandrine Bailleux [Thu, 20 Mar 2014 15:51:02 +0000 (15:51 +0000)]
Semihosting: Fix file mode to load binaries on Windows
Trusted firmware binaries loaded via semihosting used to be
opened using 'r' mode (i.e. read mode). This is fine on POSIX
conforming systems (including Linux) but for Windows it also means
that the file should be opened in text mode. 'rb' mode must be
specified instead for binary mode. On POSIX conforming systems,
'rb' mode is equivalent to 'r' mode so it does no harm.
Fixes ARM-software/tf-issues#69
Change-Id: Ifa53f2ecfd765f572dea5dd73191f9fe2b2c2011
Vikram Kanigiri [Tue, 11 Mar 2014 17:41:00 +0000 (17:41 +0000)]
Remove partially qualified asm helper functions
Each ARM Trusted Firmware image should know in which EL it is running
and it should use the corresponding register directly instead of reading
currentEL and knowing which asm register to read/write
Change-Id: Ief35630190b6f07c8fbb7ba6cb20db308f002945
Vikram Kanigiri [Thu, 20 Mar 2014 12:23:21 +0000 (12:23 +0000)]
Fix the disable_mmu code
Remove the hard coding of all the MMU related registers with 0 and disable MMU
by clearing the M and C bit in SCTLR_ELx
Change-Id: I4a0b1bb14a604734b74c32eb31315d8504a7b8d8
Sandrine Bailleux [Thu, 13 Mar 2014 14:48:31 +0000 (14:48 +0000)]
TSP: Make the platform-specific makefile mandatory
The Test Secure-EL1 Payload implementation should always have a
platform-specific component. Therefore, there should always
be a platform-specific sub-makefile for the TSP. If there is
none then assume TSP is not supported on this specific platform
and throw an error at build time if the user tries to compile it.
Change-Id: Ibfbe6e4861cc7786a29f2fc0341035b852925193
Sandrine Bailleux [Wed, 19 Mar 2014 16:03:48 +0000 (16:03 +0000)]
Fix file_to_uuid() function
This patch fixes a bug in the 'file_to_uuid()' function: it used
to cause an exception by dereferencing a null pointer when
a given UUID was not found in the UUID array. The fix is to delete
the final null entry in the UUID array, which is not needed because
the array is statically declared so its size is known at build time.
Fixes ARM-software/tf-issues#43
Change-Id: I0a003485b88134564c0d36f57c274215d9e16532
Sandrine Bailleux [Wed, 19 Mar 2014 13:39:52 +0000 (13:39 +0000)]
FIP tool: Fix error message for missing FIP filename
Previously to this path, the FIP tool used to print the following,
misleading error message when called without any argument or with
'--help' option:
ERROR: Too many arguments
This patch fixes this behavior by printing the following error
message instead:
ERROR: Missing FIP filename
If called with '--help', no error message is printed and only the
help message is displayed.
Change-Id: Ib281b056f5cd3bc2f66d98be0b0cb2a0aed7c6a8
Sandrine Bailleux [Wed, 19 Mar 2014 13:21:42 +0000 (13:21 +0000)]
FIP tool: Add support for '--help' option.
Also improve the help message printed by the FIP tool.
Change-Id: If0f802f1083458182ca8ce57e8c104d40eee0dbe
Sandrine Bailleux [Wed, 19 Mar 2014 13:09:54 +0000 (13:09 +0000)]
FIP tool: Small optimisation for option parsing
This patch makes use of different values for '--dump' and other
command-line options. This makes the code simpler and also
optimises it a bit (because it avoids a string comparison).
Change-Id: I1c8345f210074fc5f962ea0282fd3625775dec69
Jeenu Viswambharan [Thu, 13 Mar 2014 11:16:25 +0000 (11:16 +0000)]
Rework bakery lock with WFE/SEV sequence
Current implementation of Bakery Lock does tight-loop waiting upon lock
contention.
This commit reworks the implementation to use WFE instruction for
waiting, and SEV to signal lock availability. It also adds the rationale
for choosing Bakery Locks instead of exclusion primitives, and more
comments for the lock algorithm.
Fixes ARM-software/tf-issue#67
Change-Id: Ie351d3dbb27ec8e64dbc9507c84af07bd385a7df
Co-authored-by: Vikram Kanigiri <vikram.kanigiri@arm.com>
Jeenu Viswambharan [Tue, 11 Mar 2014 11:06:45 +0000 (11:06 +0000)]
Specify image entry in linker script
At present, the entry point for each BL image is specified via the
Makefiles and provided on the command line to the linker. When using a
link script the entry point should rather be specified via the ENTRY()
directive in the link script.
This patch updates linker scripts of all BL images to specify the entry
point using the ENTRY() directive. It also removes the --entry flag
passed to the linker through Makefile.
Fixes issue ARM-software/tf-issues#66
Change-Id: I1369493ebbacea31885b51185441f6b628cf8da0
Jeenu Viswambharan [Fri, 28 Feb 2014 11:23:35 +0000 (11:23 +0000)]
Implement standard calls for TSP
This patch adds call count, UID and version information SMC calls for
the Trusted OS, as specified by the SMC calling convention.
Change-Id: I9a3e84ac1bb046051db975d853dcbe9612aba6a9
Jeenu Viswambharan [Fri, 28 Feb 2014 10:08:33 +0000 (10:08 +0000)]
Implement ARM Standard Service
This patch implements ARM Standard Service as a runtime service and adds
support for call count, UID and revision information SMCs. The existing
PSCI implementation is subsumed by the Standard Service calls and all
PSCI calls are therefore dispatched by the Standard Service to the PSCI
handler.
At present, PSCI is the only specification under Standard Service. Thus
call count returns the number of PSCI calls implemented. As this is the
initial implementation, a revision number of 0.1 is returned for call
revision.
Fixes ARM-software/tf-issues#62
Change-Id: I6d4273f72ad6502636efa0f872e288b191a64bc1
Jeenu Viswambharan [Tue, 7 Jan 2014 10:21:18 +0000 (10:21 +0000)]
Move architecture timer setup to platform-specific code
At present, bl1_arch_setup() and bl31_arch_setup() program the counter
frequency using a value from the memory mapped generic timer. The
generic timer however is not necessarily present on all ARM systems
(although it is architected to be present on all server systems).
This patch moves the timer setup to platform-specific code and updates
the relevant documentation. Also, CNTR.FCREQ is set as the specification
requires the bit corresponding to the counter's frequency to be set when
enabling. Since we intend to use the base frequency, set bit 8.
Fixes ARM-software/tf-issues#24
Change-Id: I32c52cf882253e01f49056f47c58c23e6f422652
Jeenu Viswambharan [Tue, 7 Jan 2014 10:20:48 +0000 (10:20 +0000)]
Remove unused 'CPU present' flag
This patch removes the 'CPU present' flag that's being set but not
referred or used anywhere else.
Change-Id: Iaf82bdb354134e0b33af16c7ba88eb2259b2682a
Dan Handley [Tue, 4 Mar 2014 11:51:32 +0000 (11:51 +0000)]
Remove change log instructions from contribution.md
Remove the instructions to update the change log from
contribution.md. The change log no longer contains a
"Detailed changes since last release" section.
Also, update the documentation links following recent
documentation changes.
Change-Id: Id9df43d666f7f9a60dcc6f663a8a85cdd2ff7cc4
Ryan Harkin [Tue, 4 Feb 2014 11:43:57 +0000 (11:43 +0000)]
bl_common: add image_size()
Fixes ARM-software/tf-issues#42
Some callers of load_image() may need to get the size of the image
before/after loading it.
Change-Id: I8dc067b69fc711433651a560ba5a8c3519445857
Signed-off-by: Ryan Harkin <ryan.harkin@linaro.org>
Ryan Harkin [Tue, 18 Feb 2014 17:40:24 +0000 (17:40 +0000)]
fvp: plat_io_storage: remove duplicated code
Fixes ARM-software/tf-issues#41
The policy functions for each file to be loaded were implemented by
copy/pasting one method and then varying the data checked.
This patch creates a generic function to check the policy based on the
data stored in a table.
This removes the amount of duplicated code but also makes the code
simpler and more efficient.
Change-Id: I1c52eacf6f18a1442dabbb33edd03d4bb8bbeae0
Signed-off-by: Ryan Harkin <ryan.harkin@linaro.org>
Jon Medhurst [Thu, 13 Feb 2014 15:19:28 +0000 (15:19 +0000)]
Enable platforms to omit some bootloaders
If a platform doesn't specify a BLx_SOURCE variable, then building
of the corresponding bootloader isn't attempted. Also allow BL3-3 to
be omitted from the FIP.
Note, this change also removes support for PLAT=all and the 'fip' target
from the 'all' recipe.
Fixes ARM-software/tf-issues#30
Change-Id: Ibdfead0440256eaf364617ecff65290ca6fe6240
Signed-off-by: Jon Medhurst <tixy@linaro.org>
Jon Medhurst [Mon, 17 Feb 2014 12:18:24 +0000 (12:18 +0000)]
Generate build time and date message at link time.
So it updates each time a bootloader changes, not just when bl*_main.c
files are recompiled.
Fixes ARM-software/tf-issues#33
Change-Id: Ie8e1a7bd7e1913d2e96ac268606284f76af8c5ab
Signed-off-by: Jon Medhurst <tixy@linaro.org>
Jon Medhurst [Wed, 26 Feb 2014 16:27:53 +0000 (16:27 +0000)]
fvp: Make use of the generic MMU translation table setup code
Change-Id: I559c5a4d86cad55ce3f6ad71285b538d3cfd76dc
Signed-off-by: Jon Medhurst <tixy@linaro.org>
Jon Medhurst [Fri, 24 Jan 2014 15:41:33 +0000 (15:41 +0000)]
Add generic functions for setting up aarch64 MMU translation tables
Change-Id: I5b8d040ebc6672e40e4f13925e2fd5bc124103f4
Signed-off-by: Jon Medhurst <tixy@linaro.org>
Jon Medhurst [Wed, 12 Feb 2014 15:54:48 +0000 (15:54 +0000)]
Update Makefiles to get proper dependency checking working.
This change requires all platforms to now specify a list of source files
rather than object files.
New source files should preferably be specified by using the path as
well and we should add this in the future for all files so we can remove
use of vpath. This is desirable because vpath hides issues like the fact
that BL2 currently pulls in a BL1 file bl1/aarch64/early_exceptions.S
and if in the future we added bl2/aarch64/early_exceptions.S then it's
likely only one of the two version would be used for both bootloaders.
This change also removes the 'dump' build target and simply gets
bootloaders to always generate a dump file. At the same time the -x
option is added so the section headers and symbols table are listed.
Fixes ARM-software/tf-issues#11
Change-Id: Ie38f7be76fed95756c8576cf3f3ea3b7015a18dc
Signed-off-by: Jon Medhurst <tixy@linaro.org>
Jon Medhurst [Tue, 11 Feb 2014 14:48:56 +0000 (14:48 +0000)]
Fix implementation and users of gicd_set_ipriorityr()
Make gicd_set_ipriorityr() actually write to the priority register.
Also correct callers of this function which want the highest priority
to use the value zero as this is the highest priority value according
to the ARM Generic Interrupt Controller Architecture Specification.
To make this easier to get right, we introduce defines for the lowest
and highest priorities for secure and non-secure interrupts.
Fixes ARM-software/tf-issues#21
Signed-off-by: Jon Medhurst <tixy@linaro.org>
Jon Medhurst [Thu, 6 Feb 2014 14:13:16 +0000 (14:13 +0000)]
Fix assert in bakery_lock_release()
bakery_lock_release() expects an mpidr as the first argument however
bakery_lock_release() is calling it with the 'entry' argument it has
calculated. Rather than fixing this to pass the mpidr value it would be
much more efficient to just replace the call with
assert(bakery->owner == entry)
As this leaves no remaining users of bakery_lock_held(), we might as
well delete it.
Fixes ARM-software/tf-issues#27
Signed-off-by: Jon Medhurst <tixy@linaro.org>
Dan Handley [Wed, 26 Feb 2014 17:20:40 +0000 (17:20 +0000)]
Add v0.3 release documentation
Update the readme.md and change-log.md with release information.
Also, remove the "Detailed changes since last release" section of
the change-log.md since the same information can be found in the
GIT commit messages. Fixes ARM-software/tf-issues#22.
Change-Id: I968cc8aaf588aa5c34ba8f1c12a5b797a46e04f5
Dan Handley [Thu, 27 Feb 2014 19:46:37 +0000 (19:46 +0000)]
Consolidate design and porting documentation
Consolidate firmware-design.md and porting-guide.pm so
that recently added sections fit better with
pre-existing sections. Make the documentation more
consistent in use of terminology.
Change-Id: Id87050b096122fbd845189dc2fe1cd17c3003468
Dan Handley [Tue, 25 Feb 2014 19:09:48 +0000 (19:09 +0000)]
Add EL3 runtime services and SPD documentation
1. Add design information on EL3 runtime services and
Secure-EL1 Payload Dispatchers (SPD) to
firmware-design.md.
2. Create new EL3 runtime service writer's guide
(rt-svc-writers-guide.md) to ease creation of new
runtime services.
Change-Id: I670aeb5fc246e25c6e599a15139aac886a0074fd
Dan Handley [Tue, 25 Feb 2014 13:28:04 +0000 (13:28 +0000)]
Separate firmware design out of user-guide.md
Move the firmware design documentation out of user-guide.md
and into a new file - firmware-design.md. Reformat the
section headers.
Change-Id: I664815dd47011c7c1cf2202aa4472a8fd78ebb92
Dan Handley [Wed, 19 Feb 2014 16:30:22 +0000 (16:30 +0000)]
Update versions of dependencies in user-guide.md
1. Update user-guide.md with the latest versions of dependent
components required by the tested configurations of ARM Trusted
Firmware. This includes the tested versions of Fixed Virtual
Platforms (FVPs), toolchain, EFI Development Kit 2(EDK2),
Linux kernel and Linux file system.
2. Remove the instructions to configure the Cortex Base FVP
with the legacy GICv2 memory map as this is no longer supported
since version 5.3 of the Base FVPs.
3. General tidyup of "Using the software" section.
Change-Id: If8264cd29036b59dc5ff435b5f8b1d072dd36ef0
Jeenu Viswambharan [Mon, 24 Feb 2014 15:20:28 +0000 (15:20 +0000)]
Remove duplicate xlat_table descriptions
The BL31 and BL2 linker scripts ended up having duplicate descriptions
for xlat_tables section. This patch removes those duplicate
descriptions.
Change-Id: Ibbdda0902c57fca5ea4e91e0baefa6df8f0a9bb1
Sandrine Bailleux [Fri, 21 Feb 2014 14:16:16 +0000 (14:16 +0000)]
fvp: Initialise UART earlier
The UART used to be initialised in bl1_platform_setup(). This is too
late because there are some calls to the assert() macro, which needs
to print some messages on the console, before that.
This patch moves the UART initialisation code to
bl1_early_platform_setup().
Fixes ARM-software/tf-issues#49
Change-Id: I98c83a803866372806d2a9c2e1ed80f2ef5b3bcc
Jeenu Viswambharan [Thu, 20 Feb 2014 17:19:39 +0000 (17:19 +0000)]
Tolerate runtime service initialization failure
At present, the firmware panics if a runtime service fails to
initialize. An earlier patch had implemented late binding for all
runtime service handlers.
With that in place, this patch allows the firmware to proceed even when
a service fails to initialize.
Change-Id: I6cf4de2cecea9719f4cd48272a77cf459b080d4e
Jeenu Viswambharan [Thu, 20 Feb 2014 17:11:00 +0000 (17:11 +0000)]
Implement late binding for runtime hooks
At present SPD power management hooks and BL3-2 entry are implemented
using weak references. This would have the handlers bound and registered
with the core framework at build time, but leaves them dangling if a
service fails to initialize at runtime.
This patch replaces implementation by requiring runtime handlers to
register power management and deferred initialization hooks with the
core framework at runtime. The runtime services are to register the
hooks only as the last step, after having all states successfully
initialized.
Change-Id: Ibe788a2a381ef39aec1d4af5ba02376e67269782
Dan Handley [Mon, 24 Feb 2014 12:17:36 +0000 (12:17 +0000)]
Update contributing.md to new CLA location
This commit updates contributing.md to point to the ARM website
for downloading copies of the Contribution License Agreement (CLA).
It is no longer necessary to email ARM for these.
Change-Id: Iaf58680631a626f26827577709ac5471e3b84566
Harry Liebel [Mon, 24 Feb 2014 12:01:27 +0000 (12:01 +0000)]
Reduce GICv3 debug output
Change-Id: Ia8502f8d0566025d8bad150029f49cb63815261d
Jeenu Viswambharan [Fri, 21 Feb 2014 11:42:08 +0000 (11:42 +0000)]
Revert accidental removal of BL2 from help message
Commit
375f538a7 in Github accidentally removed the BL2 targets from the
Makefile help message. This patch reverts that change.
Change-Id: I825a9abe5b4ba0f15d02879dda1056912e2ad60c
Jeenu Viswambharan [Tue, 18 Feb 2014 12:57:55 +0000 (12:57 +0000)]
Update .gitignore
This patch updates .gitignore file to ignore potential build products,
tool object files and binaries
Also fixes issue ARM-software/tf-issues#35
Change-Id: I053dfba4ec8fecbcca081cad5b4bf94f8abfb15c
Ryan Harkin [Mon, 10 Feb 2014 17:17:04 +0000 (17:17 +0000)]
Fix semihosting with latest toolchain
Fixes issues #10:
https://github.com/ARM-software/tf-issues/issues/10
This patch changes all/most variables of type int to be size_t or long
to fix the sizing and alignment problems found when building with the
newer toolchains such as Linaro GCC 13.12 or later.
Change-Id: Idc9d48eb2ff9b8c5bbd5b227e6907263d1ea188b
Signed-off-by: Ryan Harkin <ryan.harkin@linaro.org>
Jeenu Viswambharan [Wed, 19 Feb 2014 09:38:18 +0000 (09:38 +0000)]
Cleanup FIP build targets and messages
At present the fip.bin depends on phony targets for BL images, resulting
in unconditional remake of fip.bin. Also the build messages doesn't
match with the rest of build system.
This patch modifies the fip.bin dependencies to the actual BL binary
images so that fip.bin is remade only when the component images are
rebuilt/modified. The build messages and FIP Makefile are modified to
match the style of rest of the build system.
Change-Id: I8dd08666ff766d106820a5b4b037c2161bcf140f
Jeenu Viswambharan [Thu, 20 Feb 2014 12:03:31 +0000 (12:03 +0000)]
Report recoverable errors as warnings
At present many recoverable failures are reported as errors. This patch
modifies all such failures to be reported as warnings instead.
Change-Id: I5141653c82498defcada9b90fdf7498ba496b2f2
Achin Gupta [Sun, 9 Feb 2014 23:11:46 +0000 (23:11 +0000)]
Rework arithmetic operations in Test Secure Payload
This patch reworks the service provided by the TSP to perform common
arithmetic operations on a set of arguments provided by the non-secure
world. For a addition, division, subtraction & multiplication operation
requested on two arguments in x0 and x1 the steps are:
1. TSPD saves the non-secure context and passes the operation and its
arguments to the TSP.
2. TSP asks the TSPD to return the same arguments once again. This
exercises an additional SMC path.
3. TSP now has two copies of both x0 and x1. It performs the operation
on the corresponding copies i.e. in case of addition it returns x0+x0
and x1+x1.
4. TSPD receives the result, saves the secure context, restores the
non-secure context and passes the result back to the non-secure
client.
Change-Id: I6eebfa2ae0a6f28b1d2e11a31f575c7a4b96724b
Co-authored-by: Jeenu Viswambharan <jeenu.viswambharan@arm.com>
Achin Gupta [Sun, 9 Feb 2014 18:24:19 +0000 (18:24 +0000)]
Add power management support in the SPD
This patch implements a set of handlers in the SPD which are called by
the PSCI runtime service upon receiving a power management
operation. These handlers in turn pass control to the Secure Payload
image if required before returning control to PSCI. This ensures that
the Secure Payload has complete visibility of all power transitions in
the system and can prepare accordingly.
Change-Id: I2d1dba5629b7cf2d53999d39fe807dfcf3f62fe2
Achin Gupta [Tue, 18 Feb 2014 18:12:48 +0000 (18:12 +0000)]
Add Test Secure Payload Dispatcher (TSPD) service
This patch adds the TSPD service which is responsible for managing
communication between the non-secure state and the Test Secure Payload
(TSP) executing in S-EL1.
The TSPD does the following:
1. Determines the location of the TSP (BL3-2) image and passes control
to it for initialization. This is done by exporting the 'bl32_init()'
function.
2. Receives a structure containing the various entry points into the TSP
image as a response to being initialized. The TSPD uses this
information to determine how the TSP should be entered depending on
the type of operation.
3. Implements a synchronous mechanism for entering into and returning
from the TSP image. This mechanism saves the current C runtime
context on top of the current stack and jumps to the TSP through an
ERET instruction. The TSP issues an SMC to indicate completion of the
previous request. The TSPD restores the saved C runtime context and
resumes TSP execution.
This patch also introduces a Make variable 'SPD' to choose the specific
SPD to include in the build. By default, no SPDs are included in the
build.
Change-Id: I124da5695cdc510999b859a1bf007f4d049e04f3
Co-authored-by: Jeenu Viswambharan <jeenu.viswambharan@arm.com>
Jeenu Viswambharan [Thu, 20 Feb 2014 11:51:00 +0000 (11:51 +0000)]
Fix FIP offset address when file not found
If there is a request to open a file from FIP, and that file is not
found, the driver fails to reset the offset address. This causes
subsequent file loads to fail.
This patch resets the offset address to zero if a file is not found so
that subsequent file loads are unaffected.
Change-Id: I16418e35f92fb7c85fb12e2acc071990520cdef8
Achin Gupta [Tue, 18 Feb 2014 18:09:12 +0000 (18:09 +0000)]
Add Test Secure Payload (BL3-2) image
This patch adds a simple TSP as the BL3-2 image. The secure payload
executes in S-EL1. It paves the way for the addition of the TSP
dispatcher runtime service to BL3-1. The TSP and the dispatcher service
will serve as an example of the runtime firmware's ability to toggle
execution between the non-secure and secure states in response to SMC
request from the non-secure state. The TSP will be replaced by a
Trusted OS in a real system.
The TSP also exports a set of handlers which should be called in
response to a PSCI power management event e.g a cpu being suspended or
turned off. For now it runs out of Secure DRAM on the ARM FVP port and
will be moved to Secure SRAM later. The default translation table setup
code assumes that the caller is executing out of secure SRAM. Hence the
TSP exports its own translation table setup function.
The TSP only services Fast SMCs, is non-reentrant and non-interruptible.
It does arithmetic operations on two sets of four operands, one set
supplied by the non-secure client, and the other supplied by the TSP
dispatcher in EL3. It returns the result according to the Secure Monitor
Calling convention standard.
This TSP has two functional entry points:
- An initial, one-time entry point through which the TSP is initialized
and prepares for receiving further requests from secure
monitor/dispatcher
- A fast SMC service entry point through which the TSP dispatcher
requests secure services on behalf of the non-secure client
Change-Id: I24377df53399307e2560a025eb2c82ce98ab3931
Co-authored-by: Jeenu Viswambharan <jeenu.viswambharan@arm.com>
Achin Gupta [Sun, 9 Feb 2014 17:48:12 +0000 (17:48 +0000)]
Move PSCI to runtime services directory
This patch creates a 'services' directory and moves the PSCI under
it. Other runtime services e.g. the Secure Payload Dispatcher service
will be placed under the same directory in the future.
Also fixes issue ARM-software/tf-issues#12
Change-Id: I187f83dcb660b728f82155d91882e961d2255068
Achin Gupta [Sun, 9 Feb 2014 13:47:08 +0000 (13:47 +0000)]
Specify address of UART device to use as a console
This patch adds the ability to specify the base address of a UART
device for initialising the console. This allows a boot loader stage
to use a different UART device from UART0 (default) for the console.
Change-Id: Ie60b927389ae26085cfc90d22a564ff83ba62955
Achin Gupta [Sun, 9 Feb 2014 13:30:38 +0000 (13:30 +0000)]
Factor out translation table setup in ARM FVP port
This patch factors out the ARM FVP specific code to create MMU
translation tables so that it is possible for a boot loader stage to
create a different set of tables instead of using the default ones.
The default translation tables are created with the assumption that
the calling boot loader stage executes out of secure SRAM. This might
not be true for the BL3_2 stage in the future.
A boot loader stage can define the `fill_xlation_tables()` function as
per its requirements. It returns a reference to the level 1
translation table which is used by the common platform code to setup
the TTBR_EL3.
This patch is a temporary solution before a larger rework of
translation table creation logic is introduced.
Change-Id: I09a075d5da16822ee32a411a9dbe284718fb4ff6
Achin Gupta [Wed, 19 Feb 2014 17:58:33 +0000 (17:58 +0000)]
Add support for BL3-2 in BL3-1
This patch adds the following support to the BL3-1 stage:
1. BL3-1 allows runtime services to specify and determine the security
state of the next image after BL3-1. This has been done by adding
the `bl31_set_next_image_type()` & `bl31_get_next_image_type()`
apis. The default security state is non-secure. The platform api
`bl31_get_next_image_info()` has been modified to let the platform
decide which is the next image in the desired security state.
2. BL3-1 exports the `bl31_prepare_next_image_entry()` function to
program entry into the target security state. It uses the apis
introduced in 1. to do so.
3. BL3-1 reads the information populated by BL2 about the BL3-2 image
into its internal data structures.
4. BL3-1 introduces a weakly defined reference `bl32_init()` to allow
initialisation of a BL3-2 image. A runtime service like the Secure
payload dispatcher will define this function if present.
Change-Id: Icc46dcdb9e475ce6575dd3f9a5dc7a48a83d21d1
Achin Gupta [Wed, 19 Feb 2014 17:52:35 +0000 (17:52 +0000)]
Add support for BL3-2 in BL2
This patch adds support for loading a BL3-2 image in BL2. In case a
BL3-2 image is found, it also passes information to BL3-1 about where it
is located and the extents of memory available to it. Information about
memory extents is populated by platform specific code.
The documentation has also been updated to reflect the above changes.
Change-Id: I526b2efb80babebab1318f2b02e319a86d6758b0
Co-authored-by: Jeenu Viswambharan <jeenu.viswambharan@arm.com>
Achin Gupta [Wed, 19 Feb 2014 17:18:23 +0000 (17:18 +0000)]
Rework BL2 to BL3-1 hand over interface
This patch reworks BL2 to BL3-1 hand over interface by introducing a
composite structure (bl31_args) that holds the superset of information
that needs to be passed from BL2 to BL3-1.
- The extents of secure memory available to BL3-1
- The extents of memory available to BL3-2 (not yet implemented) and
BL3-3
- Information to execute BL3-2 (not yet implemented) and BL3-3 images
This patch also introduces a new platform API (bl2_get_bl31_args_ptr)
that needs to be implemented by the platform code to export reference to
bl31_args structure which has been allocated in platform-defined memory.
The platform will initialize the extents of memory available to BL3-3
during early platform setup in bl31_args structure. This obviates the
need for bl2_get_ns_mem_layout platform API.
BL2 calls the bl2_get_bl31_args_ptr function to get a reference to
bl31_args structure. It uses the 'bl33_meminfo' field of this structure
to load the BL3-3 image. It sets the entry point information for the
BL3-3 image in the 'bl33_image_info' field of this structure. The
reference to this structure is passed to the BL3-1 image.
Also fixes issue ARM-software/tf-issues#25
Change-Id: Ic36426196dd5ebf89e60ff42643bed01b3500517
Jeenu Viswambharan [Fri, 7 Feb 2014 15:53:18 +0000 (15:53 +0000)]
Add exception vector guards
This patch adds guards so that an exception vector exceeding 32
instructions will generate a compile-time error. This keeps the
exception handlers in check from spilling over.
Change-Id: I7aa56dd0071a333664e2814c656d3896032046fe