Commit Graph

338 Commits

Author SHA1 Message Date
Sandrine Bailleux a602ad6175 Document 'BL30' build configuration in user guide
Change-Id: I67d8d44a708aefb04b285436dd45ff4589e3b3e9
2014-06-05 17:39:40 +01:00
Sandrine Bailleux 45a5fe9433 juno: Implement 'plat_print_gic_regs' macro
The 'plat_print_gic_regs' macro will print the contents of
the GICC_IAR and GICC_CTLR registers.

Change-Id: Ib435522c2d597e15c31fe05f9b0b310b9053206c
2014-06-05 17:39:40 +01:00
Sandrine Bailleux a90bfa3361 juno: Provide per-EL MMU setup functions
Instead of having a single version of the MMU setup functions for all
bootloader images that can execute either in EL3 or in EL1, provide
separate functions for EL1 and EL3. Each bootloader image can then
call the appropriate version of these functions. The aim is to reduce
the amount of code compiled in each BL image by embedding only what's
needed (e.g. BL1 to embed only EL3 variants).

Change-Id: Ie3f6fb58f7d9ea4e4085b5069e27d6b9dceaa286
2014-06-05 17:39:40 +01:00
Sandrine Bailleux fe23b15d11 juno: Add support for BL3-2 image
This patch implements the TSP on Juno. It executes from Secure RAM.

Also, the other bootloader images (i.e. BL1 R/W, BL2 and BL3-1) have
been moved around. The reason is, although there was enough space
overall to store the TSP in SRAM, there was no contiguous free chunk
of SRAM big enough to hold it.

This patch keeps the overall memory layout (i.e. keeping BL1 R/W at
the bottom, BL2 at the top and BL3-1 in between) but moves the base
addresses of all the bootloader images in such a way that:
 - memory fragmentation is reduced enough to fit BL3-2 in;
 - new base addresses are suitable for release builds as well as debug
   ones;
 - each image has a few extra kilobytes for future growth.
   BL3-1 and BL3-2 are the images which received the biggest slice
   of the cake since they will most probably grow the most.

A few useful numbers for reference (valid at the time of this patch):
        |-----------------------|-------------------------------
        |  image size (debug)   |  extra space for the future
--------|-----------------------|-------------------------------
BL1 R/W |         28 KB         |            4 KB
BL2     |         48 KB         |            4 KB
BL3-1   |         96 KB         |            8 KB
BL3-2   |         56 KB         |            8 KB
--------|-----------------------|-------------------------------
Total   |        228 KB         |           24 KB       = 252 KB
--------|-----------------------|-------------------------------

Note: On Juno, although the Secure RAM is 256 KB, the first 4KB
are reserved for the AP/SCP mailboxes.

Change-Id: I999ec39589c45beabe1ecd772641623e58569a6e
2014-06-05 17:39:40 +01:00
Sandrine Bailleux 7795260a2c juno: Access MPIDR_EL1 register directly in assembler
Instead of using the read_mpidr() helper functions to read the
MPIDR_EL1 system register, assembler coded functions should
use MRS/MSR instructions. This results in faster and more
compact code.

Change-Id: I42bb61a926113c4f80aa1ce72ee29ab26cd8fa43
2014-06-05 17:39:40 +01:00
Sandrine Bailleux dcb3a56353 juno: Correct usage of mem. barriers in MMU setup code
Add memory barriers to ensure that all translation table writes
have drained into memory, the TLB invalidation is complete,
and translation register writes are committed before enabling
the MMU.

Also ensure the MMU enable takes effect immediately.

These changes are necessary because of commit 8cec598ba3.

Change-Id: I65b5c3593af27f19da3fd2170c55f631f1ce7b81
2014-06-05 17:39:40 +01:00
Sandrine Bailleux d3f262465b juno: Remove unused disable_mmu() function
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.

This patch removes the C version of this function in juno code.
An assembly version has been introduced in commit 2f5dcfef1d.

Change-Id: I0de10dbe2db8d22855bf1f60f1e48540a4861cb6
2014-06-05 17:39:40 +01:00
Sandrine Bailleux dbc6eb236b juno: Constify some variables
Mark some of the variables in the juno code as 'const' where possible.

