blob: 3949754b9b8824fded9f5e5addf2144755a35243 [file] [log] [blame]
Dan Handleyed6ff952014-05-14 17:44:19 +01001/*
2 * Copyright (c) 2014, ARM Limited and Contributors. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are met:
6 *
7 * Redistributions of source code must retain the above copyright notice, this
8 * list of conditions and the following disclaimer.
9 *
10 * Redistributions in binary form must reproduce the above copyright notice,
11 * this list of conditions and the following disclaimer in the documentation
12 * and/or other materials provided with the distribution.
13 *
14 * Neither the name of ARM nor the names of its contributors may be used
15 * to endorse or promote products derived from this software without specific
16 * prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
22 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 * POSSIBILITY OF SUCH DAMAGE.
29 */
30
31#ifndef __FVP_PRIVATE_H__
32#define __FVP_PRIVATE_H__
33
Soby Mathew523d6332015-01-08 18:02:19 +000034#include <bakery_lock.h>
Dan Handleyed6ff952014-05-14 17:44:19 +010035#include <bl_common.h>
Soby Mathew523d6332015-01-08 18:02:19 +000036#include <cpu_data.h>
Dan Handleyed6ff952014-05-14 17:44:19 +010037#include <platform_def.h>
38
39
40typedef volatile struct mailbox {
41 unsigned long value
42 __attribute__((__aligned__(CACHE_WRITEBACK_GRANULE)));
43} mailbox_t;
44
45/*******************************************************************************
46 * This structure represents the superset of information that is passed to
47 * BL31 e.g. while passing control to it from BL2 which is bl31_params
48 * and bl31_plat_params and its elements
49 ******************************************************************************/
50typedef struct bl2_to_bl31_params_mem {
51 bl31_params_t bl31_params;
52 image_info_t bl31_image_info;
53 image_info_t bl32_image_info;
54 image_info_t bl33_image_info;
55 entry_point_info_t bl33_ep_info;
56 entry_point_info_t bl32_ep_info;
57 entry_point_info_t bl31_ep_info;
58} bl2_to_bl31_params_mem_t;
59
Soby Mathew523d6332015-01-08 18:02:19 +000060#if USE_COHERENT_MEM
61/*
62 * These are wrapper macros to the Coherent Memory Bakery Lock API.
63 */
64#define fvp_lock_init(_lock_arg) bakery_lock_init(_lock_arg)
65#define fvp_lock_get(_lock_arg) bakery_lock_get(_lock_arg)
66#define fvp_lock_release(_lock_arg) bakery_lock_release(_lock_arg)
67
68#else
69
Dan Handleyed6ff952014-05-14 17:44:19 +010070/*******************************************************************************
Soby Mathew523d6332015-01-08 18:02:19 +000071 * Constants to specify how many bakery locks this platform implements. These
72 * are used if the platform chooses not to use coherent memory for bakery lock
73 * data structures.
Dan Handley7ce42df2014-05-15 14:11:36 +010074 ******************************************************************************/
Soby Mathew523d6332015-01-08 18:02:19 +000075#define FVP_MAX_BAKERIES 1
76#define FVP_PWRC_BAKERY_ID 0
77
78/*******************************************************************************
79 * Definition of structure which holds platform specific per-cpu data. Currently
80 * it holds only the bakery lock information for each cpu. Constants to
81 * specify how many bakeries this platform implements and bakery ids are
82 * specified in fvp_def.h
83 ******************************************************************************/
84typedef struct fvp_cpu_data {
85 bakery_info_t pcpu_bakery_info[FVP_MAX_BAKERIES];
86} fvp_cpu_data_t;
87
88/* Macro to define the offset of bakery_info_t in fvp_cpu_data_t */
89#define FVP_CPU_DATA_LOCK_OFFSET __builtin_offsetof\
90 (fvp_cpu_data_t, pcpu_bakery_info)
91
Dan Handley7ce42df2014-05-15 14:11:36 +010092
93/*******************************************************************************
Soby Mathew523d6332015-01-08 18:02:19 +000094 * Helper macros for bakery lock api when using the above fvp_cpu_data_t for
95 * bakery lock data structures. It assumes that the bakery_info is at the
96 * beginning of the platform specific per-cpu data.
97 ******************************************************************************/
98#define fvp_lock_init(_lock_arg) /* No init required */
99#define fvp_lock_get(_lock_arg) bakery_lock_get(_lock_arg, \
100 CPU_DATA_PLAT_PCPU_OFFSET + \
101 FVP_CPU_DATA_LOCK_OFFSET)
102#define fvp_lock_release(_lock_arg) bakery_lock_release(_lock_arg, \
103 CPU_DATA_PLAT_PCPU_OFFSET + \
104 FVP_CPU_DATA_LOCK_OFFSET)
105
106/*
107 * Ensure that the size of the FVP specific per-cpu data structure and the size
108 * of the memory allocated in generic per-cpu data for the platform are the same.
109 */
110CASSERT(PLAT_PCPU_DATA_SIZE == sizeof(fvp_cpu_data_t), \
111 fvp_pcpu_data_size_mismatch);
112
113#endif /* __USE_COHERENT_MEM__ */
114
115/*******************************************************************************
Dan Handleyed6ff952014-05-14 17:44:19 +0100116 * Function and variable prototypes
117 ******************************************************************************/
Dan Handleyea451572014-05-15 14:53:30 +0100118void fvp_configure_mmu_el1(unsigned long total_base,
119 unsigned long total_size,
120 unsigned long,
Soby Mathew2ae20432015-01-08 18:02:44 +0000121 unsigned long
122#if USE_COHERENT_MEM
123 , unsigned long,
124 unsigned long
125#endif
126 );
Dan Handleyea451572014-05-15 14:53:30 +0100127void fvp_configure_mmu_el3(unsigned long total_base,
128 unsigned long total_size,
129 unsigned long,
Soby Mathew2ae20432015-01-08 18:02:44 +0000130 unsigned long
131#if USE_COHERENT_MEM
132 , unsigned long,
133 unsigned long
134#endif
135 );
Soby Mathew523d6332015-01-08 18:02:19 +0000136
Dan Handleyea451572014-05-15 14:53:30 +0100137int fvp_config_setup(void);
Dan Handleyed6ff952014-05-14 17:44:19 +0100138
Dan Handleybe234f92014-08-04 16:11:15 +0100139void fvp_cci_init(void);
140void fvp_cci_enable(void);
Dan Handleyed6ff952014-05-14 17:44:19 +0100141
Dan Handleyfb42b122014-06-20 09:43:15 +0100142void fvp_gic_init(void);
Dan Handleyed6ff952014-05-14 17:44:19 +0100143
144/* Declarations for fvp_topology.c */
Dan Handleyea451572014-05-15 14:53:30 +0100145int fvp_setup_topology(void);
Dan Handleyed6ff952014-05-14 17:44:19 +0100146
Dan Handleyea451572014-05-15 14:53:30 +0100147/* Declarations for fvp_io_storage.c */
148void fvp_io_setup(void);
Dan Handleyed6ff952014-05-14 17:44:19 +0100149
Dan Handleyea451572014-05-15 14:53:30 +0100150/* Declarations for fvp_security.c */
151void fvp_security_setup(void);
Dan Handleyed6ff952014-05-14 17:44:19 +0100152
Vikram Kanigiricf79bf52014-06-02 14:59:00 +0100153/* Gets the SPR for BL32 entry */
154uint32_t fvp_get_spsr_for_bl32_entry(void);
Dan Handleyed6ff952014-05-14 17:44:19 +0100155
Vikram Kanigiricf79bf52014-06-02 14:59:00 +0100156/* Gets the SPSR for BL33 entry */
157uint32_t fvp_get_spsr_for_bl33_entry(void);
Dan Handleyed6ff952014-05-14 17:44:19 +0100158
159
160#endif /* __FVP_PRIVATE_H__ */