Commit Graph

724 Commits

Author SHA1 Message Date
Andrew Thoelke 8cec598ba3 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
2014-05-07 11:19:47 +01:00
Dan Handley 625de1d4f0 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
2014-05-06 17:55:38 +01:00
Dan Handley 97043ac98e 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
2014-05-06 13:57:48 +01:00
Dan Handley fb037bfb7c 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
2014-05-06 13:57:48 +01:00
Dan Handley 8a4fb6f658 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
2014-05-06 12:35:02 +01:00
Dan Handley 35e98e5588 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
2014-05-06 12:35:02 +01:00
Dan Handley e8246c0714 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
2014-05-06 12:35:02 +01:00
Dan Handley 4ecca33988 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
2014-05-06 12:35:02 +01:00
Harry Liebel cd116d177b 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
2014-04-24 13:55:56 +01:00
Dan Handley d72f6e31b0 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
2014-04-14 17:03:01 +01:00
Vikram Kanigiri 0796fe01f8 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
2014-03-26 17:36:36 +00:00
Soby Mathew c1df3be7dd 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
2014-03-26 17:36:36 +00:00
Sandrine Bailleux 493c8cb2ae 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
2014-03-21 17:17:48 +00:00
Ryan Harkin cd52932098 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>
2014-02-20 19:06:34 +00:00
Jeenu Viswambharan 08c28d5385 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
2014-02-20 19:06:34 +00:00
Jeenu Viswambharan dd3dc32f1d 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
2014-02-20 19:06:34 +00:00
Achin Gupta 8aa0cd43a8 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
2014-02-20 19:06:34 +00:00
Harry Liebel 561cd33ece 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
2014-02-17 18:51:44 +00:00
James Morrissey 9d72b4ea9c 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
2014-02-17 18:51:43 +00:00
James Morrissey f2f9bb5e71 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
2014-02-17 18:51:43 +00:00
Dan Handley e83b0cadc6 Update year in copyright text to 2014
Change-Id: Ic7fb61aabae1d515b9e6baf3dd003807ff42da60
2014-01-17 10:27:53 +00:00
Achin Gupta b127cdb879 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
2013-12-05 12:28:50 +00:00
Dan Handley ab2d31edbd Enable third party contributions
- Add instructions for contributing to ARM Trusted Firmware.

- Update copyright text in all files to acknowledge contributors.

Change-Id: I9311aac81b00c6c167d2f8c889aea403b84450e5
2013-12-05 11:34:09 +00:00
Achin Gupta 4f6ad66ae9 ARMv8 Trusted Firmware release v0.2 2013-10-25 09:37:16 +01:00