Change-Id: I14b19cccff5993c08a0ca11cd42e57d5435081f4
2014-06-05 17:39:40 +01:00
Sandrine Bailleux 7beb5ec173 Remove duplicate TZC-400 header file
Because we needed to configure the trustzone controller on Juno,
minimal support for the TZC-400 had been added. However, a proper
TZC-400 driver has been introduced since then. This patch removes
the old, minimal header file and makes the necessary changes to use
the new one.

Change-Id: I4af1d8fb423e3214a0020c527bd2c1c2fcdb5c56
2014-06-05 17:39:40 +01:00
Sandrine Bailleux 65a42f57eb juno: Fix build errors due to recent changes
This is a miscellaneous commit that fixes all build
errors introduced by the rebase of the Juno codebase
on the latest trusted firmware.

 - Make codebase consistent in its use of #include "" syntax
   for user includes and #include <> syntax for system includes.

 - Sort header files alphabetically

 - Use tag names for structure types.
   Replace instances of the former io_handle and io_dev_handle
   types with uintptr_t.

 - Review the .c and .S files for which header files really need
   including and reorder the #include statements alphabetically.

Change-Id: I1d409fafb6dc257a38992ee15b22b0e890d040b0
2014-06-05 17:39:40 +01:00
Sandrine Bailleux dbff210ec5 Revert "juno: Initialise architected timer in BL3-1"
This reverts commit ff7480a34839693fdba599f74e5c7e6e189eebb8.
because the architected timer is now initialised in architecture
code and no longer in platform code. See commit 9e86490f8f.

Change-Id: I0f12e006ba1574c7c0fc03c616503f33958b9596
2014-06-05 17:39:40 +01:00
Sandrine Bailleux 569a5db9ef juno: Remove vpath usage in platform makefile
As per commit bee8241711, remove all usage of the vpath keyword
in makefiles. Specify the relative paths to source files instead.

Also reorder source files in makefiles alphabetically.

Change-Id: Ic85c396f34e7a25a7239533f12bde3eed8da0ca2
2014-06-05 17:39:40 +01:00
Sandrine Bailleux b01f49b5d1 juno: Fix base addresses for UART2 and UART3
Also remove 'PL011_BASE' macro because it is no longer used.

Change-Id: Iefe94037cf67293b630d5256e6cac3f82abda807
2014-06-05 17:39:40 +01:00
Sandrine Bailleux 61cb163bb8 juno: Rename Juno "mmap" array to avoid name confusion
Rename the array "mmap" in plat/juno/aarch64/plat_common.c to
"juno_mmap", to avoid confusion with the array of the same name
in lib/arch/aarch64/xlat_tables.c

Change-Id: If2f2976b1bc9177a14625a2a4559c32c5236090f
2014-06-05 17:39:40 +01:00
Sandrine Bailleux db7bc010ec juno: Place assembler functions in separate sections
This extends the --gc-sections behaviour to the Juno-specific assembler
support functions in the firmware images by placing each function
into its own code section. This is achieved by using the 'func'
macro when declaring a function label.

Change-Id: I738370c0515face104531ab7944cc5bbdad49a9d
2014-06-05 17:39:40 +01:00
Sandrine Bailleux c8deb8b482 juno: Initialise UART console in all bootloader stages
Ensure that each bootloader stage initializes the UART console
independently. As a result, both BL3-1 and BL2 platform code now
calls console_init() instead of relying on BL1 to perform console
setup.

Also perform the console initialisation earlier in BL1 because
it must be done before it is used e.g. through a printf() call
in an assert() statement.

Change-Id: I8bb58cf1f0e42a71a01abf65da30bfa4ae533665
2014-06-05 17:39:39 +01:00
Sandrine Bailleux 4114d891a8 juno: Semihosting: Fix file mode to load binaries on Windows
Propagate commit 886278e55f on Juno.

Change-Id: I1e5e1e3c019c51af6ed54bb02fee6b1ebc201a2a
2014-06-05 17:39:35 +01:00
Sandrine Bailleux d3c10e6c44 juno: Fix build further to changes on UP/MP stacks
These changes are necessary because of commit 2bf28e620a.

Change-Id: I3e42e97638fe895c885bcbf44392a899284956f8
2014-06-04 15:37:36 +01:00
Sandrine Bailleux 2b80760dbe juno: Fix build further to console driver changes
Change-Id: I5ff5c1a6253d29fca0b271c08d74fafe33cd8f2d
2014-06-04 15:37:36 +01:00
Sandrine Bailleux fee39236d2 juno: 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.

