Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 1 | /* |
Dan Handley | ab2d31e | 2013-12-02 19:25:12 +0000 | [diff] [blame] | 2 | * Copyright (c) 2013, ARM Limited and Contributors. All rights reserved. |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 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 __ARCH_HELPERS_H__ |
| 32 | #define __ARCH_HELPERS_H__ |
| 33 | |
| 34 | #include <arch.h> |
| 35 | |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 36 | #ifndef __ASSEMBLY__ |
| 37 | |
| 38 | /******************************************************************************* |
| 39 | * TLB maintenance accessor prototypes |
| 40 | ******************************************************************************/ |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 41 | extern void tlbialle1(void); |
| 42 | extern void tlbialle1is(void); |
| 43 | extern void tlbialle2(void); |
| 44 | extern void tlbialle2is(void); |
| 45 | extern void tlbialle3(void); |
| 46 | extern void tlbialle3is(void); |
| 47 | extern void tlbivmalle1(void); |
| 48 | |
| 49 | /******************************************************************************* |
| 50 | * Cache maintenance accessor prototypes |
| 51 | ******************************************************************************/ |
| 52 | extern void dcisw(unsigned long); |
| 53 | extern void dccisw(unsigned long); |
| 54 | extern void dccsw(unsigned long); |
| 55 | extern void dccvac(unsigned long); |
| 56 | extern void dcivac(unsigned long); |
| 57 | extern void dccivac(unsigned long); |
| 58 | extern void dccvau(unsigned long); |
| 59 | extern void dczva(unsigned long); |
| 60 | extern void flush_dcache_range(unsigned long, unsigned long); |
| 61 | extern void inv_dcache_range(unsigned long, unsigned long); |
| 62 | extern void dcsw_op_louis(unsigned int); |
| 63 | extern void dcsw_op_all(unsigned int); |
| 64 | |
| 65 | /******************************************************************************* |
| 66 | * Misc. accessor prototypes |
| 67 | ******************************************************************************/ |
| 68 | extern void enable_irq(void); |
| 69 | extern void enable_fiq(void); |
| 70 | extern void enable_serror(void); |
Sandrine Bailleux | 3738274 | 2013-11-18 17:26:59 +0000 | [diff] [blame] | 71 | extern void enable_debug_exceptions(void); |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 72 | |
| 73 | extern void disable_irq(void); |
| 74 | extern void disable_fiq(void); |
| 75 | extern void disable_serror(void); |
Sandrine Bailleux | 3738274 | 2013-11-18 17:26:59 +0000 | [diff] [blame] | 76 | extern void disable_debug_exceptions(void); |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 77 | |
| 78 | extern unsigned long read_id_pfr1_el1(void); |
| 79 | extern unsigned long read_id_aa64pfr0_el1(void); |
| 80 | extern unsigned long read_current_el(void); |
| 81 | extern unsigned long read_daif(void); |
| 82 | extern unsigned long read_spsr(void); |
| 83 | extern unsigned long read_spsr_el1(void); |
| 84 | extern unsigned long read_spsr_el2(void); |
| 85 | extern unsigned long read_spsr_el3(void); |
| 86 | extern unsigned long read_elr(void); |
| 87 | extern unsigned long read_elr_el1(void); |
| 88 | extern unsigned long read_elr_el2(void); |
| 89 | extern unsigned long read_elr_el3(void); |
| 90 | |
| 91 | extern void write_daif(unsigned long); |
| 92 | extern void write_spsr(unsigned long); |
| 93 | extern void write_spsr_el1(unsigned long); |
| 94 | extern void write_spsr_el2(unsigned long); |
| 95 | extern void write_spsr_el3(unsigned long); |
| 96 | extern void write_elr(unsigned long); |
| 97 | extern void write_elr_el1(unsigned long); |
| 98 | extern void write_elr_el2(unsigned long); |
| 99 | extern void write_elr_el3(unsigned long); |
| 100 | |
| 101 | extern void wfi(void); |
| 102 | extern void wfe(void); |
| 103 | extern void rfe(void); |
| 104 | extern void sev(void); |
| 105 | extern void dsb(void); |
| 106 | extern void isb(void); |
| 107 | |
| 108 | extern unsigned int get_afflvl_shift(unsigned int); |
| 109 | extern unsigned int mpidr_mask_lower_afflvls(unsigned long, unsigned int); |
| 110 | |
| 111 | extern void eret(unsigned long, unsigned long, |
| 112 | unsigned long, unsigned long, |
| 113 | unsigned long, unsigned long, |
| 114 | unsigned long, unsigned long); |
| 115 | |
| 116 | extern unsigned long smc(unsigned long, unsigned long, |
| 117 | unsigned long, unsigned long, |
| 118 | unsigned long, unsigned long, |
| 119 | unsigned long, unsigned long); |
| 120 | |
| 121 | /******************************************************************************* |
| 122 | * System register accessor prototypes |
| 123 | ******************************************************************************/ |
| 124 | extern unsigned long read_midr(void); |
| 125 | extern unsigned long read_mpidr(void); |
| 126 | |
| 127 | extern unsigned long read_scr(void); |
| 128 | extern unsigned long read_hcr(void); |
| 129 | |
| 130 | extern unsigned long read_vbar(void); |
| 131 | extern unsigned long read_vbar_el1(void); |
| 132 | extern unsigned long read_vbar_el2(void); |
| 133 | extern unsigned long read_vbar_el3(void); |
| 134 | |
| 135 | extern unsigned long read_sctlr(void); |
| 136 | extern unsigned long read_sctlr_el1(void); |
| 137 | extern unsigned long read_sctlr_el2(void); |
| 138 | extern unsigned long read_sctlr_el3(void); |
| 139 | |
| 140 | extern unsigned long read_actlr(void); |
| 141 | extern unsigned long read_actlr_el1(void); |
| 142 | extern unsigned long read_actlr_el2(void); |
| 143 | extern unsigned long read_actlr_el3(void); |
| 144 | |
| 145 | extern unsigned long read_esr(void); |
| 146 | extern unsigned long read_esr_el1(void); |
| 147 | extern unsigned long read_esr_el2(void); |
| 148 | extern unsigned long read_esr_el3(void); |
| 149 | |
| 150 | extern unsigned long read_afsr0(void); |
| 151 | extern unsigned long read_afsr0_el1(void); |
| 152 | extern unsigned long read_afsr0_el2(void); |
| 153 | extern unsigned long read_afsr0_el3(void); |
| 154 | |
| 155 | extern unsigned long read_afsr1(void); |
| 156 | extern unsigned long read_afsr1_el1(void); |
| 157 | extern unsigned long read_afsr1_el2(void); |
| 158 | extern unsigned long read_afsr1_el3(void); |
| 159 | |
| 160 | extern unsigned long read_far(void); |
| 161 | extern unsigned long read_far_el1(void); |
| 162 | extern unsigned long read_far_el2(void); |
| 163 | extern unsigned long read_far_el3(void); |
| 164 | |
| 165 | extern unsigned long read_mair(void); |
| 166 | extern unsigned long read_mair_el1(void); |
| 167 | extern unsigned long read_mair_el2(void); |
| 168 | extern unsigned long read_mair_el3(void); |
| 169 | |
| 170 | extern unsigned long read_amair(void); |
| 171 | extern unsigned long read_amair_el1(void); |
| 172 | extern unsigned long read_amair_el2(void); |
| 173 | extern unsigned long read_amair_el3(void); |
| 174 | |
| 175 | extern unsigned long read_rvbar(void); |
| 176 | extern unsigned long read_rvbar_el1(void); |
| 177 | extern unsigned long read_rvbar_el2(void); |
| 178 | extern unsigned long read_rvbar_el3(void); |
| 179 | |
| 180 | extern unsigned long read_rmr(void); |
| 181 | extern unsigned long read_rmr_el1(void); |
| 182 | extern unsigned long read_rmr_el2(void); |
| 183 | extern unsigned long read_rmr_el3(void); |
| 184 | |
| 185 | extern unsigned long read_tcr(void); |
| 186 | extern unsigned long read_tcr_el1(void); |
| 187 | extern unsigned long read_tcr_el2(void); |
| 188 | extern unsigned long read_tcr_el3(void); |
| 189 | |
| 190 | extern unsigned long read_ttbr0(void); |
| 191 | extern unsigned long read_ttbr0_el1(void); |
| 192 | extern unsigned long read_ttbr0_el2(void); |
| 193 | extern unsigned long read_ttbr0_el3(void); |
| 194 | |
| 195 | extern unsigned long read_ttbr1(void); |
| 196 | extern unsigned long read_ttbr1_el1(void); |
| 197 | extern unsigned long read_ttbr1_el2(void); |
| 198 | |
| 199 | extern unsigned long read_cptr(void); |
| 200 | extern unsigned long read_cptr_el2(void); |
| 201 | extern unsigned long read_cptr_el3(void); |
| 202 | |
| 203 | extern unsigned long read_cpacr(void); |
| 204 | extern unsigned long read_cpuectlr(void); |
| 205 | extern unsigned int read_cntfrq_el0(void); |
| 206 | extern unsigned long read_cnthctl_el2(void); |
| 207 | |
| 208 | extern void write_scr(unsigned long); |
| 209 | extern void write_hcr(unsigned long); |
| 210 | extern void write_cpacr(unsigned long); |
| 211 | extern void write_cntfrq_el0(unsigned int); |
| 212 | extern void write_cnthctl_el2(unsigned long); |
| 213 | |
| 214 | extern void write_vbar(unsigned long); |
| 215 | extern void write_vbar_el1(unsigned long); |
| 216 | extern void write_vbar_el2(unsigned long); |
| 217 | extern void write_vbar_el3(unsigned long); |
| 218 | |
| 219 | extern void write_sctlr(unsigned long); |
| 220 | extern void write_sctlr_el1(unsigned long); |
| 221 | extern void write_sctlr_el2(unsigned long); |
| 222 | extern void write_sctlr_el3(unsigned long); |
| 223 | |
| 224 | extern void write_actlr(unsigned long); |
| 225 | extern void write_actlr_el1(unsigned long); |
| 226 | extern void write_actlr_el2(unsigned long); |
| 227 | extern void write_actlr_el3(unsigned long); |
| 228 | |
| 229 | extern void write_esr(unsigned long); |
| 230 | extern void write_esr_el1(unsigned long); |
| 231 | extern void write_esr_el2(unsigned long); |
| 232 | extern void write_esr_el3(unsigned long); |
| 233 | |
| 234 | extern void write_afsr0(unsigned long); |
| 235 | extern void write_afsr0_el1(unsigned long); |
| 236 | extern void write_afsr0_el2(unsigned long); |
| 237 | extern void write_afsr0_el3(unsigned long); |
| 238 | |
| 239 | extern void write_afsr1(unsigned long); |
| 240 | extern void write_afsr1_el1(unsigned long); |
| 241 | extern void write_afsr1_el2(unsigned long); |
| 242 | extern void write_afsr1_el3(unsigned long); |
| 243 | |
| 244 | extern void write_far(unsigned long); |
| 245 | extern void write_far_el1(unsigned long); |
| 246 | extern void write_far_el2(unsigned long); |
| 247 | extern void write_far_el3(unsigned long); |
| 248 | |
| 249 | extern void write_mair(unsigned long); |
| 250 | extern void write_mair_el1(unsigned long); |
| 251 | extern void write_mair_el2(unsigned long); |
| 252 | extern void write_mair_el3(unsigned long); |
| 253 | |
| 254 | extern void write_amair(unsigned long); |
| 255 | extern void write_amair_el1(unsigned long); |
| 256 | extern void write_amair_el2(unsigned long); |
| 257 | extern void write_amair_el3(unsigned long); |
| 258 | |
| 259 | extern void write_rmr(unsigned long); |
| 260 | extern void write_rmr_el1(unsigned long); |
| 261 | extern void write_rmr_el2(unsigned long); |
| 262 | extern void write_rmr_el3(unsigned long); |
| 263 | |
| 264 | extern void write_tcr(unsigned long); |
| 265 | extern void write_tcr_el1(unsigned long); |
| 266 | extern void write_tcr_el2(unsigned long); |
| 267 | extern void write_tcr_el3(unsigned long); |
| 268 | |
| 269 | extern void write_ttbr0(unsigned long); |
| 270 | extern void write_ttbr0_el1(unsigned long); |
| 271 | extern void write_ttbr0_el2(unsigned long); |
| 272 | extern void write_ttbr0_el3(unsigned long); |
| 273 | |
| 274 | extern void write_ttbr1(unsigned long); |
| 275 | extern void write_ttbr1_el1(unsigned long); |
| 276 | extern void write_ttbr1_el2(unsigned long); |
| 277 | |
| 278 | extern void write_cptr(unsigned long); |
| 279 | extern void write_cpuectlr(unsigned long); |
| 280 | extern void write_cptr_el2(unsigned long); |
| 281 | extern void write_cptr_el3(unsigned long); |
| 282 | |
| 283 | #endif /*__ASSEMBLY__*/ |
| 284 | |
| 285 | #endif /* __ARCH_HELPERS_H__ */ |