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