Also remove use of partially qualified asm helper functions.

Change-Id: I383083f93a0a53143e58f146faf7755198f6a6ca
2014-06-04 15:37:36 +01:00
Sandrine Bailleux 4c54d5c53f juno: Remove use of partially qualified asm helper functions
Change-Id: I6d7c040d7569df601a12007dd2413c39f40f07ce
2014-06-04 15:37:36 +01:00
Sandrine Bailleux 8aa94a0ec3 juno: Increase L2RAM wait state to support higher cluster frequencies
Change-Id: I7f1fb4ed01ed73de1196ca17ed6fc1524478ec75
2014-06-04 15:37:36 +01:00
Sandrine Bailleux 8a40778c75 Enable Debug and SError exceptions on warm boot path
Enable Debug and SError exceptions:
 - when receiving an SMC;
 - when a CPU is physically powered up (upon resumption from suspend
   or in response to a PSCI cpu_on call)

Change-Id: I7e5613e34034be6ed68ec9e2aef4de66aa5ac65e
2014-06-04 15:37:36 +01:00
Sandrine Bailleux b78f25bf3d Do not route external abort and SError interrupts to EL3
The software running at a given exception level should handle
external aborts and SError interrupts itself.

Change-Id: Ic249fdf8472e0c64306ce3913562a2ac89c78627
2014-06-04 15:37:36 +01:00
Sandrine Bailleux 0d1a5804a2 juno: Implement plat_get_syscnt_freq() function
In the Juno port, this function returns the first entry of the
frequency modes table from the memory mapped generic timer.
2014-06-04 15:37:36 +01:00
Sandrine Bailleux 26bae2fc74 Workaround: Define BL32 base address
Workaround for issue #68
2014-06-04 15:37:36 +01:00
Sandrine Bailleux 6a89c0d46e juno: Pull out some software components
On Juno, we don't need the following components so this patch
removes them of the images:
 - semihosting support;
 - FVP power controller support;
 - GICv3 support.
2014-06-04 15:37:36 +01:00
Sandrine Bailleux 476165d31d juno: Improve TZC-400 initialisation code
- Distinguish Juno specific from platform agnostic constants
 - Define constants for Juno TZC-400 NSAID
2014-06-04 15:37:35 +01:00
Sandrine Bailleux f3a80454c1 tzc-400: Export some TZC-400 related constants in a generic header 2014-06-04 15:37:35 +01:00
Sandrine Bailleux 87abe30b21 juno: Expose NIC-400 constants in the platform header file
It is easier to have all platform constants in the same place.
2014-06-04 15:37:35 +01:00
Sandrine Bailleux 5d4c86436a juno: Implement plat_report_exception() function
As for FVP platforms, Juno provides some LEDs that we can
use to report exceptions during the early boot code.
2014-06-04 15:37:35 +01:00
Sandrine Bailleux 29bb973d3e juno: BL2: Load BL30
Signed-off-by: Ryan Harkin <ryan.harkin@linaro.org>
2014-06-04 15:37:35 +01:00
Jon Medhurst 3c74eb6ca1 Add optional BL30 to fip make rule
Signed-off-by: Jon Medhurst <tixy@linaro.org>
2014-06-04 15:37:35 +01:00
Ryan Harkin 8f2411c071 io_fip: add BL30 to FIP name to uuid table
BL30 needs an entry in the table in io_fip.c.  I made it #ifdef'd so
that ports that don't use a BL30 won't break.

Signed-off-by: Ryan Harkin <ryan.harkin@linaro.org>
2014-06-04 15:37:35 +01:00
Ryan Harkin bbd918c41e juno: plat_io_storage: remove semihosting
Removing semihosting from the plat_io_storage code copied from FVP.

Signed-off-by: Ryan Harkin <ryan.harkin@linaro.org>
2014-06-04 15:37:35 +01:00
Ryan Harkin 8276d53e4b juno: BL1: default to building bypass rom
Juno has a "taped out" BL1.

To run your own BL1 on the board, you have to place it in a "ROM bypass"
address and configure the platform to boot from there.

The agreed bypass address is an offset of 0x03EC0000 from the start of
NOR flash (0x08000000), which equates to 0x0BEC0000.

