Dan Handley | ed6ff95 | 2014-05-14 17:44:19 +0100 | [diff] [blame] | 1 | /* |
| 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 Mathew | 523d633 | 2015-01-08 18:02:19 +0000 | [diff] [blame] | 34 | #include <bakery_lock.h> |
Dan Handley | ed6ff95 | 2014-05-14 17:44:19 +0100 | [diff] [blame] | 35 | #include <bl_common.h> |
Soby Mathew | 523d633 | 2015-01-08 18:02:19 +0000 | [diff] [blame] | 36 | #include <cpu_data.h> |
Dan Handley | ed6ff95 | 2014-05-14 17:44:19 +0100 | [diff] [blame] | 37 | #include <platform_def.h> |
| 38 | |
| 39 | |
| 40 | typedef 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 | ******************************************************************************/ |
| 50 | typedef 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 Mathew | 523d633 | 2015-01-08 18:02:19 +0000 | [diff] [blame] | 60 | #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 Handley | ed6ff95 | 2014-05-14 17:44:19 +0100 | [diff] [blame] | 70 | /******************************************************************************* |
Soby Mathew | 523d633 | 2015-01-08 18:02:19 +0000 | [diff] [blame] | 71 | * 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 Handley | 7ce42df | 2014-05-15 14:11:36 +0100 | [diff] [blame] | 74 | ******************************************************************************/ |
Soby Mathew | 523d633 | 2015-01-08 18:02:19 +0000 | [diff] [blame] | 75 | #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 | ******************************************************************************/ |
| 84 | typedef 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 Handley | 7ce42df | 2014-05-15 14:11:36 +0100 | [diff] [blame] | 92 | |
| 93 | /******************************************************************************* |
Soby Mathew | 523d633 | 2015-01-08 18:02:19 +0000 | [diff] [blame] | 94 | * 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 | */ |
| 110 | CASSERT(PLAT_PCPU_DATA_SIZE == sizeof(fvp_cpu_data_t), \ |
| 111 | fvp_pcpu_data_size_mismatch); |
| 112 | |
| 113 | #endif /* __USE_COHERENT_MEM__ */ |
| 114 | |
| 115 | /******************************************************************************* |
Dan Handley | ed6ff95 | 2014-05-14 17:44:19 +0100 | [diff] [blame] | 116 | * Function and variable prototypes |
| 117 | ******************************************************************************/ |
Dan Handley | ea45157 | 2014-05-15 14:53:30 +0100 | [diff] [blame] | 118 | void fvp_configure_mmu_el1(unsigned long total_base, |
| 119 | unsigned long total_size, |
| 120 | unsigned long, |
Soby Mathew | 2ae2043 | 2015-01-08 18:02:44 +0000 | [diff] [blame] | 121 | unsigned long |
| 122 | #if USE_COHERENT_MEM |
| 123 | , unsigned long, |
| 124 | unsigned long |
| 125 | #endif |
| 126 | ); |
Dan Handley | ea45157 | 2014-05-15 14:53:30 +0100 | [diff] [blame] | 127 | void fvp_configure_mmu_el3(unsigned long total_base, |
| 128 | unsigned long total_size, |
| 129 | unsigned long, |
Soby Mathew | 2ae2043 | 2015-01-08 18:02:44 +0000 | [diff] [blame] | 130 | unsigned long |
| 131 | #if USE_COHERENT_MEM |
| 132 | , unsigned long, |
| 133 | unsigned long |
| 134 | #endif |
| 135 | ); |
Soby Mathew | 523d633 | 2015-01-08 18:02:19 +0000 | [diff] [blame] | 136 | |
Dan Handley | ea45157 | 2014-05-15 14:53:30 +0100 | [diff] [blame] | 137 | int fvp_config_setup(void); |
Dan Handley | ed6ff95 | 2014-05-14 17:44:19 +0100 | [diff] [blame] | 138 | |
Dan Handley | be234f9 | 2014-08-04 16:11:15 +0100 | [diff] [blame] | 139 | void fvp_cci_init(void); |
| 140 | void fvp_cci_enable(void); |
Dan Handley | ed6ff95 | 2014-05-14 17:44:19 +0100 | [diff] [blame] | 141 | |
Dan Handley | fb42b12 | 2014-06-20 09:43:15 +0100 | [diff] [blame] | 142 | void fvp_gic_init(void); |
Dan Handley | ed6ff95 | 2014-05-14 17:44:19 +0100 | [diff] [blame] | 143 | |
| 144 | /* Declarations for fvp_topology.c */ |
Dan Handley | ea45157 | 2014-05-15 14:53:30 +0100 | [diff] [blame] | 145 | int fvp_setup_topology(void); |
Dan Handley | ed6ff95 | 2014-05-14 17:44:19 +0100 | [diff] [blame] | 146 | |
Dan Handley | ea45157 | 2014-05-15 14:53:30 +0100 | [diff] [blame] | 147 | /* Declarations for fvp_io_storage.c */ |
| 148 | void fvp_io_setup(void); |
Dan Handley | ed6ff95 | 2014-05-14 17:44:19 +0100 | [diff] [blame] | 149 | |
Dan Handley | ea45157 | 2014-05-15 14:53:30 +0100 | [diff] [blame] | 150 | /* Declarations for fvp_security.c */ |
| 151 | void fvp_security_setup(void); |
Dan Handley | ed6ff95 | 2014-05-14 17:44:19 +0100 | [diff] [blame] | 152 | |
Vikram Kanigiri | cf79bf5 | 2014-06-02 14:59:00 +0100 | [diff] [blame] | 153 | /* Gets the SPR for BL32 entry */ |
| 154 | uint32_t fvp_get_spsr_for_bl32_entry(void); |
Dan Handley | ed6ff95 | 2014-05-14 17:44:19 +0100 | [diff] [blame] | 155 | |
Vikram Kanigiri | cf79bf5 | 2014-06-02 14:59:00 +0100 | [diff] [blame] | 156 | /* Gets the SPSR for BL33 entry */ |
| 157 | uint32_t fvp_get_spsr_for_bl33_entry(void); |
Dan Handley | ed6ff95 | 2014-05-14 17:44:19 +0100 | [diff] [blame] | 158 | |
| 159 | |
| 160 | #endif /* __FVP_PRIVATE_H__ */ |