diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/bl32/tsp/platform_tsp.h | 44 | ||||
-rw-r--r-- | include/bl32/tsp/tsp.h (renamed from include/bl32/payloads/tsp.h) | 89 | ||||
-rw-r--r-- | include/common/debug.h | 57 | ||||
-rw-r--r-- | include/drivers/arm/cci400.h | 21 | ||||
-rw-r--r-- | include/drivers/arm/tzc400.h | 32 | ||||
-rw-r--r-- | include/drivers/io/io_driver.h (renamed from include/drivers/io_driver.h) | 14 | ||||
-rw-r--r-- | include/drivers/io/io_fip.h (renamed from include/drivers/io_fip.h) | 0 | ||||
-rw-r--r-- | include/drivers/io/io_memmap.h (renamed from include/drivers/io_memmap.h) | 0 | ||||
-rw-r--r-- | include/drivers/io/io_semihosting.h (renamed from include/drivers/io_semihosting.h) | 0 | ||||
-rw-r--r-- | include/drivers/io/io_storage.h (renamed from include/lib/io_storage.h) | 0 | ||||
-rw-r--r-- | include/plat/common/platform.h | 7 |
11 files changed, 121 insertions, 143 deletions
diff --git a/include/bl32/tsp/platform_tsp.h b/include/bl32/tsp/platform_tsp.h new file mode 100644 index 00000000..f6f73911 --- /dev/null +++ b/include/bl32/tsp/platform_tsp.h @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2014, ARM Limited and Contributors. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * Neither the name of ARM nor the names of its contributors may be used + * to endorse or promote products derived from this software without specific + * prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef __PLATFORM_TSP_H__ + + +/******************************************************************************* + * Mandatory TSP functions (only if platform contains a TSP) + ******************************************************************************/ +void tsp_early_platform_setup(void); +void tsp_plat_arch_setup(void); +void tsp_platform_setup(void); + + +#define __PLATFORM_H__ + +#endif diff --git a/include/bl32/payloads/tsp.h b/include/bl32/tsp/tsp.h index 2db3b346..c0b191f7 100644 --- a/include/bl32/payloads/tsp.h +++ b/include/bl32/tsp/tsp.h @@ -98,25 +98,12 @@ /* 0xbf00ff02 is reserved */ #define TOS_CALL_VERSION 0xbf00ff03 /* Trusted OS Call Version */ -/* Definitions to help the assembler access the SMC/ERET args structure */ -#define TSP_ARGS_SIZE 0x40 -#define TSP_ARG0 0x0 -#define TSP_ARG1 0x8 -#define TSP_ARG2 0x10 -#define TSP_ARG3 0x18 -#define TSP_ARG4 0x20 -#define TSP_ARG5 0x28 -#define TSP_ARG6 0x30 -#define TSP_ARG7 0x38 -#define TSP_ARGS_END 0x40 #ifndef __ASSEMBLY__ -#include <cassert.h> -#include <platform_def.h> /* For CACHE_WRITEBACK_GRANULE */ -#include <spinlock.h> #include <stdint.h> + typedef uint32_t tsp_vector_isn_t; typedef struct tsp_vectors { @@ -129,79 +116,7 @@ typedef struct tsp_vectors { tsp_vector_isn_t fiq_entry; } tsp_vectors_t; -typedef struct work_statistics { - uint32_t fiq_count; /* Number of FIQs on this cpu */ - uint32_t irq_count; /* Number of IRQs on this cpu */ - uint32_t sync_fiq_count; /* Number of sync. fiqs on this cpu */ - uint32_t sync_fiq_ret_count; /* Number of fiq returns on this cpu */ - uint32_t smc_count; /* Number of returns on this cpu */ - uint32_t eret_count; /* Number of entries on this cpu */ - uint32_t cpu_on_count; /* Number of cpu on requests */ - uint32_t cpu_off_count; /* Number of cpu off requests */ - uint32_t cpu_suspend_count; /* Number of cpu suspend requests */ - uint32_t cpu_resume_count; /* Number of cpu resume requests */ -} __aligned(CACHE_WRITEBACK_GRANULE) work_statistics_t; - -typedef struct tsp_args { - uint64_t _regs[TSP_ARGS_END >> 3]; -} __aligned(CACHE_WRITEBACK_GRANULE) tsp_args_t; - -/* Macros to access members of the above structure using their offsets */ -#define read_sp_arg(args, offset) ((args)->_regs[offset >> 3]) -#define write_sp_arg(args, offset, val) (((args)->_regs[offset >> 3]) \ - = val) - -/* - * Ensure that the assembler's view of the size of the tsp_args is the - * same as the compilers - */ -CASSERT(TSP_ARGS_SIZE == sizeof(tsp_args_t), assert_sp_args_size_mismatch); - -void tsp_get_magic(uint64_t args[4]); - -tsp_args_t *tsp_cpu_resume_main(uint64_t arg0, - uint64_t arg1, - uint64_t arg2, - uint64_t arg3, - uint64_t arg4, - uint64_t arg5, - uint64_t arg6, - uint64_t arg7); -tsp_args_t *tsp_cpu_suspend_main(uint64_t arg0, - uint64_t arg1, - uint64_t arg2, - uint64_t arg3, - uint64_t arg4, - uint64_t arg5, - uint64_t arg6, - uint64_t arg7); -tsp_args_t *tsp_cpu_on_main(void); -tsp_args_t *tsp_cpu_off_main(uint64_t arg0, - uint64_t arg1, - uint64_t arg2, - uint64_t arg3, - uint64_t arg4, - uint64_t arg5, - uint64_t arg6, - uint64_t arg7); - -/* Generic Timer functions */ -void tsp_generic_timer_start(void); -void tsp_generic_timer_handler(void); -void tsp_generic_timer_stop(void); -void tsp_generic_timer_save(void); -void tsp_generic_timer_restore(void); - -/* FIQ management functions */ -void tsp_update_sync_fiq_stats(uint32_t type, uint64_t elr_el3); - -/* Data structure to keep track of TSP statistics */ -extern spinlock_t console_lock; -extern work_statistics_t tsp_stats[PLATFORM_CORE_COUNT]; - -/* Vector table of jumps */ -extern tsp_vectors_t tsp_vector_table; #endif /* __ASSEMBLY__ */ -#endif /* __BL2_H__ */ +#endif /* __TSP_H__ */ diff --git a/include/common/debug.h b/include/common/debug.h index 3f5655ba..a8dcb8da 100644 --- a/include/common/debug.h +++ b/include/common/debug.h @@ -33,24 +33,53 @@ #include <stdio.h> -/* If building the project with DEBUG disabled the INFO and WARN macros - * won't produce any output. The ERROR macro is always enabled. - * The format expected is the same as for printf(). - * INFO("Info %s.\n", "message") -> INFO: Info message. - * WARN("Warning %s.\n", "message") -> WARN: Warning message. - * ERROR("Error %s.\n", "message") -> ERROR: Error message. - * - * TODO : add debug levels. +/* The log output macros print output to the console. These macros produce + * compiled log output only if the LOG_LEVEL defined in the makefile (or the + * make command line) is greater or equal than the level required for that + * type of log output. + * The format expected is the same as for printf(). For example: + * INFO("Info %s.\n", "message") -> INFO: Info message. + * WARN("Warning %s.\n", "message") -> WARNING: Warning message. */ -#if DEBUG - #define INFO(...) tf_printf("INFO: " __VA_ARGS__) - #define WARN(...) tf_printf("WARN: " __VA_ARGS__) + +#define LOG_LEVEL_NONE 0 +#define LOG_LEVEL_ERROR 10 +#define LOG_LEVEL_NOTICE 20 +#define LOG_LEVEL_WARNING 30 +#define LOG_LEVEL_INFO 40 +#define LOG_LEVEL_VERBOSE 50 + + +#if LOG_LEVEL >= LOG_LEVEL_NOTICE +# define NOTICE(...) tf_printf("NOTICE: " __VA_ARGS__) +#else +# define NOTICE(...) +#endif + +#if LOG_LEVEL >= LOG_LEVEL_ERROR +# define ERROR(...) tf_printf("ERROR: " __VA_ARGS__) +#else +# define ERROR(...) +#endif + +#if LOG_LEVEL >= LOG_LEVEL_WARNING +# define WARN(...) tf_printf("WARNING: " __VA_ARGS__) +#else +# define WARN(...) +#endif + +#if LOG_LEVEL >= LOG_LEVEL_INFO +# define INFO(...) tf_printf("INFO: " __VA_ARGS__) +#else +# define INFO(...) +#endif + +#if LOG_LEVEL >= LOG_LEVEL_VERBOSE +# define VERBOSE(...) tf_printf("VERBOSE: " __VA_ARGS__) #else - #define INFO(...) - #define WARN(...) +# define VERBOSE(...) #endif -#define ERROR(...) tf_printf("ERROR: " __VA_ARGS__) void __dead2 do_panic(void); #define panic() do_panic() diff --git a/include/drivers/arm/cci400.h b/include/drivers/arm/cci400.h index 6246e480..7756bdfa 100644 --- a/include/drivers/arm/cci400.h +++ b/include/drivers/arm/cci400.h @@ -37,7 +37,8 @@ #define SLAVE_IFACE2_OFFSET 0x3000 #define SLAVE_IFACE1_OFFSET 0x2000 #define SLAVE_IFACE0_OFFSET 0x1000 -#define SLAVE_IFACE_OFFSET(index) SLAVE_IFACE0_OFFSET + (0x1000 * index) +#define SLAVE_IFACE_OFFSET(index) SLAVE_IFACE0_OFFSET + \ + (0x1000 * (index)) /* Control and ID register offsets */ #define CTRL_OVERRIDE_REG 0x0 @@ -68,8 +69,22 @@ #ifndef __ASSEMBLY__ /* Function declarations */ -void cci_enable_coherency(unsigned long mpidr); -void cci_disable_coherency(unsigned long mpidr); + +/* + * The CCI-400 driver must be initialized with the base address of the + * CCI-400 device in the platform memory map, and the cluster indices for + * the CCI-400 slave interfaces 3 and 4 respectively. These are the fully + * coherent ACE slave interfaces of CCI-400. + * The cluster indices must either be 0 or 1, corresponding to the level 1 + * affinity instance of the mpidr representing the cluster. A negative cluster + * index indicates that no cluster is present on that slave interface. + */ +void cci_init(unsigned long cci_base, + int slave_iface3_cluster_ix, + int slave_iface4_cluster_ix); + +void cci_enable_cluster_coherency(unsigned long mpidr); +void cci_disable_cluster_coherency(unsigned long mpidr); #endif /* __ASSEMBLY__ */ #endif /* __CCI_400_H__ */ diff --git a/include/drivers/arm/tzc400.h b/include/drivers/arm/tzc400.h index 03fce546..ff8b49ae 100644 --- a/include/drivers/arm/tzc400.h +++ b/include/drivers/arm/tzc400.h @@ -182,27 +182,17 @@ typedef enum { TZC_REGION_S_RDWR = (TZC_REGION_S_RD | TZC_REGION_S_WR) } tzc_region_attributes_t; -/* - * Implementation defined values used to validate inputs later. - * Filters : max of 4 ; 0 to 3 - * Regions : max of 9 ; 0 to 8 - * Address width : Values between 32 to 64 - */ -typedef struct tzc_instance { - uint64_t base; - uint32_t aid_width; - uint8_t addr_width; - uint8_t num_filters; - uint8_t num_regions; -} tzc_instance_t ; - -void tzc_init(tzc_instance_t *controller); -void tzc_configure_region(const tzc_instance_t *controller, uint32_t filters, - uint8_t region, uint64_t region_base, uint64_t region_top, - tzc_region_attributes_t sec_attr, uint32_t ns_device_access); -void tzc_enable_filters(const tzc_instance_t *controller); -void tzc_disable_filters(const tzc_instance_t *controller); -void tzc_set_action(const tzc_instance_t *controller, tzc_action_t action); + +void tzc_init(uint64_t base); +void tzc_configure_region(uint32_t filters, + uint8_t region, + uint64_t region_base, + uint64_t region_top, + tzc_region_attributes_t sec_attr, + uint32_t ns_device_access); +void tzc_enable_filters(void); +void tzc_disable_filters(void); +void tzc_set_action(tzc_action_t action); #endif /* __TZC400__ */ diff --git a/include/drivers/io_driver.h b/include/drivers/io/io_driver.h index 867abbfa..adb38b0f 100644 --- a/include/drivers/io_driver.h +++ b/include/drivers/io/io_driver.h @@ -32,7 +32,6 @@ #define __IO_DRIVER_H__ #include <io_storage.h> -#include <platform_def.h> /* For MAX_IO_DEVICES */ #include <stdint.h> @@ -76,20 +75,9 @@ typedef struct io_dev_funcs { } io_dev_funcs_t; -/* IO platform data - used to track devices registered for a specific - * platform */ -typedef struct io_plat_data { - const io_dev_info_t *devices[MAX_IO_DEVICES]; - unsigned int dev_count; -} io_plat_data_t; - - /* Operations intended to be performed during platform initialisation */ -/* Initialise the IO layer */ -void io_init(io_plat_data_t *data); - -/* Register a device driver */ +/* Register an IO device */ int io_register_device(const io_dev_info_t *dev_info); #endif /* __IO_DRIVER_H__ */ diff --git a/include/drivers/io_fip.h b/include/drivers/io/io_fip.h index 90b2fd0b..90b2fd0b 100644 --- a/include/drivers/io_fip.h +++ b/include/drivers/io/io_fip.h diff --git a/include/drivers/io_memmap.h b/include/drivers/io/io_memmap.h index 7ee60fe3..7ee60fe3 100644 --- a/include/drivers/io_memmap.h +++ b/include/drivers/io/io_memmap.h diff --git a/include/drivers/io_semihosting.h b/include/drivers/io/io_semihosting.h index 8902a6f0..8902a6f0 100644 --- a/include/drivers/io_semihosting.h +++ b/include/drivers/io/io_semihosting.h diff --git a/include/lib/io_storage.h b/include/drivers/io/io_storage.h index ae1158c0..ae1158c0 100644 --- a/include/lib/io_storage.h +++ b/include/drivers/io/io_storage.h diff --git a/include/plat/common/platform.h b/include/plat/common/platform.h index ab93123c..8e038aa7 100644 --- a/include/plat/common/platform.h +++ b/include/plat/common/platform.h @@ -78,6 +78,7 @@ int plat_crash_console_putc(int c); /******************************************************************************* * Mandatory BL1 functions ******************************************************************************/ +void bl1_early_platform_setup(void); void bl1_plat_arch_setup(void); void bl1_platform_setup(void); struct meminfo *bl1_plat_sec_mem_layout(void); @@ -98,6 +99,7 @@ void bl1_init_bl2_mem_layout(const struct meminfo *bl1_mem_layout, /******************************************************************************* * Mandatory BL2 functions ******************************************************************************/ +void bl2_early_platform_setup(struct meminfo *mem_layout); void bl2_plat_arch_setup(void); void bl2_platform_setup(void); struct meminfo *bl2_plat_sec_mem_layout(void); @@ -185,11 +187,6 @@ unsigned int plat_get_aff_state(unsigned int, unsigned long); void bl31_plat_enable_mmu(uint32_t flags); /******************************************************************************* - * Mandatory BL3-2 functions (only if platform contains a BL3-2) - ******************************************************************************/ -void bl32_platform_setup(void); - -/******************************************************************************* * Optional BL3-2 functions (may be overridden) ******************************************************************************/ void bl32_plat_enable_mmu(uint32_t flags); |