To run the model using a BL1 in bypass mode, you should use a parameter
set something like this:

	<path to>/FVP_CSS_Juno3 \
		-C css.aon.scp.ROMloader.fname=<SCP ROM filename> \
		--data css.cluster1.cpu0=bl1.bin@0x0BEC0000 \
		-C soc.scc.apps_alt_boot=0x0BEC0000

To build BL1 as a ROM located at address zero, you can over-ride the
default value for TZROM_BASE by passing parameters to make, eg:

	ASFLAGS="-D TZROM_BASE=0x00000000" \
	CFLAGS="-D TZROM_BASE=0x00000000" \
	CROSS_COMPILE=aarch64-linux-gnu- \
	make PLAT=juno DEBUG=1 all

Then you can launch the model using a command such as:

	<path to>/FVP_CSS_Juno3 \
		-C css.aon.scp.ROMloader.fname=<SCP ROM filename> \
		-C css.trustedBootROMloader.fname=<path to>/bl1.bin \

Signed-off-by: Ryan Harkin <ryan.harkin@linaro.org>
2014-06-04 15:37:35 +01:00
Jon Medhurst 1b0ad016bd juno: Add a handler for 'ARM Architecture' SMC calls
Currently UEFI and Linux are using SMC calls in the 'ARM Architecture'
Owning Entity range so lets implement these to get things working.

UEFI probably doesn't actually need to issue the ID_PRESENCE and ID_UID
calls it does, and the device-tree used by Linux could specify the PSCI
identifiers instead. After those changes, this patch isn't required.

Signed-off-by: Jon Medhurst <tixy@linaro.org>
2014-06-04 15:37:35 +01:00
Jon Medhurst 53677b935a Workaround: Setup register context for BL3-3
This is a temporary solution for issue #20

Signed-off-by: Jon Medhurst <tixy@linaro.org>
2014-06-04 15:37:35 +01:00
Jon Medhurst fc73ee91bf juno: Implement PM ops to power down CPUs
Signed-off-by: Jon Medhurst <tixy@linaro.org>
2014-06-04 15:37:35 +01:00
Jon Medhurst b44e1f562e juno: Implement PM ops to power on CPUs
Signed-off-by: Jon Medhurst <tixy@linaro.org>
2014-06-04 15:37:35 +01:00
Jon Medhurst 49fd6d0775 juno: Implement SCPI Set CSS Power State command
Signed-off-by: Jon Medhurst <tixy@linaro.org>
2014-06-04 15:37:35 +01:00
Jon Medhurst 378d73fb61 juno: Add bootloader for SCP image
Signed-off-by: Jon Medhurst <tixy@linaro.org>
2014-06-04 15:37:35 +01:00
Jon Medhurst 5951bc1f65 juno: Add SCPI interface and implement the SCP Ready command
The SCP Ready command is sent by the SCP to indicate that the BL3-0 RAM
Firmware image is successfully up and running.

Signed-off-by: Jon Medhurst <tixy@linaro.org>
2014-06-04 15:37:35 +01:00
Jon Medhurst 3928b593bd juno: Add MHU interface
Signed-off-by: Jon Medhurst <tixy@linaro.org>
2014-06-04 15:37:35 +01:00
Jon Medhurst 96b8dd2b56 juno: Initialise PCIe
Signed-off-by: Jon Medhurst <tixy@linaro.org>
2014-06-04 15:37:35 +01:00
Jon Medhurst f91ec7dc0a juno: Initialise TZC-400
Signed-off-by: Jon Medhurst <tixy@linaro.org>
2014-06-04 15:37:35 +01:00
Jon Medhurst 4d958dbf70 juno: Initialise NIC-400
Signed-off-by: Jon Medhurst <tixy@linaro.org>
2014-06-04 15:37:34 +01:00
Jon Medhurst 8e69da328e juno: Initialise GIC
Signed-off-by: Jon Medhurst <tixy@linaro.org>
2014-06-04 15:37:34 +01:00
Jon Medhurst 82195441d0 juno: Port plat_topology.c
Signed-off-by: Jon Medhurst <tixy@linaro.org>
2014-06-04 15:37:34 +01:00
Jon Medhurst 521b4ebaa8 juno: Update GIC addresses
Signed-off-by: Jon Medhurst <tixy@linaro.org>
2014-06-04 15:37:34 +01:00