summary |
shortlog | log |
commit |
commitdiff |
tree
first ⋅ prev ⋅ next
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
Achin Gupta [Sun, 2 Feb 2014 13:04:00 +0000 (13:04 +0000)]
Increase coherent stack sizes
This patch increases coherent stack size for both debug and release
builds in order to accommodate stack-heavy printf() and extended EL3
functionality
Change-Id: I30ef30530a01517a97e63d703873374828c09f20
Jeenu Viswambharan [Thu, 6 Feb 2014 10:36:15 +0000 (10:36 +0000)]
Add support for handling runtime service requests
This patch uses the reworked exception handling support to handle
runtime service requests through SMCs following the SMC calling
convention. This is a giant commit since all the changes are
inter-related. It does the following:
1. Replace the old exception handling mechanism with the new one
2. Enforce that SP_EL0 is used C runtime stacks.
3. Ensures that the cold and warm boot paths use the 'cpu_context'
structure to program an ERET into the next lower EL.
4. Ensures that SP_EL3 always points to the next 'cpu_context'
structure prior to an ERET into the next lower EL
5. Introduces a PSCI SMC handler which completes the use of PSCI as a
runtime service
Change-Id: I661797f834c0803d2c674d20f504df1b04c2b852
Co-authored-by: Achin Gupta <achin.gupta@arm.com>
Achin Gupta [Sun, 2 Feb 2014 12:02:23 +0000 (12:02 +0000)]
Introduce new exception handling framework
This patch introduces the reworked exception handling logic which lays
the foundation for accessing runtime services in later patches. The
type of an exception has a greater say in the way it is
handled. SP_EL3 is used as the stack pointer for:
1. Determining the type of exception and handling the unexpected ones
on the exception stack
2. Saving and restoring the essential general purpose and system
register state after exception entry and prior to exception exit.
SP_EL0 is used as the stack pointer for handling runtime service
requests e.g. SMCs. A new structure for preserving general purpose
register state has been added to the 'cpu_context' structure. All
assembler ensures that it does not use callee saved registers
(x19-x29). The C runtime preserves them across functions calls. Hence
EL3 code does not have to save and restore them explicitly.
Since the exception handling framework has undergone substantial change,
the changes have been kept in separate files to aid readability. These
files will replace the existing ones in subsequent patches.
Change-Id: Ice418686592990ff7a4260771e8d6676e6c8c5ef
Achin Gupta [Sat, 1 Feb 2014 18:53:26 +0000 (18:53 +0000)]
Add runtime services framework
This patch introduces the framework to enable registration and
initialisation of runtime services. PSCI is registered and initialised
as a runtime service. Handling of runtime service requests will be
implemented in subsequent patches.
Change-Id: Id21e7ddc5a33d42b7d6e455b41155fc5441a9547
Achin Gupta [Sat, 1 Feb 2014 08:59:56 +0000 (08:59 +0000)]
psci: Use context library for preserving EL3 state
This patch uses the context library to save and restore EL3 state on
the 'cpu_context' data structures allocated by PSCI for managing
non-secure state context on each cpu.
Change-Id: I19c1f26578204a7cd9e0a6c582ced0d97ee4cf80
Achin Gupta [Sat, 1 Feb 2014 07:51:28 +0000 (07:51 +0000)]
Add context management library
This patch adds support for a cpu context management library. This
library will be used to:
1. Share pointers to secure and non-secure state cpu contexts between
runtime services e.g. PSCI and Secure Payload Dispatcher services
2. Set SP_EL3 to a context structure which will be used for
programming an ERET into a lower EL
3. Provide wrapper functions to save and restore EL3 & EL1
state. These functions will in turn use the helper functions in
context.S
Change-Id: I655eeef83dcd2a0c6f2eb2ac23efab866ac83ca0
Achin Gupta [Thu, 16 Jan 2014 12:08:03 +0000 (12:08 +0000)]
Add helper library for cpu context management
This patch introduces functions for saving and restoring shared system
registers between secure and non-secure EL1 exception levels, VFP
registers and essential EL3 system register and other state. It also
defines the 'cpu_context' data structure which will used for saving and
restoring execution context for a given security state. These functions
will allow runtime services like PSCI and Secure payload dispatcher to
implement logic for switching between the secure and non-secure states.
The save and restore functions follow AArch64 PCS and only use
caller-saved temporary registers.
Change-Id: I8ee3aaa061d3caaedb28ae2c5becb9a206b6fd74
Achin Gupta [Sat, 18 Jan 2014 16:50:09 +0000 (16:50 +0000)]
Setup VBAR_EL3 incrementally
This patch ensures that VBAR_EL3 points to the simple stack-less
'early_exceptions' when the C runtime stack is not correctly setup to
use the more complex 'runtime_exceptions'. It is initialised to
'runtime_exceptions' once this is done.
This patch also moves all exception vectors into a '.vectors' section
and modifies linker scripts to place all such sections together. This
will minimize space wastage from alignment restrictions.
Change-Id: I8c3e596ea3412c8bd582af9e8d622bb1cb2e049d
Jeenu Viswambharan [Fri, 7 Feb 2014 15:50:57 +0000 (15:50 +0000)]
Fix spilled-over BL1 exception vector
The SynchronousExceptionA64 vector has gone beyond the 32-instruction
limit for individual exception vector. This patch splits and relocates
the exception handler so that it fits into the 32-instruction window.
Change-Id: Ic60c4fc3f09a1cb071d63ff0e58353ecaecbb62f
Jeenu Viswambharan [Mon, 17 Feb 2014 17:26:51 +0000 (17:26 +0000)]
Move translation tables into separate section
This patch moves the translation tables into their own section. This
saves space that would otherwise have been lost in padding due to page
table alignment constraints. The BL31 and BL32 bases have been
consequently adjusted.
Change-Id: Ibd65ae8a5ce4c4ea9a71a794c95bbff40dc63e65
Harry Liebel [Fri, 31 Jan 2014 19:04:10 +0000 (19:04 +0000)]
Add Firmware Image Package (FIP) documentation
This fixes ARM-software/tf-issues#9
Change-Id: Id57037115b8762efc9eaf5ff41887b71d6494c5d
Harry Liebel [Fri, 14 Feb 2014 14:42:48 +0000 (14:42 +0000)]
Add Firmware Image Package (FIP) driver
The Firmware Image Package (FIP) driver allows for data to be loaded
from a FIP on platform storage. The FVP supports loading bootloader
images from a FIP located in NOR FLASH.
The implemented FVP policy states that bootloader images will be
loaded from a FIP in NOR FLASH if available and fall back to loading
individual images from semi-hosting.
NOTE:
- BL3-3(e.g. UEFI) is loaded into DRAM and needs to be configured
to run from the BL33_BASE address. This is currently set to
DRAM_BASE+128MB for the FVP.
Change-Id: I2e4821748e3376b5f9e467cf3ec09509e43579a0
Harry Liebel [Fri, 10 Jan 2014 18:00:33 +0000 (18:00 +0000)]
Add Firmware Image Package creation tool
This tool can be used to create a Firmware Image Packages (FIP). These
FIPs store a combined set of firmware images with a Table of Contents
(ToC) that can be loaded by the firmware from platform storage.
- Add uuid.h from FreeBSD.
- Use symbolic links to shared headers otherwise unwanted headers and
definitions are pulled in.
- A FIP is created as part of the default FVP build.
- A BL3-3 image(e.g. UEFI) must be provided.
Change-Id: Ib73feee181df2dba68bf6abec115a83cfa5e26cb
James Morrissey [Mon, 10 Feb 2014 17:04:32 +0000 (17:04 +0000)]
Implement load_image in terms of IO abstraction
The modified implementation uses the IO abstraction rather than
making direct semi-hosting calls. The semi-hosting driver is now
registered for the FVP platform during initialisation of each boot
stage where it is used. Additionally, the FVP platform includes a
straightforward implementation of 'plat_get_image_source' which
provides a generic means for the 'load_image' function to determine
how to access the image data.
Change-Id: Ia34457b471dbee990c7b3c79de7aee4ceea51aa6
James Morrissey [Mon, 10 Feb 2014 16:18:59 +0000 (16:18 +0000)]
Add IO abstraction framework
This is intended primarily for use as a storage abstraction.
It allows operations such as image-loading to be implemented
in a platform-independent fashion. Each platform registers
a set of IO drivers during initialisation. The platform must
also provide a function that will return a device and a specifier
that can be used to access specified content.
Clients of the API will primarily use device and entity handles.
The term "entity" is deliberately vague, to allow for different
representations of content accessed using different types of
specifier, but will often be interpreted as a "file" where the
specifier will normally be its path.
This commit builds, but is intended to be paired with a sample
implementation of "load_image" using a semi-hosting driver on FVP.
Change-Id: Id3b52f1c0eb9ce76b44b99fc6b6460803668cc86
James Morrissey [Mon, 10 Feb 2014 14:24:36 +0000 (14:24 +0000)]
Fix asserts appearing in release builds
Also fix warnings generated in release builds when assert code
is absent.
Change-Id: I45b9173d3888f9e93e98eb5b4fdc06727ba5cbf4
Sandrine Bailleux [Tue, 11 Feb 2014 13:31:33 +0000 (13:31 +0000)]
Compile assembly files with -DDEBUG flag
Change-Id: Ic6cf19402a0936161baf6b91bf75d64d95269a3c
Jon Medhurst [Wed, 15 Jan 2014 18:22:34 +0000 (18:22 +0000)]
Fix memmove and memcpy
memmove needs to allow for overlapping memory regions and, together
with memcpy, should return the input destination pointer, not the
address after the end of the copied data.
fixes ARM-software/tf-issues#18
Signed-off-by: Jon Medhurst <tixy@linaro.org>
Ian Spray [Thu, 30 Jan 2014 17:25:28 +0000 (17:25 +0000)]
Allow style checking of tree and local changes
New phony Makefile targets have been added:
* checkcodebase
* checkpatch
The checkcodebase target will run a Linux style compliance check over the
entire codebase, and honours the V=1 Makefile verbose setting and so will
show more information when this is enabled.
If the local directory is a git checkout then the output of git ls-files is
used to decide which files to test for compliance. If the local directory
is not under git control then a 'best attempt' is made, but in this case it
should be noted that it is possible for additional non-codebase files to be
tested, so care should be taken when parsing the output.
The checkpatch target will compare local changes against the git origin/master
to allow issues with the last set of changes to be identified. To override
the change comparision location, set the BASE_COMMIT variable to your
desired git branch.
Both targets rely on the Linux source tree script checkpatch.pl to do the
syntax checking, and expects that the CHECKPATCH environment variable points
to the location of this file.
Notes on the usage of these targets have been added to the contributing.md
and docs/user-guide.md text files.
Change-Id: I6d73c97af578e24a34226d972afadab9d30f1d8d
Joakim Bech [Thu, 23 Jan 2014 13:51:49 +0000 (14:51 +0100)]
Build system: Add cscope target to the Makefile
Fixes arm-software/tf-issues#15
Signed-off-by: Joakim Bech <joakim.bech@linaro.org>
Achin Gupta [Fri, 17 Jan 2014 16:52:29 +0000 (16:52 +0000)]
fvp: clear a pending cluster power off request
The last CPU in a cluster is responsible for issuing the cluster power
down request to the FVP power controller. If another CPU in this
cluster wakes up before the last CPU enters WFI then the cluster power
down request remains pending. If this request is not cancelled and the
newly woken up CPU enters a simple WFI later, the power controller
powers the cluster down. This leads to unpredictable behaviour.
This patch fixes this issue by ensuring that the first CPU to wake up
in a cluster writes its MPIDR to the power controller's PPONR. This
cancels any pending cluster power down request.
Change-Id: I7e787adfd6c9a0bd7308390e3309d46f35c01086
Achin Gupta [Thu, 5 Dec 2013 16:33:10 +0000 (16:33 +0000)]
psci: fix affinity level upgrade issue
The psci implementation does not track target affinity level requests
specified during cpu_suspend calls correctly as per the following
example.
1. cpu0.cluster0 calls cpu_suspend with the target affinity level as 0
2. Only the cpu0.cluster0 is powered down while cluster0 remains
powered up
3. cpu1.cluster0 calls cpu_off to power itself down to highest
possible affinity level
4. cluster0 will be powered off even though cpu0.cluster0 does not
allow cluster shutdown
This patch introduces reference counts at affinity levels > 0 to track
the number of cpus which want an affinity instance at level X to
remain powered up. This instance can be turned off only if its
reference count is 0. Cpus still undergo the normal state transitions
(ON, OFF, ON_PENDING, SUSPEND) but the higher levels can only be
either ON or OFF depending upon their reference count.
The above issue is thus fixed as follows:
1. cluster0's reference count is incremented by two when cpu0 and cpu1
are initially powered on.
2. cpu0.cluster0 calls cpu_suspend with the target affinity level as
0. This does not affect the cluster0 reference count.
3. Only the cpu0.cluster0 is powered down while cluster0 remains
powered up as it has a non-zero reference count.
4. cpu1.cluster0 call cpu_off to power itself down to highest possible
affinity level. This decrements the cluster0 reference count.
5. cluster0 is still not powered off since its reference count will at
least be 1 due to the restriction placed by cpu0.
Change-Id: I433dfe82b946f5f6985b1602c2de87800504f7a9
Achin Gupta [Thu, 5 Dec 2013 15:10:48 +0000 (15:10 +0000)]
psci: preserve target affinity level during suspend
This patch adds support to save and restore the target affinity level
specified during a cpu_suspend psci call. This ensures that we
traverse only through the affinity levels that we originally intended
to after resuming from suspend.
Change-Id: I0900ae49a50b496da137cfec8f158da0397ec56c
Achin Gupta [Thu, 5 Dec 2013 14:21:04 +0000 (14:21 +0000)]
psci: replace secure context with suspend context
The secure context saved and restored across a cpu_suspend operation
can be more than just the state of the secure system registers e.g. we
also need to save the affinity level till which the cpu is being
powered down. This patch creates a suspend_context data structure
which includes the system register context. This will allow other bits
to be saved and restored as well in subsequent patches.
Change-Id: I1c1f7d25497388b54b7d6ee4fab77e8c6a9992c4
Ryan Harkin [Wed, 15 Jan 2014 17:37:25 +0000 (17:37 +0000)]
fvp: rename fvp_* files to plat_*
The FVP platform has a few filenames that begin with fvp_. These are
renamed to plat_ to make it easier to use the FVP port as a template.
Change-Id: I601e6256d5ef3bae81a2e1f5df6de56db5b27069
Signed-off-by: Ryan Harkin <ryan.harkin@linaro.org>
Ryan Harkin [Wed, 15 Jan 2014 16:55:07 +0000 (16:55 +0000)]
Build system: add 'make help' option
Add the 'help' target to the Makefile to present a brief guide to the
various build options available.
Change-Id: Ic3a3489860b6362eb236470ea6b43a16a1b2fe3a
Signed-off-by: Ryan Harkin <ryan.harkin@linaro.org>
Ryan Harkin [Mon, 13 Jan 2014 14:40:13 +0000 (14:40 +0000)]
Build system: minor spacing tidyup
Tidy up the spacing of variable definitions within the makefiles to make
them more consistent, easier to read and amend.
Change-Id: Ic6d7c8489ca4330824abb5cd1ead8f1d449d1a85
Signed-off-by: Ryan Harkin <ryan.harkin@linaro.org>
Ryan Harkin [Mon, 13 Jan 2014 12:37:03 +0000 (12:37 +0000)]
Build system: Fixes #2: Add multi-platform support
Move all explicit platform or architecture specific references
into a new platform.mk file that is defined for each platform.
Change-Id: I9d6320d1ba957e0cc8d9b316b3578132331fa428
Signed-off-by: Ryan Harkin <ryan.harkin@linaro.org>
Achin Gupta [Sat, 18 Jan 2014 16:26:30 +0000 (16:26 +0000)]
remove empty definition of display_boot_progress()
This patch replaces the empty definition of display_boot_progress() in
bl2_main.c with a weak definition. The former allowed bl2 to use the
early_exceptions(). It is possible to do that with a simple weak
definition as well.
Change-Id: Idb3f425a5e265f3579b638e3d26bd8c9bb78f80d
Jeenu Viswambharan [Thu, 16 Jan 2014 17:30:39 +0000 (17:30 +0000)]
Change comments in assembler files to help ctags
Ctags seem to have a problem with generating tags for assembler symbols
when a comment immediately follows an assembly label.
This patch inserts a single space character between the label
definition and the following comments to help ctags.
The patch is generated by the command:
git ls-files -- \*.S | xargs sed -i 's/^\([^:]\+\):;/\1: ;/1'
Change-Id: If7a3c9d0f51207ea033cc8b8e1b34acaa0926475
Harry Liebel [Thu, 12 Dec 2013 13:00:29 +0000 (13:00 +0000)]
Probe for GICv3 re-distributors on core bring-up
The GICv3 distributor can have more ports than CPUs are available in
the system. Probe all re-distributors and use the matching affinity
levels as specified by each core and re-distributor to decide which
re-distributor to use with which CPU core.
If a core cannot be matched with a re-distributor, the core panics and
is placed in an endless loop.
Change-Id: Ie393cfe07c7449a2383959e3c968664882e18afc
Harry Liebel [Tue, 14 Jan 2014 18:11:48 +0000 (18:11 +0000)]
Do not trap access to floating point registers
Traps when accessing architectural features are disabled by clearing bits
in CPTR_EL3 during early boot, including accesses to floating point
registers. The value of this register was previously undetermined, causing
unwanted traps to EL3. Future EL3 code (for example, context save/restore
code) may use floating point registers, although they are not used by current
code.
Also, the '-mgeneral-regs-only' flag is enabled in the GCC settings to
prevent generation of code that uses floating point registers.
Change-Id: I9a03675f6387bbbee81a6f2c9ccf81150db03747
Dan Handley [Tue, 14 Jan 2014 18:17:09 +0000 (18:17 +0000)]
Update year in copyright text to 2014
Change-Id: Ic7fb61aabae1d515b9e6baf3dd003807ff42da60
Dan Handley [Tue, 14 Jan 2014 13:20:12 +0000 (13:20 +0000)]
Refer to separate issue tracking repository
Update documentation to refer to separate issue tracking
repository, https://github.com/ARM-software/tf-issues/issues.
Change-Id: Ib1cef65b0da420bec58290d8743eb069b1226c96
Ian Spray [Thu, 2 Jan 2014 16:57:12 +0000 (16:57 +0000)]
Move GIC setup to a separate file
GIC setup code which used to be in bl31_plat_setup.c is now in fvp_gic.c
to simplify future changes to other bootloader stages. This patch moves
code from bl31_plat_setup.c to fvp_gic.c, simplifies the include file
list for bl31_plat_setup.c, moves GIC declarations from the bl31.h header
file into the platform.h, and reworks files according to coding style
guide.
Change-Id: I48d82a4ba33e7114dcc88f9ca98767a06cf8f417
Harry Liebel [Fri, 3 Jan 2014 14:18:15 +0000 (14:18 +0000)]
Build project with 'pedantic'
Tighten up ISO C standard checking. Fix 'CASSERT' implementation to
conform to C99 as opposed to GNU99 standard.
Change-Id: I58ddc61913617b66f11da5b6e3f7363136d5cf7d
Harry Liebel [Fri, 20 Dec 2013 18:51:12 +0000 (18:51 +0000)]
Do not let GCC use built-in functions
In order to reduce the software dependency on the compiler, the project
is now compiled with the '-ffreestanding' flag. This is to prevent GCC
from replacing functions with more optimised versions. An example is
where GCC replaces a simple printf() with a puts().
Change-Id: I1973fe6957cd708e8432a0039af9d50e037bd884
Sandrine Bailleux [Tue, 17 Dec 2013 13:47:14 +0000 (13:47 +0000)]
Fix SPSR register size in gp_regs structure
SPSR is a 32-bit register and so its size should be reflected in
the gp_regs structure. This patch fixes the type of gp_regs.spsr
to use a 32-bit variable. It also makes the size of the other
register fields more explicit.
Change-Id: I27e0367df1a91cc501d5217c1b3856d4097c60ba
Harry Liebel [Thu, 12 Dec 2013 16:03:44 +0000 (16:03 +0000)]
Local C library documentation updates
- Update porting guide to describe where files live and how to get
FreeBSD source code.
- Update change-log to describe relocation and new functions.
Change-Id: Id8f30cc7bafdd1064b3a5c5aae958c5aa3fb79f3
Harry Liebel [Thu, 12 Dec 2013 16:46:30 +0000 (16:46 +0000)]
Add strchr() and putchar() to local C library
Change-Id: I3659e119a242f8ef828e32bfdf5d0b4b7ac4f716
Harry Liebel [Tue, 17 Dec 2013 18:19:04 +0000 (18:19 +0000)]
Create local C library implementation (2/2)
- This change is split into two separate patches in order to
simplify the history as interpreted by 'git'. The split is
between the move/rename and addition of new files.
- Remove dependency on toolchain C library headers and functions in
order to ensure behavioural compatibility between toolchains.
- Use FreeBSD as reference for C library implementation.
- Do not let GCC use default library include paths.
- Remove unused definitions in modified headers and implementations.
- Move C library files to 'lib/stdlib' and 'include/stdlib'.
- Break std.c functions out into separate files.
Change-Id: I3e3d8d992052264d2a02489034ae4c03bf0f5512
Harry Liebel [Tue, 17 Dec 2013 18:31:42 +0000 (18:31 +0000)]
Create local C library implementation (1/2)
- This change is split into two separate patches in order to
simplify the history as interpreted by 'git'. The split is
between the move/rename and addition of new files.
- Remove dependency on toolchain C library headers and functions in
order to ensure behavioural compatibility between toolchains.
- Use FreeBSD as reference for C library implementation.
- Do not let GCC use default library include paths.
- Remove unused definitions in modified headers and implementations.
- Move C library files to 'lib/stdlib' and 'include/stdlib'.
- Break std.c functions out into separate files.
Change-Id: I91cddfb3229775f770ad781589670c57d347a154
Harry Liebel [Thu, 19 Dec 2013 13:30:58 +0000 (13:30 +0000)]
Add debug macros
- Add 'debug.h' with INFO, WARN and ERROR macros.
- This prints the specified message with the appropriate tag.
- INFO and WARN messages are only displayed when building with
the DEBUG flag set. Error messages are always printed.
Change-Id: I21835b6063fcc99649b30ac7489387cbd3705bc0
Sandrine Bailleux [Mon, 2 Dec 2013 15:57:09 +0000 (15:57 +0000)]
Make BL31's ns_entry_info a single-cpu area
ns_entry_info used to be a per-cpu array. This is a waste of space
because it is only accessed by the primary CPU on the cold boot path.
This patch reduces ns_entry_info to a single-cpu area.
Change-Id: I647c70c4e76069560f1aaad37a1d5910f56fba4c
Sandrine Bailleux [Mon, 2 Dec 2013 15:45:07 +0000 (15:45 +0000)]
BL2: Sanity check value in x0 in the entry point code
Change-Id: Icef68e314e6ba0f3694189b57f4b1dbbea5ba255
Sandrine Bailleux [Mon, 2 Dec 2013 15:41:25 +0000 (15:41 +0000)]
Move RUN_IMAGE constant from bl1.h to bl_common.h
RUN_IMAGE constant is used by all bootloader stages.
Change-Id: I1b4e28d8fcf3ad1363f202c859f5efab0f320efe
Sandrine Bailleux [Thu, 28 Nov 2013 14:55:58 +0000 (14:55 +0000)]
Remove useless copies of meminfo structures
Platform setup code has to reserve some memory for storing the
memory layout information. It is populated in early platform setup
code.
blx_get_sec_mem_layout() functions used to return a copy of this
structure. This patch modifies blx_get_sec_mem_layout() functions
so that they now directly return a pointer to their memory layout
structure. It ensures that the memory layout returned by
blx_get_sec_mem_layout() is always up-to-date and also avoids a
useless copy of the meminfo structure.
Also rename blx_get_sec_mem_layout() to blx_plat_sec_mem_layout()
to make it clear those functions are platform specific.
Change-Id: Ic7a6f9d6b6236b14865ab48a9f5eff545ce56551
Achin Gupta [Tue, 26 Nov 2013 15:34:12 +0000 (15:34 +0000)]
psci: update docs with status of cpu_suspend api
This patch makes changes to the documents to reflect the current
state of play of the psci cpu_suspend function.
Change-Id: I086509fb75111b6e9f93b7f6dbcd33cc4591b9f3
Achin Gupta [Mon, 2 Dec 2013 17:33:04 +0000 (17:33 +0000)]
psci: rectify and homogenise generic code
This patch performs a major rework of the psci generic implementation
to achieve the following:
1. replace recursion with iteration where possible to aid code
readability e.g. affinity instance states are changed iteratively
instead of recursively.
2. acquire pointers to affinity instance nodes at the beginning of a
psci operation. All subsequent actions use these pointers instead
of calling psci_get_aff_map_node() repeatedly e.g. management of
locks has been abstracted under functions which use these pointers
to ensure correct ordering. Helper functions have been added to
create these abstractions.
3. assertions have been added to cpu level handlers to ensure correct
state transition
4. the affinity level extents specified to various functions have the
same meaning i.e. start level is always less than the end level.
Change-Id: If0508c3a7b20ea3ddda2a66128429382afc3dfc8
Achin Gupta [Mon, 2 Dec 2013 16:23:12 +0000 (16:23 +0000)]
psci: rework cpu_off assertion and minor cleanups
This patch:
1. removes a duplicate assertion to check that the only error
condition that can be returned while turning a cpu off is
PSCI_E_DENIED. Having this assertion after calling
psci_afflvl_off() is sufficient.
2. corrects some incorrect usage of 'its' vs 'it is'
3. removes some unwanted white spaces
Change-Id: Icf014e269b54f5be5ce0b9fbe6b41258e4ebf403
Achin Gupta [Tue, 5 Nov 2013 11:10:38 +0000 (11:10 +0000)]
remove check on non-secure entrypoint parameter
In fvp_affinst_on/suspend, the non-secure entrypoint is always
expected to lie in the DRAM. This check will not be valid if
non-secure code executes directly out of flash e.g. a baremetal
test. This patch removes this check.
Change-Id: I0436e1138fc394aae8ff1ea59ebe38b46a440b61
Achin Gupta [Thu, 31 Oct 2013 11:27:43 +0000 (11:27 +0000)]
move timer #defines & remove duplicate declaration
This patch removes the duplicate declaration of psci_cpu_on in psci.h
and moves the constants for the system level implementation of the
generic timer from arch_helpers.h to arch.h. All other architectural
constants are defined in arch.h so there is no need to add them to
arch_helpers.h
Change-Id: Ia8ad3f91854f7e57fce31873773eede55c384ff1
Achin Gupta [Mon, 25 Nov 2013 18:45:02 +0000 (18:45 +0000)]
psci: fix error due to a non zero context id
In the previous psci implementation, the psci_afflvl_power_on_finish()
function would run into an error condition if the value of the context
id parameter in the cpu_on and cpu_suspend psci calls was != 0. The
parameter was being restored as the return value of the affinity level
0 finisher function. A non zero context id would be treated as an
error condition. This would prevent successful wake up of the cpu from
a power down state. Also, the contents of the general purpose
registers were not being cleared upon return to the non-secure world
after a cpu power up. This could potentially allow the non-secure
world to view secure data.
This patch ensures that all general purpose registers are set to ~0
prior to the final eret that drops the execution to the non-secure
world. The context id is used to initialize the general purpose
register x0 prior to re-entry into the non-secure world and is no
longer restored as a function return value. A platform helper
(platform_get_stack()) has been introduced to facilitate this change.
Change-Id: I2454911ffd75705d6aa8609a5d250d9b26fa097c
Achin Gupta [Sat, 26 Oct 2013 12:10:31 +0000 (13:10 +0100)]
psci: fix values of incorrectly defined constants
This patch fixes the following constant values in the psci.h:
1. The affinity level shift value in the power_state parameter of the
cpu_suspend psci call. The previous value was preventing shutdown
of the affinity level 1.
2. The values used for affinity state constants (ON, OFF,
ON_PENDING). They did not match the values expected to be returned
by the affinity_info psci api as mentioned in the spec.
3. The state id shift value in the power_state parameter of the
cpu_suspend psci call.
Change-Id: I62ed5eb0e9640b4aa97b93923d6630e6b877a097
Achin Gupta [Tue, 12 Nov 2013 16:40:00 +0000 (16:40 +0000)]
clear wakeup enable bit upon resuming from suspend
The FVP specific code that gets called after a cpu has been physically
powered on after having been turned off or suspended earlier does not
clear the PWRC.PWKUPR.WEN bit. Not doing so causes problems if: a cpu
is suspended, woken from suspend, powered down through a cpu_off call
& receives a spurious interrupt. Since the WEN bit is not cleared
after the cpu woke up from suspend, the spurious wakeup will power the
cpu on. Since the cpu_off call clears the jump address in the mailbox
this spurious wakeup will cause the cpu to crash.
This patch fixes this issue by clearing the WEN bit whenever a cpu is
powered up.
Change-Id: Ic91f5dffe1ed01d76bc7fc807acf0ecd3e38ce5b
Achin Gupta [Mon, 25 Nov 2013 14:00:56 +0000 (14:00 +0000)]
rework general purpose registers save and restore
The runtime exception handling assembler code used magic numbers for
saving and restoring the general purpose register context on stack
memory. The memory is interpreted as a 'gp_regs' structure and the
magic numbers are offsets to members of this structure. This patch
replaces the magic number offsets with constants. It also adds compile
time assertions to prevent an incorrect assembler view of this
structure.
Change-Id: Ibf125bfdd62ba3a33e58c5f1d71f8c229720781c
Dan Handley [Mon, 2 Dec 2013 19:25:12 +0000 (19:25 +0000)]
Enable third party contributions
- Add instructions for contributing to ARM Trusted Firmware.
- Update copyright text in all files to acknowledge contributors.
Change-Id: I9311aac81b00c6c167d2f8c889aea403b84450e5
Sandrine Bailleux [Wed, 27 Nov 2013 10:32:17 +0000 (10:32 +0000)]
Update user guide further to linker scripts changes
This patch updates the user guide section about the memory layout.
- Explain the verifications that the linker scripts does on the
global memory layout.
- Refer to the new linker symbols.
- Describe the linker symbols exported to the trusted firmware code.
Change-Id: I033ab2b867e8b9776deb4185b9986bcb8218f286
Sandrine Bailleux [Thu, 28 Nov 2013 09:43:06 +0000 (09:43 +0000)]
Properly initialise the C runtime environment
This patch makes sure the C runtime environment is properly
initialised before executing any C code.
- Zero-initialise NOBITS sections (e.g. the bss section).
- Relocate BL1 data from ROM to RAM.
Change-Id: I0da81b417b2f0d1f7ef667cc5131b1e47e22571f
Sandrine Bailleux [Wed, 27 Nov 2013 09:38:52 +0000 (09:38 +0000)]
Various improvements/cleanups on the linker scripts
- Check at link-time that bootloader images will fit in memory
at run time and that they won't overlap each other.
- Remove text and rodata orphan sections.
- Define new linker symbols to remove the need for platform setup
code to know the order of sections.
- Reduce the size of the raw binary images by cutting some sections
out of the disk image and allocating them at load time, whenever
possible.
- Rework alignment constraints on sections.
- Remove unused linker symbols.
- Homogenize linker symbols names across all BLs.
- Add some comments in the linker scripts.
Change-Id: I47a328af0ccc7c8ab47fcc0dc6e7dd26160610b9
Sandrine Bailleux [Wed, 20 Nov 2013 11:50:48 +0000 (11:50 +0000)]
Treat compiler, assembler and linker warnings as errors
Change-Id: I56284ebf63bef99de1beb4fd86e2d8b6a7962ac0
James Morrissey [Fri, 1 Nov 2013 13:56:59 +0000 (13:56 +0000)]
Generate build products in sub-directories
A single binary can be compiled using a command such as:
make CROSS_COMPILE=aarch64-none-elf- bl1
Also make use of brackets consistent in the Makefile.
Change-Id: I2180fdb473411ef7cffe39670a7b2de82def812e
Harry Liebel [Mon, 18 Nov 2013 16:05:21 +0000 (16:05 +0000)]
Increase default amount of RAM for Base FVPs in FDTs
- Large RAM-disks may have trouble starting with 2GB of memory.
- Increase from 2GB to 4GB in FDT.
Change-Id: I12c1b8e5db41114b88c69c48621cb21247a6a6a7
Sandrine Bailleux [Tue, 19 Nov 2013 17:14:22 +0000 (17:14 +0000)]
fvp: Remove call to bl2_get_ns_mem_layout() function
On FVP platforms, for now it is assumed that the normal-world
bootloader is already sitting in its final memory location.
Therefore, BL2 doesn't need to load it and so it doesn't need
to know the extents of the non-trusted DRAM.
Change-Id: I33177ab43ca242edc8958f2fa8d994e7cf3e0843
Sandrine Bailleux [Fri, 15 Nov 2013 14:46:44 +0000 (14:46 +0000)]
AArch64: Remove EL-agnostic TLB helper functions
Also, don't invalidate the TLBs in disable_mmu() function, it's better
to do it in enable_mmu() function just before actually enabling the
MMU.
Change-Id: Ib32d6660019b0b2c17254156aad4be67ab4970e1
Sandrine Bailleux [Mon, 18 Nov 2013 17:26:59 +0000 (17:26 +0000)]
Unmask SError and Debug exceptions.
Any asynchronous exception caused by the firmware should be handled
in the firmware itself. For this reason, unmask SError exceptions
(and Debug ones as well) on all boot paths. Also route external
abort and SError interrupts to EL3, otherwise they will target EL1.
Change-Id: I9c191d2d0dcfef85f265641c8460dfbb4d112092
Sandrine Bailleux [Mon, 28 Oct 2013 15:14:00 +0000 (15:14 +0000)]
fvp: Remove unnecessary initializers
Global and static variables are expected to be initialised to zero
by default. This is specified by the C99 standard. This patch
removes some unnecessary initialisations of such variables.
It fixes a compilation warning at the same time:
plat/fvp/bl31_plat_setup.c:82:3: warning: missing braces around
initializer [-Wmissing-braces]
section("tzfw_coherent_mem"))) = {0};
^
plat/fvp/bl31_plat_setup.c:82:3: warning: (near initialization for
‘ns_entry_info[0]’) [-Wmissing-braces]
Note that GCC should not have emitted this warning message in the
first place. The C Standard permits braces to be elided around
subaggregate initializers. See this GCC bug report:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53119
Change-Id: I13cb0c344feb9803bca8819f976377741fa6bc35
Sandrine Bailleux [Fri, 25 Oct 2013 14:33:39 +0000 (15:33 +0100)]
Fix inlining of GIC helper functions
Change-Id: I27aad560a5da21c0439f3ccc9dc07b026e7c6022
Sandrine Bailleux [Tue, 12 Nov 2013 16:41:16 +0000 (16:41 +0000)]
Move generic architectural setup out of blx_plat_arch_setup().
blx_plat_arch_setup() should only perform platform-specific
architectural setup, e.g. enabling the MMU. This patch moves
generic architectural setup code out of blx_plat_arch_setup().
Change-Id: I4ccf56b8c4a2fa84909817779a2d97a14aaafab6
James Morrissey [Tue, 29 Oct 2013 10:56:46 +0000 (10:56 +0000)]
Fix documentation issues in v0.2 release
Change-Id: I4e2a9daa97e3be3d2f53894f2ec7947ba6bb3a16
Harry Liebel [Tue, 5 Nov 2013 18:00:38 +0000 (18:00 +0000)]
Add Foundation FVP documentation
Change-Id: I5e47ba96e128d3a793517441f5a6c9f2ccbdfc66
Harry Liebel [Mon, 11 Nov 2013 13:24:47 +0000 (13:24 +0000)]
Add GICv3 ITS to FDTs
- The interrupt addresses need to be updated to work.
Change-Id: Icdd00177095ae9e4eb7b13718762f92e29b1465c
Harry Liebel [Wed, 30 Oct 2013 17:41:48 +0000 (17:41 +0000)]
Do not enable CCI on Foundation FVP
- The Foundation FVP only has one cluster and does not have
CCI.
Change-Id: If91e81ff72c52e448150089c4cfea3e4d6ae1232
Harry Liebel [Tue, 22 Oct 2013 16:29:14 +0000 (17:29 +0100)]
FDTs for v5.2 Foundation model
- The Foundation FVP is a cut down version of the Base FVP and as
such lacks some components.
- Three FDTs are provided.
fvp-foundation-gicv2legacy-psci:
Use this when setting the Foundation FVP to use GICv2. In this
mode the GIC is located at the VE location, as described in the
VE platform memory map.
fvp-foundation-gicv3-psci :
Use this when setting the Foundation FVP to use GICv3. In this
mode the GIC is located at the Base location, as described in the
Base platform memory map.
fvp-foundation-gicv2-psci :
Use this when setting the Foundation FVP to use GICv3, but Linux
is expected to use GICv2 emulation mode. In this mode the GIC is
located at the Base location, but the GICv3 is used in GICv2
emulation mode.
Change-Id: I9d69bcef35c64cc8f16550efe077f578e55aaae5
Harry Liebel [Fri, 25 Oct 2013 15:07:53 +0000 (16:07 +0100)]
Writing to the FVP LED register should be a 32bit access.
- Writing to this register with a 64bit access can cause a
Systen Error Exception on some models.
Change-Id: Ibcf5bdf7ab55707db61c16298f25caff50e1ff7e
Achin Gupta [Fri, 25 Oct 2013 08:08:21 +0000 (09:08 +0100)]
ARMv8 Trusted Firmware release v0.2